diff --git a/doc/static b/doc/static new file mode 100644 index 0000000000..3bf771c03d --- /dev/null +++ b/doc/static @@ -0,0 +1 @@ +Sk.builtinFiles={"files":{"src/builtin/this.py":"s = \"\"\"Gur Mra bs Clguba, ol Gvz Crgref\n\nOrnhgvshy vf orggre guna htyl.\nRkcyvpvg vf orggre guna vzcyvpvg.\nFvzcyr vf orggre guna pbzcyrk.\nPbzcyrk vf orggre guna pbzcyvpngrq.\nSyng vf orggre guna arfgrq.\nFcnefr vf orggre guna qrafr.\nErnqnovyvgl pbhagf.\nFcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.\nNygubhtu cenpgvpnyvgl orngf chevgl.\nReebef fubhyq arire cnff fvyragyl.\nHayrff rkcyvpvgyl fvyraprq.\nVa gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.\nGurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.\nNygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.\nAbj vf orggre guna arire.\nNygubhtu arire vf bsgra orggre guna *evtug* abj.\nVs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.\nVs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.\nAnzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!\"\"\"\n\nd = {}\nfor c in (65, 97):\n for i in range(26):\n d[chr(i+c)] = chr((i+13) % 26 + c)\n\nprint(\"\".join([d.get(c, c) for c in s]))\n","src/lib/BaseHTTPServer.py":"import _sk_fail; _sk_fail._(\"BaseHTTPServer\")\n","src/lib/Bastion.py":"import _sk_fail; _sk_fail._(\"Bastion\")\n","src/lib/CGIHTTPServer.py":"import _sk_fail; _sk_fail._(\"CGIHTTPServer\")\n","src/lib/ConfigParser.py":"import _sk_fail; _sk_fail._(\"ConfigParser\")\n","src/lib/Cookie.py":"import _sk_fail; _sk_fail._(\"Cookie\")\n","src/lib/DocXMLRPCServer.py":"import _sk_fail; _sk_fail._(\"DocXMLRPCServer\")\n","src/lib/HTMLParser.py":"import _sk_fail; _sk_fail._(\"HTMLParser\")\n","src/lib/MimeWriter.py":"import _sk_fail; _sk_fail._(\"MimeWriter\")\n","src/lib/Queue.py":"import _sk_fail; _sk_fail._(\"Queue\")\n","src/lib/SimpleHTTPServer.py":"import _sk_fail; _sk_fail._(\"SimpleHTTPServer\")\n","src/lib/SimpleXMLRPCServer.py":"import _sk_fail; _sk_fail._(\"SimpleXMLRPCServer\")\n","src/lib/SocketServer.py":"import _sk_fail; _sk_fail._(\"SocketServer\")\n","src/lib/StringIO.py":"r\"\"\"File-like objects that read from or write to a string buffer.\n\nThis implements (nearly) all stdio methods.\n\nf = StringIO() # ready for writing\nf = StringIO(buf) # ready for reading\nf.close() # explicitly release resources held\nflag = f.isatty() # always false\npos = f.tell() # get current position\nf.seek(pos) # set current position\nf.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF\nbuf = f.read() # read until EOF\nbuf = f.read(n) # read up to n bytes\nbuf = f.readline() # read until end of line ('\\n') or EOF\nlist = f.readlines()# list of f.readline() results until EOF\nf.truncate([size]) # truncate file at to at most size (default: current pos)\nf.write(buf) # write at current position\nf.writelines(list) # for line in list: f.write(line)\nf.getvalue() # return whole file's contents as a string\n\nNotes:\n- Using a real file is often faster (but less convenient).\n- There's also a much faster implementation in C, called cStringIO, but\n it's not subclassable.\n- fileno() is left unimplemented so that code which uses it triggers\n an exception early.\n- Seeking far beyond EOF and then writing will insert real null\n bytes that occupy space in the buffer.\n- There's a simple test set (see end of this file).\n\"\"\"\n\n__all__ = [\"StringIO\"]\n\ndef _complain_ifclosed(closed):\n if closed:\n raise ValueError(\"I/O operation on closed file\")\n\nclass StringIO:\n \"\"\"class StringIO([buffer])\n\n When a StringIO object is created, it can be initialized to an existing\n string by passing the string to the constructor. If no string is given,\n the StringIO will start empty.\n\n The StringIO object can accept either Unicode or 8-bit strings, but\n mixing the two may take some care. If both are used, 8-bit strings that\n cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause\n a UnicodeError to be raised when getvalue() is called.\n \"\"\"\n def __init__(self, buf = ''):\n # Force self.buf to be a string or unicode\n if not isinstance(buf, str):\n buf = str(buf)\n self.buf = buf\n self.len = len(buf)\n self.buflist = []\n self.pos = 0\n self.closed = False\n self.softspace = 0\n\n def __iter__(self):\n return self\n\n def next(self):\n \"\"\"A file object is its own iterator, for example iter(f) returns f\n (unless f is closed). When a file is used as an iterator, typically\n in a for loop (for example, for line in f: print line), the next()\n method is called repeatedly. This method returns the next input line,\n or raises StopIteration when EOF is hit.\n \"\"\"\n _complain_ifclosed(self.closed)\n r = self.readline()\n if not r:\n raise StopIteration\n return r\n\n def close(self):\n \"\"\"Free the memory buffer.\n \"\"\"\n if not self.closed:\n self.closed = True\n self.buf = None\n self.pos = None\n\n def isatty(self):\n \"\"\"Returns False because StringIO objects are not connected to a\n tty-like device.\n \"\"\"\n _complain_ifclosed(self.closed)\n return False\n\n def seek(self, pos, mode = 0):\n \"\"\"Set the file's current position.\n\n The mode argument is optional and defaults to 0 (absolute file\n positioning); other values are 1 (seek relative to the current\n position) and 2 (seek relative to the file's end).\n\n There is no return value.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n if mode == 1:\n pos += self.pos\n elif mode == 2:\n pos += self.len\n self.pos = max(0, pos)\n\n def tell(self):\n \"\"\"Return the file's current position.\"\"\"\n _complain_ifclosed(self.closed)\n return self.pos\n\n def read(self, n = -1):\n \"\"\"Read at most size bytes from the file\n (less if the read hits EOF before obtaining size bytes).\n\n If the size argument is negative or omitted, read all data until EOF\n is reached. The bytes are returned as a string object. An empty\n string is returned when EOF is encountered immediately.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n if n is None or n < 0:\n newpos = self.len\n else:\n newpos = min(self.pos+n, self.len)\n r = self.buf[self.pos:newpos]\n self.pos = newpos\n return r\n\n def readline(self, length=None):\n r\"\"\"Read one entire line from the file.\n\n A trailing newline character is kept in the string (but may be absent\n when a file ends with an incomplete line). If the size argument is\n present and non-negative, it is a maximum byte count (including the\n trailing newline) and an incomplete line may be returned.\n\n An empty string is returned only when EOF is encountered immediately.\n\n Note: Unlike stdio's fgets(), the returned string contains null\n characters ('\\0') if they occurred in the input.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n i = self.buf.find('\\n', self.pos)\n if i < 0:\n newpos = self.len\n else:\n newpos = i+1\n if length is not None and length >= 0:\n if self.pos + length < newpos:\n newpos = self.pos + length\n r = self.buf[self.pos:newpos]\n self.pos = newpos\n return r\n\n def readlines(self, sizehint = 0):\n \"\"\"Read until EOF using readline() and return a list containing the\n lines thus read.\n\n If the optional sizehint argument is present, instead of reading up\n to EOF, whole lines totalling approximately sizehint bytes (or more\n to accommodate a final whole line).\n \"\"\"\n total = 0\n lines = []\n line = self.readline()\n while line:\n lines.append(line)\n total += len(line)\n if 0 < sizehint <= total:\n break\n line = self.readline()\n return lines\n\n def truncate(self, size=None):\n \"\"\"Truncate the file's size.\n\n If the optional size argument is present, the file is truncated to\n (at most) that size. The size defaults to the current position.\n The current file position is not changed unless the position\n is beyond the new file size.\n\n If the specified size exceeds the file's current size, the\n file remains unchanged.\n \"\"\"\n _complain_ifclosed(self.closed)\n if size is None:\n size = self.pos\n elif size < 0:\n raise IOError(22, \"Negative size not allowed\")\n elif size < self.pos:\n self.pos = size\n self.buf = self.getvalue()[:size]\n self.len = size\n\n def write(self, s):\n \"\"\"Write a string to the file.\n\n There is no return value.\n \"\"\"\n _complain_ifclosed(self.closed)\n if not s: return\n # Force s to be a string or unicode\n if not isinstance(s, str):\n s = str(s)\n spos = self.pos\n slen = self.len\n if spos == slen:\n self.buflist.append(s)\n self.len = self.pos = spos + len(s)\n return\n if spos > slen:\n self.buflist.append('\\0'*(spos - slen))\n slen = spos\n newpos = spos + len(s)\n if spos < slen:\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = [self.buf[:spos], s, self.buf[newpos:]]\n self.buf = ''\n if newpos > slen:\n slen = newpos\n else:\n self.buflist.append(s)\n slen = newpos\n self.len = slen\n self.pos = newpos\n\n def writelines(self, iterable):\n \"\"\"Write a sequence of strings to the file. The sequence can be any\n iterable object producing strings, typically a list of strings. There\n is no return value.\n\n (The name is intended to match readlines(); writelines() does not add\n line separators.)\n \"\"\"\n write = self.write\n for line in iterable:\n write(line)\n\n def flush(self):\n \"\"\"Flush the internal buffer\n \"\"\"\n _complain_ifclosed(self.closed)\n\n def getvalue(self):\n \"\"\"\n Retrieve the entire contents of the \"file\" at any time before\n the StringIO object's close() method is called.\n\n The StringIO object can accept either Unicode or 8-bit strings,\n but mixing the two may take some care. If both are used, 8-bit\n strings that cannot be interpreted as 7-bit ASCII (that use the\n 8th bit) will cause a UnicodeError to be raised when getvalue()\n is called.\n \"\"\"\n _complain_ifclosed(self.closed)\n if self.buflist:\n self.buf += ''.join(self.buflist)\n self.buflist = []\n return self.buf\n","src/lib/UserDict.py":"import _sk_fail; _sk_fail._(\"UserDict\")\n","src/lib/UserList.py":"import _sk_fail; _sk_fail._(\"UserList\")\n","src/lib/UserString.py":"import _sk_fail; _sk_fail._(\"UserString\")\n","src/lib/_LWPCookieJar.py":"import _sk_fail; _sk_fail._(\"_LWPCookieJar\")\n","src/lib/_MozillaCookieJar.py":"import _sk_fail; _sk_fail._(\"_MozillaCookieJar\")\n","src/lib/__future__.py":"import _sk_fail;_sk_fail._(\"__future__\")\n","src/lib/__phello__.foo.py":"import _sk_fail; _sk_fail._(\"__phello__.foo\")\n","src/lib/_abcoll.py":"import _sk_fail; _sk_fail._(\"_abcoll\")\n","src/lib/_sk_fail.py":"class NotImplementedImportError(ImportError, NotImplementedError): pass\n\ndef _(name):\n msg = \"{} is not yet implemented in Skulpt\".format(name)\n raise NotImplementedImportError(msg, name=name)\n","src/lib/_threading_local.py":"import _sk_fail; _sk_fail._(\"_threading_local\")\n","src/lib/abc.py":"import _sk_fail; _sk_fail._(\"abc\")\n","src/lib/aifc.py":"import _sk_fail; _sk_fail._(\"aifc\")\n","src/lib/antigravity.py":"import webbrowser\n\nwebbrowser.open(\"https://xkcd.com/353/\")\n","src/lib/anydbm.py":"import _sk_fail; _sk_fail._(\"anydbm\")\n","src/lib/ast.py":"import _sk_fail; _sk_fail._(\"ast\")\n","src/lib/asynchat.py":"import _sk_fail; _sk_fail._(\"asynchat\")\n","src/lib/asyncore.py":"import _sk_fail; _sk_fail._(\"asyncore\")\n","src/lib/atexit.py":"import _sk_fail; _sk_fail._(\"atexit\")\n","src/lib/audiodev.py":"import _sk_fail; _sk_fail._(\"audiodev\")\n","src/lib/base64.py":"import _sk_fail; _sk_fail._(\"base64\")\n","src/lib/bdb.py":"import _sk_fail; _sk_fail._(\"bdb\")\n","src/lib/binhex.py":"import _sk_fail; _sk_fail._(\"binhex\")\n","src/lib/bisect.py":"\"\"\"Bisection algorithms.\"\"\"\n\ndef insort_right(a, x, lo=0, hi=None):\n \"\"\"Insert item x in list a, and keep it sorted assuming a is sorted.\n\n If x is already in a, insert it to the right of the rightmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if x < a[mid]: hi = mid\n else: lo = mid+1\n a.insert(lo, x)\n\ndef bisect_right(a, x, lo=0, hi=None):\n \"\"\"Return the index where to insert item x in list a, assuming a is sorted.\n\n The return value i is such that all e in a[:i] have e <= x, and all e in\n a[i:] have e > x. So if x already appears in the list, a.insert(x) will\n insert just after the rightmost x already there.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if x < a[mid]: hi = mid\n else: lo = mid+1\n return lo\n\ndef insort_left(a, x, lo=0, hi=None):\n \"\"\"Insert item x in list a, and keep it sorted assuming a is sorted.\n\n If x is already in a, insert it to the left of the leftmost x.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if a[mid] < x: lo = mid+1\n else: hi = mid\n a.insert(lo, x)\n\n\ndef bisect_left(a, x, lo=0, hi=None):\n \"\"\"Return the index where to insert item x in list a, assuming a is sorted.\n\n The return value i is such that all e in a[:i] have e < x, and all e in\n a[i:] have e >= x. So if x already appears in the list, a.insert(x) will\n insert just before the leftmost x already there.\n\n Optional args lo (default 0) and hi (default len(a)) bound the\n slice of a to be searched.\n \"\"\"\n\n if lo < 0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi = len(a)\n while lo < hi:\n mid = (lo+hi)//2\n if a[mid] < x: lo = mid+1\n else: hi = mid\n return lo\n\n# Overwrite above definitions with a fast C implementation\ntry:\n from _bisect import *\nexcept ImportError:\n pass\n\n# Create aliases\nbisect = bisect_right\ninsort = insort_right\n","src/lib/bsddb/__init__.py":"import _sk_fail; _sk_fail._(\"bsddb\")\n","src/lib/cProfile.py":"import _sk_fail; _sk_fail._(\"cProfile\")\n","src/lib/cgi.py":"import _sk_fail; _sk_fail._(\"cgi\")\n","src/lib/cgitb.py":"import _sk_fail; _sk_fail._(\"cgitb\")\n","src/lib/chunk.py":"import _sk_fail; _sk_fail._(\"chunk\")\n","src/lib/cmd.py":"import _sk_fail; _sk_fail._(\"cmd\")\n","src/lib/code.py":"import _sk_fail; _sk_fail._(\"code\")\n","src/lib/codecs.py":"import _sk_fail; _sk_fail._(\"codecs\")\n","src/lib/codeop.py":"import _sk_fail; _sk_fail._(\"codeop\")\n","src/lib/colorsys.py":"import _sk_fail; _sk_fail._(\"colorsys\")\n","src/lib/commands.py":"import _sk_fail; _sk_fail._(\"commands\")\n","src/lib/compileall.py":"import _sk_fail; _sk_fail._(\"compileall\")\n","src/lib/compiler/__init__.py":"import _sk_fail; _sk_fail._(\"compiler\")\n","src/lib/config/__init__.py":"import _sk_fail; _sk_fail._(\"config\")\n","src/lib/contextlib.py":"import _sk_fail; _sk_fail._(\"contextlib\")\n","src/lib/cookielib.py":"import _sk_fail; _sk_fail._(\"cookielib\")\n","src/lib/copy.py":"\"\"\"\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n\"\"\"\nimport types\nclass Error(Exception):\n pass\nerror = Error \nclass _EmptyClass:\n pass\ntry:\n long\nexcept NameError:\n long = int\ntry:\n bytes\nexcept NameError:\n bytes = str\n\ndef check_notimplemented_state(x):\n getstate = getattr(x, \"__getstate__\", None)\n setstate = getattr(x, \"__setstate__\", None)\n initargs = getattr(x, \"__getinitargs__\", None)\n if getstate or setstate or initargs:\n raise NotImplementedError(\"Skulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()\")\n\n\ndef copy(x):\n cls = type(x)\n if callable(x):\n return x\n copier = getattr(cls, \"__copy__\", None)\n if copier:\n return copier(x)\n if cls in (type(None), int, float, bool, str, bytes, tuple, type, frozenset, long):\n return x\n if (cls == list) or (cls == dict) or (cls == set) or (cls == slice):\n return cls(x)\n reductor = getattr(x, \"__reduce_ex__\", None)\n if reductor:\n rv = reductor(4)\n else:\n reductor = getattr(x, \"__reduce__\", None)\n if reductor:\n rv = reductor()\n elif str(cls)[1:6] == \"class\":\n check_notimplemented_state(x)\n copier = _copy_inst\n return copier(x)\n else:\n raise Error(\"un(shallow)copyable object of type %s\" % cls)\n if isinstance(rv, str):\n return x\n return _reconstruct(x, rv, 0)\n\ndef _copy_inst(x):\n if hasattr(x, '__copy__'):\n return x.__copy__()\n if hasattr(x, '__getinitargs__'):\n args = x.__getinitargs__()\n y = x.__class__(*args)\n else:\n y = _EmptyClass()\n y.__class__ = x.__class__\n if hasattr(x, '__getstate__'):\n state = x.__getstate__()\n else:\n state = x.__dict__\n if hasattr(y, '__setstate__'):\n y.__setstate__(state)\n else:\n y.__dict__.update(state)\n return y\n\nd = _deepcopy_dispatch = {}\n\ndef deepcopy(x, memo=None, _nil=[]):\n \"\"\"Deep copy operation on arbitrary Python objects.\n See the module's __doc__ string for more info.\n \"\"\"\n if memo is None:\n memo = {}\n idx = id(x)\n y = memo.get(idx, _nil)\n if y is not _nil:\n return y\n cls = type(x)\n copier = _deepcopy_dispatch.get(cls)\n if copier:\n y = copier(x, memo)\n else:\n try:\n issc = issubclass(cls, type)\n except TypeError: # cls is not a class (old Boost; see SF #502085)\n issc = 0\n if issc:\n y = _deepcopy_atomic(x, memo)\n else:\n copier = getattr(x, \"__deepcopy__\", None)\n if copier:\n y = copier(memo)\n else:\n reductor = getattr(x, \"__reduce_ex__\", None)\n if reductor:\n rv = reductor(2)\n else:\n rv = None\n reductor = getattr(x, \"__reduce__\", None)\n if reductor:\n rv = reductor()\n elif str(cls)[1:6] == \"class\":\n check_notimplemented_state(x)\n copier = _deepcopy_dispatch[\"InstanceType\"]\n y = copier(x, memo)\n else:\n raise Error(\n \"un(deep)copyable object of type %s\" % cls)\n if rv is not None:\n y = _reconstruct(x, rv, 1, memo)\n memo[idx] = y\n _keep_alive(x, memo) # Make sure x lives at least as long as d\n return y\n\ndef _deepcopy_atomic(x, memo):\n return x\nd[type(None)] = _deepcopy_atomic\n# d[type(Ellipsis)] = _deepcopy_atomic\nd[type(NotImplemented)] = _deepcopy_atomic\nd[int] = _deepcopy_atomic\nd[float] = _deepcopy_atomic\nd[bool] = _deepcopy_atomic\nd[complex] = _deepcopy_atomic\nd[bytes] = _deepcopy_atomic\nd[str] = _deepcopy_atomic\n# try:\n# d[types.CodeType] = _deepcopy_atomic\n# except AttributeError:\n# pass\nd[type] = _deepcopy_atomic\n# d[types.BuiltinFunctionType] = _deepcopy_atomic\nd[types.FunctionType] = _deepcopy_atomic\n# d[weakref.ref] = _deepcopy_atomic\n\ndef _deepcopy_list(x, memo):\n y = []\n memo[id(x)] = y\n for a in x:\n y.append(deepcopy(a, memo))\n return y\nd[list] = _deepcopy_list\n\ndef _deepcopy_set(x, memo):\n result = set([]) # make empty set\n memo[id(x)] = result # register this set in the memo for loop checking\n for a in x: # go through elements of set\n result.add(deepcopy(a, memo)) # add the copied elements into the new set\n return result # return the new set\nd[set] = _deepcopy_set\n\ndef _deepcopy_frozenset(x, memo):\n result = frozenset(_deepcopy_set(x,memo)) \n memo[id(x)] = result \n return result\nd[frozenset] = _deepcopy_frozenset\n\ndef _deepcopy_tuple(x, memo):\n y = [deepcopy(a, memo) for a in x]\n # We're not going to put the tuple in the memo, but it's still important we\n # check for it, in case the tuple contains recursive mutable structures.\n try:\n return memo[id(x)]\n except KeyError:\n pass\n for k, j in zip(x, y):\n if k is not j:\n y = tuple(y)\n break\n else:\n y = x\n return y\nd[tuple] = _deepcopy_tuple\n\ndef _deepcopy_dict(x, memo):\n y = {}\n memo[id(x)] = y\n for key, value in x.items():\n y[deepcopy(key, memo)] = deepcopy(value, memo)\n return y\nd[dict] = _deepcopy_dict\n\n# def _deepcopy_method(x, memo): # Copy instance methods\n# y = type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class);\n# return y\nd[types.MethodType] = _deepcopy_atomic\n\ndef _deepcopy_inst(x, memo):\n if hasattr(x, '__deepcopy__'):\n return x.__deepcopy__(memo)\n if hasattr(x, '__getinitargs__'):\n args = x.__getinitargs__()\n args = deepcopy(args, memo)\n y = x.__class__(*args)\n else:\n y = _EmptyClass()\n y.__class__ = x.__class__\n memo[id(x)] = y\n if hasattr(x, '__getstate__'):\n state = x.__getstate__()\n else:\n state = x.__dict__\n state = deepcopy(state, memo)\n if hasattr(y, '__setstate__'):\n y.__setstate__(state)\n else:\n y.__dict__.update(state)\n return y\nd[\"InstanceType\"] = _deepcopy_inst\n\ndef _keep_alive(x, memo):\n \"\"\"Keeps a reference to the object x in the memo.\n Because we remember objects by their id, we have\n to assure that possibly temporary objects are kept\n alive by referencing them.\n We store a reference at the id of the memo, which should\n normally not be used unless someone tries to deepcopy\n the memo itself...\n \"\"\"\n try:\n memo[id(memo)].append(x)\n except KeyError:\n # aha, this is the first one :-)\n memo[id(memo)]=[x]\n\ndef _reconstruct(x, info, deep, memo=None):\n if isinstance(info, str):\n return x\n assert isinstance(info, tuple)\n if memo is None:\n memo = {}\n n = len(info)\n assert n in (2, 3, 4, 5)\n callable, args = info[:2]\n if n > 2:\n state = info[2]\n else:\n state = None\n if n > 3:\n listiter = info[3]\n else:\n listiter = None\n if n > 4:\n dictiter = info[4]\n else:\n dictiter = None\n if deep:\n args = deepcopy(args, memo)\n y = callable(*args)\n memo[id(x)] = y\n\n if state is not None:\n if deep:\n state = deepcopy(state, memo)\n if hasattr(y, '__setstate__'):\n y.__setstate__(state)\n else:\n if isinstance(state, tuple) and len(state) == 2:\n state, slotstate = state\n else:\n slotstate = None\n if state is not None:\n y.__dict__.update(state)\n if slotstate is not None:\n for key, value in slotstate.items():\n setattr(y, key, value)\n\n if listiter is not None:\n for item in listiter:\n if deep:\n item = deepcopy(item, memo)\n y.append(item)\n if dictiter is not None:\n for key, value in dictiter:\n if deep:\n key = deepcopy(key, memo)\n value = deepcopy(value, memo)\n y[key] = value\n return y\n\ndel d\n\ndel types\n\n# Helper for instance creation without calling __init__\nclass _EmptyClass:\n pass","src/lib/copy_reg.py":"import _sk_fail; _sk_fail._(\"copy_reg\")\n","src/lib/csv.py":"import _sk_fail; _sk_fail._(\"csv\")\n","src/lib/ctypes/__init__.py":"import _sk_fail; _sk_fail._(\"ctypes\")\n","src/lib/ctypes/macholib/__init__.py":"import _sk_fail; _sk_fail._(\"macholib\")\n","src/lib/curses/__init__.py":"import _sk_fail; _sk_fail._(\"curses\")\n","src/lib/dbhash.py":"import _sk_fail; _sk_fail._(\"dbhash\")\n","src/lib/decimal.py":"import _sk_fail; _sk_fail._(\"decimal\")\n","src/lib/difflib.py":"import _sk_fail; _sk_fail._(\"difflib\")\n","src/lib/dircache.py":"import _sk_fail; _sk_fail._(\"dircache\")\n","src/lib/dis.py":"import _sk_fail; _sk_fail._(\"dis\")\n","src/lib/distutils/__init__.py":"import _sk_fail; _sk_fail._(\"distutils\")\n","src/lib/distutils/command/__init__.py":"import _sk_fail; _sk_fail._(\"command\")\n","src/lib/distutils/tests/__init__.py":"import _sk_fail; _sk_fail._(\"tests\")\n","src/lib/doctest.py":"import _sk_fail; _sk_fail._(\"doctest\")\n","src/lib/dumbdbm.py":"import _sk_fail; _sk_fail._(\"dumbdbm\")\n","src/lib/dummy_thread.py":"import _sk_fail; _sk_fail._(\"dummy_thread\")\n","src/lib/dummy_threading.py":"import _sk_fail; _sk_fail._(\"dummy_threading\")\n","src/lib/email/__init__.py":"import _sk_fail; _sk_fail._(\"email\")\n","src/lib/email/mime/__init__.py":"import _sk_fail; _sk_fail._(\"mime\")\n","src/lib/email/test/data/__init__.py":"import _sk_fail; _sk_fail._(\"data\")\n","src/lib/encodings/__init__.py":"import _sk_fail; _sk_fail._(\"encodings\")\n","src/lib/filecmp.py":"import _sk_fail; _sk_fail._(\"filecmp\")\n","src/lib/fileinput.py":"import _sk_fail; _sk_fail._(\"fileinput\")\n","src/lib/fnmatch.py":"import _sk_fail; _sk_fail._(\"fnmatch\")\n","src/lib/formatter.py":"import _sk_fail; _sk_fail._(\"formatter\")\n","src/lib/fpformat.py":"import _sk_fail; _sk_fail._(\"fpformat\")\n","src/lib/fractions.py":"import _sk_fail; _sk_fail._(\"fractions\")\n","src/lib/ftplib.py":"import _sk_fail; _sk_fail._(\"ftplib\")\n","src/lib/genericpath.py":"import _sk_fail; _sk_fail._(\"genericpath\")\n","src/lib/getopt.py":"import _sk_fail; _sk_fail._(\"getopt\")\n","src/lib/getpass.py":"import _sk_fail; _sk_fail._(\"getpass\")\n","src/lib/gettext.py":"import _sk_fail; _sk_fail._(\"gettext\")\n","src/lib/glob.py":"import _sk_fail; _sk_fail._(\"glob\")\n","src/lib/gzip.py":"import _sk_fail; _sk_fail._(\"gzip\")\n","src/lib/hashlib.py":"import _sk_fail; _sk_fail._(\"hashlib\")\n","src/lib/heapq.py":"import _sk_fail; _sk_fail._(\"heapq\")\n","src/lib/hmac.py":"import _sk_fail; _sk_fail._(\"hmac\")\n","src/lib/hotshot/__init__.py":"import _sk_fail; _sk_fail._(\"hotshot\")\n","src/lib/htmlentitydefs.py":"import _sk_fail; _sk_fail._(\"htmlentitydefs\")\n","src/lib/htmllib.py":"import _sk_fail; _sk_fail._(\"htmllib\")\n","src/lib/httplib.py":"import _sk_fail; _sk_fail._(\"httplib\")\n","src/lib/idlelib/Icons/__init__.py":"import _sk_fail; _sk_fail._(\"Icons\")\n","src/lib/idlelib/__init__.py":"import _sk_fail; _sk_fail._(\"idlelib\")\n","src/lib/ihooks.py":"import _sk_fail; _sk_fail._(\"ihooks\")\n","src/lib/imaplib.py":"import _sk_fail; _sk_fail._(\"imaplib\")\n","src/lib/imghdr.py":"import _sk_fail; _sk_fail._(\"imghdr\")\n","src/lib/imputil.py":"import _sk_fail; _sk_fail._(\"imputil\")\n","src/lib/io.py":"import _sk_fail; _sk_fail._(\"io\")\n","src/lib/lib-dynload/__init__.py":"import _sk_fail; _sk_fail._(\"lib-dynload\")\n","src/lib/lib-tk/__init__.py":"import _sk_fail; _sk_fail._(\"lib-tk\")\n","src/lib/lib2to3/__init__.py":"import _sk_fail; _sk_fail._(\"lib2to3\")\n","src/lib/lib2to3/fixes/__init__.py":"import _sk_fail; _sk_fail._(\"fixes\")\n","src/lib/lib2to3/pgen2/__init__.py":"import _sk_fail; _sk_fail._(\"pgen2\")\n","src/lib/lib2to3/tests/__init__.py":"import _sk_fail; _sk_fail._(\"tests\")\n","src/lib/linecache.py":"import _sk_fail; _sk_fail._(\"linecache\")\n","src/lib/locale.py":"import _sk_fail; _sk_fail._(\"locale\")\n","src/lib/logging/__init__.py":"import _sk_fail; _sk_fail._(\"logging\")\n","src/lib/macpath.py":"import _sk_fail; _sk_fail._(\"macpath\")\n","src/lib/macurl2path.py":"import _sk_fail; _sk_fail._(\"macurl2path\")\n","src/lib/mailbox.py":"import _sk_fail; _sk_fail._(\"mailbox\")\n","src/lib/mailcap.py":"import _sk_fail; _sk_fail._(\"mailcap\")\n","src/lib/markupbase.py":"import _sk_fail; _sk_fail._(\"markupbase\")\n","src/lib/md5.py":"import _sk_fail; _sk_fail._(\"md5\")\n","src/lib/mhlib.py":"import _sk_fail; _sk_fail._(\"mhlib\")\n","src/lib/mimetools.py":"import _sk_fail; _sk_fail._(\"mimetools\")\n","src/lib/mimetypes.py":"import _sk_fail; _sk_fail._(\"mimetypes\")\n","src/lib/mimify.py":"import _sk_fail; _sk_fail._(\"mimify\")\n","src/lib/modulefinder.py":"import _sk_fail; _sk_fail._(\"modulefinder\")\n","src/lib/multifile.py":"import _sk_fail; _sk_fail._(\"multifile\")\n","src/lib/multiprocessing/__init__.py":"import _sk_fail; _sk_fail._(\"multiprocessing\")\n","src/lib/multiprocessing/dummy/__init__.py":"import _sk_fail; _sk_fail._(\"dummy\")\n","src/lib/mutex.py":"import _sk_fail; _sk_fail._(\"mutex\")\n","src/lib/netrc.py":"import _sk_fail; _sk_fail._(\"netrc\")\n","src/lib/new.py":"import _sk_fail; _sk_fail._(\"new\")\n","src/lib/nntplib.py":"import _sk_fail; _sk_fail._(\"nntplib\")\n","src/lib/ntpath.py":"import _sk_fail; _sk_fail._(\"ntpath\")\n","src/lib/nturl2path.py":"import _sk_fail; _sk_fail._(\"nturl2path\")\n","src/lib/numbers.py":"Number = (int, float, complex)\nIntegral = int\nComplex = complex\n","src/lib/opcode.py":"import _sk_fail; _sk_fail._(\"opcode\")\n","src/lib/optparse.py":"import _sk_fail; _sk_fail._(\"optparse\")\n","src/lib/os.py":"import _sk_fail; _sk_fail._(\"os\")\n","src/lib/os2emxpath.py":"import _sk_fail; _sk_fail._(\"os2emxpath\")\n","src/lib/pdb.py":"import _sk_fail; _sk_fail._(\"pdb\")\n","src/lib/pickle.py":"import _sk_fail; _sk_fail._(\"pickle\")\n","src/lib/pickletools.py":"import _sk_fail; _sk_fail._(\"pickletools\")\n","src/lib/pipes.py":"import _sk_fail; _sk_fail._(\"pipes\")\n","src/lib/pkgutil.py":"import _sk_fail; _sk_fail._(\"pkgutil\")\n","src/lib/platform.py":"import _sk_fail; _sk_fail._(\"platform\")\n","src/lib/plistlib.py":"import _sk_fail; _sk_fail._(\"plistlib\")\n","src/lib/popen2.py":"import _sk_fail; _sk_fail._(\"popen2\")\n","src/lib/poplib.py":"import _sk_fail; _sk_fail._(\"poplib\")\n","src/lib/posixfile.py":"import _sk_fail; _sk_fail._(\"posixfile\")\n","src/lib/posixpath.py":"import _sk_fail; _sk_fail._(\"posixpath\")\n","src/lib/pprint.py":"import _sk_fail; _sk_fail._(\"pprint\")\n","src/lib/profile.py":"import _sk_fail; _sk_fail._(\"profile\")\n","src/lib/pstats.py":"import _sk_fail; _sk_fail._(\"pstats\")\n","src/lib/pty.py":"import _sk_fail; _sk_fail._(\"pty\")\n","src/lib/py_compile.py":"import _sk_fail; _sk_fail._(\"py_compile\")\n","src/lib/pyclbr.py":"import _sk_fail; _sk_fail._(\"pyclbr\")\n","src/lib/pydoc.py":"import _sk_fail; _sk_fail._(\"pydoc\")\n","src/lib/pydoc_topics.py":"import _sk_fail; _sk_fail._(\"pydoc_topics\")\n","src/lib/pythonds/__init__.py":"","src/lib/pythonds/basic/__init__.py":"\n#__all__ = [\"stack\"]\n\n\n#from .stack import Stack\n#from .queue import Queue\n\n\n\n","src/lib/pythonds/basic/deque.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#deque.py\n\n\nclass Deque:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def addFront(self, item):\n self.items.append(item)\n\n def addRear(self, item):\n self.items.insert(0,item)\n\n def removeFront(self):\n return self.items.pop()\n\n def removeRear(self):\n return self.items.pop(0)\n\n def size(self):\n return len(self.items)\n","src/lib/pythonds/basic/queue.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#queue.py\n\nclass Queue:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def enqueue(self, item):\n self.items.insert(0,item)\n\n def dequeue(self):\n return self.items.pop()\n\n def size(self):\n return len(self.items)\n","src/lib/pythonds/basic/stack.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#stack.py\n\nclass Stack:\n def __init__(self):\n self.items = []\n\n def isEmpty(self):\n return self.items == []\n\n def push(self, item):\n self.items.append(item)\n\n def pop(self):\n return self.items.pop()\n\n def peek(self):\n return self.items[len(self.items)-1]\n\n def size(self):\n return len(self.items)\n\n","src/lib/pythonds/graphs/__init__.py":"\n\nfrom .adjGraph import Graph\nfrom .adjGraph import Vertex\nfrom .priorityQueue import PriorityQueue\n","src/lib/pythonds/graphs/adjGraph.py":"#\n# adjGraph\n#\n# Created by Brad Miller on 2005-02-24.\n# Copyright (c) 2005 Brad Miller, David Ranum, Luther College. All rights reserved.\n#\n\nimport sys\nimport os\nimport unittest\n\nclass Graph:\n def __init__(self):\n self.vertices = {}\n self.numVertices = 0\n \n def addVertex(self,key):\n self.numVertices = self.numVertices + 1\n newVertex = Vertex(key)\n self.vertices[key] = newVertex\n return newVertex\n \n def getVertex(self,n):\n if n in self.vertices:\n return self.vertices[n]\n else:\n return None\n\n def __contains__(self,n):\n return n in self.vertices\n \n def addEdge(self,f,t,cost=0):\n if f not in self.vertices:\n nv = self.addVertex(f)\n if t not in self.vertices:\n nv = self.addVertex(t)\n self.vertices[f].addNeighbor(self.vertices[t],cost)\n \n def getVertices(self):\n return list(self.vertices.keys())\n \n def __iter__(self):\n return iter(self.vertices.values())\n \nclass Vertex:\n def __init__(self,num):\n self.id = num\n self.connectedTo = {}\n self.color = 'white'\n self.dist = sys.maxsize\n self.pred = None\n self.disc = 0\n self.fin = 0\n\n # def __lt__(self,o):\n # return self.id < o.id\n \n def addNeighbor(self,nbr,weight=0):\n self.connectedTo[nbr] = weight\n \n def setColor(self,color):\n self.color = color\n \n def setDistance(self,d):\n self.dist = d\n\n def setPred(self,p):\n self.pred = p\n\n def setDiscovery(self,dtime):\n self.disc = dtime\n \n def setFinish(self,ftime):\n self.fin = ftime\n \n def getFinish(self):\n return self.fin\n \n def getDiscovery(self):\n return self.disc\n \n def getPred(self):\n return self.pred\n \n def getDistance(self):\n return self.dist\n \n def getColor(self):\n return self.color\n \n def getConnections(self):\n return self.connectedTo.keys()\n \n def getWeight(self,nbr):\n return self.connectedTo[nbr]\n \n def __str__(self):\n return str(self.id) + \":color \" + self.color + \":disc \" + str(self.disc) + \":fin \" + str(self.fin) + \":dist \" + str(self.dist) + \":pred \\n\\t[\" + str(self.pred)+ \"]\\n\"\n \n def getId(self):\n return self.id\n\nclass adjGraphTests(unittest.TestCase):\n def setUp(self):\n self.tGraph = Graph()\n \n def testMakeGraph(self):\n gFile = open(\"test.dat\")\n for line in gFile:\n fVertex, tVertex = line.split('|')\n fVertex = int(fVertex)\n tVertex = int(tVertex)\n self.tGraph.addEdge(fVertex,tVertex)\n for i in self.tGraph:\n adj = i.getAdj()\n for k in adj:\n print(i, k)\n\n \nif __name__ == '__main__':\n unittest.main()\n \n","src/lib/pythonds/graphs/priorityQueue.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \nimport unittest\n\n# this implementation of binary heap takes key value pairs,\n# we will assume that the keys are all comparable\n\nclass PriorityQueue:\n def __init__(self):\n self.heapArray = [(0,0)]\n self.currentSize = 0\n\n def buildHeap(self,alist):\n self.currentSize = len(alist)\n self.heapArray = [(0,0)]\n for i in alist:\n self.heapArray.append(i)\n i = len(alist) // 2 \n while (i > 0):\n self.percDown(i)\n i = i - 1\n \n def percDown(self,i):\n while (i * 2) <= self.currentSize:\n mc = self.minChild(i)\n if self.heapArray[i][0] > self.heapArray[mc][0]:\n tmp = self.heapArray[i]\n self.heapArray[i] = self.heapArray[mc]\n self.heapArray[mc] = tmp\n i = mc\n \n def minChild(self,i):\n if i*2 > self.currentSize:\n return -1\n else:\n if i*2 + 1 > self.currentSize:\n return i*2\n else:\n if self.heapArray[i*2][0] < self.heapArray[i*2+1][0]:\n return i*2\n else:\n return i*2+1\n\n def percUp(self,i):\n while i // 2 > 0:\n if self.heapArray[i][0] < self.heapArray[i//2][0]:\n tmp = self.heapArray[i//2]\n self.heapArray[i//2] = self.heapArray[i]\n self.heapArray[i] = tmp\n i = i//2\n \n def add(self,k):\n self.heapArray.append(k)\n self.currentSize = self.currentSize + 1\n self.percUp(self.currentSize)\n\n def delMin(self):\n retval = self.heapArray[1][1]\n self.heapArray[1] = self.heapArray[self.currentSize]\n self.currentSize = self.currentSize - 1\n self.heapArray.pop()\n self.percDown(1)\n return retval\n \n def isEmpty(self):\n if self.currentSize == 0:\n return True\n else:\n return False\n\n def decreaseKey(self,val,amt):\n # this is a little wierd, but we need to find the heap thing to decrease by\n # looking at its value\n done = False\n i = 1\n myKey = 0\n while not done and i <= self.currentSize:\n if self.heapArray[i][1] == val:\n done = True\n myKey = i\n else:\n i = i + 1\n if myKey > 0:\n self.heapArray[myKey] = (amt,self.heapArray[myKey][1])\n self.percUp(myKey)\n \n def __contains__(self,vtx):\n for pair in self.heapArray:\n if pair[1] == vtx:\n return True\n return False\n \nclass TestBinHeap(unittest.TestCase):\n def setUp(self):\n self.theHeap = PriorityQueue()\n self.theHeap.add((2,'x'))\n self.theHeap.add((3,'y'))\n self.theHeap.add((5,'z'))\n self.theHeap.add((6,'a'))\n self.theHeap.add((4,'d'))\n\n\n def testInsert(self):\n assert self.theHeap.currentSize == 5\n\n def testDelmin(self):\n assert self.theHeap.delMin() == 'x'\n assert self.theHeap.delMin() == 'y'\n \n def testDecKey(self):\n self.theHeap.decreaseKey('d',1)\n assert self.theHeap.delMin() == 'd'\n \nif __name__ == '__main__':\n unittest.main()\n","src/lib/pythonds/trees/__init__.py":"\n# from .binaryTree import BinaryTree\n# from .balance import AVLTree\n# from .bst import BinarySearchTree\n# from .binheap import BinHeap\n\n\n","src/lib/pythonds/trees/balance.py":"#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nfrom .bst import BinarySearchTree, TreeNode\n\nclass AVLTree(BinarySearchTree):\n '''\n Author: Brad Miller\n Date: 1/15/2005\n Description: Imlement a binary search tree with the following interface\n functions: \n __contains__(y) <==> y in x\n __getitem__(y) <==> x[y]\n __init__()\n __len__() <==> len(x)\n __setitem__(k,v) <==> x[k] = v\n clear()\n get(k)\n has_key(k)\n items() \n keys() \n values()\n put(k,v)\n '''\n\n\n def _put(self,key,val,currentNode):\n if key < currentNode.key:\n if currentNode.hasLeftChild():\n self._put(key,val,currentNode.leftChild)\n else:\n currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n self.updateBalance(currentNode.leftChild)\n else:\n if currentNode.hasRightChild():\n self._put(key,val,currentNode.rightChild)\n else:\n currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n self.updateBalance(currentNode.rightChild) \n\n def updateBalance(self,node):\n if node.balanceFactor > 1 or node.balanceFactor < -1:\n self.rebalance(node)\n return\n if node.parent != None:\n if node.isLeftChild():\n node.parent.balanceFactor += 1\n elif node.isRightChild():\n node.parent.balanceFactor -= 1\n\n if node.parent.balanceFactor != 0:\n self.updateBalance(node.parent)\n\n def rebalance(self,node):\n if node.balanceFactor < 0:\n if node.rightChild.balanceFactor > 0:\n # Do an LR Rotation\n self.rotateRight(node.rightChild)\n self.rotateLeft(node)\n else:\n # single left\n self.rotateLeft(node)\n elif node.balanceFactor > 0:\n if node.leftChild.balanceFactor < 0:\n # Do an RL Rotation\n self.rotateLeft(node.leftChild)\n self.rotateRight(node)\n else:\n # single right\n self.rotateRight(node)\n\n def rotateLeft(self,rotRoot):\n newRoot = rotRoot.rightChild\n rotRoot.rightChild = newRoot.leftChild\n if newRoot.leftChild != None:\n newRoot.leftChild.parent = rotRoot\n newRoot.parent = rotRoot.parent\n if rotRoot.isRoot():\n self.root = newRoot\n else:\n if rotRoot.isLeftChild():\n rotRoot.parent.leftChild = newRoot\n else:\n rotRoot.parent.rightChild = newRoot\n newRoot.leftChild = rotRoot\n rotRoot.parent = newRoot\n rotRoot.balanceFactor = rotRoot.balanceFactor + 1 - min(newRoot.balanceFactor, 0)\n newRoot.balanceFactor = newRoot.balanceFactor + 1 + max(rotRoot.balanceFactor, 0)\n\n\n def rotateRight(self,rotRoot):\n newRoot = rotRoot.leftChild\n rotRoot.leftChild = newRoot.rightChild\n if newRoot.rightChild != None:\n newRoot.rightChild.parent = rotRoot\n newRoot.parent = rotRoot.parent\n if rotRoot.isRoot():\n self.root = newRoot\n else:\n if rotRoot.isRightChild():\n rotRoot.parent.rightChild = newRoot\n else:\n rotRoot.parent.leftChild = newRoot\n newRoot.rightChild = rotRoot\n rotRoot.parent = newRoot\n rotRoot.balanceFactor = rotRoot.balanceFactor - 1 - max(newRoot.balanceFactor, 0)\n newRoot.balanceFactor = newRoot.balanceFactor - 1 + min(rotRoot.balanceFactor, 0)\n \n","src/lib/pythonds/trees/binaryTree.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\nclass BinaryTree:\n \"\"\"\n A recursive implementation of Binary Tree\n Using links and Nodes approach.\n \"\"\" \n def __init__(self,rootObj):\n self.key = rootObj\n self.leftChild = None\n self.rightChild = None\n\n def insertLeft(self,newNode):\n if self.leftChild == None:\n self.leftChild = BinaryTree(newNode)\n else:\n t = BinaryTree(newNode)\n t.left = self.leftChild\n self.leftChild = t\n \n def insertRight(self,newNode):\n if self.rightChild == None:\n self.rightChild = BinaryTree(newNode)\n else:\n t = BinaryTree(newNode)\n t.right = self.rightChild\n self.rightChild = t\n\n def isLeaf(self):\n return ((not self.leftChild) and (not self.rightChild))\n\n def getRightChild(self):\n return self.rightChild\n\n def getLeftChild(self):\n return self.leftChild\n\n def setRootVal(self,obj):\n self.key = obj\n\n def getRootVal(self,):\n return self.key\n\n def inorder(self):\n if self.leftChild:\n self.leftChild.inorder()\n print(self.key)\n if self.rightChild:\n self.rightChild.inorder()\n\n def postorder(self):\n if self.leftChild:\n self.leftChild.postorder()\n if self.rightChild:\n self.rightChild.postorder()\n print(self.key)\n\n\n def preorder(self):\n print(self.key)\n if self.leftChild:\n self.leftChild.preorder()\n if self.rightChild:\n self.rightChild.preorder()\n\n def printexp(self):\n if self.leftChild:\n print('(')\n self.leftChild.printexp()\n print(self.key)\n if self.rightChild:\n self.rightChild.printexp()\n print(')')\n\n def postordereval(self):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if self.leftChild:\n res1 = self.leftChild.postordereval() #// \\label{peleft}\n if self.rightChild:\n res2 = self.rightChild.postordereval() #// \\label{peright}\n if res1 and res2:\n return opers[self.key](res1,res2) #// \\label{peeval}\n else:\n return self.key\n\ndef inorder(tree):\n if tree != None:\n inorder(tree.getLeftChild())\n print(tree.getRootVal())\n inorder(tree.getRightChild())\n\ndef printexp(tree):\n if tree.leftChild:\n print('(')\n printexp(tree.getLeftChild())\n print(tree.getRootVal())\n if tree.rightChild:\n printexp(tree.getRightChild())\n print(')') \n\ndef printexp(tree):\n sVal = \"\"\n if tree:\n sVal = '(' + printexp(tree.getLeftChild())\n sVal = sVal + str(tree.getRootVal())\n sVal = sVal + printexp(tree.getRightChild()) + ')'\n return sVal\n\ndef postordereval(tree):\n opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n res1 = None\n res2 = None\n if tree:\n res1 = postordereval(tree.getLeftChild()) #// \\label{peleft}\n res2 = postordereval(tree.getRightChild()) #// \\label{peright}\n if res1 and res2:\n return opers[tree.getRootVal()](res1,res2) #// \\label{peeval}\n else:\n return tree.getRootVal()\n\ndef height(tree):\n if tree == None:\n return -1\n else:\n return 1 + max(height(tree.leftChild),height(tree.rightChild))\n\n# t = BinaryTree(7)\n# t.insertLeft(3)\n# t.insertRight(9)\n# inorder(t)\n# import operator\n# x = BinaryTree('*')\n# x.insertLeft('+')\n# l = x.getLeftChild()\n# l.insertLeft(4)\n# l.insertRight(5)\n# x.insertRight(7)\n# print(printexp(x))\n# print(postordereval(x))\n# print(height(x))\n","src/lib/pythonds/trees/binheap.py":"# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\n# this heap takes key value pairs, we will assume that the keys are integers\nclass BinHeap:\n def __init__(self):\n self.heapList = [0]\n self.currentSize = 0\n\n\n def buildHeap(self,alist):\n i = len(alist) // 2\n self.currentSize = len(alist)\n self.heapList = [0] + alist[:]\n print(len(self.heapList), i)\n while (i > 0):\n print(self.heapList, i)\n self.percDown(i)\n i = i - 1\n print(self.heapList,i)\n \n def percDown(self,i):\n while (i * 2) <= self.currentSize:\n mc = self.minChild(i)\n if self.heapList[i] > self.heapList[mc]:\n tmp = self.heapList[i]\n self.heapList[i] = self.heapList[mc]\n self.heapList[mc] = tmp\n i = mc\n \n def minChild(self,i):\n if i * 2 + 1 > self.currentSize:\n return i * 2\n else:\n if self.heapList[i * 2] < self.heapList[i * 2 + 1]:\n return i * 2\n else:\n return i * 2 + 1\n\n def percUp(self,i):\n while i // 2 > 0:\n if self.heapList[i] < self.heapList[i//2]:\n tmp = self.heapList[i // 2]\n self.heapList[i // 2] = self.heapList[i]\n self.heapList[i] = tmp\n i = i // 2\n \n def insert(self,k):\n self.heapList.append(k)\n self.currentSize = self.currentSize + 1\n self.percUp(self.currentSize)\n\n def delMin(self):\n retval = self.heapList[1]\n self.heapList[1] = self.heapList[self.currentSize]\n self.currentSize = self.currentSize - 1\n self.heapList.pop()\n self.percDown(1)\n return retval\n \n def isEmpty(self):\n if currentSize == 0:\n return True\n else:\n return False\n","src/lib/pythonds/trees/bst.py":"#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nclass BinarySearchTree:\n '''\n Author: Brad Miller\n Date: 1/15/2005\n Description: Imlement a binary search tree with the following interface\n functions: \n __contains__(y) <==> y in x\n __getitem__(y) <==> x[y]\n __init__()\n __len__() <==> len(x)\n __setitem__(k,v) <==> x[k] = v\n clear()\n get(k)\n items() \n keys() \n values()\n put(k,v)\n in\n del <==> \n '''\n\n def __init__(self):\n self.root = None\n self.size = 0\n \n def put(self,key,val):\n if self.root:\n self._put(key,val,self.root)\n else:\n self.root = TreeNode(key,val)\n self.size = self.size + 1\n\n def _put(self,key,val,currentNode):\n if key < currentNode.key:\n if currentNode.hasLeftChild():\n self._put(key,val,currentNode.leftChild)\n else:\n currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n else:\n if currentNode.hasRightChild():\n self._put(key,val,currentNode.rightChild)\n else:\n currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n \n def __setitem__(self,k,v):\n self.put(k,v)\n\n def get(self,key):\n if self.root:\n res = self._get(key,self.root)\n if res:\n return res.payload\n else:\n return None\n else:\n return None\n \n def _get(self,key,currentNode):\n if not currentNode:\n return None\n elif currentNode.key == key:\n return currentNode\n elif key < currentNode.key:\n return self._get(key,currentNode.leftChild)\n else:\n return self._get(key,currentNode.rightChild)\n \n \n def __getitem__(self,key):\n res = self.get(key)\n if res:\n return res\n else:\n raise KeyError('Error, key not in tree')\n \n\n def __contains__(self,key):\n if self._get(key,self.root):\n return True\n else:\n return False\n \n def length(self):\n return self.size\n\n def __len__(self):\n return self.size\n\n def __iter__(self):\n return self.root.__iter__()\n \n def delete(self,key):\n if self.size > 1:\n nodeToRemove = self._get(key,self.root)\n if nodeToRemove:\n self.remove(nodeToRemove)\n self.size = self.size-1\n else:\n raise KeyError('Error, key not in tree')\n elif self.size == 1 and self.root.key == key:\n self.root = None\n self.size = self.size - 1\n else:\n raise KeyError('Error, key not in tree')\n\n def __delitem__(self,key):\n self.delete(key)\n \n def remove(self,currentNode):\n if currentNode.isLeaf(): #leaf\n if currentNode == currentNode.parent.leftChild:\n currentNode.parent.leftChild = None\n else:\n currentNode.parent.rightChild = None\n elif currentNode.hasBothChildren(): #interior\n succ = currentNode.findSuccessor()\n succ.spliceOut()\n currentNode.key = succ.key\n currentNode.payload = succ.payload\n else: # this node has one child\n if currentNode.hasLeftChild():\n if currentNode.isLeftChild():\n currentNode.leftChild.parent = currentNode.parent\n currentNode.parent.leftChild = currentNode.leftChild\n elif currentNode.isRightChild():\n currentNode.leftChild.parent = currentNode.parent\n currentNode.parent.rightChild = currentNode.leftChild\n else:\n currentNode.replaceNodeData(currentNode.leftChild.key,\n currentNode.leftChild.payload,\n currentNode.leftChild.leftChild,\n currentNode.leftChild.rightChild)\n else:\n if currentNode.isLeftChild():\n currentNode.rightChild.parent = currentNode.parent\n currentNode.parent.leftChild = currentNode.rightChild\n elif currentNode.isRightChild():\n currentNode.rightChild.parent = currentNode.parent\n currentNode.parent.rightChild = currentNode.rightChild\n else:\n currentNode.replaceNodeData(currentNode.rightChild.key,\n currentNode.rightChild.payload,\n currentNode.rightChild.leftChild,\n currentNode.rightChild.rightChild)\n\n def inorder(self):\n self._inorder(self.root)\n\n def _inorder(self,tree):\n if tree != None:\n self._inorder(tree.leftChild)\n print(tree.key)\n self._inorder(tree.rightChild)\n\n def postorder(self):\n self._postorder(self.root)\n\n def _postorder(self, tree):\n if tree:\n self._postorder(tree.rightChild)\n self._postorder(tree.leftChild)\n print(tree.key) \n\n def preorder(self):\n self._preorder(self,self.root)\n\n def _preorder(self,tree):\n if tree:\n print(tree.key) \n self._preorder(tree.leftChild)\n self._preorder(tree.rightChild)\n\n \nclass TreeNode:\n def __init__(self,key,val,left=None,right=None,parent=None):\n self.key = key\n self.payload = val\n self.leftChild = left\n self.rightChild = right\n self.parent = parent\n self.balanceFactor = 0\n \n def hasLeftChild(self):\n return self.leftChild\n\n def hasRightChild(self):\n return self.rightChild\n \n def isLeftChild(self):\n return self.parent and self.parent.leftChild == self\n\n def isRightChild(self):\n return self.parent and self.parent.rightChild == self\n\n def isRoot(self):\n return not self.parent\n\n def isLeaf(self):\n return not (self.rightChild or self.leftChild)\n\n def hasAnyChildren(self):\n return self.rightChild or self.leftChild\n\n def hasBothChildren(self):\n return self.rightChild and self.leftChild\n \n def replaceNodeData(self,key,value,lc,rc):\n self.key = key\n self.payload = value\n self.leftChild = lc\n self.rightChild = rc\n if self.hasLeftChild():\n self.leftChild.parent = self\n if self.hasRightChild():\n self.rightChild.parent = self\n \n def findSuccessor(self):\n succ = None\n if self.hasRightChild():\n succ = self.rightChild.findMin()\n else:\n if self.parent:\n if self.isLeftChild():\n succ = self.parent\n else:\n self.parent.rightChild = None\n succ = self.parent.findSuccessor()\n self.parent.rightChild = self\n return succ\n\n\n def spliceOut(self):\n if self.isLeaf():\n if self.isLeftChild():\n self.parent.leftChild = None\n else:\n self.parent.rightChild = None\n elif self.hasAnyChildren():\n if self.hasLeftChild():\n if self.isLeftChild():\n self.parent.leftChild = self.leftChild\n else:\n self.parent.rightChild = self.leftChild\n self.leftChild.parent = self.parent\n else:\n if self.isLeftChild():\n self.parent.leftChild = self.rightChild\n else:\n self.parent.rightChild = self.rightChild\n self.rightChild.parent = self.parent\n\n def findMin(self):\n current = self\n while current.hasLeftChild():\n current = current.leftChild\n return current\n\n def __iter__(self):\n \"\"\"The standard inorder traversal of a binary tree.\"\"\"\n if self:\n if self.hasLeftChild():\n for elem in self.leftChild:\n yield elem\n yield self.key\n if self.hasRightChild():\n for elem in self.rightChild:\n yield elem\n\n \n","src/lib/quopri.py":"import _sk_fail; _sk_fail._(\"quopri\")\n","src/lib/repr.py":"import _sk_fail; _sk_fail._(\"repr\")\n","src/lib/rexec.py":"import _sk_fail; _sk_fail._(\"rexec\")\n","src/lib/rfc822.py":"import _sk_fail; _sk_fail._(\"rfc822\")\n","src/lib/rlcompleter.py":"import _sk_fail; _sk_fail._(\"rlcompleter\")\n","src/lib/robotparser.py":"import _sk_fail; _sk_fail._(\"robotparser\")\n","src/lib/runpy.py":"import _sk_fail; _sk_fail._(\"runpy\")\n","src/lib/sched.py":"import _sk_fail; _sk_fail._(\"sched\")\n","src/lib/sets.py":"import _sk_fail; _sk_fail._(\"sets\")\n","src/lib/sgmllib.py":"import _sk_fail; _sk_fail._(\"sgmllib\")\n","src/lib/sha.py":"import _sk_fail; _sk_fail._(\"sha\")\n","src/lib/shelve.py":"import _sk_fail; _sk_fail._(\"shelve\")\n","src/lib/shlex.py":"import _sk_fail; _sk_fail._(\"shlex\")\n","src/lib/shutil.py":"import _sk_fail; _sk_fail._(\"shutil\")\n","src/lib/site.py":"import _sk_fail; _sk_fail._(\"site\")\n","src/lib/smtpd.py":"import _sk_fail; _sk_fail._(\"smtpd\")\n","src/lib/smtplib.py":"import _sk_fail; _sk_fail._(\"smtplib\")\n","src/lib/sndhdr.py":"import _sk_fail; _sk_fail._(\"sndhdr\")\n","src/lib/socket.py":"import _sk_fail; _sk_fail._(\"socket\")\n","src/lib/sqlite3/__init__.py":"import _sk_fail; _sk_fail._(\"sqlite3\")\n","src/lib/sre.py":"import _sk_fail; _sk_fail._(\"sre\")\n","src/lib/sre_compile.py":"import _sk_fail; _sk_fail._(\"sre_compile\")\n","src/lib/sre_constants.py":"import _sk_fail; _sk_fail._(\"sre_constants\")\n","src/lib/sre_parse.py":"import _sk_fail; _sk_fail._(\"sre_parse\")\n","src/lib/ssl.py":"import _sk_fail; _sk_fail._(\"ssl\")\n","src/lib/stat.py":"import _sk_fail; _sk_fail._(\"stat\")\n","src/lib/statvfs.py":"import _sk_fail; _sk_fail._(\"statvfs\")\n","src/lib/stringold.py":"import _sk_fail; _sk_fail._(\"stringold\")\n","src/lib/stringprep.py":"import _sk_fail; _sk_fail._(\"stringprep\")\n","src/lib/struct.py":"import _sk_fail; _sk_fail._(\"struct\")\n","src/lib/subprocess.py":"import _sk_fail; _sk_fail._(\"subprocess\")\n","src/lib/sunau.py":"import _sk_fail; _sk_fail._(\"sunau\")\n","src/lib/sunaudio.py":"import _sk_fail; _sk_fail._(\"sunaudio\")\n","src/lib/symbol.py":"import _sk_fail; _sk_fail._(\"symbol\")\n","src/lib/symtable.py":"import _sk_fail; _sk_fail._(\"symtable\")\n","src/lib/tabnanny.py":"import _sk_fail; _sk_fail._(\"tabnanny\")\n","src/lib/tarfile.py":"import _sk_fail; _sk_fail._(\"tarfile\")\n","src/lib/telnetlib.py":"import _sk_fail; _sk_fail._(\"telnetlib\")\n","src/lib/tempfile.py":"import _sk_fail; _sk_fail._(\"tempfile\")\n","src/lib/test/__init__.py":"__author__ = 'bmiller'\n\ndef testEqual(actual, expected):\n if type(expected) == type(1):\n if actual == expected:\n print('Pass')\n return True\n elif type(expected) == type(1.11):\n if abs(actual-expected) < 0.00001:\n print('Pass')\n return True\n else:\n if actual == expected:\n print('Pass')\n return True\n print('Test Failed: expected ' + str(expected) + ' but got ' + str(actual))\n return False\n\ndef testNotEqual(actual, expected):\n pass\n\n","src/lib/test/ann_module.py":"\n\n\"\"\"\nThe module for testing variable annotations.\nEmpty lines above are for good reason (testing for correct line numbers)\n\"\"\"\n\n# from typing import Optional\n# from functools import wraps\n\n__annotations__[1] = 2\n\nclass C:\n\n x = 5; #y: Optional['C'] = None\n\n# from typing import Tuple\nx: int = 5; y: str = x;# f: Tuple[int, int]\n\nclass M(type):\n\n __annotations__['123'] = 123\n o: type = object\n\n(pars): bool = True\n\nclass D(C):\n j: str = 'hi'; k: str= 'bye'\n\n# from types import new_class\n# h_class = new_class('H', (C,))\n# j_class = new_class('J')\n\nclass F():\n z: int = 5\n def __init__(self, x):\n pass\n\nclass Y(F):\n def __init__(self):\n super(F, self).__init__(123)\n\nclass Meta(type):\n def __new__(meta, name, bases, namespace):\n return super().__new__(meta, name, bases, namespace)\n\nclass S(metaclass = Meta):\n x: str = 'something'\n y: str = 'something else'\n\n# def foo(x: int = 10):\n# def bar(y: List[str]):\n# x: str = 'yes'\n# bar()\n\n# def dec(func):\n# @wraps(func)\n# def wrapper(*args, **kwargs):\n# return func(*args, **kwargs)\n# return wrapper\n","src/lib/test/ann_module2.py":"\"\"\"\nSome correct syntax for variable annotation here.\nMore examples are in test_grammar and test_parser.\n\"\"\"\n\n# from typing import no_type_check, ClassVar\n\ni: int = 1\nj: int\nx: float = i/10\n\ndef f():\n # class C: ...\n class C: pass\n return C()\n\nf().new_attr: object = object()\n\nclass C:\n def __init__(self, x: int) -> None:\n self.x = x\n\nc = C(5)\nc.new_attr: int = 10\n\n__annotations__ = {}\n\n\n# @no_type_check\n# class NTC:\n# def meth(self, param: complex) -> None:\n# ...\n\n# class CV:\n# var: ClassVar['CV']\n\n# CV.var = CV()\n","src/lib/test/ann_module3.py":"\"\"\"\nCorrect syntax for variable annotation that should fail at runtime\nin a certain manner. More examples are in test_grammar and test_parser.\n\"\"\"\n\ndef f_bad_ann():\n __annotations__[1] = 2\n\nclass C_OK:\n def __init__(self, x: int) -> None:\n self.x: no_such_name = x # This one is OK as proposed by Guido\n\nclass D_bad_ann:\n def __init__(self, x: int) -> None:\n sfel.y: int = 0\n\ndef g_bad_ann():\n no_such_name.attr: int = 0\n","src/lib/test/bad_getattr.py":"x = 1\n\n__getattr__ = \"Surprise!\"\n__dir__ = \"Surprise again!\"\n","src/lib/test/bad_getattr2.py":"def __getattr__():\n \"Bad one\"\n\nx = 1\n\ndef __dir__(bad_sig):\n return []\n","src/lib/test/bad_getattr3.py":"def __getattr__(name):\n global __getattr__\n if name != 'delgetattr':\n raise AttributeError\n del __getattr__\n raise AttributeError\n","src/lib/test/decimaltestdata/__init__.py":"import _sk_fail; _sk_fail._(\"decimaltestdata\")\n","src/lib/test/good_getattr.py":"x = 1\n\ndef __dir__():\n return ['a', 'b', 'c']\n\ndef __getattr__(name):\n if name == \"yolo\":\n raise AttributeError(\"Deprecated, use whatever instead\")\n return f\"There is {name}\"\n\ny = 2\n","src/lib/test/test_support.py":"\"\"\"Supporting definitions for the Python regression tests.\"\"\"\n\nif __name__ != 'test.test_support':\n raise ImportError('test_support must be imported from the test package')\n\nimport unittest\n\n\n# def run_unittest(*classes):\n# \"\"\"Run tests from unittest.TestCase-derived classes.\"\"\"\n# valid_types = (unittest.TestSuite, unittest.TestCase)\n# suite = unittest.TestSuite()\n# for cls in classes:\n# if isinstance(cls, str):\n# if cls in sys.modules:\n# suite.addTest(unittest.findTestCases(sys.modules[cls]))\n# else:\n# raise ValueError(\"str arguments must be keys in sys.modules\")\n# elif isinstance(cls, valid_types):\n# suite.addTest(cls)\n# else:\n# suite.addTest(unittest.makeSuite(cls))\n# _run_suite(suite)\n\ndef run_unittest(*classes):\n \"\"\"Run tests from unittest.TestCase-derived classes.\"\"\"\n for cls in classes:\n print cls\n if issubclass(cls, unittest.TestCase):\n cls().main()\n else:\n print \"Don't know what to do with \", cls\n","src/lib/textwrap.py":"\"\"\"Text wrapping and filling.\n\"\"\"\n\n# Copyright (C) 1999-2001 Gregory P. Ward.\n# Copyright (C) 2002, 2003 Python Software Foundation.\n# Written by Greg Ward \n\nimport re, string\n\n__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent', 'shorten']\n\n# Hardcode the recognized whitespace characters to the US-ASCII\n# whitespace characters. The main reason for doing this is that\n# some Unicode spaces (like \\u00a0) are non-breaking whitespaces.\n_whitespace = '\\t\\n\\x0b\\x0c\\r '\n\nclass TextWrapper:\n \"\"\"\n Object for wrapping/filling text. The public interface consists of\n the wrap() and fill() methods; the other methods are just there for\n subclasses to override in order to tweak the default behaviour.\n If you want to completely replace the main wrapping algorithm,\n you'll probably have to override _wrap_chunks().\n Several instance attributes control various aspects of wrapping:\n width (default: 70)\n the maximum width of wrapped lines (unless break_long_words\n is false)\n initial_indent (default: \"\")\n string that will be prepended to the first line of wrapped\n output. Counts towards the line's width.\n subsequent_indent (default: \"\")\n string that will be prepended to all lines save the first\n of wrapped output; also counts towards each line's width.\n expand_tabs (default: true)\n Expand tabs in input text to spaces before further processing.\n Each tab will become 0 .. 'tabsize' spaces, depending on its position\n in its line. If false, each tab is treated as a single character.\n tabsize (default: 8)\n Expand tabs in input text to 0 .. 'tabsize' spaces, unless\n 'expand_tabs' is false.\n replace_whitespace (default: true)\n Replace all whitespace characters in the input text by spaces\n after tab expansion. Note that if expand_tabs is false and\n replace_whitespace is true, every tab will be converted to a\n single space!\n fix_sentence_endings (default: false)\n Ensure that sentence-ending punctuation is always followed\n by two spaces. Off by default because the algorithm is\n (unavoidably) imperfect.\n break_long_words (default: true)\n Break words longer than 'width'. If false, those words will not\n be broken, and some lines might be longer than 'width'.\n break_on_hyphens (default: true)\n Allow breaking hyphenated words. If true, wrapping will occur\n preferably on whitespaces and right after hyphens part of\n compound words.\n drop_whitespace (default: true)\n Drop leading and trailing whitespace from lines.\n max_lines (default: None)\n Truncate wrapped lines.\n placeholder (default: ' [...]')\n Append to the last line of truncated text.\n \"\"\"\n\n unicode_whitespace_trans = {}\n # uspace = ord(' ')\n uspace = ' '\n for x in _whitespace:\n # unicode_whitespace_trans[ord(x)] = uspace\n unicode_whitespace_trans[x] = uspace\n\n # This funky little regex is just the trick for splitting\n # text up into word-wrappable chunks. E.g.\n # \"Hello there -- you goof-ball, use the -b option!\"\n # splits into\n # Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option!\n # (after stripping out empty strings).\n wordsep_re = re.compile(\n r'(\\s+|' # any whitespace\n r'[^\\s\\w]*\\w+[^0-9\\W]-(?=\\w+[^0-9\\W]))') # hyphenated words\n em_dash = re.compile(r'(\\s+|' # any whitespace\n r'[^\\s\\w]*\\w+[^0-9\\W]-(?=\\w+[^0-9\\W])|' # hyphenated words\n r'(?!^)-{2,}(?=\\w))') # em-dash\n\n \n # This less funky little regex just split on recognized spaces. E.g.\n # \"Hello there -- you goof-ball, use the -b option!\"\n # splits into\n # Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/\n wordsep_simple_re = re.compile(r'(\\s+)')\n\n\n # XXX this is not locale- or charset-aware -- string.lowercase\n # is US-ASCII only (and therefore English-only)\n sentence_end_re = re.compile(r'[a-z]' # lowercase letter\n r'[\\.\\!\\?]' # sentence-ending punct.\n r'[\\\"\\']?' # optional end-of-quote\n r'\\Z') # end of chunk\n sentence_end_re = r'[a-z][\\.\\!\\?][\\\"\\']?'\n\n def __init__(self,\n width=70,\n initial_indent=\"\",\n subsequent_indent=\"\",\n expand_tabs=True,\n replace_whitespace=True,\n fix_sentence_endings=False,\n break_long_words=True,\n drop_whitespace=True,\n break_on_hyphens=True,\n tabsize=8,\n max_lines=None,\n placeholder=' [...]'):\n self.width = width\n self.initial_indent = initial_indent\n self.subsequent_indent = subsequent_indent\n self.expand_tabs = expand_tabs\n self.replace_whitespace = replace_whitespace\n self.fix_sentence_endings = fix_sentence_endings\n self.break_long_words = break_long_words\n self.drop_whitespace = drop_whitespace\n self.break_on_hyphens = break_on_hyphens\n self.tabsize = tabsize\n self.max_lines = max_lines\n self.placeholder = placeholder\n\n\n # -- Private methods -----------------------------------------------\n # (possibly useful for subclasses to override)\n\n def _munge_whitespace(self, text):\n \"\"\"_munge_whitespace(text : string) -> string\n Munge whitespace in text: expand tabs and convert all other\n whitespace characters to spaces. Eg. \" foo\\\\tbar\\\\n\\\\nbaz\"\n becomes \" foo bar baz\".\n \"\"\"\n if self.expand_tabs:\n text = text.expandtabs(self.tabsize)\n if self.replace_whitespace:\n for key, val in self.unicode_whitespace_trans.items():\n text = text.replace(key, val)\n return text\n\n\n def _split(self, text):\n \"\"\"_split(text : string) -> [string]\n Split the text to wrap into indivisible chunks. Chunks are\n not quite the same as words; see _wrap_chunks() for full\n details. As an example, the text\n Look, goof-ball -- use the -b option!\n breaks into the following chunks:\n 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',\n 'use', ' ', 'the', ' ', '-b', ' ', 'option!'\n if break_on_hyphens is True, or in:\n 'Look,', ' ', 'goof-ball', ' ', '--', ' ',\n 'use', ' ', 'the', ' ', '-b', ' ', option!'\n otherwise.\n \"\"\"\n if self.break_on_hyphens is True:\n chunks = self.wordsep_re.split(text)\n if \"--\" in text:\n chunks = [item \n for sublist in [self.em_dash.split(chunk) for chunk in chunks] \n for item in sublist]\n else:\n chunks = self.wordsep_simple_re.split(text)\n chunks = [c for c in chunks if c]\n return chunks\n\n def _fix_sentence_endings(self, chunks):\n \"\"\"_fix_sentence_endings(chunks : [string])\n Correct for sentence endings buried in 'chunks'. Eg. when the\n original text contains \"... foo.\\\\nBar ...\", munge_whitespace()\n and split() will convert that to [..., \"foo.\", \" \", \"Bar\", ...]\n which has one too few spaces; this method simply changes the one\n space to two.\n \"\"\"\n i = 0\n # patsearch = self.sentence_end_re.search\n while i < len(chunks)-1:\n if chunks[i+1] == \" \" and re.search(self.sentence_end_re, chunks[i]) and chunks[i][-1] in \".!?\\\"\\'\":\n chunks[i+1] = \" \"\n i += 2\n else:\n i += 1\n\n def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):\n \"\"\"_handle_long_word(chunks : [string],\n cur_line : [string],\n cur_len : int, width : int)\n Handle a chunk of text (most likely a word, not whitespace) that\n is too long to fit in any line.\n \"\"\"\n # Figure out when indent is larger than the specified width, and make\n # sure at least one character is stripped off on every pass\n if width < 1:\n space_left = 1\n else:\n space_left = width - cur_len\n\n # If we're allowed to break long words, then do so: put as much\n # of the next chunk onto the current line as will fit.\n if self.break_long_words:\n cur_line.append(reversed_chunks[-1][:space_left])\n reversed_chunks[-1] = reversed_chunks[-1][space_left:]\n\n # Otherwise, we have to preserve the long word intact. Only add\n # it to the current line if there's nothing already there --\n # that minimizes how much we violate the width constraint.\n elif not cur_line:\n cur_line.append(reversed_chunks.pop())\n\n # If we're not allowed to break long words, and there's already\n # text on the current line, do nothing. Next time through the\n # main loop of _wrap_chunks(), we'll wind up here again, but\n # cur_len will be zero, so the next line will be entirely\n # devoted to the long word that we can't handle right now.\n\n def _wrap_chunks(self, chunks):\n \"\"\"_wrap_chunks(chunks : [string]) -> [string]\n Wrap a sequence of text chunks and return a list of lines of\n length 'self.width' or less. (If 'break_long_words' is false,\n some lines may be longer than this.) Chunks correspond roughly\n to words and the whitespace between them: each chunk is\n indivisible (modulo 'break_long_words'), but a line break can\n come between any two chunks. Chunks should not have internal\n whitespace; ie. a chunk is either all whitespace or a \"word\".\n Whitespace chunks will be removed from the beginning and end of\n lines, but apart from that whitespace is preserved.\n \"\"\"\n lines = []\n if self.width <= 0:\n raise ValueError(\"invalid width %r (must be > 0)\" % self.width)\n if self.max_lines is not None:\n if self.max_lines > 1:\n indent = self.subsequent_indent\n else:\n indent = self.initial_indent\n if len(indent) + len(self.placeholder.lstrip()) > self.width:\n raise ValueError(\"placeholder too large for max width\")\n\n # Arrange in reverse order so items can be efficiently popped\n # from a stack of chucks.\n chunks.reverse()\n\n while chunks:\n\n # Start the list of chunks that will make up the current line.\n # cur_len is just the length of all the chunks in cur_line.\n cur_line = []\n cur_len = 0\n\n # Figure out which static string will prefix this line.\n if lines:\n indent = self.subsequent_indent\n else:\n indent = self.initial_indent\n\n # Maximum width for this line.\n width = self.width - len(indent)\n\n # First chunk on line is whitespace -- drop it, unless this\n # is the very beginning of the text (ie. no lines started yet).\n if self.drop_whitespace and chunks[-1].strip() == '' and lines:\n del chunks[-1]\n\n while chunks:\n l = len(chunks[-1])\n\n # Can at least squeeze this chunk onto the current line.\n if cur_len + l <= width:\n cur_line.append(chunks.pop())\n cur_len += l\n\n # Nope, this line is full.\n else:\n break\n\n # The current line is full, and the next chunk is too big to\n # fit on *any* line (not just this one).\n if chunks and len(chunks[-1]) > width:\n self._handle_long_word(chunks, cur_line, cur_len, width)\n cur_len = sum(map(len, cur_line))\n\n # If the last chunk on this line is all whitespace, drop it.\n if self.drop_whitespace and cur_line and cur_line[-1].strip() == '':\n cur_len -= len(cur_line[-1])\n del cur_line[-1]\n\n if cur_line:\n if (self.max_lines is None or\n len(lines) + 1 < self.max_lines or\n (not chunks or\n self.drop_whitespace and\n len(chunks) == 1 and\n not chunks[0].strip()) and cur_len <= width):\n # Convert current line back to a string and store it in\n # list of all lines (return value).\n lines.append(indent + ''.join(cur_line))\n else:\n while cur_line:\n if (cur_line[-1].strip() and\n cur_len + len(self.placeholder) <= width):\n cur_line.append(self.placeholder)\n lines.append(indent + ''.join(cur_line))\n break\n cur_len -= len(cur_line[-1])\n del cur_line[-1]\n else:\n if lines:\n prev_line = lines[-1].rstrip()\n if (len(prev_line) + len(self.placeholder) <=\n self.width):\n lines[-1] = prev_line + self.placeholder\n break\n lines.append(indent + self.placeholder.lstrip())\n break\n\n return lines\n\n def _split_chunks(self, text):\n text = self._munge_whitespace(text)\n return self._split(text)\n\n # -- Public interface ----------------------------------------------\n\n def wrap(self, text):\n \"\"\"wrap(text : string) -> [string]\n Reformat the single paragraph in 'text' so it fits in lines of\n no more than 'self.width' columns, and return a list of wrapped\n lines. Tabs in 'text' are expanded with string.expandtabs(),\n and all other whitespace characters (including newline) are\n converted to space.\n \"\"\"\n chunks = self._split_chunks(text)\n if self.fix_sentence_endings:\n self._fix_sentence_endings(chunks)\n return self._wrap_chunks(chunks)\n\n def fill(self, text):\n \"\"\"fill(text : string) -> string\n Reformat the single paragraph in 'text' to fit in lines of no\n more than 'self.width' columns, and return a new string\n containing the entire wrapped paragraph.\n \"\"\"\n return \"\\n\".join(self.wrap(text))\n\n\n# -- Convenience interface ---------------------------------------------\n\ndef wrap(text, width=70, **kwargs):\n \"\"\"Wrap a single paragraph of text, returning a list of wrapped lines.\n Reformat the single paragraph in 'text' so it fits in lines of no\n more than 'width' columns, and return a list of wrapped lines. By\n default, tabs in 'text' are expanded with string.expandtabs(), and\n all other whitespace characters (including newline) are converted to\n space. See TextWrapper class for available keyword args to customize\n wrapping behaviour.\n \"\"\"\n w = TextWrapper(width=width, **kwargs)\n return w.wrap(text)\n\ndef fill(text, width=70, **kwargs):\n \"\"\"Fill a single paragraph of text, returning a new string.\n Reformat the single paragraph in 'text' to fit in lines of no more\n than 'width' columns, and return a new string containing the entire\n wrapped paragraph. As with wrap(), tabs are expanded and other\n whitespace characters converted to space. See TextWrapper class for\n available keyword args to customize wrapping behaviour.\n \"\"\"\n w = TextWrapper(width=width, **kwargs)\n return w.fill(text)\n\ndef shorten(text, width, **kwargs):\n \"\"\"Collapse and truncate the given text to fit in the given width.\n The text first has its whitespace collapsed. If it then fits in\n the *width*, it is returned as is. Otherwise, as many words\n as possible are joined and then the placeholder is appended::\n >>> textwrap.shorten(\"Hello world!\", width=12)\n 'Hello world!'\n >>> textwrap.shorten(\"Hello world!\", width=11)\n 'Hello [...]'\n \"\"\"\n w = TextWrapper(width=width, max_lines=1, **kwargs)\n return w.fill(' '.join(text.strip().split()))\n\n\n# -- Loosely related functionality -------------------------------------\n\n# _whitespace_only_re = re.compile('^[ \\t]+$', re.MULTILINE)\n# _leading_whitespace_re = re.compile('(^[ \\t]*)(?:[^ \\t\\n])', re.MULTILINE)\n\ndef dedent(text):\n \"\"\"Remove any common leading whitespace from every line in `text`.\n This can be used to make triple-quoted strings line up with the left\n edge of the display, while still presenting them in the source code\n in indented form.\n Note that tabs and spaces are both treated as whitespace, but they\n are not equal: the lines \" hello\" and \"\\\\thello\" are\n considered to have no common leading whitespace.\n Entirely blank lines are normalized to a newline character.\n \"\"\"\n # Look for the longest leading string of spaces and tabs common to\n # all lines.\n margin = None\n\n indents = re.findall(r'(^[ \\t]*)(?:[^ \\t\\n])',text, re.MULTILINE)\n for indent in indents:\n if margin is None:\n margin = indent\n\n # Current line more deeply indented than previous winner:\n # no change (previous winner is still on top).\n elif indent.startswith(margin):\n pass\n\n # Current line consistent with and no deeper than previous winner:\n # it's the new winner.\n elif margin.startswith(indent):\n margin = indent\n\n # Find the largest common whitespace between current line and previous\n # winner.\n else:\n for i, (x, y) in enumerate(zip(margin, indent)):\n if x != y:\n margin = margin[:i]\n break\n # sanity check (testing/debugging only)\n if 0 and margin:\n for line in text.split(\"\\n\"):\n assert not line or line.startswith(margin), \\\n \"line = %r, margin = %r\" % (line, margin)\n\n if margin:\n lines = [line[len(margin):] \n if line.strip()\n else line.strip() \n for line in text.split(\"\\n\")]\n text = \"\\n\".join(lines)\n return text\n\n\ndef indent(text, prefix, predicate=None):\n \"\"\"Adds 'prefix' to the beginning of selected lines in 'text'.\n If 'predicate' is provided, 'prefix' will only be added to the lines\n where 'predicate(line)' is True. If 'predicate' is not provided,\n it will default to adding 'prefix' to all non-empty lines that do not\n consist solely of whitespace characters.\n \"\"\"\n if predicate is None:\n def predicate(line):\n return line.strip()\n\n def prefixed_lines():\n for line in text.splitlines(True):\n yield (prefix + line if predicate(line) else line)\n return ''.join(prefixed_lines())\n\n\nif __name__ == \"__main__\":\n #print dedent(\"\\tfoo\\n\\tbar\")\n #print dedent(\" \\thello there\\n \\t how are you?\")\n print(dedent(\"Hello there.\\n This is indented.\"))","src/lib/this.py":"import _sk_fail; _sk_fail._(\"this\")\n","src/lib/threading.py":"import _sk_fail; _sk_fail._(\"threading\")\n","src/lib/timeit.py":"import _sk_fail; _sk_fail._(\"timeit\")\n","src/lib/toaiff.py":"import _sk_fail; _sk_fail._(\"toaiff\")\n","src/lib/trace.py":"import _sk_fail; _sk_fail._(\"trace\")\n","src/lib/traceback.py":"import _sk_fail; _sk_fail._(\"traceback\")\n","src/lib/tty.py":"import _sk_fail; _sk_fail._(\"tty\")\n","src/lib/types.py":"\"\"\"\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n\"\"\"\n\"\"\"Define names for all type symbols known in the standard interpreter.\nTypes that are part of optional modules (e.g. array) are not listed.\n\"\"\"\nimport sys\n\n# Iterators in Python aren't a matter of type but of protocol. A large\n# and changing number of builtin types implement *some* flavor of\n# iterator. Don't check the type! Use hasattr to check for both\n# \"__iter__\" and \"next\" attributes instead.\nMappingProxyType = type(type.__dict__)\nWrapperDescriptorType = type(object.__init__)\nMethodWrapperType = type(object().__str__)\nMethodDescriptorType = type(str.join)\nClassMethodDescriptorType = type(dict.__dict__['fromkeys'])\n\nNoneType = type(None)\nTypeType = type\nObjectType = object\nIntType = int\ntry:\n LongType = long\nexcept: pass\nFloatType = float\nBooleanType = bool\ntry:\n ComplexType = complex\nexcept NameError:\n pass\nStringType = str\n\n# StringTypes is already outdated. Instead of writing \"type(x) in\n# types.StringTypes\", you should use \"isinstance(x, basestring)\". But\n# we keep around for compatibility with Python 2.2.\ntry:\n UnicodeType = unicode\n StringTypes = (StringType, UnicodeType)\nexcept NameError:\n StringTypes = (StringType,)\n\nBufferType = buffer\n\nTupleType = tuple\nListType = list\nDictType = DictionaryType = dict\n\ndef _f(): pass\nFunctionType = type(_f)\nLambdaType = type(lambda: None) # Same as FunctionType\n#CodeType = type(_f.func_code)\n\ndef _g():\n yield 1\nGeneratorType = type(_g())\n\nclass _C:\n def _m(self): pass\nClassType = type(_C)\nUnboundMethodType = type(_C._m) # Same as MethodType\n_x = _C()\nInstanceType = type(_x)\nMethodType = type(_x._m)\nBuiltinFunctionType = type(len)\nBuiltinMethodType = type([].append) # Same as BuiltinFunctionType\n\nModuleType = type(sys)\nFileType = file\ntry:\n XRangeType = xrange\nexcept NameError:\n pass\n\n# try:\n# raise TypeError\n# except TypeError:\n# tb = sys.exc_info()[2]\n# TracebackType = type(tb)\n# FrameType = type(tb.tb_frame)\n# del tb\n\nSliceType = slice\nEllipsisType = type(Ellipsis)\n\n# DictProxyType = type(TypeType.__dict__)\nNotImplementedType = type(NotImplemented)\n\n# For Jython, the following two types are identical\n# GetSetDescriptorType = type(FunctionType.func_code)\n# MemberDescriptorType = type(FunctionType.func_globals)\n\ndel sys, _f, _g, _C, _x # Not for export\n__all__ = list(n for n in globals() if n[:1] != '_')\n\nGenericAlias = type(type[int])","src/lib/unittest/__init__.py":"__author__ = 'bmiller'\n'''\nThis is the start of something that behaves like\nthe unittest module from cpython.\n\n'''\nimport re\n\nclass _AssertRaisesContext(object):\n \"\"\"A context manager used to implement TestCase.assertRaises* methods.\"\"\"\n def __init__(self, expected, test_case):\n self.test_case = test_case\n self.expected = expected\n self.exception = None\n\n def _is_subtype(self, expected, basetype):\n if isinstance(expected, tuple):\n return all(self._is_subtype(e, basetype) for e in expected)\n return isinstance(expected, type) and issubclass(expected, basetype)\n\n def handle(self, args, kwargs):\n \"\"\"\n If args is empty, assertRaises is being used as a\n context manager, so return self.\n If args is not empty, call a callable passing positional and keyword\n arguments.\n \"\"\"\n try:\n if not self._is_subtype(self.expected, BaseException):\n raise TypeError('assertRaises() arg 1 must be an exception type or tuple of exception types')\n if not args:\n return self\n\n callable_obj = args[0]\n args = args[1:]\n with self:\n callable_obj(*args, **kwargs) \n\n finally:\n # bpo-23890: manually break a reference cycle\n self = None\n\n def __enter__(self):\n return self\n\n def __exit__(self, exc_type, exc_value, tb):\n res = True\n feedback = \"\"\n self.exception = exc_value\n try:\n act_exc = exc_type.__name__\n except AttributeError:\n act_exc = str(exc_type)\n try:\n exp_exc = self.expected.__name__\n except AttributeError:\n exp_exc = str(self.expected)\n\n if exc_type is None:\n res = False\n feedback = \"{} not raised\".format(exp_exc)\n elif not issubclass(exc_type, self.expected):\n res = False\n feedback = \"Expected {} but got {}\".format(exp_exc, act_exc)\n\n self.test_case.appendResult(res, act_exc, exp_exc, feedback)\n return True\n\n\nclass TestCase(object):\n def __init__(self):\n self.numPassed = 0\n self.numFailed = 0\n self.assertPassed = 0\n self.assertFailed = 0\n self.verbosity = 1\n self.tlist = []\n testNames = {}\n for name in dir(self):\n if name[:4] == 'test' and name not in testNames:\n self.tlist.append(getattr(self,name))\n testNames[name]=True\n\n def setUp(self):\n pass\n\n def tearDown(self):\n pass\n \n def cleanName(self,funcName):\n return funcName.__func__.__name__\n\n def main(self):\n\n for func in self.tlist:\n if self.verbosity > 1:\n print('Running %s' % self.cleanName(func))\n try:\n self.setUp()\n self.assertPassed = 0\n self.assertFailed = 0\n func()\n self.tearDown()\n if self.assertFailed == 0:\n self.numPassed += 1\n else:\n self.numFailed += 1\n print('Tests failed in %s ' % self.cleanName(func))\n except Exception as e:\n self.assertFailed += 1\n self.numFailed += 1\n print('Test threw exception in %s (%s)' % (self.cleanName(func), e))\n self.showSummary()\n\n def assertEqual(self, actual, expected, feedback=\"\"):\n res = actual==expected\n if not res and feedback == \"\":\n feedback = \"Expected %s to equal %s\" % (str(actual),str(expected))\n self.appendResult(res, actual ,expected, feedback)\n\n def assertNotEqual(self, actual, expected, feedback=\"\"):\n res = actual != expected\n if not res and feedback == \"\":\n feedback = \"Expected %s to not equal %s\" % (str(actual),str(expected))\n self.appendResult(res, actual, expected, feedback)\n\n def assertTrue(self,x, feedback=\"\"):\n res = bool(x) is True\n if not res and feedback == \"\":\n feedback = \"Expected %s to be True\" % (str(x))\n self.appendResult(res, x, True, feedback)\n\n def assertFalse(self,x, feedback=\"\"):\n res = not bool(x)\n if not res and feedback == \"\":\n feedback = \"Expected %s to be False\" % (str(x))\n self.appendResult(res, x, False, feedback)\n\n def assertIs(self,a,b, feedback=\"\"):\n res = a is b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be the same object as %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsNot(self,a,b, feedback=\"\"):\n res = a is not b\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be the same object as %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsNone(self,x, feedback=\"\"):\n res = x is None\n if not res and feedback == \"\":\n feedback = \"Expected %s to be None\" % (str(x))\n self.appendResult(res, x, None, feedback)\n\n def assertIsNotNone(self,x, feedback=\"\"):\n res = x is not None\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be None\" % (str(x))\n self.appendResult(res, x, None, feedback)\n\n def assertIn(self, a, b, feedback=\"\"):\n res = a in b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be in %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotIn(self, a, b, feedback=\"\"):\n res = a not in b\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be in %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertIsInstance(self,a,b, feedback=\"\"):\n res = isinstance(a,b)\n if not res and feedback == \"\":\n feedback = \"Expected %s to be an instance of %s\" % (str(a), str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotIsInstance(self,a,b, feedback=\"\"):\n res = not isinstance(a,b)\n if not res and feedback == \"\":\n feedback = \"Expected %s to not be an instance of %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertRegex(self, text, expected_regex, feedback=\"\"):\n \"\"\"Fail the test unless the text matches the regular expression.\"\"\"\n if isinstance(expected_regex, (str, )): #bytes\n assert expected_regex, \"expected_regex must not be empty.\"\n expected_regex = re.compile(expected_regex)\n if not expected_regex.search(text):\n res = False\n if feedback == \"\":\n feedback = \"Regex didn't match: %r not found in %r\" % (\n repr(expected_regex), text)\n else:\n res = True\n self.appendResult(res, text, expected_regex, feedback)\n\n def assertNotRegex(self, text, unexpected_regex, feedback=\"\"):\n \"\"\"Fail the test if the text matches the regular expression.\"\"\"\n if isinstance(unexpected_regex, (str, )): # bytes\n unexpected_regex = re.compile(unexpected_regex)\n match = unexpected_regex.search(text)\n if match:\n feedback = 'Regex matched: %r matches %r in %r' % (\n text[match.start() : match.end()],\n repr(unexpected_regex),\n text)\n # _formatMessage ensures the longMessage option is respected\n self.appendResult(not bool(match), text, unexpected_regex, feedback)\n\n def assertAlmostEqual(self, a, b, places=7, feedback=\"\", delta=None):\n\n if delta is not None:\n res = abs(a-b) <= delta\n else:\n if places is None:\n places = 7\n res = round(a-b, places) == 0\n \n if not res and feedback == \"\":\n feedback = \"Expected %s to equal %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertNotAlmostEqual(self, a, b, places=7, feedback=\"\", delta=None):\n\n if delta is not None:\n res = not (a == b) and abs(a - b) > delta\n else:\n if places is None:\n places = 7\n\n res = round(a-b, places) != 0\n\n if not res and feedback == \"\":\n feedback = \"Expected %s to not equal %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertGreater(self,a,b, feedback=\"\"):\n res = a > b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be greater than %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertGreaterEqual(self,a,b, feedback=\"\"):\n res = a >= b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be >= %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertLess(self, a, b, feedback=\"\"):\n res = a < b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be less than %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def assertLessEqual(self,a,b, feedback=\"\"):\n res = a <= b\n if not res and feedback == \"\":\n feedback = \"Expected %s to be <= %s\" % (str(a),str(b))\n self.appendResult(res, a, b, feedback)\n\n def appendResult(self,res,actual,expected,feedback):\n if res:\n msg = 'Pass'\n self.assertPassed += 1\n else:\n msg = 'Fail: ' + feedback\n print(msg)\n self.assertFailed += 1\n\n def assertRaises(self, expected_exception, *args, **kwargs):\n context = _AssertRaisesContext(expected_exception, self)\n try:\n return context.handle(args, kwargs)\n finally:\n # bpo-23890: manually break a reference cycle\n context = None\n\n def fail(self, msg=None):\n if msg is None:\n msg = 'Fail'\n else:\n msg = 'Fail: ' + msg\n print(msg)\n self.assertFailed += 1\n\n def showSummary(self):\n # don't divde by zero\n # pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n print(\"Ran %d tests, passed: %d failed: %d\\n\" % (self.numPassed+self.numFailed,\n self.numPassed, self.numFailed))\n\n\n\ndef main(verbosity=1):\n glob = globals() # globals() still needs work\n for name in glob:\n if type(glob[name]) == type and issubclass(glob[name], TestCase):\n try:\n tc = glob[name]()\n tc.verbosity = verbosity\n tc.main()\n except:\n print(\"Uncaught Error in: \", name)\n","src/lib/unittest/gui.py":"import document\nfrom unittest import TestCase\n\nclass TestCaseGui(TestCase):\n def __init__(self):\n TestCase.__init__(self)\n self.divid = document.currentDiv()\n self.mydiv = document.getElementById(self.divid)\n res = document.getElementById(self.divid+'_unit_results')\n if res:\n self.resdiv = res\n res.innerHTML = ''\n else:\n self.resdiv = document.createElement('div')\n self.resdiv.setAttribute('id',self.divid+'_unit_results')\n self.resdiv.setAttribute('class','unittest-results')\n self.mydiv.appendChild(self.resdiv)\n\n\n def main(self):\n t = document.createElement('table')\n self.resTable = t\n self.resdiv.appendChild(self.resTable)\n\n headers = ['Result','Actual Value','Expected Value','Notes']\n row = document.createElement('tr')\n for item in headers:\n head = document.createElement('th')\n head.setAttribute('class','ac-feedback')\n head.innerHTML = item\n head.setCSS('text-align','center')\n row.appendChild(head)\n self.resTable.appendChild(row)\n\n for func in self.tlist:\n try:\n self.setUp()\n func()\n self.tearDown()\n except Exception as e:\n self.appendResult('Error', None, None, e)\n self.numFailed += 1\n self.showSummary()\n\n def appendResult(self,res,actual,expected,param):\n trimActual = False\n if len(str(actual)) > 15:\n trimActual = True\n actualType = type(actual)\n trimExpected = False\n if len(str(expected)) > 15:\n trimExpected = True\n expectedType = type(expected)\n row = document.createElement('tr')\n err = False\n if res == 'Error':\n err = True\n msg = 'Error: %s' % param\n errorData = document.createElement('td')\n errorData.setAttribute('class','ac-feedback')\n errorData.innerHTML = 'ERROR'\n errorData.setCSS('background-color','#de8e96')\n errorData.setCSS('text-align','center')\n row.appendChild(errorData)\n elif res:\n passed = document.createElement('td')\n passed.setAttribute('class','ac-feedback')\n passed.innerHTML = 'Pass'\n passed.setCSS('background-color','#83d382')\n passed.setCSS('text-align','center')\n row.appendChild(passed)\n self.numPassed += 1\n else:\n fail = document.createElement('td')\n fail.setAttribute('class','ac-feedback')\n fail.innerHTML = 'Fail'\n fail.setCSS('background-color','#de8e96')\n fail.setCSS('text-align','center')\n row.appendChild(fail)\n self.numFailed += 1\n\n\n act = document.createElement('td')\n act.setAttribute('class','ac-feedback')\n if trimActual:\n actHTML = str(actual)[:5] + \"...\" + str(actual)[-5:]\n if actualType == str:\n actHTML = repr(actHTML)\n act.innerHTML = actHTML\n else:\n act.innerHTML = repr(actual)\n act.setCSS('text-align','center')\n row.appendChild(act)\n\n expect = document.createElement('td')\n expect.setAttribute('class','ac-feedback')\n\n if trimExpected:\n expectedHTML = str(expected)[:5] + \"...\" + str(expected)[-5:]\n if expectedType == str:\n expectedHTML = repr(expectedHTML)\n expect.innerHTML = expectedHTML\n else:\n expect.innerHTML = repr(expected)\n expect.setCSS('text-align','center')\n row.appendChild(expect)\n inp = document.createElement('td')\n inp.setAttribute('class','ac-feedback')\n\n if err:\n inp.innerHTML = msg\n else:\n inp.innerHTML = param\n inp.setCSS('text-align','center')\n row.appendChild(inp)\n self.resTable.appendChild(row)\n\n\n def showSummary(self):\n pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n pTag = document.createElement('p')\n pTag.innerHTML = \"You passed: \" + str(pct) + \"% of the tests\"\n self.resdiv.appendChild(pTag)\n","src/lib/urllib2.py":"import _sk_fail; _sk_fail._(\"urllib2\")\n","src/lib/urlparse.py":"import _sk_fail; _sk_fail._(\"urlparse\")\n","src/lib/user.py":"import _sk_fail; _sk_fail._(\"user\")\n","src/lib/uu.py":"import _sk_fail; _sk_fail._(\"uu\")\n","src/lib/warnings.py":"import _sk_fail; _sk_fail._(\"warnings\")\n","src/lib/wave.py":"import _sk_fail; _sk_fail._(\"wave\")\n","src/lib/weakref.py":"import _sk_fail; _sk_fail._(\"weakref\")\n","src/lib/whichdb.py":"import _sk_fail; _sk_fail._(\"whichdb\")\n","src/lib/wsgiref/__init__.py":"import _sk_fail; _sk_fail._(\"wsgiref\")\n","src/lib/xdrlib.py":"import _sk_fail; _sk_fail._(\"xdrlib\")\n","src/lib/xml/__init__.py":"import _sk_fail; _sk_fail._(\"xml\")\n","src/lib/xml/dom/__init__.py":"import _sk_fail; _sk_fail._(\"dom\")\n","src/lib/xml/etree/__init__.py":"import _sk_fail; _sk_fail._(\"etree\")\n","src/lib/xml/parsers/__init__.py":"import _sk_fail; _sk_fail._(\"parsers\")\n","src/lib/xml/sax/__init__.py":"import _sk_fail; _sk_fail._(\"sax\")\n","src/lib/xmllib.py":"import _sk_fail; _sk_fail._(\"xmllib\")\n","src/lib/xmlrpclib.py":"import _sk_fail; _sk_fail._(\"xmlrpclib\")\n","src/lib/zipfile.py":"import _sk_fail; _sk_fail._(\"zipfile\")\n","src/builtin/sys.js":"var $builtinmodule=function(i){var t,n={},e=[],u=Sk.getSysArgv();for(t=0;tnew Sk.builtin.str(\"utf-8\"))),n.getExecutionLimit=new Sk.builtin.func((function(){return null===Sk.execLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.execLimit)})),n.setExecutionLimit=new Sk.builtin.func((function(i){if(null===Sk.execLimit)throw new Sk.builtin.NotImplementedError(\"Execution limiting is not enabled\");void 0!==i&&(Sk.execLimit=Sk.builtin.asnum$(i))})),n.resetTimeout=new Sk.builtin.func((function(){Sk.execStart=new Date})),n.getYieldLimit=new Sk.builtin.func((function(){return null===Sk.yieldLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.yieldLimit)})),n.setYieldLimit=new Sk.builtin.func((function(i){if(null===Sk.yieldLimit)throw new Sk.builtin.NotImplementedError(\"Yielding is not enabled\");void 0!==i&&(Sk.yieldLimit=Sk.builtin.asnum$(i))})),n.debug=new Sk.builtin.func((function(){return Sk.builtin.none.none$}));const o=Sk.builtin.make_structseq(\"sys\",\"float_info\",{max:\"DBL_MAX -- maximum representable finite float\",max_exp:\"DBL_MAX_EXP -- maximum int e such that radix**(e-1) is representable\",max_10_exp:\"DBL_MAX_10_EXP -- maximum int e such that 10**e is representable\",min:\"DBL_MIN -- Minimum positive normalized float\",min_exp:\"DBL_MIN_EXP -- minimum int e such that radix**(e-1) is a normalized float\",min_10_exp:\"DBL_MIN_10_EXP -- minimum int e such that 10**e is a normalized\",dig:\"DBL_DIG -- digits\",mant_dig:\"DBL_MANT_DIG -- mantissa digits\",epsilon:\"DBL_EPSILON -- Difference between 1 and the next representable float\",radix:\"FLT_RADIX -- radix of exponent\",rounds:\"FLT_ROUNDS -- rounding mode\"});n.float_info=new o([Number.MAX_VALUE,Math.floor(Math.log2(Number.MAX_VALUE)),Math.floor(Math.log10(Number.MAX_VALUE)),Number.MIN_VALUE,Math.ceil(Math.log2(Number.MIN_VALUE)),Math.ceil(Math.log10(Number.MIN_VALUE)),15,Math.log2(Number.MAX_SAFE_INTEGER),Number.EPSILON,2,1].map((i=>Sk.ffi.remapToPy(i))));const s=Sk.builtin.make_structseq(\"sys\",\"int_info\",{bits_per_digit:\"size of a digit in bits\",sizeof_digit:\"size in bytes of the C type used to represent a digit\"});n.int_info=new s([30,4].map((i=>Sk.ffi.remapToPy(i))));const l=Sk.builtin.make_structseq(\"sys\",\"hash_info\",{width:\"width of the type used for hashing, in bits\",modulus:\"prime number giving the modulus on which the hash function is based\",inf:\"value to be used for hash of a positive infinity\",nan:\"value to be used for hash of a nan\",imag:\"multiplier used for the imaginary part of a complex number\",algorithm:\"name of the algorithm for hashing of str, bytes and memoryviews\",hash_bits:\"internal output size of hash algorithm\",seed_bits:\"seed size of hash algorithm\",cutoff:\"small string optimization cutoff\"});return n.hash_info=new l([32,536870911,314159,0,1000003,\"siphash24\",32,128,0].map((i=>Sk.ffi.remapToPy(i)))),n.__stdout__=new Sk.builtin.file(new Sk.builtin.str(\"/dev/stdout\"),new Sk.builtin.str(\"w\")),n.__stdin__=new Sk.builtin.file(new Sk.builtin.str(\"/dev/stdin\"),new Sk.builtin.str(\"r\")),n.stdout=n.__stdout__,n.stdin=n.__stdin__,n};","src/lib/_strptime.js":"function $builtinmodule(){const e=Sk.builtin.int_,t=Sk.builtin.none.none$,i=Sk.builtin.str,s=Sk.builtin.tuple,n=Sk.misceval.callsimOrSuspendArray,{isTrue:a,richCompareBool:r,chain:l}=Sk.misceval,{typeName:o,setUpModuleMethods:_,buildNativeClass:c}=Sk.abstr,{TypeError:m,ValueError:d,KeyError:h,IndexError:f,checkString:u,asnum$:w}=Sk.builtin,{remapToPy:p,remapToJs:g}=Sk.ffi,{getAttr:$,setAttr:y}=Sk.generic,S=l,k=/^[0-9]+$/;function _as_integer(e){if(!k.test(e))throw new d(`invalid literal for int() with base 10: '${e}'`);return parseInt(e)}const b=/([\\\\.^$*+?\\(\\){}\\[\\]|])/g,v=/\\s+/g;let O=Sk.importModule(\"time\",!1,!0),z=Sk.importModule(\"datetime\",!1,!0);const L=S(z,(e=>(z=e.$d,O)),(e=>{O=e.$d}));return S(L,(()=>{function _strftime(e){return t=>e.$strftime(t).toString().toLowerCase()}function _strftime_timetuple(e,t){return O.strftime.tp$call([new i(e),t]).toString().toLowerCase()}const l=new i(\"fromordinal\");function _struct_time(t){return O.struct_time.tp$call([new s(t.map((t=>new e(t))))])}function _localized_month(){const e=[()=>\"\"];for(let t=0;t<12;t++){const i=new k(2001,t+1,1);e.push(_strftime(i))}return e}function _localized_day(){const e=[];for(let t=0;t<7;t++){const i=new k(2001,1,t+1);e.push(_strftime(i))}return e}const S={__name__:new i(\"_strptime\")},k=z.date,L=z.timedelta,E=z.timezone;function _getlang(){return[t,t]}class LocaleTime{constructor(){this.lang=_getlang(),this.__calc_weekday(),this.__calc_month(),this.__calc_am_pm(),this.__calc_timezone(),this.__calc_date_time()}__calc_weekday(){this.a_weekday=_localized_day().map((e=>e(\"%a\"))),this.f_weekday=_localized_day().map((e=>e(\"%A\")))}__calc_month(){this.a_month=_localized_month().map((e=>e(\"%b\"))),this.f_month=_localized_month().map((e=>e(\"%B\")))}__calc_am_pm(){const e=[];[1,22].forEach((t=>{const i=_strftime_timetuple(\"%p\",_struct_time([1999,3,17,t,44,55,2,76,0]));e.push(i)})),this.am_pm=e}__calc_date_time(){const e=_struct_time([1999,3,17,22,44,55,2,76,0]),i=[t,t,t];i[0]=_strftime_timetuple(\"%c\",e),i[1]=_strftime_timetuple(\"%x\",e),i[2]=_strftime_timetuple(\"%X\",e);const s=[[\"%\",\"%%\"],[this.f_weekday[2],\"%A\"],[this.f_month[3],\"%B\"],[this.a_weekday[2],\"%a\"],[this.a_month[3],\"%b\"],[this.am_pm[1],\"%p\"],[\"1999\",\"%Y\"],[\"99\",\"%y\"],[\"22\",\"%H\"],[\"44\",\"%M\"],[\"55\",\"%S\"],[\"76\",\"%j\"],[\"17\",\"%d\"],[\"03\",\"%m\"],[\"3\",\"%m\"],[\"2\",\"%w\"],[\"10\",\"%I\"]];s.push(...this.timezone.flat().map((e=>[e,\"%Z\"]))),[[0,\"%c\"],[1,\"%x\"],[2,\"%X\"]].forEach((([e,t])=>{let n=i[e];s.forEach((([e,t])=>{e&&(n=n.replace(e,t))}));let a;a=_strftime_timetuple(t,_struct_time([1999,1,3,1,1,1,6,3,0])).includes(\"00\")?\"%W\":\"%U\",i[e]=n.replace(\"11\",a)})),this.LC_date_time=i[0],this.LC_date=i[1],this.LC_time=i[2]}__calc_timezone(){try{O.tzset.tp$call([])}catch{}this.tzname=O.tzname.v.map((e=>e.toString())),this.daylight=w(O.daylight);const e=[this.tzname[0].toLowerCase(),\"utc\",\"gmt\"];let t;t=this.daylight?[this.tzname[1].toLowerCase()]:[],this.timezone=[e,t]}}class TimeRE{constructor(e=null){this.locale_time=e||new LocaleTime,Object.assign(this,{d:\"(?3[0-1]|[1-2]\\\\d|0[1-9]|[1-9]| [1-9])\",f:\"(?[0-9]{1,6})\",H:\"(?2[0-3]|[0-1]\\\\d|\\\\d)\",I:\"(?1[0-2]|0[1-9]|[1-9])\",G:\"(?\\\\d\\\\d\\\\d\\\\d)\",j:\"(?36[0-6]|3[0-5]\\\\d|[1-2]\\\\d\\\\d|0[1-9]\\\\d|00[1-9]|[1-9]\\\\d|0[1-9]|[1-9])\",m:\"(?1[0-2]|0[1-9]|[1-9])\",M:\"(?[0-5]\\\\d|\\\\d)\",S:\"(?6[0-1]|[0-5]\\\\d|\\\\d)\",U:\"(?5[0-3]|[0-4]\\\\d|\\\\d)\",w:\"(?[0-6])\",u:\"(?[1-7])\",V:\"(?5[0-3]|0[1-9]|[1-4]\\\\d|\\\\d)\",y:\"(?\\\\d\\\\d)\",Y:\"(?\\\\d\\\\d\\\\d\\\\d)\",z:\"(?[+-]\\\\d\\\\d:?[0-5]\\\\d(:?[0-5]\\\\d(\\\\.\\\\d{1,6})?)?|Z)\",A:this.__seqToRE(this.locale_time.f_weekday,\"A\"),a:this.__seqToRE(this.locale_time.a_weekday,\"a\"),B:this.__seqToRE(this.locale_time.f_month.slice(1),\"B\"),b:this.__seqToRE(this.locale_time.a_month.slice(1),\"b\"),p:this.__seqToRE(this.locale_time.am_pm,\"p\"),Z:this.__seqToRE(this.locale_time.timezone.flat(),\"Z\"),\"%\":\"%\"}),this.W=this.U.replace(\"U\",\"W\"),this.x=this.pattern(this.locale_time.LC_date),this.X=this.pattern(this.locale_time.LC_time),this.c=this.pattern(this.locale_time.LC_date_time)}__seqToRE(e,t){if((e=e.slice(0).sort(((e,t)=>t.length-e.length))).every((e=>\"\"===e)))return\"\";return`(?<${t}>${e.map((e=>e)).join(\"|\")})`}pattern(e){let t=\"\";for(e=(e=e.replace(b,\"\\\\$1\")).replace(v,\"\\\\s+\");e.includes(\"%\");){const i=e.indexOf(\"%\")+1,s=this[e[i]];if(void 0===s)throw new h(e[i]);t=`${t}${e.slice(0,i-1)}${s}`,e=e.slice(i+1)}return t+e}compile(e){return new RegExp(\"^\"+this.pattern(e),\"i\")}}let C=new TimeRE;let T={};function _strptime(i,s=\"%a %b %d %H:%M:%S %Y\"){function _checkString(e,t){if(\"string\"!=typeof e&&!u(e))throw new m(`strptime() argument ${t} must be a str, not '${o(e)}'`)}_checkString(i,0),_checkString(s,1),i=i.toString(),s=s.toString();let n,_=C.locale_time;if(Object.keys(T).length>5&&(T={}),n=T[s],void 0===n)try{n=C.compile(s)}catch(R){if(R instanceof h){let e=R.args.v[0];throw\"\\\\\"==e&&(e=\"%\"),new d(`'${e}' is a bad directive in format '${s}'`)}if(R instanceof f)throw new d(\"stray %% in format '\"+s+\"'\");throw R}const c=i.match(n);if(null===c)throw new d(`time data '${i}' does not match format '${s}'`);if(i.length!==c[0].length)throw new d(`unconverted data remains: ${i.slice(c[0].length)}`);let w=t,p=t,g=1,$=1,y=0,S=0,b=0,v=0,z=-1,L=t,E=0,A=t,I=t,M=t,H=t,Y=t,j=c.groups||{};if(Object.keys(j).forEach((e=>{if(void 0!==j[e])if(\"y\"===e)p=_as_integer(j.y),p+=p<=68?2e3:1900;else if(\"Y\"===e)p=_as_integer(j.Y);else if(\"G\"===e)w=_as_integer(j.G);else if(\"m\"===e)g=_as_integer(j.m);else if(\"B\"===e)g=_.f_month.indexOf(j.B.toLowerCase());else if(\"b\"===e)g=_.a_month.indexOf(j.b.toLowerCase());else if(\"d\"===e)$=_as_integer(j.d);else if(\"H\"===e)y=_as_integer(j.H);else if(\"H\"===e)y=_as_integer(j.H);else if(\"I\"===e){y=_as_integer(j.I);const e=(j.p||\"\").toLowerCase();[\"\",_.am_pm[0]].includes(e)?12===y&&(y=0):e===_.am_pm[1]&&12!==y&&(y+=12)}else if(\"M\"===e)S=_as_integer(j.M);else if(\"S\"===e)b=_as_integer(j.S);else if(\"f\"===e){let e=j.f;e+=\"0\".repeat(6-e.length),v=_as_integer(e)}else if(\"A\"===e)H=_.f_weekday.indexOf(j.A.toLowerCase());else if(\"a\"===e)H=_.a_weekday.indexOf(j.a.toLowerCase());else if(\"w\"===e)H=_as_integer(j.w),0===H?H=6:H-=1;else if(\"u\"===e)H=_as_integer(j.u),H-=1;else if(\"j\"===e)Y=_as_integer(j.j);else if([\"U\",\"W\"].includes(e))I=_as_integer(j[e]),M=\"U\"===e?6:0;else if(\"V\"===e)A=_as_integer(j.V);else if(\"z\"===e){let e=j.z;if(\"Z\"===e)L=0;else{if(\":\"===e[3]&&(e=e.slice(0,3)+e.slice(4),e.length>5)){if(\":\"!==e[5]){const e=`Inconsistent use of : in ${j.z}`;throw new d(e)}e=e.slice(0,5)+e.slice(6)}const t=_as_integer(e.slice(1,3)),i=_as_integer(e.slice(3,5)),s=_as_integer(e.slice(5,7)||0);L=3600*t+60*i+s;const n=e.slice(8),a=\"0\".repeat(6-n.length);E=_as_integer(n+a),e.startsWith(\"-\")&&(L=-L,E=-E)}}else if(\"Z\"===e){let e=j.Z.toLowerCase(),t=0;for(let i of _.timezone){if(i.includes(e)){const i=O.tzname.v;if(r(i[0],i[1],\"Eq\")&&a(O.daylight)&&![\"utc\",\"gmt\"].includes(e))break;z=t}t++}}})),p===t&&w!==t){if(A===t||H===t)throw new d(\"ISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A','%a', '%w', or '%u').\");if(Y!==t)throw new d(\"Day of the year directive '%j' is not compatible with ISO year directive '%G'.Use '%Y' instead.\")}else if(I===t&&A!==t)throw new d(H===t?\"ISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u').\":\"ISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.\");let U=!1;if(p===t&&2===g&&29===$?(p=1904,U=!0):p===t&&(p=1900),Y===t&&H!==t){if(I!==t){Y=function _calc_julian_from_U_or_W(e,t,i,s){let n=(new k(e,1,1).$toOrdinal()+6)%7;return s||(n=(n+1)%7,i=(i+1)%7),0===t?1+i-n:(7-n)%7+7*(t-1)+1+i}(p,I,H,0===M)}else w!==t&&A!==t&&([p,Y]=function _calc_julian_from_V(e,t,i){let s=7*t+i-((new k(e,1,4).$toOrdinal()%7||7)+3);return s<1&&(s+=new k(e,1,1).$toOrdinal(),s-=new k(e-=1,1,1).$toOrdinal()),[e,s]}(w,A,H+1));if(Y!==t&&Y<=0){p-=1;const e=function _is_leap(e){return e%4==0&&(e%100!=0||e%400==0)}(p)?366:365;Y+=e}}if(Y===t)Y=new k(p,g,$).$toOrdinal()-new k(p,1,1).$toOrdinal()+1;else{const t=function _fromordinal(t){return k.tp$getattr(l).tp$call([new e(t)])}(Y-1+new k(p,1,1).$toOrdinal());p=t.$year,g=t.$month,$=t.$day}H===t&&(H=(new k(p,g,$).$toOrdinal()+6)%7);const x=j.Z||t;return U&&(p=1900),[[p,g,$,y,S,b,H,Y,z,x,L],v,E]}return _(\"_strptime\",S,{_strptime_time:{$meth:function _strptime_time(t,i=\"%a %b %d %H:%M:%S %Y\"){let n=_strptime(t,i)[0].slice(0,11);return n=n.map(((t,i)=>i<9?new e(t):p(t))),O.struct_time.tp$call([new s(n)])},$flags:{NamedArgs:[\"data_string\",\"format\"],Defaults:[\"%a %b %d %H:%M:%S %Y\"]}},_strptime_datetime:{$meth:function _strptime_datetime(s,r,l=\"%a %b %d %H:%M:%S %Y\"){const[o,_,c]=_strptime(r,l),[m,d]=o.slice(-2),h=o.slice(0,6);let f,u;return h.push(_),h.map((t=>new e(t))),d!==t&&(f=new L(0,d,c),u=a(m)?new E(f,new i(m)):new E(f),h.push(u)),n(s,h)},$flags:{NamedArgs:[\"cls\",\"data_string\",\"format\"],Defaults:[\"%a %b %d %H:%M:%S %Y\"]}},_strptime:{$meth(i,n){const a=_strptime(i,n);return a[0]=new s(a[0].map((i=>i===t?i:new e(i)))),a[1]=new e(a[1]),a[2]=new e(a[2]),new s(a)},$flags:{NamedArgs:[\"data_string\",\"format\"],Defaults:[\"%a %b %d %H:%M:%S %Y\"]}},_getlang:{$meth:()=>p(_getlang()),$flags:{NoArgs:!0}}}),S.LocaleTime=c(\"_strptime.LocaleTime\",{constructor:function(){this.v=new LocaleTime},slots:{tp$getattr(e,t){return this.v.hasOwnProperty(e.toString())?p(this.v[e.toString()]):$.call(this,e,t)},tp$setattr(e,t){if(!this.v.hasOwnProperty(e.toString()))return y.call(this,e,t);this.v[e.toString()]=g(t)}}}),S}))}","src/lib/array.js":"function $builtinmodule(e){var n={},t=[\"c\",\"b\",\"B\",\"u\",\"h\",\"H\",\"i\",\"I\",\"l\",\"L\",\"f\",\"d\"];return n.__name__=new Sk.builtin.str(\"array\"),n.array=Sk.misceval.buildClass(n,(function(e,n){n.__init__=new Sk.builtin.func((function(e,n,i){if(Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,2,3),-1==t.indexOf(Sk.ffi.remapToJs(n)))throw new Sk.builtin.ValueError(\"bad typecode (must be c, b, B, u, h, H, i, I, l, L, f or d)\");if(i&&!Sk.builtin.checkIterable(i))throw new Sk.builtin.TypeError(\"iteration over non-sequence\");if(e.$d.mp$ass_subscript(new Sk.builtin.str(\"typecode\"),n),e.$d.mp$ass_subscript(new Sk.builtin.str(\"__module__\"),new Sk.builtin.str(\"array\")),e.typecode=n,void 0===i)e.internalIterable=new Sk.builtin.list;else if(i instanceof Sk.builtin.list)e.internalIterable=i;else{e.internalIterable=new Sk.builtin.list;for(let n=Sk.abstr.iter(i),t=n.tp$iternext();void 0!==t;t=n.tp$iternext())Sk.misceval.callsimArray(e.internalIterable.append,[e.internalIterable,t])}})),n.__repr__=new Sk.builtin.func((function(e){var n=Sk.ffi.remapToJs(e.typecode),t=\"\";return Sk.ffi.remapToJs(e.internalIterable).length&&(t=\"c\"==Sk.ffi.remapToJs(e.typecode)?\", '\"+Sk.ffi.remapToJs(e.internalIterable).join(\"\")+\"'\":\", \"+Sk.ffi.remapToJs(Sk.misceval.callsimArray(e.internalIterable.__repr__,[e.internalIterable]))),new Sk.builtin.str(\"array('\"+n+\"'\"+t+\")\")})),n.__str__=n.__repr__,n.__getattribute__=new Sk.builtin.func((function(e,n){return e.tp$getattr(n)})),n.append=new Sk.builtin.func((function(e,n){return Sk.misceval.callsimArray(e.internalIterable.append,[e.internalIterable,n]),Sk.builtin.none.none$})),n.extend=new Sk.builtin.func((function(e,n){if(Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,2,2),!Sk.builtin.checkIterable(n))throw new Sk.builtin.TypeError(\"iteration over non-sequence\");for(let t=Sk.abstr.iter(n),i=t.tp$iternext();void 0!==i;i=t.tp$iternext())Sk.misceval.callsimArray(e.internalIterable.append,[e.internalIterable,i])}))}),\"array\",[]),n}","src/lib/calendar.js":"function $builtinmodule(e){const t={},{misceval:{chain:n},importModule:r}=Sk,importOrSuspend=e=>r(e,!1,!0);return n(importOrSuspend(\"datetime\"),(e=>(t.datetime=e,importOrSuspend(\"itertools\"))),(e=>(t.iterRepeat=e.$d.repeat,t.iterChain=e.$d.chain,calendarModule(t))))}function calendarModule(e){const{abstr:{setUpModuleMethods:t,numberBinOp:n,iter:r,objectGetItem:o},builtin:{bool:s,bool:{true$:m,false$:d},func:l,int_:i,list:c,none:{none$:f},str:h,slice:w,tuple:y,range:u,max:_,min:g,property:k,print:p,enumerate:$,ValueError:b},ffi:{remapToPy:M},misceval:{isTrue:T,iterator:C,arrayFromIterable:O,buildClass:L,richCompareBool:x,asIndexOrThrow:F,objectRepr:I,callsimArray:A},global:v,global:{strftime:E}}=Sk,S=new i(0),H=new i(1),D=new i(2),N=new i(3),R=new i(6),j=new i(7),J=new i(9),P=new i(12),Y=new i(13),U=new i(24),z=new i(60),le=(e,t)=>x(e,t,\"LtE\"),eq=(e,t)=>x(e,t,\"Eq\"),mod=(e,t)=>n(e,t,\"Mod\"),add=(e,t)=>n(e,t,\"Add\"),sub=(e,t)=>n(e,t,\"Sub\"),mul=(e,t)=>n(e,t,\"Mult\"),inc=e=>add(e,H),dec=e=>sub(e,H),mod7=e=>mod(e,j),getA=(e,t)=>e.tp$getattr(new h(t)),callA=(e,t,...n)=>A(e.tp$getattr(new h(t)),n);function*iterJs(e){const t=r(e);let n;for(;n=t.tp$iternext();)yield n}function iterFn(e,t){return e=r(e),new C((()=>{const n=e.tp$iternext();return n&&t(n)}),!0)}function makePyMethod(e,t,{args:n,name:r,doc:o,defaults:s}){t.co_varnames=[\"self\",...n||[]],t.co_docstring=o?new h(o):f,s&&(t.$defaults=s),t.co_name=new h(r),t.co_qualname=new h(e+\".\"+r);const m=new l(t);return m.$module=Q.__name__,m}const{datetime:B,iterRepeat:W,iterChain:q}=e;let{MINYEAR:G,MAXYEAR:X,date:V}=B.$d;const K=getA(h,\"center\"),pyCenter=(e,t)=>A(K,[e,t]),pyRStrip=e=>new h(e.toString().trimRight());G=G.valueOf(),X=X.valueOf();const Q={__name__:new h(\"calendar\"),__all__:M([\"IllegalMonthError\",\"IllegalWeekdayError\",\"setfirstweekday\",\"firstweekday\",\"isleap\",\"leapdays\",\"weekday\",\"monthrange\",\"monthcalendar\",\"prmonth\",\"month\",\"prcal\",\"calendar\",\"timegm\",\"month_name\",\"month_abbr\",\"day_name\",\"day_abbr\",\"Calendar\",\"TextCalendar\",\"HTMLCalendar\",\"LocaleTextCalendar\",\"LocaleHTMLCalendar\",\"weekheader\"])};function makeErr(e,t){return L(Q,((e,n)=>{n.__init__=new l((function __init__(e,t){e.$attr=t})),n.__str__=new l((function __str__(e){return new h(t.replace(\"$\",I(e.$attr)))}))}),e,[b])}const Z=makeErr(\"IllegalMonthError\",\"bad month $; must be 1-12\"),ee=makeErr(\"IllegalWeekdayError\",\"bad weekday number $; must be 0 (Monday) to 6 (Sunday)\"),te=[0,31,28,31,30,31,30,31,31,30,31,30,31];function mkLocalizedCls(e,t){t.__init__=new l((function __init__(e,t){e.format=t})),t.__getitem__=new l((function __getitem__(t,n){const r=o(e,n);if(n instanceof w){const e=[];for(const n of r.valueOf())e.push(A(n,[t.format]));return new c(e)}return A(r,[t.format])}));const n=new i(e.valueOf().length);t.__len__=new l((function __len__(e){return n}))}const ae=new h(\"strftime\"),ne=L(Q,((e,t)=>{let n=[new l((e=>h.$empty))];for(let r=0;r<12;r++){const e=new V(2001,r+1,1);n.push(e.tp$getattr(ae))}n=new c(n),t._months=n,mkLocalizedCls(n,t)}),\"_localized_month\"),re=L(Q,((e,t)=>{let n=[];for(let r=0;r<7;r++){const e=new V(2001,1,r+1);n.push(e.tp$getattr(ae))}n=new c(n),t._days=n,mkLocalizedCls(n,t)}),\"_localized_day\"),oe=A(re,[new h(\"%A\")]),se=A(re,[new h(\"%a\")]),me=A(ne,[new h(\"%B\")]),de=A(ne,[new h(\"%b\")]),[ie,ce,fe,he,we,ye,ue]=[0,1,2,3,4,5,6];function isleap(e){return(e=F(e))%4==0&&(e%100!=0||e%400==0)}function weekday(e,t,n){e=F(e),G<=e&&e<=X||(e=2e3+e%400);const r=A(V,[new i(e),t,n]);return callA(V,\"weekday\",r)}function monthrange(e,t){if(!le(H,t)||!le(t,P))throw A(Z,[t]);const n=weekday(e,t,H);t=F(t);const r=te[t]+Number(2===t&&isleap(e));return[n,new i(r)]}function iterweekdays(e){return iterFn(A(u,[e.fwd,add(e.fwd,j)]),mod7)}function itermonthdates(e,t,n){return iterFn(itermonthdays3(e,t,n),(e=>A(V,e.valueOf())))}function itermonthdays(e,t,n){const[r,o]=monthrange(t,n),s=mod7(sub(r,e.fwd)),m=A(W,[S,s]),d=A(u,[H,inc(o)]),l=mod7(sub(e.fwd,add(r,o))),i=A(W,[S,l]);return A(q,[m,d,i])}function itermonthdays2(e,t,n){return iterFn(A($,[itermonthdays(e,t,n),e.fwd]),(e=>{const[t,n]=e.valueOf();return new y([n,mod7(t)])}))}function itermonthdays3(e,t,n){const ymdIter=(e,t,n)=>iterFn(n,(n=>new y([e,t,n]))),[r,o]=monthrange(t,n),s=mod7(sub(r,e.fwd)),m=mod7(sub(e.fwd,add(r,o))),[d,l]=function _prevmonth(e,t){return eq(t,H)?[dec(e),P]:[e,dec(t)]}(t,n),c=inc(function _monthlen(e,t){return t=F(t),new i(te[t]+Number(2===t&&isleap(e)))}(d,l)),f=A(u,[sub(c,s),c]),h=A(u,[H,inc(o)]),[w,_]=function _nextmonth(e,t){return eq(t,P)?[inc(e),H]:[e,inc(t)]}(t,n),g=A(u,[H,inc(m)]);return A(q,[ymdIter(d,l,f),ymdIter(t,n,h),ymdIter(w,_,g)])}function itermonthdays4(e,t,n){const r=itermonthdays3(e,t,n);let o=0;return iterFn(r,(t=>new y([...t.valueOf(),mod7(add(e.fwd,new i(o++)))])))}function _monthIter(e,t,n,r){const o=O(e(t,n,r)),s=[];for(let m=0;m{const n=makePyMethod.bind(null,\"Calendar\"),r=[\"firstweekday\"],o=[\"year\",\"month\"],s=[\"year\",\"width\"],m={__init__:n((function __init__(e,t){return Object.defineProperty(e,\"fwd\",{get(){return mod7(this._fwd)},set(e){return this._fwd=e,!0}}),e.fwd=t,f}),{name:\"__init__\",args:r,defaults:[S]}),getfirstweekday:n((function getfirstweekday(e){return e.fwd}),{name:\"getfirstweekday\"}),setfirstweekday:n((function setfirstweekday(e,t){return e.fwd=t,f}),{name:\"setfirstweekday\",args:r}),iterweekdays:n(iterweekdays,{name:\"iterweekdays\"}),itermonthdates:n(itermonthdates,{name:\"itermonthdates\",args:o}),itermonthdays:n(itermonthdays,{name:\"itermonthdays\",args:o}),itermonthdays2:n(itermonthdays2,{name:\"itermonthdays2\",args:o}),itermonthdays3:n(itermonthdays3,{name:\"itermonthdays3\",args:o}),itermonthdays4:n(itermonthdays4,{name:\"itermonthdays4\",args:o}),monthdatescalendar:n(monthdatescalendar,{name:\"monthdatescalendar\",args:o}),monthdays2calendar:n(monthdays2calendar,{name:\"monthdays2calendar\",args:o}),monthdayscalendar:n(monthdayscalendar,{name:\"monthdayscalendar\",args:o}),yeardatescalendar:n(yeardatescalendar,{name:\"yeardatescalendar\",args:s,defaults:[N]}),yeardays2calendar:n(yeardays2calendar,{name:\"yeardays2calendar\",args:s,defaults:[N]}),yeardayscalendar:n(yeardayscalendar,{name:\"yeardayscalendar\",args:s,defaults:[N]})};m.firstweekday=new k(m.getfirstweekday,m.setfirstweekday),Object.assign(t,m)}),\"Calendar\");function doTextFormatweekday(e,t,n){let r;return r=x(n,J,\"GtE\")?oe:se,pyCenter(o(o(r,t),new w(f,n)),n)}function doTextFormatmonthname(e,t,n,r,s=!0){let m=o(me,n);return T(s)&&(m=mod(new h(\"%s %r\"),new y([m,t]))),pyCenter(m,r)}const ge=L(Q,((e,t)=>{const txtPrint=e=>p([e],[\"end\",h.$empty]);const n=doTextFormatweekday;function formatweekheader(e,t){const n=[];for(const r of iterJs(iterweekdays(e)))n.push(callA(e,\"formatweekday\",r,t).toString());return new h(n.join(\" \"))}const r=doTextFormatmonthname;const o=makePyMethod.bind(null,\"TextCalendar\"),s={prweek:o((function prweek(e,t,n){txtPrint(callA(e,\"formatweek\",t,n))}),{name:\"prweek\",args:[\"theweek\",\"width\"]}),formatday:o((function formatday(e,t,n,r){let o;return o=eq(t,S)?h.$empty:mod(new h(\"%2i\"),t),pyCenter(o,r)}),{name:\"formatday\",args:[\"day\",\"weekday\",\"width\"]}),formatweek:o((function formatweek(e,t,n){const r=[];for(const o of iterJs(t)){const[t,s]=o.valueOf();r.push(callA(e,\"formatday\",t,s,n).toString())}return new h(r.join(\" \"))}),{name:\"formatweek\",args:[\"theweek\",\"width\"]}),formatweekday:o(n,{name:\"formatweekday\",args:[\"day\",\"width\"]}),formatweekheader:o(formatweekheader,{name:\"formatweekheader\",args:[\"width\"]}),formatmonthname:o(r,{name:\"formatmonthname\",args:[\"theyear\",\"themonth\",\"width\",\"withyear\"],defaults:[m]}),prmonth:o((function prmonth(e,t,n,r,o){txtPrint(callA(e,\"formatmonth\",t,n,r,o))}),{name:\"prmonth\",args:[\"theyear\",\"themonth\",\"w\",\"l\"],defaults:[S,S]}),formatmonth:o((function formatmonth(e,t,n,r,o){const addNewLines=e=>new h(e+\"\\n\".repeat(o.valueOf()));r=_([D,r]),o=_([H,o]);let s=callA(e,\"formatmonthname\",t,n,dec(mul(j,inc(r))),!0);s=pyRStrip(s),s=addNewLines(s),s=add(s,pyRStrip(callA(e,\"formatweekheader\",r))),s=addNewLines(s);for(const m of iterJs(monthdays2calendar(e,t,n)))s=add(s,pyRStrip(callA(e,\"formatweek\",m,r))),s=addNewLines(s);return s}),{name:\"formatmonth\",args:[\"thyear\",\"themonth\",\"w\",\"l\"],defaults:[S,S]}),formatyear:o((function formatyear(e,t,n,r,o,s){n=_([D,n]),r=_([H,r]),o=_([D,o]);const m=dec(mul(inc(n),j));let d=\"\";const a=e=>d+=e;a(pyRStrip(pyCenter(t.$r(),add(mul(m,s),mul(o,dec(s)))))),a(\"\\n\".repeat(r));const l=formatweekheader(e,n);let f=0;for(const w of iterJs(yeardays2calendar(e,t,s))){const d=new i(f),y=inc(mul(s,d)),_=g([inc(mul(s,inc(d))),Y]),k=A(u,[y,_]);a(\"\\n\".repeat(r));const p=iterFn(k,(n=>callA(e,\"formatmonthname\",t,n,m,!1)));a(pyRStrip(formatstring(p,m,o))),a(\"\\n\".repeat(r));const $=iterFn(k,(e=>l));a(pyRStrip(formatstring($,m,o))),a(\"\\n\".repeat(r));const b=Math.max(...w.valueOf().map((e=>e.valueOf().length)));for(let t=0;t=r.length?s.push(h.$empty):s.push(callA(e,\"formatweek\",r[t],n));a(pyRStrip(formatstring(new c(s),m,o))),a(\"\\n\".repeat(r))}f++}return new h(d)}),{name:\"formatyear\",args:[\"theyear\",\"w\",\"l\",\"c\",\"m\"],defaults:[D,H,R,N]}),pryear:o((function pryear(e,t,n,r,o,s){txtPrint(callA(e,\"formatyear\",t,n,r,o,s))}),{name:\"pryear\",args:[\"theyear\",\"w\",\"l\",\"c\",\"m\"],defaults:[S,S,R,N]})};Object.assign(t,s)}),\"TextCalendar\",[_e]);function doHtmlFormatweekday(e,t){return new h(`${o(se,t)}`)}function doHtmlFormatmonthname(e,t,n,r=!0){let s=\"\"+o(me,n);return T(r)&&(s+=\" \"+t),new h(`${s}`)}const ke=L(Q,((e,t)=>{const n=M([\"mon\",\"tue\",\"wed\",\"thu\",\"fri\",\"sat\",\"sun\"]),r=n,s=new h(\"noday\"),d=new h(\"month\"),l=d,c=new h(\"year\"),w=c,u=new h(' '),g=new h('%d');const k=doHtmlFormatweekday;function formatweekheader(e){let t=\"\";for(const n of iterJs(iterweekdays(e)))t+=callA(e,\"formatweekday\",n);return new h(`${t}`)}const p=doHtmlFormatmonthname;const $=makePyMethod.bind(null,\"HTMLCalendar\"),b={formatday:$((function formatday(e,t,n){return eq(t,S)?mod(u,getA(e,\"cssclass_noday\")):mod(g,new y([o(getA(e,\"cssclasses\"),n),t]))}),{name:\"formatday\",args:[\"day\",\"weekday\"]}),formatweek:$((function formatweek(e,t){let n=\"\";for(const r of iterJs(t)){const[t,o]=r.valueOf();n+=callA(e,\"formatday\",t,o)}return new h(`${n}`)}),{name:\"formatweek\",args:[\"theweek\"]}),formatweekday:$(k,{name:\"formatweekday\",args:[\"day\"]}),formatweekheader:$(formatweekheader,{name:\"formatweekheader\"}),formatmonthname:$(p,{name:\"formatmonthname\",args:[\"theyear\",\"themonth\",\"withyear\"],defaults:[m]}),formatmonth:$((function formatmonth(e,t,n,r=!0){let o=\"\";const a=e=>o+=e+\"\\n\";a(``),a(callA(e,\"formatmonthname\",t,n,r)),a(formatweekheader(e));for(const s of iterJs(monthdays2calendar(e,t,n)))a(callA(e,\"formatweek\",s));return a(\"
\"),new h(o)}),{name:\"formatmonth\",args:[\"thyear\",\"themonth\",\"withyear\"],defaults:[m]}),formatyear:$((function formatyear(e,t,n){let r=\"\";const a=e=>r+=e;n=_([n,H]).valueOf(),a(``),a(\"\\n\"),a(``);for(let o=1;o<13;o+=n){a(\"\");const r=Math.min(o+n,13);for(let n=o;n\"),a(callA(e,\"formatmonth\",t,new i(n),!1)),a(\"\");a(\"\")}return a(\"
${t}
\"),new h(r)}),{name:\"formatyear\",args:[\"theyear\",\"width\"],defaults:[N]}),formatyearpage:$((function formatyearpage(e,t,n=3,r=\"calendar.css\",o=null){null!==o&&o!==f||(o=new h(\"utf-8\"));let s=\"\";const a=e=>s+=e;return a(`\\n`),a('\\n'),a(\"\\n\"),a(\"\\n\"),a(`\\n`),r!==f&&a(`\\n`),a(`Calendar for ${t}\\n`),a(\"\\n\"),a(\"\\n\"),a(callA(e,\"formatyear\",t,n)),a(\"\\n\"),a(\"\\n\"),callA(h,\"encode\",new h(s),o,new h(\"ignore\"))}),{name:\"formatyearpage\",args:[\"theyear\",\"width\",\"css\",\"encoding\"],defaults:[N,new h(\"calendar.css\"),new h(\"utf-8\")]}),cssclasses:n,cssclasses_weekday_head:r,cssclass_noday:s,cssclass_month_head:d,cssclass_month:l,cssclass_year_head:c,cssclass_year:w};Object.assign(t,b)}),\"HTMLCalendar\",[_e]);function withLocale(e,t){const n=E.localizeByIdentifier(e.toString());v.strftime=n;try{return t()}finally{v.strftime=E}}function localInit(e,t){T(t)||(t=new h(\"en_US\")),e.locale=t}const pe=L(Q,((e,t)=>{const n=makePyMethod.bind(null,\"LocaleTextCalendar\"),r={__init__:n((function __init__(e,t,n){return callA(ge,\"__init__\",e,t),localInit(e,n),f}),{name:\"__init__\",args:[\"firstweekday\",\"locale\"],defaults:[S,f]}),formatweekday:n((function formatweekday(e,t,n){return withLocale(e.locale,(()=>doTextFormatweekday(0,t,n)))}),{name:\"formatweekday\",args:[\"day\",\"width\"]}),formatmonthname:n((function formatmonthname(e,t,n,r,o){return withLocale(e.locale,(()=>doTextFormatmonthname(0,t,n,r,o)))}),{name:\"formatmonthname\",args:[\"theyear\",\"themonth\",\"width\",\"withyear\"],defaults:[m]})};Object.assign(t,r)}),\"LocaleTextCalendar\",[ge]),$e=L(Q,((e,t)=>{const n=makePyMethod.bind(null,\"LocaleHTMLCalendar\"),r={__init__:n((function __init__(e,t,n){return callA(ke,\"__init__\",e,t),localInit(e,n),f}),{name:\"__init__\",args:[\"firstweekday\",\"locale\"],defaults:[S,f]}),formatweekday:n((function formatweekday(e,t){return withLocale(e.locale,(()=>doHtmlFormatweekday(e,t)))}),{name:\"formatweekday\",args:[\"day\"]}),formatmonthname:n((function formatmonthname(e,t,n,r){return withLocale(e.locale,(()=>doHtmlFormatmonthname(e,t,n,r)))}),{name:\"formatmonthname\",args:[\"theyear\",\"themonth\",\"withyear\"],defaults:[m]})};Object.assign(t,r)}),\"LocaleHTMLCalendar\",[ke]),be=A(ge,[]);Object.assign(Q,{IllegalMonthError:Z,IllegalWeekdayError:ee,day_name:oe,month_name:me,day_abbr:se,month_abbr:de,January:new i(1),February:new i(2),mdays:M(te),MONDAY:new i(ie),TUESDAY:new i(ce),WEDNESDAY:new i(fe),THURSDAY:new i(he),FRIDAY:new i(we),SATURDAY:new i(ye),SUNDAY:new i(ue),Calendar:_e,TextCalendar:ge,HTMLCalendar:ke,LocaleTextCalendar:pe,LocaleHTMLCalendar:$e,c:be,firstweekday:getA(be,\"getfirstweekday\"),monthcalendar:getA(be,\"monthdayscalendar\"),prweek:getA(be,\"prweek\"),week:getA(be,\"formatweek\"),weekheader:getA(be,\"formatweekheader\"),prmonth:getA(be,\"prmonth\"),month:getA(be,\"formatmonth\"),calendar:getA(be,\"formatyear\"),prcal:getA(be,\"pryear\")});const Me=new i(20),Te=R;function formatstring(e,t,n){t||(t=Me),n||(n=Te),n=mul(n,new h(\" \"));const r=[];for(const o of iterJs(e))r.push(pyCenter(o,t).toString());return new h(r.join(n.toString()))}const Ce=getA(V,\"toordinal\"),Oe=A(Ce,[new V(1970,1,1)]);return t(\"calendar\",Q,{isleap:{$meth:e=>s(isleap(e)),$flags:{NamedArgs:[\"year\"]},$doc:\"Return True for leap years, False for non-leap years\"},leapdays:{$meth(e,t){e=F(e)-1,t=F(t)-1;const n=Math.floor;return new i(n(t/4)-n(e/4)-(n(t/100)-n(e/100))+(n(t/400)-n(e/400)))},$flags:{MinArgs:2,MaxArgs:2}},weekday:{$meth:weekday,$flags:{NamedArgs:[\"year\",\"month\",\"day\"]},$doc:\"Return weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31).\"},monthrange:{$meth:(e,t)=>new y(monthrange(e,t)),$flags:{NamedArgs:[\"year\",\"month\"]},$doc:\"Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for year, month.\"},setfirstweekday:{$meth(e){const t=F(e);if(!(ie<=t&&t<=ue))throw A(ee,[e]);be.fwd=e},$flags:{NamedArgs:[\"firstweekday\"]}},format:{$meth:function format(e,t,n){return p([formatstring(e,t,n)]),f},$flags:{NamedArgs:[\"cols\",\"colwidth\",\"spacing\"],Defaults:[Me,Te]}},formatstring:{$meth:formatstring,$flags:{NamedArgs:[\"cols\",\"colwidth\",\"spacing\"],Defaults:[Me,Te]}},timegm:{$meth(e){const[t,n,r,o,s,m]=e.valueOf(),d=A(V,[t,n,H]),l=A(Ce,[d]),i=add(sub(l,Oe),dec(r)),c=add(mul(i,U),o),f=add(mul(c,z),s);return add(mul(f,z),m)},$flags:{OneArg:!0}}}),Q}","src/lib/collections.js":"function $builtinmodule(t){const e={};return Sk.misceval.chain(Sk.importModule(\"keyword\",!1,!0),(t=>(e._iskeyword=t.$d.iskeyword,Sk.importModule(\"itertools\",!1,!0))),(t=>(e._chain=t.$d.chain,e._starmap=t.$d.starmap,e._repeat=t.$d.repeat,Sk.importModule(\"operator\",!1,!0))),(t=>{e._itemgetter=t.$d.itemgetter}),(()=>collections_mod(e)))}function collections_mod(t){function counterNumberSlot(e){return function(i){if(void 0!==i&&!(i instanceof t.Counter))return Sk.builtin.NotImplemented.NotImplemented$;const s=new t.Counter;return e.call(this,s,i),s}}function counterInplaceSlot(t,e){return function(i){if(!(i instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError(\"Counter \"+t+\"= \"+Sk.abstr.typeName(i)+\" is not supported\");return e.call(this,i),this.keep$positive()}}t.__all__=new Sk.builtin.list([\"deque\",\"defaultdict\",\"namedtuple\",\"Counter\",\"OrderedDict\"].map((t=>new Sk.builtin.str(t)))),t.defaultdict=Sk.abstr.buildNativeClass(\"collections.defaultdict\",{constructor:function defaultdict(t,e){this.default_factory=t,Sk.builtin.dict.call(this,e)},base:Sk.builtin.dict,methods:{copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__missing__:{$meth(t){if(Sk.builtin.checkNone(this.default_factory))throw new Sk.builtin.KeyError(Sk.misceval.objectRepr(t));{const e=Sk.misceval.callsimArray(this.default_factory,[]);return this.mp$ass_subscript(t,e),e}},$flags:{OneArg:!0}}},getsets:{default_factory:{$get(){return this.default_factory},$set(t){t=t||Sk.builtin.none.none$,this.default_factory=t}}},slots:{tp$doc:\"defaultdict(default_factory[, ...]) --\\x3e dict with default factory\\n\\nThe default factory is called without arguments to produce\\na new value when a key is not present, in __getitem__ only.\\nA defaultdict compares equal to a dict with the same items.\\nAll remaining arguments are treated the same as if they were\\npassed to the dict constructor, including keyword arguments.\\n\",tp$init(t,e){const i=t.shift();if(void 0===i)this.default_factory=Sk.builtin.none.none$;else{if(!Sk.builtin.checkCallable(i)&&!Sk.builtin.checkNone(i))throw new Sk.builtin.TypeError(\"first argument must be callable\");this.default_factory=i}return Sk.builtin.dict.prototype.tp$init.call(this,t,e)},$r(){const t=Sk.misceval.objectRepr(this.default_factory),e=Sk.builtin.dict.prototype.$r.call(this).v;return new Sk.builtin.str(\"defaultdict(\"+t+\", \"+e+\")\")}},proto:{$copy(){const e=[];return Sk.misceval.iterFor(Sk.abstr.iter(this),(t=>{e.push(t),e.push(this.mp$subscript(t))})),new t.defaultdict(this.default_factory,e)}}}),t.Counter=Sk.abstr.buildNativeClass(\"Counter\",{constructor:function Counter(){this.$d=new Sk.builtin.dict,Sk.builtin.dict.apply(this)},base:Sk.builtin.dict,methods:{elements:{$flags:{NoArgs:!0},$meth(){const e=t._chain.tp$getattr(new Sk.builtin.str(\"from_iterable\")),i=t._starmap,s=t._repeat,n=Sk.misceval.callsimArray;return n(e,[n(i,[s,n(this.tp$getattr(this.str$items))])])}},most_common:{$flags:{NamedArgs:[\"n\"],Defaults:[Sk.builtin.none.none$]},$meth(t){const e=this.sq$length();t=Sk.builtin.checkNone(t)||(t=Sk.misceval.asIndexOrThrow(t))>e?e:t<0?0:t;const i=this.$items().sort(((t,e)=>Sk.misceval.richCompareBool(t[1],e[1],\"Lt\")?1:Sk.misceval.richCompareBool(t[1],e[1],\"Gt\")?-1:0));return new Sk.builtin.list(i.slice(0,t).map((t=>new Sk.builtin.tuple(t))))}},update:{$flags:{FastCall:!0},$meth(t,e){return Sk.abstr.checkArgsLen(\"update\",t,0,1),this.counter$update(t,e)}},subtract:{$flags:{FastCall:!0},$meth(t,e){Sk.abstr.checkArgsLen(\"subtract\",t,0,1);const i=t[0];if(void 0!==i)if(i instanceof Sk.builtin.dict)for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,i.mp$subscript(n),\"Sub\"))}else for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,this.$one,\"Sub\"))}e=e||[];for(let s=0;s>> c = Counter('abcdeabcdabcaba') # count elements from a string\\n\\n >>> c.most_common(3) # three most common elements\\n [('a', 5), ('b', 4), ('c', 3)]\\n >>> sorted(c) # list all unique elements\\n ['a', 'b', 'c', 'd', 'e']\\n >>> ''.join(sorted(c.elements())) # list elements with repetitions\\n 'aaaaabbbbcccdde'\\n >>> sum(c.values()) # total of all counts\\n 15\\n\\n >>> c['a'] # count of letter 'a'\\n 5\\n >>> for elem in 'shazam': # update counts from an iterable\\n ... c[elem] += 1 # by adding 1 to each element's count\\n >>> c['a'] # now there are seven 'a'\\n 7\\n >>> del c['b'] # remove all 'b'\\n >>> c['b'] # now there are zero 'b'\\n 0\\n\\n >>> d = Counter('simsalabim') # make another counter\\n >>> c.update(d) # add in the second counter\\n >>> c['a'] # now there are nine 'a'\\n 9\\n\\n >>> c.clear() # empty the counter\\n >>> c\\n Counter()\\n\\n Note: If a count is set to zero or reduced to zero, it will remain\\n in the counter until the entry is deleted or the counter is cleared:\\n\\n >>> c = Counter('aaabbc')\\n >>> c['b'] -= 2 # reduce the count of 'b' by two\\n >>> c.most_common() # 'b' is still in, but its count is zero\\n [('a', 3), ('c', 1), ('b', 0)]\\n\\n\",tp$init(t,e){return Sk.abstr.checkArgsLen(this.tpjs_name,t,0,1),this.counter$update(t,e)},$r(){const t=this.size>0?Sk.builtin.dict.prototype.$r.call(this).v:\"\";return new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+t+\")\")},tp$as_sequence_or_mapping:!0,mp$ass_subscript(t,e){return void 0===e?this.mp$lookup(t)&&Sk.builtin.dict.prototype.mp$ass_subscript.call(this,t,e):Sk.builtin.dict.prototype.mp$ass_subscript.call(this,t,e)},tp$as_number:!0,nb$positive:counterNumberSlot((function(t){this.$items().forEach((([e,i])=>{Sk.misceval.richCompareBool(i,this.$zero,\"Gt\")&&t.mp$ass_subscript(e,i)}))})),nb$negative:counterNumberSlot((function(t){this.$items().forEach((([e,i])=>{Sk.misceval.richCompareBool(i,this.$zero,\"Lt\")&&t.mp$ass_subscript(e,Sk.abstr.numberBinOp(this.$zero,i,\"Sub\"))}))})),nb$subtract:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=Sk.abstr.numberBinOp(s,e.mp$subscript(i),\"Sub\");Sk.misceval.richCompareBool(n,this.$zero,\"Gt\")&&t.mp$ass_subscript(i,n)})),e.$items().forEach((([e,i])=>{void 0===this.mp$lookup(e)&&Sk.misceval.richCompareBool(i,this.$zero,\"Lt\")&&t.mp$ass_subscript(e,Sk.abstr.numberBinOp(this.$zero,i,\"Sub\"))}))})),nb$add:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=Sk.abstr.numberBinOp(s,e.mp$subscript(i),\"Add\");Sk.misceval.richCompareBool(n,this.$zero,\"Gt\")&&t.mp$ass_subscript(i,n)})),e.$items().forEach((([e,i])=>{void 0===this.mp$lookup(e)&&Sk.misceval.richCompareBool(i,this.$zero,\"Gt\")&&t.mp$ass_subscript(e,i)}))})),nb$inplace_add:counterInplaceSlot(\"+\",(function(t){t.$items().forEach((([t,e])=>{const i=Sk.abstr.numberInplaceBinOp(this.mp$subscript(t),e,\"Add\");this.mp$ass_subscript(t,i)}))})),nb$inplace_subtract:counterInplaceSlot(\"-\",(function(t){t.$items().forEach((([t,e])=>{const i=Sk.abstr.numberInplaceBinOp(this.mp$subscript(t),e,\"Sub\");this.mp$ass_subscript(t,i)}))})),nb$or:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=e.mp$subscript(i),r=Sk.misceval.richCompareBool(s,n,\"Lt\")?n:s;Sk.misceval.richCompareBool(r,this.$zero,\"Gt\")&&t.mp$ass_subscript(i,r)})),e.$items().forEach((([e,i])=>{void 0===this.mp$lookup(e)&&Sk.misceval.richCompareBool(i,this.$zero,\"Gt\")&&t.mp$ass_subscript(e,i)}))})),nb$and:counterNumberSlot((function(t,e){this.$items().forEach((([i,s])=>{const n=e.mp$subscript(i),r=Sk.misceval.richCompareBool(s,n,\"Lt\")?s:n;Sk.misceval.richCompareBool(r,this.$zero,\"Gt\")&&t.mp$ass_subscript(i,r)}))})),nb$inplace_and:counterInplaceSlot(\"&\",(function(t){this.$items().forEach((([e,i])=>{const s=t.mp$subscript(e);Sk.misceval.richCompareBool(s,i,\"Lt\")&&this.mp$ass_subscript(e,s)}))})),nb$inplace_or:counterInplaceSlot(\"|\",(function(t){t.$items().forEach((([t,e])=>{Sk.misceval.richCompareBool(e,this.mp$subscript(t),\"Gt\")&&this.mp$ass_subscript(t,e)}))})),nb$reflected_and:null,nb$reflected_or:null,nb$reflected_add:null,nb$reflected_subtract:null},proto:{keep$positive(){return this.$items().forEach((([t,e])=>{Sk.misceval.richCompareBool(e,this.$zero,\"LtE\")&&this.mp$ass_subscript(t)})),this},$zero:new Sk.builtin.int_(0),$one:new Sk.builtin.int_(1),str$items:new Sk.builtin.str(\"items\"),counter$update(t,e){const i=t[0];if(void 0!==i)if(Sk.builtin.checkMapping(i))if(this.sq$length())for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,i.mp$subscript(n),\"Add\"))}else this.update$common(t,void 0,\"update\");else for(let s=Sk.abstr.iter(i),n=s.tp$iternext();void 0!==n;n=s.tp$iternext()){const t=this.mp$subscript(n);this.mp$ass_subscript(n,Sk.abstr.numberBinOp(t,this.$one,\"Add\"))}if(e&&e.length)if(this.sq$length())for(let s=0;s`(${Sk.misceval.objectRepr(t)}, ${Sk.misceval.objectRepr(e)})`));return t=0===t.length?\"\":\"[\"+t.join(\", \")+\"]\",this.in$repr=!1,new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+t+\")\")},tp$richcompare(e,i){if(\"Eq\"!==i&&\"Ne\"!==i)return Sk.builtin.NotImplemented.NotImplemented$;if(!(e instanceof t.OrderedDict))return Sk.builtin.dict.prototype.tp$richcompare.call(this,e,i);const s=\"Eq\"==i,n=this.size;if(n!==e.size)return!s;const r=e.$items(),a=this.$items();for(let t=0;t=r||l>=a)switch(i){case\"Lt\":return ra;case\"GtE\":return r>=a}return\"Eq\"!==i&&(\"NotEq\"===i||Sk.misceval.richCompareBool(n[this.head+l&this.mask],e[s.head+l&s.mask],i))},tp$iter(){return new e(this)},$r(){const t=[],e=this.tail-this.head&this.mask;if(this.$entered_repr)return new Sk.builtin.str(\"[...]\");this.$entered_repr=!0;for(let s=0;s=e||t<-e)throw new Sk.builtin.IndexError(\"deque index out of range\");const i=(t>=0?this.head:this.tail)+t&this.mask;return this.v[i]},mp$ass_subscript(t,e){t=Sk.misceval.asIndexOrThrow(t);const i=this.tail-this.head&this.mask;if(t>=i||t<-i)throw new Sk.builtin.IndexError(\"deque index out of range\");void 0===e?this.del$item(t):this.set$item(t,e)},nb$inplace_add(t){this.maxlen=void 0;for(let e=Sk.abstr.iter(t),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())this.$push(i);return this},nb$inplace_multiply(t){(t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError,\"can't multiply sequence by non-int of type '{tp$name}'\"))<=0&&this.$clear();const e=this.$copy(),i=this.tail-this.head&this.mask;for(let s=1;s integer -- return number of occurrences of value\"},extend:{$meth(t){return this.$extend(t),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:\"Extend the right side of the deque with elements from the iterable\"},extendleft:{$meth(t){for(let e=Sk.abstr.iter(t),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())this.$pushLeft(i);return Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:\"Extend the left side of the deque with elements from the iterable\"},index:{$meth(t,e,i){const s=this.$index(t,e,i);if(void 0!==s)return new Sk.builtin.int_(s);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(t)+\" is not in deque\")},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:\"D.index(value, [start, [stop]]) -> integer -- return first index of value.\\nRaises ValueError if the value is not present.\"},insert:{$meth(t,e){t=Sk.misceval.asIndexOrThrow(t,\"integer argument expected, got {tp$name}\");const i=this.tail-this.head&this.mask;if(void 0!==this.maxlen&&i>=this.maxlen)throw new Sk.builtin.IndexError(\"deque already at its maximum size\");t>i&&(t=i),t<=-i&&(t=0);const s=(t>=0?this.head:this.tail)+t&this.mask;let n=this.tail;for(this.tail=this.tail+1&this.mask;n!==s;){const t=n-1&this.mask;this.v[n]=this.v[t],n=t}return this.v[s]=e,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1),Sk.builtin.none.none$},$flags:{MinArgs:2,MaxArgs:2},$textsig:null,$doc:\"D.insert(index, object) -- insert object before index\"},pop:{$meth(){return this.$pop()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Remove and return the rightmost element.\"},popleft:{$meth(){return this.$popLeft()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Remove and return the leftmost element.\"},remove:{$meth(t){const e=this.$index(t);if(void 0===e)throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(t)+\" is not in deque\");let i=this.head+e&this.mask;for(;i!==this.tail;){const t=i+1&this.mask;this.v[i]=this.v[t],i=t}this.tail=this.tail-1&this.mask;var s=this.tail-this.head&this.mask;s>>1&&this.$resize(s,this.v.length>>>1)},$flags:{OneArg:!0},$textsig:null,$doc:\"D.remove(value) -- remove first occurrence of value.\"},__reversed__:{$meth(){return new i(this)},$flags:{NoArgs:!0},$textsig:null,$doc:\"D.__reversed__() -- return a reverse iterator over the deque\"},reverse:{$meth(){const t=this.head,e=this.tail,i=this.mask,s=this.tail-this.head&this.mask;for(let n=0;n<~~(s/2);n++){const s=e-n-1&i,r=t+n&i,a=this.v[s];this.v[s]=this.v[r],this.v[r]=a}return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:\"D.reverse() -- reverse *IN PLACE*\"},rotate:{$meth(t){t=void 0===t?1:Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError);const e=this.head,i=this.tail;if(0===t||e===i)return this;if(this.head=e-t&this.mask,this.tail=i-t&this.mask,t>0)for(let s=1;s<=t;s++){const t=e-s&this.mask,n=i-s&this.mask;this.v[t]=this.v[n],this.v[n]=void 0}else for(let s=0;s>t;s--){const t=i-s&this.mask,n=e-s&this.mask;this.v[t]=this.v[n],this.v[n]=void 0}return Sk.builtin.none.none$},$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:\"Rotate the deque n steps to the right (default n=1). If n is negative, rotates left.\"}},classmethods:Sk.generic.classGetItem,getsets:{maxlen:{$get(){return void 0===this.maxlen?Sk.builtin.none.none$:new Sk.builtin.int_(this.maxlen)},$doc:\"maximum size of a deque or None if unbounded\"}},proto:{$clear(){this.head=0,this.tail=0,this.mask=1,this.v=new Array(2)},$copy(){return new t.deque(this.v.slice(0),this.maxlen,this.head,this.tail,this.mask)},$extend(t){for(let e=Sk.abstr.iter(t),i=e.tp$iternext();void 0!==i;i=e.tp$iternext())this.$push(i)},set$item(t,e){const i=(t>=0?this.head:this.tail)+t&this.mask;this.v[i]=e},del$item(t){let e=(t>=0?this.head:this.tail)+t&this.mask;for(;e!==this.tail;){const t=e+1&this.mask;this.v[e]=this.v[t],e=t}const i=this.tail-this.head&this.mask;this.tail=this.tail-1&this.mask,i>>1&&this.$resize(i,this.v.length>>>1)},$push(t){this.v[this.tail]=t,this.tail=this.tail+1&this.mask,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);const e=this.tail-this.head&this.mask;return void 0!==this.maxlen&&e>this.maxlen&&this.$popLeft(),this},$pushLeft(t){this.head=this.head-1&this.mask,this.v[this.head]=t,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);const e=this.tail-this.head&this.mask;return void 0!==this.maxlen&&e>this.maxlen&&this.$pop(),this},$pop(){if(this.head===this.tail)throw new Sk.builtin.IndexError(\"pop from an empty deque\");this.tail=this.tail-1&this.mask;const t=this.v[this.tail];this.v[this.tail]=void 0;const e=this.tail-this.head&this.mask;return e>>1&&this.$resize(e,this.v.length>>>1),t},$popLeft(){if(this.head===this.tail)throw new Sk.builtin.IndexError(\"pop from an empty deque\");const t=this.v[this.head];this.v[this.head]=void 0,this.head=this.head+1&this.mask;const e=this.tail-this.head&this.mask;return e>>1&&this.$resize(e,this.v.length>>>1),t},$resize(t,e){const i=this.head,s=this.mask;if(this.head=0,this.tail=t,this.mask=e-1,0===i)return void(this.v.length=e);const n=new Array(e);for(let r=0;r=0?i:i<-s?0:s+i;for(let o=e>=0?e:e<-s?0:s+e;o=this.$length)return;const t=(this.$index>=0?this.$head:this.$tail)+this.$index&this.$mask;return this.$index++,this.dq[t]},methods:{__length_hint__:{$meth:function __length_hint__(){return new Sk.builtin.int_(this.$length-this.$index)},$flags:{NoArgs:!0}}}}),i=Sk.abstr.buildIteratorClass(\"_collections._deque_reverse_iterator\",{constructor:function _deque_reverse_iterator(t){this.$index=(t.tail-t.head&t.mask)-1,this.dq=t.v,this.$head=t.head,this.$mask=t.mask},iternext(){if(this.$index<0)return;const t=this.$head+this.$index&this.$mask;return this.$index--,this.dq[t]},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef}}),s=new RegExp(/^[0-9].*/),n=new RegExp(/^[0-9_].*/),r=new RegExp(/^\\w*$/),a=/,/g,o=/\\s+/;function namedtuple(e,i,l,h,c){if(e=e.tp$str(),Sk.misceval.isTrue(Sk.misceval.callsimArray(t._iskeyword,[e])))throw new Sk.builtin.ValueError(\"Type names and field names cannot be a keyword: '\"+Sk.misceval.objectRepr(e)+\"'\");const u=e.$jsstr();if(s.test(u)||!r.test(u)||!u)throw new Sk.builtin.ValueError(\"Type names and field names must be valid identifiers: '\"+u+\"'\");let m,d;if(Sk.builtin.checkString(i))m=i.$jsstr().replace(a,\" \").split(o),1==m.length&&\"\"===m[0]&&(m=[]),d=m.map((t=>new Sk.builtin.str(t)));else{m=[],d=[];for(let t=Sk.abstr.iter(i),e=t.tp$iternext();void 0!==e;e=t.tp$iternext())e=e.tp$str(),d.push(e),m.push(e.$jsstr())}let p=new Set;if(Sk.misceval.isTrue(l))for(let s=0;sm.length)throw new Sk.builtin.TypeError(\"Got more default values than field names\");for(let t=0,e=d.length-b.length;e\"'\"+t.$jsstr()+\"'\"))+\"]\")}return r}_make.co_varnames=[\"_cls\",\"iterable\"],_asdict.co_varnames=[\"self\"],_replace.co_kwargs=1,_replace.co_varnames=[\"_self\"];const S={};for(let s=0;sm[e]+\"=\"+Sk.misceval.objectRepr(t)));return new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+t.join(\", \")+\")\")}},flags:{sk$klass:!0},proto:Object.assign({__module__:Sk.builtin.checkNone(c)?Sk.globals.__name__:c,__slots__:new Sk.builtin.tuple,_fields:$,_field_defaults:f,_make:new Sk.builtin.classmethod(new Sk.builtin.func(_make)),_asdict:new Sk.builtin.func(_asdict),_replace:new Sk.builtin.func(_replace)},S)})}return namedtuple.co_argcount=2,namedtuple.co_kwonlyargcount=3,namedtuple.$kwdefs=[Sk.builtin.bool.false$,Sk.builtin.none.none$,Sk.builtin.none.none$],namedtuple.co_varnames=[\"typename\",\"field_names\",\"rename\",\"defaults\",\"module\"],t.namedtuple=new Sk.builtin.func(namedtuple),t}","src/lib/datetime.js":"function $builtinmodule(){const{isTrue:t,richCompareBool:e,asIndexOrThrow:n,asIndexSized:i,objectRepr:s,opAllowsEquality:o,callsimArray:r,callsimOrSuspendArray:a}=Sk.misceval,{numberBinOp:$,typeName:c,buildNativeClass:h,checkArgsLen:m,objectHash:u,copyKeywordsToNamedArgs:l}=Sk.abstr,{int_:f,float_:d,str:w,bytes:_,tuple:p,bool:{true$:g},none:{none$:y},NotImplemented:{NotImplemented$:b},TypeError:z,ValueError:v,OverflowError:M,ZeroDivisionError:A,NotImplementedError:x,checkNumber:N,checkFloat:S,checkString:k,checkInt:O,asnum$:I,round:E,getattr:T}=Sk.builtin,{remapToPy:D,remapToJs:R}=Sk.ffi,intRound=t=>E(t).nb$int(),q=$,C=new w(\"auto\"),U=new w(\"utcoffset\"),Y=new w(\"tzname\"),j=new w(\"as_integer_ratio\"),F=new w(\"dst\"),H=new w(\"isoformat\"),J=new w(\"replace\"),B=new w(\"fromtimestamp\"),G=new w(\"fromordinal\"),L=new w(\"utcfromtimestamp\"),X=new w(\"strftime\"),P=new w(\"fromutc\"),W=new f(0),Z=new d(0),K=new f(7),V=new f(60),Q=new f(3600),tt=new f(1e3),et=new f(1e6),nt=new d(1e6),it=new f(86400),st=new d(86400);let ot=null;function pyDivMod(t,e){return q(t,e,\"DivMod\").v}function $divMod(t,e){if(\"number\"!=typeof t||\"number\"!=typeof e)return t=JSBI.BigInt(t),e=JSBI.BigInt(e),[JSBI.toNumber(JSBI.divide(t,e)),JSBI.toNumber(JSBI.remainder(t,e))];if(0===e)throw new A(\"integer division or modulo by zero\");return[Math.floor(t/e),t-Math.floor(t/e)*e]}function modf(t){const e=(t=I(t))<0?-1:1;return t=Math.abs(t),[new d(e*(t-Math.floor(t))),new d(e*Math.floor(t))]}function _d(t,e=\"0\",n=2){return t.toString().padStart(n,e)}const rt=/^[0-9]+$/;function _as_integer(t){if(!rt.test(t))throw new Error;return parseInt(t)}function _as_int_ratio(t){let e=r(t.tp$getattr(j));if(!(e instanceof p))throw new z(\"unexpected return type from as_integer_ratio(): expected tuple, got '\"+c(e)+\"'\");if(e=e.v,2!==e.length)throw new v(\"as_integer_ratio() must return a 2-tuple\");return e}return Sk.misceval.chain(Sk.importModule(\"time\",!1,!0),(a=>{const $=a.$d,E={__name__:new w(\"datetime\"),__all__:new Sk.builtin.list([\"date\",\"datetime\",\"time\",\"timedelta\",\"timezone\",\"tzinfo\",\"MINYEAR\",\"MAXYEAR\"].map((t=>new w(t))))};function _cmp(t,e){for(let n=0;ne[n]?1:-1;return 0}function _do_compare(t,e,n){const i=t.$cmp(e,n);switch(n){case\"Lt\":return i<0;case\"LtE\":return i<=0;case\"Eq\":return 0===i;case\"NotEq\":return 0!==i;case\"Gt\":return i>0;case\"GtE\":return i>=0}}const j=9999;E.MINYEAR=new f(1),E.MAXYEAR=new f(j);const rt=3652059,at=[-1,31,28,31,30,31,30,31,31,30,31,30,31],$t=[-1];let ct=0;function _is_leap(t){return t%4==0&&(t%100!=0||t%400==0)}function _days_before_year(t){const e=t-1;return 365*e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400)}function _days_before_month(t,e){return $t[e]+(e>2&&_is_leap(t))}function _ymd2ord(t,e,n){return _days_before_year(t)+_days_before_month(t,e)+n}at.slice(1).forEach((t=>{$t.push(ct),ct+=t}));const ht=_days_before_year(401),mt=_days_before_year(101),ut=_days_before_year(5);function _ord2ymd(t){if((t=n(t))>Number.MAX_SAFE_INTEGER)throw new M(\"Python int too large to convert to js number\");if(t<1)throw new v(\"ordinal must be >= 1\");let e,i,s,o;t-=1,[e,t]=$divMod(t,ht);let r=400*e+1;if([i,t]=$divMod(t,mt),[s,t]=$divMod(t,ut),[o,t]=$divMod(t,365),r+=100*i+4*s+o,4===o||4===i)return[r-1,12,31].map((t=>new f(t)));const a=3===o&&(24!==s||3===i);let $=t+50>>5,c=$t[$]+($>2&&a);return c>t&&($-=1,c-=at[$]+(2===$&&a)),[r,$,(t-=c)+1].map((t=>new f(t)))}const lt=[null,\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],ft=[null,\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\"];function _build_struct_time(t,e,n,i,s,o,r){const a=(_ymd2ord(t,e,n)+6)%7,c=_days_before_month(t,e)+n;return $.struct_time.tp$call([new p([t,e,n,i,s,o,a,c,r].map((t=>new f(t))))])}const dt={hours:t=>_d(t),minutes:(t,e)=>_d(t)+\":\"+_d(e),seconds:(t,e,n)=>_d(t)+\":\"+_d(e)+\":\"+_d(n),milliseconds:(t,e,n,i)=>_d(t)+\":\"+_d(e)+\":\"+_d(n)+\".\"+_d(i,\"0\",3),microseconds:(t,e,n,i)=>_d(t)+\":\"+_d(e)+\":\"+_d(n)+\".\"+_d(i,\"0\",6)};function _format_time(t,e,n,i,s=\"auto\"){if(\"string\"!=typeof s&&!k(s))throw new z(\"must be str, not \"+c(s));\"auto\"===(s=s.toString())?s=i?\"microseconds\":\"seconds\":\"milliseconds\"===s&&(i=Math.floor(i/1e3));let o=dt[s];if(void 0===o)throw new v(\"Unknown timespec value\");return o(t,e,n,i)}function _format_offset(t){let e,n=\"\";if(t!==y){let i,s,o;return t.$days<0?(e=\"-\",t=new wt(-t.$days,-t.$secs,-t.$micro)):e=\"+\",[i,s]=pyDivMod(t,pt),[s,o]=pyDivMod(s,gt),n+=e+`${_d(i)}:${_d(s)}`,(o.$secs||o.$micro)&&(n+=\":\"+_d(o.$secs,\"0\",2),o.$micro&&(n+=\".\"+_d(o.$micro,\"0\",6))),n}}function _wrap_strftime(t,e,n){let i=null,s=null,o=null,a=[],c=0;const h=e.length;for(;cnew f(t)))}function _parse_hh_mm_ss_ff(t){const e=t.length,n=[0,0,0,0];let i=0;for(let s=0;s<3;s++){if(e-i<2)throw new v(\"Incomplete time component\");n[s]=_as_integer(t.slice(i,i+2)),i+=2;const o=t.substr(i,1);if(!o||s>=2)break;if(\":\"!==o)throw new v(\"Invalid time separator: \"+o);i+=1}if(i0?t.slice(0,e-1):t),s=y;if(e>0){if(n=t.slice(e),![5,8,15].includes(n.length))throw new v(\"Malformed time zone string\");const i=_parse_hh_mm_ss_ff(n);if(i.every((t=>0===t)))s=St.prototype.utc;else{const n=\"-\"===t[e-1]?-1:1,o=new wt(0,n*(3600*i[0]+60*i[1]+i[2]),n*i[3]);s=new St(o)}}return i=i.map((t=>new f(t))),i.push(s),i}function _check_tzname(t){if(t!==y&&!k(t))throw new z(\"tzinfo.tzname() must return None or string, not '\"+c(t)+\"'\")}function _check_utc_offset(t,n){if(n!==y){if(!(n instanceof wt))throw new z(`tzinfo.${t}() must return None or timedelta, not '${c(n)}'`);if(!e(zt,n,\"Lt\")||!e(n,_t,\"Lt\"))throw new v(`${t}()=${n.toString()}, must be strictly between -timedelta(hours=24) and timedelta(hours=24)`)}}function _check_date_fields(t,e=null,i=null){if(null===e||null===i){throw new z(`function missing required argument '${null===i?\"day\":\"month\"}' (pos ${null===i?\"3\":\"2\"})`)}if(t=n(t),e=n(e),i=n(i),!(1<=t&&t<=j))throw new v(\"year must be in 1..9999\",new f(t));if(!(1<=e&&e<=12))throw new v(\"month must be in 1..12\",new f(e));const s=function _days_in_month(t,e){return 2===e&&_is_leap(t)?29:at[e]}(t,e);if(!(1<=i&&i<=s))throw new v(\"day must be in 1..\"+s,new f(i));return[t,e,i]}function _check_time_fields(t,e,i,s,o){if(t=n(t),e=n(e),i=n(i),s=n(s),o=n(o),!(0<=t&&t<=23))throw new v(\"hour must be in 0..23\",new f(t));if(!(0<=e&&e<=59))throw new v(\"minute must be in 0..59\",new f(e));if(!(0<=i&&i<=59))throw new v(\"second must be in 0..59\",new f(i));if(!(0<=s&&s<=999999))throw new v(\"microsecond must be in 0..999999\",new f(s));if(0!==o&&1!==o)throw new v(\"fold must be either 0 or 1\",new f(o));return[t,e,i,s,o]}function _check_tzinfo_arg(t){if(t!==y&&!(t instanceof Mt))throw new z(\"tzinfo argument must be None or of a tzinfo subclass\")}function _divide_and_round(t,e){let[n,i]=$divMod(t,e);return i*=2,((e>0?i>e:i999999999)throw new M(`days=${t}; must have magnitude <= 999999999`)},slots:{tp$new(t,e){let i,s,o,r,a,$,c,[h,m,u,d,w,_,p]=l(\"timedelta\",[\"days\",\"seconds\",\"microseconds\",\"milliseconds\",\"minutes\",\"hours\",\"weeks\"],t,e,new Array(7).fill(W));i=s=o=W,h=q(h,q(p,K,\"Mult\"),\"Add\"),m=q(m,q(q(w,V,\"Mult\"),q(_,Q,\"Mult\"),\"Add\"),\"Add\"),u=q(u,q(d,tt,\"Mult\"),\"Add\"),S(h)?([r,h]=modf(h),[a,$]=modf(q(r,st,\"Mult\")),s=new f($),i=new f(h)):(a=Z,i=h),S(m)?([c,m]=modf(m),m=new f(m),c=q(c,a,\"Add\")):c=a,[h,m]=pyDivMod(m,it),i=q(i,h,\"Add\"),s=q(s,new f(m),\"Add\");const g=q(c,nt,\"Mult\");if(S(u)?(u=intRound(q(u,g,\"Add\")),[m,u]=pyDivMod(u,et),[h,m]=pyDivMod(m,it),i=q(i,h,\"Add\"),s=q(s,m,\"Add\")):(u=new f(u),[m,u]=pyDivMod(u,et),[h,m]=pyDivMod(m,it),i=q(i,h,\"Add\"),s=q(s,m,\"Add\"),u=intRound(q(u,g,\"Add\"))),[m,o]=pyDivMod(u,et),s=q(s,m,\"Add\"),[h,s]=pyDivMod(s,it),i=q(i,h,\"Add\"),i=n(i),s=n(s),o=n(o),Math.abs(i)>999999999)throw new M(\"timedelta # of days is too large: \"+h.toString());if(this===wt.prototype)return new wt(i,s,o);{const t=new this.constructor;return wt.call(t,i,s,o),t}},$r(){const t=[];return this.$days&&t.push(`days=${this.$days}`),this.$secs&&t.push(`seconds=${this.$secs}`),this.$micro&&t.push(`microseconds=${this.$micro}`),t.length||t.push(\"0\"),new w(`${this.tp$name}(${t.join(\", \")})`)},tp$str(){const t=this.$secs%60;let e=Math.floor(this.$secs/60);const n=Math.floor(e/60);e%=60;let i=`${n}:${_d(e)}:${_d(t)}`;if(this.$days){i=`${this.$days} day${function plural(t){return 1!==Math.abs(t)?\"s\":\"\"}(this.$days)}, `+i}return this.$micro&&(i+=`.${_d(this.$micro,\"0\",6)}`),new w(i)},tp$as_number:!0,nb$add(t){return t instanceof wt?new wt(this.$days+t.$days,this.$secs+t.$secs,this.$micro+t.$micro):b},nb$subtract(t){return t instanceof wt?new wt(this.$days-t.$days,this.$secs-t.$secs,this.$micro-t.$micro):b},nb$positive(){return this},nb$negative(){return new wt(-this.$days,-this.$secs,-this.$micro)},nb$abs(){return this.$days<0?this.nb$negative():this},nb$multiply(t){if(O(t))return t=i(t,M),new wt(this.$days*t,this.$secs*t,this.$micro*t);if(S(t)){const e=this.$toMicrosecs();let[s,o]=_as_int_ratio(t);return s=i(s,M),o=n(o),new wt(0,0,_divide_and_round(e*s,o))}return b},nb$floor_divide(t){const e=this.$toMicrosecs();if(t instanceof wt){const n=t.$toMicrosecs();if(0===n)throw new A(\"integer division or modulo by zero\");return new f(Math.floor(e/n))}if(O(t)){if(0===(t=i(t,M)))throw new A(\"integer division or modulo by zero\");return new wt(0,0,Math.floor(e/t))}return b},nb$divide(t){const e=this.$toMicrosecs();if(t instanceof wt){if(0===t.$toMicrosecs())throw new A(\"integer division or modulo by zero\");return new d(e/t.$toMicrosecs())}if(O(t))return t=n(t),new wt(0,0,_divide_and_round(e,t));if(S(t)){let[s,o]=_as_int_ratio(t);return s=n(s),o=i(o,M),new wt(0,0,_divide_and_round(o*e,s))}return b},nb$remainder(t){if(!(t instanceof wt))return b;const e=this.$toMicrosecs(),n=t.$toMicrosecs();if(0===n)throw new A(\"integer division or modulo by zero\");const i=e-Math.floor(e/n)*n;return new wt(0,0,i)},nb$divmod(t){if(!(t instanceof wt))return b;const e=this.$toMicrosecs(),n=t.$toMicrosecs(),[i,s]=$divMod(e,n);return new p([new f(i),new wt(0,0,s)])},tp$richcompare(t,e){return t instanceof wt?_do_compare(this,t,e):b},tp$hash(){return-1===this.$hashcode&&(this.$hashcode=u(new p(this.$getState().map((t=>new f(t)))))),this.$hashcode},nb$bool(){return 0!==this.$days||0!==this.$secs||0!==this.$micro}},methods:{total_seconds:{$meth(){return new d(((86400*this.$days+this.$secs)*10**6+this.$micro)/10**6)},$flags:{NoArgs:!0},$doc:\"Total seconds in the duration.\"},__reduce__:{$meth(){return new p([this.ob$type,new p(this.$getState().map((t=>D(t))))])},$flags:{NoArgs:!0},$textsig:null,$doc:\"__reduce__() -> (cls, state)\"}},getsets:{days:{$get(){return new f(this.$days)},$doc:\"Number of days.\"},seconds:{$get(){return new f(this.$secs)},$doc:\"Number of seconds (>= 0 and less than 1 day).\"},microseconds:{$get(){return new f(this.$micro)},$doc:\"Number of microseconds (>= 0 and less than 1 second).\"}},proto:{$toMicrosecs(){return 1e6*(86400*this.$days+this.$secs)+this.$micro},$cmp(t){return _cmp(this.$getState(),t.$getState())},$getState(){return[this.$days,this.$secs,this.$micro]}}});wt.prototype.min=new wt(-999999999),wt.prototype.max=new wt(999999999,86399,999999),wt.prototype.resolution=new wt(0,0,1);const _t=new wt(1),pt=new wt(0,3600),gt=new wt(0,60),yt=new wt(0,1),bt=new wt(0),zt=new wt(-1),vt=E.date=h(\"datetime.date\",{constructor:function date(t,e,n){this.$year=t,this.$month=e,this.$day=n,this.$hashcode=-1},slots:{tp$new(t,e){let n,[i,s,o]=l(\"date\",[\"year\",\"month\",\"day\"],t,e,[null,null]);if(null===s&&i instanceof _&&4===(n=i.valueOf()).length&&1<=n[2]&&n[2]<=12){const t=new this.constructor;return t.$setState(n),t}if([i,s,o]=_check_date_fields(i,s,o),this===vt.prototype)return new vt(i,s,o);{const t=new this.constructor;return vt.call(t,i,s,o),t}},$r(){return new w(`${this.tp$name}(${this.$year}, ${this.$month}, ${this.$day})`)},tp$str(){return this.tp$getattr(H).tp$call([])},tp$richcompare(t,e){return t instanceof vt?_do_compare(this,t,e):b},tp$hash(){return-1===this.$hashcode&&(this.$hashcode=u(this.$getState())),this.$hashcode},tp$as_number:!0,nb$add(t){if(t instanceof wt){const e=this.$toOrdinal()+t.$days;if(0 local date from a POSIX timestamp (like time.time()).\"},fromordinal:{$meth:function fromordinal(t){return this.tp$call(_ord2ymd(t))},$flags:{OneArg:!0},$textsig:null,$doc:\"int -> date corresponding to a proleptic Gregorian ordinal.\"},fromisocalendar:{$meth:function fromisocalendar(t,e,i){if(t=n(t),e=n(e),i=n(i),!(1<=t&&t<=j))throw new v(`Year is out of range: ${t}`);let s,o;if(!(0 date corresponding to a proleptic Gregorian ordinal.\"},fromisoformat:{$meth:function fromisoformat(t){if(!k(t))throw new z(\"fromisoformat: argument must be str\");t=t.toString();try{if(10!==t.length)throw new Error;return this.tp$call(_parse_isoformat_date(t))}catch(e){throw new v(\"Invalid isoformat string: '\"+t+\"'\")}},$flags:{OneArg:!0},$textsig:null,$doc:\"str -> Construct a date from the output of date.isoformat()\"},today:{$meth:function today(){const t=$.time.tp$call([]);return this.tp$getattr(B).tp$call([t])},$flags:{NoArgs:!0},$textsig:null,$doc:\"Current date or datetime: same as self.__class__.fromtimestamp(time.time()).\"}},methods:{ctime:{$meth:function ctime(){const t=this.$toOrdinal()%7||7,e=ft[t],n=lt[this.$month];return new w(`${e} ${n} ${_d(this.$day,\" \",2)} 00:00:00 ${_d(this.$year,\"0\",4)}`)},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return ctime() style string.\"},strftime:{$meth:function strftime(t){if(!k(t))throw new z(\"must be str, not \"+c(t));return _wrap_strftime(this,t=t.toString(),this.$timetuple())},$flags:{OneArg:!0},$textsig:null,$doc:\"format -> strftime() style string.\"},__format__:{$meth:function __format__(t){if(!k(t))throw new z(\"must be str, not \"+c(t));return t!==w.$empty?this.tp$getattr(X).tp$call([t]):this.tp$str()},$flags:{OneArg:!0},$textsig:null,$doc:\"Formats self with strftime.\"},timetuple:{$meth:function timetuple(){return this.$timetuple()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return time tuple, compatible with time.localtime().\"},isocalendar:{$meth:function isocalendar(){let t=this.$year,e=_isoweek1monday(t);const n=_ymd2ord(this.$year,this.$month,this.$day);let[i,s]=$divMod(n-e,7);return i<0?(t-=1,e=_isoweek1monday(t),[i,s]=$divMod(n-e,7)):i>=52&&n>=_isoweek1monday(t+1)&&(t+=1,i=0),new At(new f(t),new f(i+1),new f(s+1))},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return a 3-tuple containing ISO year, week number, and weekday.\"},isoformat:{$meth:function isoformat(){return this.$isoformat()},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return string in ISO 8601 format, YYYY-MM-DD.\"},isoweekday:{$meth:function isoweekday(){return new f(this.$toOrdinal()%7||7)},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return the day of the week represented by the date.\\nMonday == 1 ... Sunday == 7\"},toordinal:{$meth:function toordinal(){return new f(this.$toOrdinal())},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.\"},weekday:{$meth:function weekday(){return new f((this.$toOrdinal()+6)%7)},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return the day of the week represented by the date.\\nMonday == 0 ... Sunday == 6\"},replace:{$meth:function replace(t,e,n){return t===y&&(t=new f(this.$year)),e===y&&(e=new f(this.$month)),n===y&&(n=new f(this.$day)),this.ob$type.tp$call([t,e,n])},$flags:{NamedArgs:[\"year\",\"month\",\"day\"],Defaults:[y,y,y]},$textsig:null,$doc:\"Return date with new specified fields.\"},__reduce__:{$meth(){return new p([this.ob$type,new p([this.$getState()])])},$flags:{NoArgs:!0},$textsig:null,$doc:\"__reduce__() -> (cls, state)\"}},getsets:{year:{$get(){return new f(this.$year)},$doc:\"year (1-9999)\"},month:{$get(){return new f(this.$month)},$doc:\"month (1-12)\"},day:{$get(){return new f(this.$day)},$doc:\"day (1-31)\"}},proto:{$cmp(t){return _cmp([this.$year,this.$month,this.$day],[t.$year,t.$month,t.$day])},$getState(){const[t,e]=$divMod(this.$year,256);return new _([t,e,this.$month,this.$day])},$setState(t){const[e,n,i,s]=t,o=256*e+n;this.$year=o,this.$month=i,this.$day=s},$toOrdinal(){return _ymd2ord(this.$year,this.$month,this.$day)},$isoformat(){return new w(`${_d(this.$year,\"0\",4)}-${_d(this.$month,\"0\",2)}-${_d(this.$day,\"0\",2)}`)},$timetuple(){return _build_struct_time(this.$year,this.$month,this.$day,this.$hour||0,this.$min||0,this.$sec||0,-1)},$strftime(t=\"\"){return _wrap_strftime(this,t.toString(),this.$timetuple())}}});vt.prototype.min=new vt(1,1,1),vt.prototype.max=new vt(9999,12,31),vt.prototype.resolution=new wt(1);const Mt=E.tzinfo=h(\"datetime.tzinfo\",{constructor:function tzinfo(){},methods:{tzname:{$meth:function tzname(t){throw new x(\"tzinfo subclass must override tzname()\")},$flags:{OneArg:!0},$textsig:null,$doc:\"datetime -> string name of time zone.\"},utcoffset:{$meth:function utcoffset(t){throw new x(\"tzinfo subclass must override utcoffset()\")},$flags:{OneArg:!0},$textsig:null,$doc:\"datetime -> timedelta showing offset from UTC, negative values indicating West of UTC\"},dst:{$meth:function dst(t){throw new x(\"tzinfo subclass must override dst()\")},$flags:{OneArg:!0},$textsig:null,$doc:\"datetime -> DST offset as timedelta positive east of UTC.\"},fromutc:{$meth:function fromutc(e){if(!(e instanceof Nt))throw new z(\"fromutc() requires a datetime argument\");if(e.$tzinfo!==this)throw new v(\"dt.tzinfo is not self\");const n=r(e.tp$getattr(U));if(n===y)throw new v(\"fromutc() requires a non-None utcoffset() result\");let i=r(e.tp$getattr(F));if(i===y)throw new v(\"fromutc() requires a non-None dst() result\");const s=q(n,i,\"Sub\");if(t(s)&&(e=q(e,s,\"Add\"),i=r(e.tp$getattr(F)),i===y))throw new v(\"fromutc(): dt.dst gave inconsistent results; cannot convert\");return q(e,i,\"Add\")},$flags:{OneArg:!0},$textsig:null,$doc:\"datetime in UTC -> datetime in local time.\"},__reduce__:{$meth(){let e,n;const i=T(this,new w(\"__getinitargs__\"),y);e=i!==y?r(i,[]):new p;const s=T(this,new w(\"__getstate__\"),y);return s!==y?n=r(s,[]):(n=T(this,new w(\"__dict__\"),y),n=t(n)?n:y),new p(n===y?[this.ob$type,e]:[this.ob$type,e,n])},$flags:{NoArgs:!0},$textsig:null,$doc:\"-> (cls, state)\"}}}),At=h(\"datetime.IsoCalendarDate\",{base:p,constructor:function IsoCalendarDate(t,e,n){this.y=t,this.w=e,this.wd=n,p.call(this,[t,e,n])},slots:{tp$new(t,e){const[n,i,s]=l(\"IsoCalendarDate\",[\"year\",\"week\",\"weekday\"],t,e);return new this.constructor(n,i,s)},$r(){return new w(`${this.tp$name}(year=${this.y}, week=${this.w}, weekday=${this.wd})`)}},getsets:{year:{$get(){return this.y}},week:{$get(){return this.w}},weekday:{$get(){return this.wd}}}}),xt=E.time=h(\"datetime.time\",{constructor:function time(t=0,e=0,n=0,i=0,s=null,o=0){this.$hour=t,this.$min=e,this.$sec=n,this.$micro=i,this.$tzinfo=s||y,this.$fold=o,this.$hashcode=-1},slots:{tp$new(t,e){m(\"time\",t,0,5);let n,[i,s,o,r,a,$]=l(\"time\",[\"hour\",\"minute\",\"second\",\"microsecond\",\"tzinfo\",\"fold\"],t,e,[W,W,W,W,y,W]);if(i instanceof _&&6===(n=i.valueOf()).length&&(127&n[0])<24){const t=new this.constructor;return t.$setState(n,s===W?y:s),t}if([i,s,o,r,$]=_check_time_fields(i,s,o,r,$),_check_tzinfo_arg(a),this===xt.prototype)return new xt(i,s,o,r,a,$);{const t=new this.constructor;return xt.call(t,i,s,o,r,a,$),t}},tp$richcompare(t,e){return t instanceof xt?_do_compare(this,t,e):b},tp$hash(){if(-1===this.$hashcode){const e=this.$fold?r(this.tp$getattr(J),[],[\"fold\",W]):this,n=r(e.tp$getattr(U));if(t(n)){let[t,e]=pyDivMod(new wt(0,3600*this.$hour+60*this.$min).nb$subtract(n),pt);e=e.nb$floor_divide(gt),0<=t&&t<=24?(t=I(t),e=I(e),this.$hashcode=u(new xt(t,e,this.$sec,this.$micro))):this.$hashcode=u(new p([t,e,new f(this.$sec),new f(this.$micro)]))}else this.$hashcode=u(e.$getState()[0])}return this.$hashcode},$r(){let t;return t=0!==this.$micro?`, ${this.$sec}, ${this.$micro}`:0!==this.$sec?`, ${this.$sec}`:\"\",t=`${this.tp$name}(${this.$hour}, ${this.$min}${t})`,this.$tzinfo!==y&&(t=t.slice(0,-1)+\", tzinfo=\"+s(this.$tzinfo)+\")\"),this.$fold&&(t=t.slice(0,-1)+\", fold=1)\"),new w(t)},tp$str(){return this.tp$getattr(H).tp$call([])}},methods:{isoformat:{$meth:function isoformat(t){let e=_format_time(this.$hour,this.$min,this.$sec,this.$micro,t);const n=this.$tzstr();return n&&(e+=n),new w(e)},$flags:{NamedArgs:[\"timespec\"],Defaults:[C]},$textsig:null,$doc:\"Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\\n\\ntimespec specifies what components of the time to include.\\n\"},strftime:{$meth:function strftime(t){if(!k(t))throw new z(\"must be str, not \"+c(t));return _wrap_strftime(this,t=t.toString(),new p([1900,1,1,this.$hour,this.$min,this.$sec,0,1,-1].map((t=>new f(t)))))},$flags:{OneArg:!0},$textsig:null,$doc:\"format -> strftime() style string.\"},__format__:{$meth:function __format__(t){if(!k(t))throw new z(\"must be str, not \"+c(t));return t!==w.$empty?this.tp$getattr(X).tp$call([t]):this.tp$str()},$flags:{OneArg:!0},$textsig:null,$doc:\"Formats self with strftime.\"},utcoffset:{$meth:function utcoffset(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(U),e=r(t,[y]);return _check_utc_offset(\"utcoffset\",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return self.tzinfo.utcoffset(self).\"},tzname:{$meth:function tzname(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(Y),e=r(t,[y]);return _check_tzname(e),e},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return self.tzinfo.tzname(self).\"},dst:{$meth:function dst(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(F),e=r(t,[y]);return _check_utc_offset(\"dst\",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return self.tzinfo.dst(self).\"},replace:{$meth:function replace(t,e){m(\"replace\",t,0,5);let[n,i,s,o,r,a]=l(\"replace\",[\"hour\",\"minute\",\"second\",\"microsecond\",\"tzinfo\",\"fold\"],t,e,[y,y,y,y,g,y]);return n===y&&(n=new f(this.$hour)),i===y&&(i=new f(this.$min)),s===y&&(s=new f(this.$sec)),o===y&&(o=new f(this.$micro)),r===g&&(r=this.$tzinfo),a===y&&(a=new f(this.$fold)),this.ob$type.tp$call([n,i,s,o,r],[\"fold\",a])},$flags:{FastCall:!0},$textsig:null,$doc:\"Return time with new specified fields.\"},__reduce_ex__:{$meth(t){return new p([this.ob$type,new p(this.$getState(R(t)))])},$flags:{OneArg:!0},$textsig:null,$doc:\"__reduce_ex__(proto) -> (cls, state)\"},__reduce__:{$meth(){return this.tp$getattr(new w(\"__reduce_ex__\")).tp$call([new f(2)])},$flags:{NoArgs:!0},$textsig:null,$doc:\"__reduce__() -> (cls, state)\"}},classmethods:{fromisoformat:{$meth:function fromisoformat(t){if(!k(t))throw new z(\"fromisoformat: argument must be str\");t=t.toString();try{return this.tp$call(_parse_isoformat_time(t))}catch{throw new v(\"Invalid isofrmat string: '\"+t+\"'\")}},$flags:{OneArg:!0},$textsig:null,$doc:\"string -> time from time.isoformat() output\"}},getsets:{hour:{$get(){return new f(this.$hour)}},minute:{$get(){return new f(this.$min)}},second:{$get(){return new f(this.$sec)}},microsecond:{$get(){return new f(this.$micro)}},tzinfo:{$get(){return this.$tzinfo}},fold:{$get(){return new f(this.$fold)}}},proto:{$cmp(t,n){const s=this.$tzinfo,o=t.$tzinfo;let a,$,c;if(a=$=y,s===o?c=!0:(a=r(this.tp$getattr(U)),$=r(t.tp$getattr(U)),c=e(a,$,\"Eq\")),c)return _cmp([this.$hour,this.$min,this.$sec,this.$micro],[t.$hour,t.$min,t.$sec,t.$micro]);if(a===y||$===y){if(\"Eq\"===n||\"NotEq\"===n)return 2;throw new z(\"cannot compare naive and aware times\")}const h=60*this.$hour+this.$min-i(a.nb$floor_divide(gt)),m=60*t.$hour+t.$min-i($.nb$floor_divide(gt));return _cmp([h,this.$sec,this.$micro],[m,t.$sec,t.$micro])},$tzstr(){return _format_offset(r(this.tp$getattr(U)))},$getState(t=3){let[e,n]=$divMod(this.$micro,256),[i,s]=$divMod(e,256),o=this.$hour;this.$fold&&t>3&&(o+=128);const r=new _([o,this.$min,this.$sec,i,s,n]);return this.$tzinfo===y?[r]:[r,this.$tzinfo]},$setState(t,e){const[n,i,s,o,r,a]=t;n>127?(this.$fold=1,this.$hour=n-128):(this.$fold=0,this.$hour=n),this.$min=i,this.$sec=s,this.$micro=(o<<8|r)<<8|a,this.$tzinfo=e}}});xt.prototype.min=new xt(0,0,0),xt.prototype.max=new xt(23,59,59,999999),xt.prototype.resolution=new wt;const Nt=E.datetime=h(\"datetime.datetime\",{base:vt,constructor:function datetime(t,e,n,i=0,s=0,o=0,r=0,a=null,$=0){this.$year=t,this.$month=e,this.$day=n,this.$hour=i,this.$min=s,this.$sec=o,this.$micro=r,this.$tzinfo=a||y,this.$fold=$,this.$hashcode=-1},slots:{tp$new(t,e){m(\"datetime\",t,0,9);let n,[i,s,o,r,a,$,c,h,u]=l(\"time\",[\"year\",\"month\",\"day\",\"hour\",\"minute\",\"second\",\"microsecond\",\"tzinfo\",\"fold\"],t,e,[null,null,W,W,W,W,y,W]);if(i instanceof _&&10===(n=i.valueOf()).length&&(127&n[2])<=12){const t=new this.constructor;return t.$setState(n,null===s?y:s),t}if([i,s,o]=_check_date_fields(i,s,o),[r,a,$,c,u]=_check_time_fields(r,a,$,c,u),_check_tzinfo_arg(h),this===Nt.prototype)return new Nt(i,s,o,r,a,$,c,h,u);{const t=new this.constructor;return Nt.call(t,i,s,o,r,a,$,c,h,u),t}},$r(){const t=[this.$year,this.$month,this.$day,this.$hour,this.$min,this.$sec,this.$micro];0===t[t.length-1]&&t.pop(),0===t[t.length-1]&&t.pop();let e=`${this.tp$name}(${t.join(\", \")})`;return this.$tzinfo!==y&&(e=e.slice(0,-1)+\", tzinfo=\"+s(this.$tzinfo)+\")\"),this.$fold&&(e=e.slice(0,-1)+\", fold=1)\"),new w(e)},tp$str(){return this.tp$getattr(H).tp$call([],[\"sep\",new w(\" \")])},tp$richcompare(t,e){if(t instanceof Nt)return _do_compare(this,t,e);if(!(t instanceof vt))return b;if(\"Eq\"===e||\"NotEq\"===e)return\"NotEq\"===e;throw new z(`can't compare '${c(this)}' to '${c(t)}'`)},tp$as_number:!0,nb$add(t){if(!(t instanceof wt))return b;let e=new wt(this.$toOrdinal(),3600*this.$hour+60*this.$min+this.$sec,this.$micro);e=q(e,t,\"Add\");let[n,i]=$divMod(e.$secs,3600),[s,o]=$divMod(i,60);if(0 string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\\nsep is used to separate the year from the time, and defaults to 'T'.\\ntimespec specifies what components of the time to include (allowed values are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds', and 'microseconds').\\n\"},utcoffset:{$meth:function utcoffset(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(U),e=r(t,[this]);return _check_utc_offset(\"utcoffset\",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return self.tzinfo.utcoffset(self).\"},tzname:{$meth:function tzname(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(Y),e=r(t,[this]);return _check_tzname(e),e},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return self.tzinfo.tzname(self).\"},dst:{$meth:function dst(){if(this.$tzinfo===y)return y;const t=this.$tzinfo.tp$getattr(F),e=r(t,[this]);return _check_utc_offset(\"dst\",e),e},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return self.tzinfo.dst(self).\"},replace:{$meth:function replace(t,e){m(\"replace\",t,0,8);let[n,i,s,o,r,a,$,c,h]=l(\"replace\",[\"year\",\"month\",\"day\",\"hour\",\"minute\",\"second\",\"microsecond\",\"tzinfo\",\"fold\"],t,e,[y,y,y,y,y,y,y,g,y]);return n===y&&(n=new f(this.$year)),i===y&&(i=new f(this.$month)),s===y&&(s=new f(this.$day)),o===y&&(o=new f(this.$hour)),r===y&&(r=new f(this.$min)),a===y&&(a=new f(this.$sec)),$===y&&($=new f(this.$micro)),c===g&&(c=this.$tzinfo),h===y&&(h=new f(this.$fold)),this.ob$type.tp$call([n,i,s,o,r,a,$,c],[\"fold\",h])},$flags:{FastCall:!0},$textsig:null,$doc:\"Return datetime with new specified fields.\"},astimezone:{$meth:function astimezone(t){if(t===y)t=this.$localTimezone();else if(!(t instanceof Mt))throw new z(\"tz argument must be an instance of tzinfo\");let e,n=this.$tzinfo;if(n===y?(n=this.$localTimezone(),e=r(n.tp$getattr(U),[this])):(e=r(n.tp$getattr(U),[this]),e===y&&(n=r(this.tp$getattr(J),[],[\"tzinfo\",y]).$localTimezone(),e=r(n.tp$getattr(U),[this]))),t===n)return this;const i=r(this.nb$subtract(e).tp$getattr(J),[],[\"tzinfo\",t]);return t.tp$getattr(P).tp$call([i])},$flags:{NamedArgs:[\"tz\"],Defaults:[y]},$textsig:null,$doc:\"tz -> convert to local time in new timezone tz\\n\"},__reduce_ex__:{$meth(t){return new p([this.ob$type,new p(this.$getState(R(t)))])},$flags:{OneArg:!0},$textsig:null,$doc:\"__reduce_ex__(proto) -> (cls, state)\"},__reduce__:{$meth(){return this.tp$getattr(new w(\"__reduce_ex__\")).tp$call([new f(2)])},$flags:{NoArgs:!0},$textsig:null,$doc:\"__reduce__() -> (cls, state)\"}},classmethods:{now:{$meth:function now(t){const e=$.time.tp$call([]);return this.tp$getattr(B).tp$call([e,t])},$flags:{NamedArgs:[\"tz\"],Defaults:[y]},$textsig:\"($type, /, tz=None)\",$doc:\"Returns new datetime object representing current time local to tz.\\n\\n tz\\n Timezone object.\\n\\nIf no tz is specified, uses local timezone.\"},utcnow:{$meth:function utcnow(){const t=$.time.tp$call([]);return this.tp$getattr(L).tp$call([t])},$flags:{NoArgs:!0},$textsig:null,$doc:\"Return a new datetime representing UTC day and time.\"},fromtimestamp:{$meth:function fromtimestamp(t,e){return _check_tzinfo_arg(e),this.prototype.$fromtimestamp.call(this,t,e!==y,e)},$flags:{NamedArgs:[\"timestamp\",\"tz\"],Defaults:[y]},$textsig:null,$doc:\"timestamp[, tz] -> tz's local time from POSIX timestamp.\"},utcfromtimestamp:{$meth:function utcfromtimestamp(t){return this.prototype.$fromtimestamp.call(this,t,!0,y)},$flags:{OneArg:!0},$textsig:null,$doc:\"Construct a naive UTC datetime from a POSIX timestamp.\"},strptime:{$meth:function strptime(t,e){return null===ot?Sk.misceval.chain(Sk.importModule(\"_strptime\",!1,!0),(n=>(ot=n.tp$getattr(new w(\"_strptime_datetime\")),ot.tp$call([this,t,e])))):ot.tp$call([this,t,e])},$flags:{MinArgs:2,MaxArgs:2},$textsig:null,$doc:\"string, format -> new datetime parsed from a string (like time.strptime()).\"},combine:{$meth:function combine(t,e,n){if(!(t instanceof vt))throw new z(\"date argument must be a date instance\");if(!(e instanceof xt))throw new z(\"time argument must be a time instance\");n===g&&(n=e.$tzinfo);const i=[t.$year,t.$month,t.$day,e.$hour,e.$min,e.$sec,e.$micro].map((t=>new f(t)));return i.push(n),this.tp$call(i,[\"fold\",new f(e.$fold)])},$flags:{NamedArgs:[\"date\",\"time\",\"tzinfo\"],Defaults:[g]},$textsig:null,$doc:\"date, time -> datetime with same date and time fields\"},fromisoformat:{$meth:function fromisoformat(t){if(!k(t))throw new z(\"fromisoformat: argument must be str\");const e=(t=t.toString()).slice(0,10),n=t.slice(11);let i,s;try{i=_parse_isoformat_date(e)}catch(o){throw new v(\"Invalid isoformat string: '\"+t+\"'\")}if(n)try{s=_parse_isoformat_time(n)}catch(o){throw new v(\"Invalid isoformat string: '\"+t+\"'\")}else s=[W,W,W,W,y];return this.tp$call(i.concat(s))},$flags:{OneArg:!0},$textsig:null,$doc:\"string -> datetime from datetime.isoformat() output\"}},getsets:{hour:{$get(){return new f(this.$hour)}},minute:{$get(){return new f(this.$min)}},second:{$get(){return new f(this.$sec)}},microsecond:{$get(){return new f(this.$micro)}},tzinfo:{$get(){return this.$tzinfo}},fold:{$get(){return new f(this.$fold)}}},proto:{$cmp(n,i){const s=this.$tzinfo,o=n.$tzinfo;let a,$,c;if(a=$=y,s===o)c=!0;else{if(a=r(this.tp$getattr(U)),$=r(n.tp$getattr(U)),\"Eq\"===i||\"NotEq\"===i){const t=r(this.tp$getattr(J),[],[\"fold\",new f(Number(!this.$fold))]);if(e(a,r(t.tp$getattr(U)),\"NotEq\"))return 2;const i=r(n.tp$getattr(J),[],[\"fold\",new f(Number(!n.$fold))]);if(e($,r(i.tp$getattr(U)),\"NotEq\"))return 2}c=e(a,$,\"Eq\")}if(c)return _cmp([this.$year,this.$month,this.$day,this.$hour,this.$min,this.$sec,this.$micro],[n.$year,n.$month,n.$day,n.$hour,n.$min,n.$sec,n.$micro]);if(a===y||$===y){if(\"Eq\"===i||\"NotEq\"===i)return 2;throw new z(\"cannot compare naive and aware datetimes\")}const h=this.nb$subtract(n);return h.$days<0?-1:t(h)?1:0},$mkTime(){const t=new Nt(1970,1,1),e=this.nb$subtract(t).nb$floor_divide(yt);function local(e){const[n,i,s,o,r,a]=$.localtime.tp$call([e]).v;return Nt.tp$call([n,i,s,o,r,a]).nb$subtract(t).nb$floor_divide(yt)}let n,i,s=local(e).nb$subtract(e),o=e.nb$subtract(s),r=local(o);if(r.ob$eq(e)){if(n=o.nb$add([new f(-86400),new f(86400)][this.$fold]),i=local(n).nb$subtract(n),s.ob$eq(i))return o}else i=r.nb$subtract(o);n=e.nb$subtract(i);if(local(n).ob$eq(e))return n;if(r.ob$eq(e))return o;const a=o.ob$ge(n)?o:n;return[a,o===a?n:o][this.$fold]},$fromtimestamp(t,n,s){let o;if(!N(t))throw new z(\"a number is required, (got '\"+c(t)+\"'\");[o,t]=modf(t);let a=intRound(q(o,nt,\"Mult\"));a=a.v,t=t.v,a>=1e6?(t+=1,a-=1e6):a<0&&(t-=1,a+=1e6),t=new f(t),Number.isInteger(a)||(a=Math.trunc(a)),a=new f(a);const h=n?$.gmtime:$.localtime;function converter(t){return h.tp$call([t]).v}let[m,u,l,d,_,p]=converter(t);p=new f(Math.min(i(p),59));let g=r(this,[m,u,l,d,_,p,a,s]);if(s===y){const n=86400;[m,u,l,d,_,p]=converter(q(t,new f(n),\"Sub\"));const i=r(this,[m,u,l,d,_,p,a,s]),o=q(q(g,i,\"Sub\"),new wt(0,n),\"Sub\");if(o.$days<0){[m,u,l,d,_,p]=converter(q(t,q(o,yt,\"FloorDiv\"),\"Add\"));const n=r(this,[m,u,l,d,_,p,a,s]);e(n,g,\"Eq\")&&(g.$fold=1)}}else g=r(s.tp$getattr(new w(\"fromutc\")),[g]);return g},$localTimezone(){let t;t=this.$tzinfo===y?this.$mkTime():this.nb$subtract(kt).nb$floor_divide(yt);const e=$.localtime.tp$call([t]),n=(Nt.tp$call(e.v.slice(0,6)),e.tp$getattr(new w(\"tm_gmtoff\"))),i=e.tp$getattr(new w(\"tm_zone\"));return new St(wt.tp$call([W,n]),i)},$getState(t=3){let[e,n]=$divMod(this.$year,256),[i,s]=$divMod(this.$micro,256),[o,r]=$divMod(i,256),a=this.$month;this.$fold&&t>3&&(a+=128);const $=new _([e,n,a,this.$day,this.$hour,this.$min,this.$sec,o,r,s]);return this.$tzinfo===y?[$]:[$,this.$tzinfo]},$setState(t,e){const[n,i,s,o,r,a,$,c,h,m]=t;s>127?(this.$fold=1,this.$month=s-128):(this.$fold=0,this.$month=s),this.$year=256*n+i,this.$day=o,this.$hour=r,this.$min=a,this.$sec=$,this.$micro=(c<<8|h)<<8|m,this.$tzinfo=e}}});function _isoweek1monday(t){const e=_ymd2ord(t,1,1),n=(e+6)%7;let i=e-n;return n>3&&(i+=7),i}Nt.prototype.min=new Nt(1,1,1),Nt.prototype.max=new Nt(9999,12,31,23,59,59,999999),Nt.prototype.resolution=new wt(0,0,1);const St=E.timezone=h(\"datetime.timezone\",{base:Mt,constructor:function timezone(t,n){if(this.$offset=t,this.$name=n||y,!e(this.$minoffset,t,\"LtE\")||!e(this.$maxoffset,t,\"GtE\"))throw new v(\"offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).\")},slots:{tp$new(e,n){let[i,s]=l(\"timezone\",[\"offset\",\"name\"],e,n,[null]);if(!(i instanceof wt))throw new z(\"offset must be a timedelta\");if(null===s){if(!t(i))return this.utc;s=y}else if(!k(s))throw new z(\"name must be a string\");if(this===St.prototype)return new St(i,s);{const t=new this.constructor;return St.call(t,i,s),t}},tp$richcompare(t,n){if(!(t instanceof St))return b;const i=e(this.$offset,t.$offset,\"Eq\");return\"NotEq\"===n?!i:\"Eq\"===n||i&&o(n)?i:b},$r(){return this===this.utc?new w(\"datetime.timezone.utc\"):this.$name===y?new w(`${this.tp$name}(${s(this.$offset)})`):new w(`${this.tp$name}(${s(this.$offset)}, ${s(this.$name)})`)},tp$str(){return this.tp$getattr(Y).tp$call([y])},tp$hash(){return u(this.$offset)}},methods:{tzname:{$meth:function tzname(t){if(t instanceof Nt||t===y)return this.$name===y?this.$nameFromOff(this.$offset):this.$name;throw new z(\"tzname() argument must be a datetime instance or None\")},$flags:{OneArg:!0},$textsig:null,$doc:\"If name is specified when timezone is created, returns the name. Otherwise returns offset as 'UTC(+|-)HH:MM'.\"},utcoffset:{$meth:function utcoffset(t){if(t instanceof Nt||t===y)return this.$offset;throw new z(\"utcoffset() argument must be a datetime instance or None\")},$flags:{OneArg:!0},$textsig:null,$doc:\"Return fixed offset.\"},dst:{$meth:function dst(t){if(t instanceof Nt||t===y)return y;throw new z(\"dst() argument must be a datetime instance or None\")},$flags:{OneArg:!0},$textsig:null,$doc:\"Return None.\"},fromutc:{$meth:function fromutc(t){if(t instanceof Nt){if(t.$tzinfo!==this)throw new v(\"fromutc: dt.tzinfo is not self\");return q(t,this.$offset,\"Add\")}throw new z(\"fromutc() argument must be a datetime instance or None\")},$flags:{OneArg:!0},$textsig:null,$doc:\"datetime in UTC -> datetime in local time.\"},__getinitargs__:{$meth(){return this.$name===y?new p([this.$offset]):new p([this.$offset,this.$name])},$flags:{NoArgs:!0}}},proto:{$maxoffset:new wt(0,86399,999999),$minoffset:new wt(-1,0,1),$nameFromOff(n){if(!t(n))return new w(\"UTC\");let i,s,o,r,a,$;return e(n,bt,\"Lt\")?(i=\"-\",n=n.nb$negative()):i=\"+\",[s,o]=pyDivMod(n,pt),[r,o]=pyDivMod(o,gt),a=o.$secs,$=o.$micro,new w($?`UTC${i}${_d(s)}:${_d(r)}:${_d(a)}.${_d($,\"0\",6)}`:a?`UTC${i}${_d(s)}:${_d(r)}:${_d(a)}`:`UTC${i}${_d(s)}:${_d(r)}`)}}});St.prototype.utc=new St(new wt(0)),St.prototype.min=new St(new wt(0,-86340,0)),St.prototype.max=new St(new wt(0,86340,0));const kt=new Nt(1970,1,1,0,0,0,0,St.prototype.utc);return E}))}","src/lib/document.js":"function $builtinmodule(){const{builtin:{str:t},misceval:{callsimArray:e},ffi:{toPy:r},abstr:{gattr:a}}=Sk,n={__name__:new t(\"document\")},_=r(Sk.global.document);return Sk.abstr.setUpModuleMethods(\"document\",n,{__getattr__:{$meth:t=>a(_,t,!0),$flags:{OneArg:!0}},__dir__:{$meth:()=>e(_.tp$getattr(t.$dir)),$flags:{NoArgs:!0}}}),n}","src/lib/fractions.js":"function $builtinmodule(t){const e={};return Sk.misceval.chain(Sk.importModule(\"math\",!1,!0),(t=>(e.math=t,Sk.importModule(\"sys\",!1,!0))),(t=>(e.sys=t,fractionsMod(e))))}function fractionsMod({math:t,sys:e}){const{builtin:{int_:n,bool:{true$:i,false$:r},none:{none$:s},NotImplemented:{NotImplemented$:o},tuple:a,float_:$,complex:u,str:h,isinstance:l,TypeError:m,ZeroDivisionError:d,ValueError:f,NotImplementedError:c,abs:_,round:b,pow:p},ffi:{remapToPy:g},abstr:{buildNativeClass:w,copyKeywordsToNamedArgs:v,numberBinOp:y,typeName:k,lookupSpecial:E,checkArgsLen:N},misceval:{isTrue:F,richCompareBool:A,callsimArray:S,objectRepr:M}}=Sk,O={__name__:new h(\"fractions\"),__all__:g([\"Fraction\"])},D=/^\\s*(?[-+]?)(?=\\d|\\.\\d)(?\\d*)(?:(?:\\/(?\\d+))?|(?:\\.(?\\d*))?(?:E(?[-+]?\\d+))?)\\s*$/i,q=new n(0),x=new n(1),z=new n(2),I=new n(10),T=new h(\"numerator\"),R=new h(\"denominator\"),B=new h(\"as_integer_ratio\"),C=new h(\"from_float\"),getNumer=t=>t.tp$getattr(T),getDenom=t=>t.tp$getattr(R),mul=(t,e)=>y(t,e,\"Mult\"),div=(t,e)=>y(t,e,\"Div\"),pow=(t,e)=>y(t,e,\"Pow\"),add=(t,e)=>y(t,e,\"Add\"),sub=(t,e)=>y(t,e,\"Sub\"),floorDiv=(t,e)=>y(t,e,\"FloorDiv\"),divmod=(t,e)=>y(t,e,\"DivMod\"),mod=(t,e)=>y(t,e,\"Mod\"),K=t.tp$getattr(new h(\"gcd\")),eq=(t,e)=>A(t,e,\"Eq\"),lt=(t,e)=>A(t,e,\"Lt\"),ge=(t,e)=>A(t,e,\"GtE\"),L={NoArgs:!0},P={OneArg:!0},j=e.tp$getattr(new h(\"hash_info\")),G=j.tp$getattr(new h(\"modulus\")),V=j.tp$getattr(new h(\"inf\"));function _operator_fallbacks(t,e){return[function(n){return isRational(n)?t(this,n):n instanceof $?e(this.nb$float(),n):n instanceof u?e(S(u,[this]),n):o},function(n){return isRational(n)?t(n,this):n instanceof $?e(n,this.nb$float()):n instanceof u?e(n,S(u,[this])):o}]}const[Z,H]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e);return S(ot,[add(mul(getNumer(t),i),mul(getNumer(e),n)),mul(n,i)])}),add),[J,Q]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e);return S(ot,[sub(mul(getNumer(t),i),mul(getNumer(e),n)),mul(n,i)])}),sub),[U,W]=_operator_fallbacks(((t,e)=>S(ot,[mul(getNumer(t),getNumer(e)),mul(getDenom(t),getDenom(e))])),mul),[X,Y]=_operator_fallbacks(((t,e)=>S(ot,[mul(getNumer(t),getDenom(e)),mul(getDenom(t),getNumer(e))])),div),[tt,et]=_operator_fallbacks(((t,e)=>floorDiv(mul(getNumer(t),getDenom(e)),mul(getDenom(t),getNumer(e)))),floorDiv),[nt,it]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e),[r,s]=divmod(mul(getNumer(t),i),mul(n,getNumer(e))).valueOf();return new a([r,S(ot,[s,mul(n,i)])])}),divmod),[rt,st]=_operator_fallbacks(((t,e)=>{const n=getDenom(t),i=getDenom(e),r=mod(mul(getNumer(t),i),mul(getNumer(e),n));return S(ot,[r,mul(n,i)])}),mod),ot=O.Fraction=w(\"fractions.Fraction\",{constructor:function(t,e){this.$num=t||q,this.$den=e||x},slots:{tp$new(t,e){N(\"Fraction\",t,0,2);let[r,o,a]=v(\"Fraction\",[\"numerator\",\"denominator\",\"_normalize\"],t,e,[q,s,i]);const u=new this.constructor;if(o===s){if(r.ob$type===n)return u.$num=r,u.$den=x,u;if(isRational(r))return u.$num=getNumer(r),u.$den=getDenom(r),u;if(r instanceof $)return[u.$num,u.$den]=S(r.tp$getattr(B)).valueOf(),u;if(!(r instanceof h))throw new m(\"argument should be a string or a Rational instance\");{const t=r.toString().match(D);if(null===t)throw new f(\"Invalid literal for Fraction: \"+M(r));r=new n(t.groups.num||\"0\");const e=t.groups.denom;if(e)o=new n(e);else{o=x;const e=t.groups.decimal;if(e){const t=new n(\"\"+10**e.length);r=add(mul(r,t),new n(e)),o=mul(o,t)}let i=t.groups.exp;i&&(i=new n(i),lt(i,q)?o=mul(o,pow(I,i.nb$negative())):r=mul(r,pow(I,i)))}\"-\"==t.groups.sign&&(r=r.nb$negative())}}else if(r.ob$type===n&&o.ob$type===n);else{if(!isRational(r)||!isRational(o))throw new m(\"both arguments should be Rational instances\");[r,o]=[mul(getNumer(r),getDenom(o)),mul(getNumer(o),getDenom(r))]}if(eq(o,q))throw new d(`Fraction(${r}, 0)`);if(F(a)){let t=S(K,[r,o]);lt(o,q)&&(t=t.nb$negative()),r=floorDiv(r,t),o=floorDiv(o,t)}return u.$num=r,u.$den=o,u},$r(){const t=E(this.ob$type,h.$name);return new h(`${t}(${this.$num}, ${this.$den})`)},tp$str(){return eq(this.$den,x)?new h(this.$num):new h(`${this.$num}/${this.$den}`)},tp$hash(){const t=p(this.$den,sub(G,z),G);let e;e=F(t)?mod(mul(_(this.$num),t),G):V;let n=ge(this,q)?e:e.nb$negative();return n=n.tp$hash(),-1===n?-2:n},tp$richcompare(t,e){const op=(t,n)=>A(t,n,e);if(\"Eq\"===e||\"NotEq\"==e){if(t.ob$type===n){const n=eq(this.$num,t)&&eq(this.$den,x);return\"Eq\"===e?n:!n}if(t instanceof ot||t instanceof n){const n=eq(this.$num,getNumer(t))&&eq(this.$den,getDenom(t));return\"Eq\"===e?n:!n}t instanceof u&&eq(t.tp$getattr(new h(\"imag\")),q)&&(t=t.tp$getattr(new h(\"real\")))}return isRational(t)?op(mul(getNumer(this),getDenom(t)),mul(getDenom(this),getNumer(t))):t instanceof $?Number.isFinite(t.valueOf())?op(this,S(this.tp$getattr(C),[t])):op(new $(0),t):o},tp$as_number:!0,nb$add:Z,nb$reflected_add:H,nb$subtract:J,nb$reflected_subtract:Q,nb$multiply:U,nb$reflected_multiply:W,nb$divide:X,nb$reflected_divide:Y,nb$floor_divide:tt,nb$reflected_floor_divide:et,nb$divmod:nt,nb$reflected_divmod:it,nb$remainder:rt,nb$reflected_remainder:st,nb$power(t){if(isRational(t)){if(eq(getDenom(t),x)){let e=getNumer(t);return ge(e,q)?S(ot,[pow(this.$num,e),pow(this.$den,e)],[\"_normalize\",r]):ge(this.$num,q)?(e=e.nb$negative(),S(ot,[pow(this.$den,e),pow(this.$num,e)],[\"_normalize\",r])):(e=e.nb$negative(),S(ot,[pow(this.$den.nb$negative(),e),pow(this.$num.nb$negative(),e)],[\"_normalize\",r]))}return pow(this.nb$float(),S($,[t]))}return pow(this.nb$float(),t)},nb$reflected_power(t){return eq(this.$den,x)&&ge(this.$num,q)?pow(t,this.$num):isRational(t)?pow(new ot(getNumer(t),getDenom(t)),this):eq(this.$den,x)?pow(t,this.$num):pow(t,this.nb$float())},nb$positive(){return new ot(this.$num,this.$den)},nb$negative(){return new ot(this.$num.nb$negative(),this.$den)},nb$abs(){return new ot(this.$num.nb$abs(),this.$den)},nb$bool(){return this.$num.nb$bool()},nb$float(){return div(this.$num,this.$den)}},methods:{as_integer_ratio:{$meth(){return new a([this.$num,this.$den])},$flags:L},limit_denominator:{$meth(t){if(lt(t,x))throw new f(\"max_denominator should be at least 1\");if(ge(t,this.$den))return S(ot,[this]);let[e,n,i,r]=[q,x,x,q],s=this.$num,o=this.$den;for(;;){const a=floorDiv(s,o),$=add(n,mul(a,r));if(lt(t,$))break;[e,n,i,r]=[i,r,add(e,mul(a,i)),$],[s,o]=[o,sub(s,mul(a,o))]}const a=floorDiv(sub(t,n),r),$=S(ot,[add(e,mul(a,i)),add(n,mul(a,r))]),u=S(ot,[i,r]);return ge(_(sub($,this)),_(sub(u,this)))?u:$},$flags:{NamedArgs:[\"max_denominator\"],Defaults:[new n(1e6)]}},__trunc__:{$meth(){return lt(this.$num,q)?floorDiv(this.$num.nb$negative(),this.$den).nb$negative():floorDiv(this.$num,this.$den)},$flags:L},__floor__:{$meth(){return floorDiv(this.$num,this.$den)},$flags:L},__ceil__:{$meth(){return floorDiv(this.$num.nb$negative(),this.$den).nb$negative()},$flags:L},__round__:{$meth(t){if(t===s){const[t,e]=divmod(this.$num,this.$den).valueOf(),n=mul(e,z);return lt(n,this.$den)?t:lt(this.$den,n)?add(t,x):eq(mod(t,z),q)?t:add(t,x)}const e=pow(I,_(t));return lt(q,t)?S(ot,[b(mul(this,e)),e]):S(ot,[mul(b(div(this,e)),e)])},$flags:{NamedArgs:[\"ndigits\"],Defaults:[s]}},__reduce__:{$meth(){return new a([this.ob$type,new a([new h(this)])])},$flags:L},__copy__:{$meth(){return this.ob$type===ot?this:S(this.ob$type,[this.$num,this.$den])},$flags:L},__deepcopy__:{$meth(t){return this.ob$type===ot?this:S(this.ob$type,[this.$num,this.$den])},$flags:P}},classmethods:{from_float:{$meth(t){if(t instanceof n)return S(this,[t]);if(t instanceof $){const[e,n]=S(t.tp$getattr(B)).valueOf();return S(this,[e,n])}throw new m(`${k(this)}.from_float() only takes floats, not ${M(t)}, (${k(t)})`)},$flags:P},from_decimal:{$meth(){throw c(\"from_decimal not yet implemented in SKulpt\")},$flags:P}},getsets:{numerator:{$get(){return this.$num}},denominator:{$get(){return this.$den}},_numerator:{$get(){return this.$num},$set(t){this.$num=t}},_denominator:{$get(){return this.$den},$set(t){this.$den=t}}}}),at=new a([n,ot]),isRational=t=>F(l(t,at));return O}","src/lib/functools.js":"function $builtinmodule(){const t={};return Sk.misceval.chain(Sk.importModule(\"collections\",!1,!0),(e=>(t._namedtuple=e.$d.namedtuple,functools_mod(t))))}function functools_mod(t){const{object:e,int_:n,str:r,list:s,tuple:a,dict:i,none:{none$:o},bool:{false$:c},NotImplemented:{NotImplemented$:_},bool:l,func:p,method:u,TypeError:h,RuntimeError:d,ValueError:f,NotImplementedError:m,AttributeErrror:w,OverflowError:g,checkNone:$,checkBool:y,checkCallable:k,checkClass:b}=Sk.builtin,{callsimArray:x,callsimOrSuspendArray:A,iterFor:S,chain:E,isIndex:v,asIndexSized:N,isTrue:P,richCompareBool:j,objectRepr:R}=Sk.misceval,{remapToPy:z}=Sk.ffi,{buildNativeClass:q,setUpModuleMethods:T,keywordArrayFromPyDict:I,keywordArrayToPyDict:D,objectHash:C,lookupSpecial:M,copyKeywordsToNamedArgs:W,typeName:F,iter:U,gattr:O}=Sk.abstr,{getSetDict:G,getAttr:B,setAttr:K}=Sk.generic;function proxyFail(t){return new p((()=>{throw new m(t+\" is not yet implemented in skulpt\")}))}Object.assign(t,{__name__:new r(\"functools\"),__doc__:new r(\"Tools for working with functions and callable objects\"),__all__:new s([\"update_wrapper\",\"wraps\",\"WRAPPER_ASSIGNMENTS\",\"WRAPPER_UPDATES\",\"total_ordering\",\"cmp_to_key\",\"cache\",\"lru_cache\",\"reduce\",\"partial\",\"partialmethod\",\"singledispatch\",\"singledispatchmethod\",\"cached_property\"].map((t=>new r(t)))),WRAPPER_ASSIGNMENTS:new a([\"__module__\",\"__name__\",\"__qualname__\",\"__doc__\",\"__annotations__\"].map((t=>new r(t)))),WRAPPER_UPDATES:new a([new r(\"__dict__\")]),singledispatch:proxyFail(\"singledispatch\"),singledispatchmethod:proxyFail(\"singledispatchmethod\"),cached_property:proxyFail(\"cached_property\")});const L=new r(\"cache_parameters\");function _lru_cache(e,n){if(n||(n=c),v(e))(e=N(e,g))<0&&(e=0);else{if(k(e)&&y(n)){const r=e,s=new V(r,e=128,n);return s.tp$setattr(L,new p((()=>z({maxsize:e,typed:n})))),A(t.update_wrapper,[s,r])}if(!$(e))throw new h(\"Expected first argument to be an integer, a callable, or None\")}return new p((r=>{const s=new V(r,e,n);return s.tp$setattr(L,new p((()=>z({maxsize:e,typed:n})))),A(t.update_wrapper,[s,r])}))}const H=t._CacheInfo=x(t._namedtuple,[\"CacheInfo\",[\"hits\",\"misses\",\"maxsize\",\"currsize\"]].map((t=>z(t))),[\"module\",new r(\"functools\")]),V=q(\"functools._lru_cache_wrapper\",{constructor:function _lru_cache_wrapper(t,e,n,r){if(!k(t))throw new h(\"the first argument must be callable\");let s;if($(e))s=infinite_lru_cache_wrapper,e=-1;else{if(!v(e))throw new h(\"maxsize should be integer or None\");(e=N(e,g))<0&&(e=0),s=0===e?uncached_lru_cache_wrapper:bounded_lru_cache_wrapper}this.root={},this.root.prev=this.root.next=this.root,this.wrapper=s,this.maxsize=e,this.typed=n,this.cache=new i([]),this.func=t,this.misses=this.hits=0,this.$d=new i([])},slots:{tp$new(t,e){const[n,r,s,a]=W(\"_lru_cache_wrapper\",[\"user_function\",\"maxsize\",\"typed\",\"cache_info_type\"],t,e);return new V(n,r,s,a)},tp$call(t,e){return this.wrapper(t,e)},tp$descr_get(t,e){return null===t?this:new u(this,t)},tp$doc:\"Create a cached callable that wraps another function.\\n\\nuser_function: the function being cached\\n\\nmaxsize: 0 for no caching\\n None for unlimited cache size\\n n for a bounded cache\\n\\ntyped: False cache f(3) and f(3.0) as identical calls\\n True cache f(3) and f(3.0) as distinct calls\\n\\ncache_info_type: namedtuple class with the fields:\\n hits misses currsize maxsize\\n\"},methods:{cache_info:{$meth(){return A(H,[this.hits,this.misses,-1===this.maxsize?o:this.maxsize,this.cache.get$size()].map((t=>z(t))))},$flags:{NoArgs:!0},$doc:\"Report cache statistics\"},cache_clear:{$meth(){return this.hits=this.misses=0,this.root={},this.root.next=this.root.prev=this.root,A(this.cache.tp$getattr(new r(\"clear\"),!0))},$flags:{NoArgs:!0},$doc:\"Clear the cache and cache statistics\"},__deepcopy__:{$meth(t){return this},$flags:{OneArg:!0}},__copy__:{$meth(){return this},$flags:{NoArgs:!0}}},getsets:{__dict__:G}});function infinite_lru_cache_wrapper(t,e){const n=_make_key(t,e,this.typed),r=this.cache.mp$lookup(n);return void 0!==r?(this.hits++,r):(this.misses++,E(A(this.func,t,e),(t=>(this.cache.mp$ass_subscript(n,t),t))))}function uncached_lru_cache_wrapper(t,e){return this.misses++,A(this.func,t,e)}function bounded_lru_cache_wrapper(t,e){const n=_make_key(t,e,this.typed),r=this.cache.mp$lookup(n);if(void 0!==r){const{result:t}=r;return lru_cache_extract_link(r),lru_cache_append_link(this,r),this.hits++,t}return this.misses++,E(A(this.func,t,e),(t=>{if(void 0!==this.cache.mp$lookup(n))return t;if(this.cache.get$size()t.ob$type)),...i.map((t=>t.ob$type)));else if(1===s.length&&X.has(s[0].ob$type))return s[0];return new J(s)}function partial_adjust_args_kwargs(t,e){if(t=this.arg_arr.concat(t),e){e=D(e);const t=this.kwdict.dict$copy();t.dict$merge(e),e=I(t)}else e=I(this.kwdict);return{args:t,kwargs:e}}function partial_new(t,e){if(t.length<1)throw new h(\"type 'partial' takes at least 1 argument\");let n,r,s=t.shift();if(s instanceof this.sk$builtinBase){const t=s;s=t.fn,n=t.arg_arr,r=t.kwdict}this.check$func(s),n&&(t=n.concat(t));let a=D(e=e||[]);if(r){const t=r.dict$copy();t.dict$merge(a),a=t}if(this.sk$builtinBase===this.constructor)return new this.constructor(s,t,a);{const e=new this.constructor;return this.sk$builtinBase.call(e,s,t,a),e}}function partial_repr(){if(this.in$repr)return new r(\"...\");this.in$repr=!0;const t=[R(this.fn)];return this.arg_arr.forEach((e=>{t.push(R(e))})),this.kwdict.$items().forEach((([e,n])=>{t.push(e.toString()+\"=\"+R(n))})),this.in$repr=!1,new r(this.tp$name+\"(\"+t.join(\", \")+\")\")}t.partial=q(\"functools.partial\",{constructor:function partial(t,e,n){this.fn=t,this.arg_arr=e,this.arg_tup=new a(e),this.kwdict=n,this.in$repr=!1,this.$d=new i([])},slots:{tp$new:partial_new,tp$call(t,e){return({args:t,kwargs:e}=this.adj$args_kws(t,e)),this.fn.tp$call(t,e)},tp$doc:\"partial(func, *args, **keywords) - new function with partial application\\n of the given arguments and keywords.\\n\",$r:partial_repr,tp$getattr:B,tp$setattr:K},getsets:{func:{$get(){return this.fn},$doc:\"function object to use in future partial calls\"},args:{$get(){return this.arg_tup},$doc:\"tuple of arguments to future partial calls\"},keywords:{$get(){return this.kwdict},$doc:\"dictionary of keyword arguments to future partial calls\"},__dict__:G},methods:{},classmethods:Sk.generic.classGetItem,proto:{adj$args_kws:partial_adjust_args_kwargs,check$func(t){if(!k(t))throw new h(\"the first argument must be callable\")}}}),t.partialmethod=q(\"functools.partialmethod\",{constructor:function partialmethod(t,e,n){this.fn=t,this.arg_arr=e,this.arg_tup=new a(e),this.kwdict=n},slots:{tp$new:partial_new,tp$doc:\"Method descriptor with partial application of the given arguments\\n and keywords.\\n\\n Supports wrapping existing descriptors and handles non-descriptor\\n callables as instance methods.\\n \",$r:partial_repr,tp$descr_get(e,n){let r;if(this.fn.tp$descr_get){const s=this.fn.tp$descr_get(e,n);if(s!==this.fn){if(!k(s))throw new h(\"type 'partial' requires a callable\");r=new t.partial(s,this.arg_arr.slice(0),this.kwdict.dict$copy());const e=M(s,this.str$self);void 0!==e&&r.tp$setattr(this.str$self,e)}}return void 0===r&&(r=this.make$unbound().tp$descr_get(e,n)),r}},methods:{_make_unbound_method:{$meth(){return this.make$unbound()},$flags:{NoArgs:!0}}},classmethods:Sk.generic.classGetItem,getsets:{func:{$get(){return this.fn},$doc:\"function object to use in future partial calls\"},args:{$get(){return this.arg_tup},$doc:\"tuple of arguments to future partial calls\"},keywords:{$get(){return this.kwdict},$doc:\"dictionary of keyword arguments to future partial calls\"},__dict__:G},proto:{str$self:new r(\"__self__\"),make$unbound(){const t=this;function _method(e,n){const r=e.shift();return({args:e,kwargs:n}=t.adj$args_kws(e,n)),e.unshift(r),A(t.fn,e,n)}return _method.co_fastcall=!0,new p(_method)},adj$args_kws:partial_adjust_args_kwargs,check$func(t){if(!k(t)&&void 0===t.tp$descr_get)throw new h(R(t)+\" is not callable or a descriptor\")}}});const Y={__lt__:r.$lt,__le__:r.$le,__gt__:r.$gt,__ge__:r.$ge};function from_slot(t,e){const n=Y[t];function compare_slot(t,r){let s=x(t.tp$getattr(n),[r]);return s===_?s:(s=P(s),new l(e(s,t,r)))}return compare_slot.co_name=n,compare_slot}const Z=from_slot(\"__lt__\",((t,e,n)=>!t&&j(e,n,\"NotEq\"))),tt=from_slot(\"__lt__\",((t,e,n)=>t||j(e,n,\"Eq\"))),et=from_slot(\"__lt__\",(t=>!t)),nt=from_slot(\"__le__\",((t,e,n)=>!t||j(e,n,\"Eq\"))),rt=from_slot(\"__le__\",((t,e,n)=>t&&j(e,n,\"NotEq\"))),st=from_slot(\"__le__\",(t=>!t)),at=from_slot(\"__gt__\",((t,e,n)=>!t&&j(e,n,\"NotEq\"))),it=from_slot(\"__gt__\",((t,e,n)=>t||j(e,n,\"Eq\"))),ot=from_slot(\"__gt__\",(t=>!t)),ct=from_slot(\"__ge__\",((t,e,n)=>!t||j(e,n,\"Eq\"))),_t=from_slot(\"__ge__\",((t,e,n)=>t&&j(e,n,\"NotEq\"))),lt=from_slot(\"__ge__\",(t=>!t)),pt={__lt__:{__gt__:new p(Z),__le__:new p(tt),__ge__:new p(et)},__le__:{__ge__:new p(nt),__lt__:new p(rt),__gt__:new p(st)},__gt__:{__lt__:new p(at),__ge__:new p(it),__le__:new p(ot)},__ge__:{__le__:new p(ct),__gt__:new p(_t),__lt__:new p(lt)}},ut={__lt__:\"ob$lt\",__le__:\"ob$le\",__gt__:\"ob$gt\",__ge__:\"ob$ge\"};const ht=new n(0),dt=q(\"functools.KeyWrapper\",{constructor:function(t,e){this.cmp=t,this.obj=e},slots:{tp$call(t,e){const[n]=W(\"K\",[\"obj\"],t,e,[]);return new dt(this.cmp,n)},tp$richcompare(t,e){if(!(t instanceof dt))throw new h(\"other argument must be K instance\");const n=this.obj,r=t.obj;if(!n||!r)throw new w(\"object\");const s=A(this.cmp,[n,r]);return E(s,(t=>j(t,ht,e)))},tp$getattr:B,tp$hash:o},getsets:{obj:{$get(){return this.obj||o},$set(t){this.obj=t},$doc:\"Value wrapped by a key function.\"}}}),ft=new r(\"update\"),mt=new r(\"__wrapped__\");return T(\"functools\",t,{cache:{$meth:function cache(t){return A(_lru_cache(o),[t])},$flags:{OneArg:!0},$doc:'Simple lightweight unbounded cache. Sometimes called \"memoize\".',$textsig:\"($module, user_function, /)\"},lru_cache:{$meth:_lru_cache,$flags:{NamedArgs:[\"maxsize\",\"typed\"],Defaults:[new n(128),c]},$doc:\"Least-recently-used cache decorator.\\n\\nIf *maxsize* is set to None, the LRU features are disabled and the cache\\ncan grow without bound.\\n\\nIf *typed* is True, arguments of different types will be cached separately.\\nFor example, f(3.0) and f(3) will be treated as distinct calls with\\ndistinct results.\\n\\nArguments to the cached function must be hashable.\\n\\nView the cache statistics named tuple (hits, misses, maxsize, currsize)\\nwith f.cache_info(). Clear the cache and statistics with f.cache_clear().\\nAccess the underlying function with f.__wrapped__.\\n\\nSee: http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)\"},cmp_to_key:{$meth:function cmp_to_key(t){return new dt(t)},$flags:{NamedArgs:[\"mycmp\"],Defaults:[]},$doc:\"Convert a cmp= function into a key= function.\",$textsig:\"($module, cmp, /)\"},reduce:{$meth:function reduce(t,e,n){const r=U(e);let s;return n=n||r.tp$iternext(!0),E(n,(e=>{if(void 0===e)throw new h(\"reduce() of empty sequence with no initial value\");return s=e,S(r,(e=>E(A(t,[s,e]),(t=>{s=t}))))}),(()=>s))},$flags:{MinArgs:2,MaxArgs:3},$doc:\"reduce(function, sequence[, initial]) -> value\\n\\nApply a function of two arguments cumulatively to the items of a sequence,\\nfrom left to right, so as to reduce the sequence to a single value.\\nFor example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\\n((((1+2)+3)+4)+5). If initial is present, it is placed before the items\\nof the sequence in the calculation, and serves as a default when the\\nsequence is empty.\",$textsig:\"($module, function, sequence[, initial], /)\"},total_ordering:{$meth:function total_ordering(t){const n=[];if(!b(t))throw new h(\"total ordering only supported for type objects not '\"+F(t)+\"'\");if(Object.keys(pt).forEach((r=>{const s=ut[r];t.prototype[s]!==e.prototype[s]&&n.push(r)})),!n.length)throw new f(\"must define atleast one ordering operation: <, >, <=, >=\");const r=n[0];return Object.entries(pt[r]).forEach((([e,r])=>{n.includes(e)||t.tp$setattr(Y[e],r)})),t},$flags:{OneArg:!0},$doc:\"Class decorator that fills in missing ordering methods\"},update_wrapper:{$meth:function update_wrapper(t,e,n,r){let s,a=U(n);for(let i=a.tp$iternext();void 0!==i;i=a.tp$iternext())void 0!==(s=e.tp$getattr(i))&&t.tp$setattr(i,s);a=U(r);for(let o=a.tp$iternext();void 0!==o;o=a.tp$iternext()){s=e.tp$getattr(o)||new i([]);const n=O(t,o),r=O(n,ft);x(r,[s])}return t.tp$setattr(mt,e),t},$flags:{NamedArgs:[\"wrapper\",\"wrapped\",\"assigned\",\"updated\"],Defaults:[t.WRAPPER_ASSIGNMENTS,t.WRAPPER_UPDATES]},$doc:\"Update a wrapper function to look like the wrapped function\\n\\n wrapper is the function to be updated\\n wrapped is the original function\\n assigned is a tuple naming the attributes assigned directly\\n from the wrapped function to the wrapper function (defaults to\\n functools.WRAPPER_ASSIGNMENTS)\\n updated is a tuple naming the attributes of the wrapper that\\n are updated with the corresponding attribute from the wrapped\\n function (defaults to functools.WRAPPER_UPDATES)\\n \",$textsig:\"($module, /, wrapper, wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__'), updated=('__dict__',))\"},wraps:{$meth:function wraps(e,n,r){const s=[\"wrapped\",e,\"assigned\",n,\"updated\",r];return A(t.partial,[t.update_wrapper],s)},$flags:{NamedArgs:[\"wrapped\",\"assigned\",\"updated\"],Defaults:[t.WRAPPER_ASSIGNMENTS,t.WRAPPER_UPDATES]},$doc:\"Decorator factory to apply update_wrapper() to a wrapper function\\n\\n Returns a decorator that invokes update_wrapper() with the decorated\\n function as the wrapper argument and the arguments to wraps() as the\\n remaining arguments. Default arguments are as for update_wrapper().\\n This is a convenience function to simplify applying partial() to\\n update_wrapper().\\n \",$textsig:\"($module, /, wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__'), updated=('__dict__',))\"}}),t}","src/lib/image.js":"var ImageMod,$builtinmodule;ImageMod||((ImageMod={}).canvasLib=[]),$builtinmodule=function(e){var n,t,i,a,u,l,r,s={__name__:new Sk.builtin.str(\"image\")};return s.Image=Sk.misceval.buildClass(s,(function(e,n){u=function(e){e.width=e.image.width,e.height=e.image.height,e.delay=0,e.updateCount=0,e.updateInterval=1,e.lastx=0,e.lasty=0,e.canvas=document.createElement(\"canvas\"),e.canvas.height=e.height,e.canvas.width=e.width,e.ctx=e.canvas.getContext(\"2d\"),e.ctx.drawImage(e.image,0,0),e.imagedata=e.ctx.getImageData(0,0,e.width,e.height)},n.__init__=new Sk.builtin.func((function(e,n){var t;Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,2,2);try{e.image=document.getElementById(Sk.ffi.remapToJs(n)),u(e)}catch(i){e.image=null}if(null==e.image)return(t=new Sk.misceval.Suspension).resume=function(){if(t.data.error)throw new Sk.builtin.IOError(t.data.error.message)},t.data={type:\"Sk.promise\",promise:new Promise((function(t,i){var a=new Image;a.crossOrigin=\"\",a.onerror=function(){i(Error(\"Failed to load URL: \"+a.src))},a.onload=function(){e.image=this,u(e),t()},a.src=r(n)}))},t})),r=function(e){var n,t,i=\"function\"==typeof Sk.imageProxy?Sk.imageProxy:function(e){return(n=document.createElement(\"a\")).href=t,window.location.host!==n.host?Sk.imageProxy+\"/\"+e:e};return t=i(t=Sk.ffi.remapToJs(e))},l=function(e,n,t){if(n<0||t<0||n>=e.width||t>=e.height)throw new Sk.builtin.ValueError(\"Pixel index out of range.\")};var setdelay=function(e,n,t){var i;Sk.builtin.pyCheckArgsLen(\"setdelay\",arguments.length,2,3),e.delay=Sk.ffi.remapToJs(n),i=Sk.builtin.asnum$(t),e.updateInterval=i||1};n.set_delay=new Sk.builtin.func(setdelay),n.setDelay=new Sk.builtin.func(setdelay);var getpixels=function(e){var n,t=[];for(Sk.builtin.pyCheckArgsLen(\"getpixels\",arguments.length,1,1),n=0;n=e.width?e.lastCtx.putImageData(e.imagedata,e.lastUlx,e.lastUly,0,e.lasty,e.width,2):e.lasty+e.updateInterval>=e.height?e.lastCtx.putImageData(e.imagedata,e.lastUlx,e.lastUly,e.lastx,0,2,e.height):e.lastCtx.putImageData(e.imagedata,e.lastUlx,e.lastUly,Math.min(n,e.lastx),Math.min(t,e.lasty),Math.max(Math.abs(n-e.lastx),1),Math.max(Math.abs(t-e.lasty),1)),e.lastx=n,e.lasty=t,e.delay>0?window.setTimeout(i,e.delay):i()):i()}))},i};var setpixel=function(e,n,t,i){var u;return Sk.builtin.pyCheckArgsLen(\"setpixel\",arguments.length,4,4),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),l(e,n,t),u=4*t*e.width+4*n,e.imagedata.data[u]=Sk.builtin.asnum$(Sk.misceval.callsimArray(i.getRed,[i])),e.imagedata.data[u+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(i.getGreen,[i])),e.imagedata.data[u+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(i.getBlue,[i])),e.imagedata.data[u+3]=255,a(e,n,t)};n.set_pixel=new Sk.builtin.func(setpixel),n.setPixel=new Sk.builtin.func(setpixel);var setpixelat=function(e,n,t){var i,u,r;return Sk.builtin.pyCheckArgsLen(\"setpixelat\",arguments.length,3,3),i=(n=Sk.builtin.asnum$(n))%e.image.width,u=Math.floor(n/e.image.width),l(e,i,u),r=4*u*e.width+4*i,e.imagedata.data[r]=Sk.builtin.asnum$(Sk.misceval.callsimArray(t.getRed,[t])),e.imagedata.data[r+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(t.getGreen,[t])),e.imagedata.data[r+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(t.getBlue,[t])),e.imagedata.data[r+3]=255,a(e,i,u)};n.set_pixel_at=new Sk.builtin.func(setpixelat),n.setPixelAt=new Sk.builtin.func(setpixelat);var updatepixel=function(e,n){var t,i,u;return Sk.builtin.pyCheckArgsLen(\"updatepixel\",arguments.length,2,2),t=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getX,[n])),i=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getY,[n])),l(e,t,i),u=4*i*e.width+4*t,e.imagedata.data[u]=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getRed,[n])),e.imagedata.data[u+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getGreen,[n])),e.imagedata.data[u+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(n.getBlue,[n])),e.imagedata.data[u+3]=255,a(e,t,i)};n.update_pixel=new Sk.builtin.func(updatepixel),n.updatePixel=new Sk.builtin.func(updatepixel);var getheight=function(e){return Sk.builtin.pyCheckArgsLen(\"getheight\",arguments.length,1,1),new Sk.builtin.int_(e.height)};n.get_height=new Sk.builtin.func(getheight),n.getHeight=new Sk.builtin.func(getheight);var getwidth=function(e,n){return Sk.builtin.pyCheckArgsLen(\"getwidth\",arguments.length,1,1),new Sk.builtin.int_(e.width)};n.get_width=new Sk.builtin.func(getwidth),n.getWidth=new Sk.builtin.func(getwidth),n.__getattr__=new Sk.builtin.func((function(e,n){return\"height\"===(n=Sk.ffi.remapToJs(n))?Sk.builtin.assk$(e.height):\"width\"===n?Sk.builtin.assk$(e.width):void 0})),n.__setattr__=new Sk.builtin.func((function(e,n,t){throw\"height\"===(n=Sk.ffi.remapToJs(n))||\"width\"===n?new Sk.builtin.Exception(\"Cannot change height or width they can only be set on creation\"):new Sk.builtin.Exception(\"Unknown attribute: \"+n)})),n.draw=new Sk.builtin.func((function(e,n,t,i){var a;return Sk.builtin.pyCheckArgsLen(\"draw\",arguments.length,2,4),(a=new Sk.misceval.Suspension).resume=function(){return Sk.builtin.none.none$},a.data={type:\"Sk.promise\",promise:new Promise((function(a,u){var l;n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),i=Sk.builtin.asnum$(i),l=Sk.misceval.callsimArray(n.getWin,[n]).getContext(\"2d\"),void 0===t&&(t=0,i=0),e.lastUlx=t,e.lastUly=i,e.lastCtx=l,l.putImageData(e.imagedata,t,i),e.delay>0?window.setTimeout(a,e.delay):window.setTimeout(a,200)}))},a}))}),\"Image\",[]),i=function(e,n){n.__init__=new Sk.builtin.func((function(e,n,t){Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,3,3),e.width=Sk.builtin.asnum$(n),e.height=Sk.builtin.asnum$(t),e.canvas=document.createElement(\"canvas\"),e.ctx=e.canvas.getContext(\"2d\"),e.canvas.height=e.height,e.canvas.width=e.width,e.imagedata=e.ctx.getImageData(0,0,e.width,e.height)}))},s.EmptyImage=Sk.misceval.buildClass(s,i,\"EmptyImage\",[s.Image]),t=function(e,n){n.__init__=new Sk.builtin.func((function(e,n,t,i,a,u){Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,4,6),e.red=Sk.builtin.asnum$(n),e.green=Sk.builtin.asnum$(t),e.blue=Sk.builtin.asnum$(i),e.x=Sk.builtin.asnum$(a),e.y=Sk.builtin.asnum$(u)}));var getred=function(e){return Sk.builtin.pyCheckArgsLen(\"getred\",arguments.length,1,1),Sk.builtin.assk$(e.red)};n.get_red=new Sk.builtin.func(getred),n.getRed=new Sk.builtin.func(getred);var getgreen=function(e){return Sk.builtin.pyCheckArgsLen(\"getgreen\",arguments.length,1,1),Sk.builtin.assk$(e.green)};n.get_green=new Sk.builtin.func(getgreen),n.getGreen=new Sk.builtin.func(getgreen);var getblue=function(e){return Sk.builtin.pyCheckArgsLen(\"getblue\",arguments.length,1,1),Sk.builtin.assk$(e.blue)};n.get_blue=new Sk.builtin.func(getblue),n.getBlue=new Sk.builtin.func(getblue);var getx=function(e){return Sk.builtin.pyCheckArgsLen(\"getx\",arguments.length,1,1),Sk.builtin.assk$(e.x)};n.get_x=new Sk.builtin.func(getx),n.getX=new Sk.builtin.func(getx);var gety=function(e){return Sk.builtin.pyCheckArgsLen(\"gety\",arguments.length,1,1),Sk.builtin.assk$(e.y)};n.get_y=new Sk.builtin.func(gety),n.getY=new Sk.builtin.func(gety);var setred=function(e,n){Sk.builtin.pyCheckArgsLen(\"setred\",arguments.length,2,2),e.red=Sk.builtin.asnum$(n)};n.set_red=new Sk.builtin.func(setred),n.setRed=new Sk.builtin.func(setred);var setgreen=function(e,n){Sk.builtin.pyCheckArgsLen(\"setgreen\",arguments.length,2,2),e.green=Sk.builtin.asnum$(n)};n.set_green=new Sk.builtin.func(setgreen),n.setGreen=new Sk.builtin.func(setgreen);var setblue=function(e,n){Sk.builtin.pyCheckArgsLen(\"setblue\",arguments.length,2,2),e.blue=Sk.builtin.asnum$(n)};n.set_blue=new Sk.builtin.func(setblue),n.setBlue=new Sk.builtin.func(setblue),n.__getattr__=new Sk.builtin.func((function(e,n){return\"red\"===(n=Sk.ffi.remapToJs(n))?Sk.builtin.assk$(e.red):\"green\"===n?Sk.builtin.assk$(e.green):\"blue\"===n?Sk.builtin.assk$(e.blue):void 0})),n.__setattr__=new Sk.builtin.func((function(e,n,t){\"red\"!==(n=Sk.ffi.remapToJs(n))&&\"green\"!==n&&\"blue\"!==n||(e[n]=Sk.builtin.asnum$(t))}));var setx=function(e,n){Sk.builtin.pyCheckArgsLen(\"setx\",arguments.length,2,2),e.x=Sk.builtin.asnum$(n)};n.set_x=new Sk.builtin.func(setx),n.setX=new Sk.builtin.func(setx);var sety=function(e,n){Sk.builtin.pyCheckArgsLen(\"sety\",arguments.length,2,2),e.y=Sk.builtin.asnum$(n)};n.set_y=new Sk.builtin.func(sety),n.setY=new Sk.builtin.func(sety),n.__getitem__=new Sk.builtin.func((function(e,n){return 0===(n=Sk.builtin.asnum$(n))?e.red:1==n?e.green:2==n?e.blue:void 0})),n.__str__=new Sk.builtin.func((function(e){return Sk.ffi.remapToPy(\"[\"+e.red+\",\"+e.green+\",\"+e.blue+\"]\")})),n.getColorTuple=new Sk.builtin.func((function(e,n,t){})),n.setRange=new Sk.builtin.func((function(e,n){e.max=Sk.builtin.asnum$(n)}))},s.Pixel=Sk.misceval.buildClass(s,t,\"Pixel\",[]),n=function(e,n){n.__init__=new Sk.builtin.func((function(e,n,t){var i,a,u;Sk.builtin.pyCheckArgsLen(\"__init__\",arguments.length,1,3),void 0===(i=ImageMod.canvasLib[Sk.canvas])?(a=document.createElement(\"canvas\"),u=document.getElementById(Sk.canvas),e.theScreen=a,u.appendChild(a),ImageMod.canvasLib[Sk.canvas]=a,ImageMod.canvasLib[Sk.canvas]=e.theScreen):(e.theScreen=i,e.theScreen.height=e.theScreen.height),void 0!==n?(e.theScreen.height=t.v,e.theScreen.width=n.v):(Sk.availableHeight&&(e.theScreen.height=Sk.availableHeight),Sk.availableWidth&&(e.theScreen.width=Sk.availableWidth)),e.theScreen.style.display=\"block\"})),n.getWin=new Sk.builtin.func((function(e){return e.theScreen})),n.exitonclick=new Sk.builtin.func((function(e){var n=e.theScreen.id;e.theScreen.onclick=function(){document.getElementById(n).style.display=\"none\",document.getElementById(n).onclick=null,delete ImageMod.canvasLib[n]}}))},s.ImageWin=Sk.misceval.buildClass(s,n,\"ImageWin\",[]),s};","src/lib/itertools.js":"var $builtinmodule=function(t){var e={};function combinationsNew(t,e,i){let r,s;[r,s]=Sk.abstr.copyKeywordsToNamedArgs(t.tp$name,[\"iterable\",\"r\"],e,i,[]);const n=Sk.misceval.arrayFromIterable(r);if(s=Sk.misceval.asIndexSized(s,Sk.builtin.OverFlowError),s<0)throw new Sk.builtin.ValueError(\"r must be non-negative\");if(this===t)return new t.constructor(n,s);{const e=new this.constructor;return t.constructor.call(e,n,s),e}}return e.accumulate=Sk.abstr.buildIteratorClass(\"itertools.accumulate\",{constructor:function accumulate(t,e,i){this.iter=t,this.func=e,this.total=i,this.tp$iternext=()=>(this.total=Sk.builtin.checkNone(this.total)?this.iter.tp$iternext():this.total,this.tp$iternext=this.constructor.prototype.tp$iternext,this.total)},iternext(t){let e=this.iter.tp$iternext();if(void 0!==e)return this.total=Sk.misceval.callsimArray(this.func,[this.total,e]),this.total},slots:{tp$doc:\"accumulate(iterable[, func, initial]) --\\x3e accumulate object\\n\\nReturn series of accumulated sums (or other binary function results).\",tp$new(t,i){Sk.abstr.checkArgsLen(\"accumulate\",t,0,2);let[r,s,n]=Sk.abstr.copyKeywordsToNamedArgs(\"accumulate\",[\"iterable\",\"func\",\"initial\"],t,i,[Sk.builtin.none.none$,Sk.builtin.none.none$]);if(r=Sk.abstr.iter(r),s=Sk.builtin.checkNone(s)?new Sk.builtin.func(((t,e)=>Sk.abstr.numberBinOp(t,e,\"Add\"))):s,this===e.accumulate.prototype)return new e.accumulate(r,s,n);{const t=new this.constructor;return e.accumulate.call(t,r,s,n),t}}}}),e.chain=Sk.abstr.buildIteratorClass(\"itertools.chain\",{constructor:function chain(t){this.iterables=t,this.current_it=null,this.tp$iternext=()=>{if(this.tp$iternext=this.constructor.prototype.tp$iternext,this.current_it=this.iterables.tp$iternext(),void 0!==this.current_it)return this.current_it=Sk.abstr.iter(this.current_it),this.tp$iternext();this.tp$iternext=()=>{}}},iternext(t){let e;for(;void 0===e;){if(e=this.current_it.tp$iternext(),void 0!==e)return e;if(this.current_it=this.iterables.tp$iternext(),void 0===this.current_it)return void(this.tp$iternext=()=>{});this.current_it=Sk.abstr.iter(this.current_it)}},slots:{tp$doc:\"chain(*iterables) --\\x3e chain object\\n\\nReturn a chain object whose .__next__() method returns elements from the\\nfirst iterable until it is exhausted, then elements from the next\\niterable, until all of the iterables are exhausted.\",tp$new(t,i){if(Sk.abstr.checkNoKwargs(\"chain\",i),t=new Sk.builtin.tuple(t.slice(0)).tp$iter(),this===e.chain.prototype)return new e.chain(t);{const i=new this.constructor;return e.chain.call(i,t),i}}},classmethods:Object.assign({from_iterable:{$meth(t){const i=Sk.abstr.iter(t);return new e.chain(i)},$flags:{OneArg:!0},$doc:\"chain.from_iterable(iterable) --\\x3e chain object\\n\\nAlternate chain() constructor taking a single iterable argument\\nthat evaluates lazily.\",$textsig:null}},Sk.generic.classGetItem)}),e.combinations=Sk.abstr.buildIteratorClass(\"itertools.combinations\",{constructor:function combinations(t,e){this.pool=t,this.r=e,this.indices=new Array(e).fill().map(((t,e)=>e)),this.n=t.length,this.tp$iternext=()=>{if(!(this.r>this.n))return this.tp$iternext=this.constructor.prototype.tp$iternext,new Sk.builtin.tuple(this.pool.slice(0,this.r))}},iternext(t){let e,i=!1;for(e=this.r-1;e>=0;e--)if(this.indices[e]!=e+this.n-this.r){i=!0;break}if(!i)return void(this.r=0);this.indices[e]++;for(let s=e+1;sthis.pool[t]));return new Sk.builtin.tuple(r)},slots:{tp$doc:\"combinations(iterable, r) --\\x3e combinations object\\n\\nReturn successive r-length combinations of elements in the iterable.\\n\\ncombinations(range(4), 3) --\\x3e (0,1,2), (0,1,3), (0,2,3), (1,2,3)\",tp$new(t,i){return combinationsNew.call(this,e.combinations.prototype,t,i)}}}),e.combinations_with_replacement=Sk.abstr.buildIteratorClass(\"itertools.combinations_with_replacement\",{constructor:function combinations_with_replacement(t,e){this.pool=t,this.r=e,this.indices=new Array(e).fill(0),this.n=t.length,this.tp$iternext=()=>{if(this.r&&!this.n)return;this.tp$iternext=this.constructor.prototype.tp$iternext;const t=this.indices.map((t=>this.pool[t]));return new Sk.builtin.tuple(t)}},iternext(t){let e,i=!1;for(e=this.r-1;e>=0;e--)if(this.indices[e]!=this.n-1){i=!0;break}if(!i)return void(this.r=0);const r=this.indices[e]+1;for(let n=e;nthis.pool[t]));return new Sk.builtin.tuple(s)},slots:{tp$doc:\"combinations_with_replacement(iterable, r) --\\x3e combinations_with_replacement object\\n\\nReturn successive r-length combinations of elements in the iterable\\nallowing individual elements to have successive repeats.\\ncombinations_with_replacement('ABC', 2) --\\x3e AA AB AC BB BC CC\",tp$new(t,i){return combinationsNew.call(this,e.combinations_with_replacement.prototype,t,i)}}}),e.compress=Sk.abstr.buildIteratorClass(\"itertools.compress\",{constructor:function compress(t,e){this.data=t,this.selectors=e},iternext(){let t=this.data.tp$iternext(),e=this.selectors.tp$iternext();for(;void 0!==t&&void 0!==e;){if(Sk.misceval.isTrue(e))return t;t=this.data.tp$iternext(),e=this.selectors.tp$iternext()}},slots:{tp$doc:\"compress(data, selectors) --\\x3e iterator over selected data\\n\\nReturn data elements corresponding to true selector elements.\\nForms a shorter iterator from selected data elements using the\\nselectors to choose the data elements.\",tp$new(t,i){let r,s;if([r,s]=Sk.abstr.copyKeywordsToNamedArgs(\"compress\",[\"data\",\"selectors\"],t,i,[]),r=Sk.abstr.iter(r),s=Sk.abstr.iter(s),this===e.count.prototype)return new e.compress(r,s);{const t=new this.constructor;return e.compress.call(t,r,s),t}}}}),e.count=Sk.abstr.buildIteratorClass(\"itertools.count\",{constructor:function count(t,e){this.start=t,this.step=e},iternext(){const t=this.start;return this.start=Sk.abstr.numberBinOp(this.start,this.step,\"Add\"),t},slots:{tp$doc:\"count(start=0, step=1) --\\x3e count object\\n\\nReturn a count object whose .__next__() method returns consecutive values.\\nEquivalent to:\\n\\n def count(firstval=0, step=1):\\n x = firstval\\n while 1:\\n yield x\\n x += step\\n\",tp$new(t,i){const[r,s]=Sk.abstr.copyKeywordsToNamedArgs(\"count\",[\"start\",\"step\"],t,i,[new Sk.builtin.int_(0),new Sk.builtin.int_(1)]);if(!Sk.builtin.checkNumber(r)&&!Sk.builtin.checkComplex(r))throw new Sk.builtin.TypeError(\"a number is required\");if(!Sk.builtin.checkNumber(s)&&!Sk.builtin.checkComplex(s))throw new Sk.builtin.TypeError(\"a number is required\");if(this===e.count.prototype)return new e.count(r,s);{const t=new this.constructor;return e.count.call(t,r,s),t}},$r(){const t=Sk.misceval.objectRepr(this.start);let e=Sk.misceval.objectRepr(this.step);return e=\"1\"===e?\"\":\", \"+e,new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+t+e+\")\")}}}),e.cycle=Sk.abstr.buildIteratorClass(\"itertools.cycle\",{constructor:function cycle(t){this.iter=t,this.saved=[],this.consumed=!1,this.i=0,this.length},iternext(){let t;if(!this.consumed){if(t=this.iter.tp$iternext(),void 0!==t)return this.saved.push(t),t;if(this.consumed=!0,this.length=this.saved.length,!this.length)return}return t=this.saved[this.i],this.i=(this.i+1)%this.length,t},slots:{tp$doc:\"cycle(iterable) --\\x3e cycle object\\n\\nReturn elements from the iterable until it is exhausted.\\nThen repeat the sequence indefinitely.\",tp$new(t,i){Sk.abstr.checkOneArg(\"cycle\",t,i);const r=Sk.abstr.iter(t[0]);if(this===e.cycle.prototype)return new e.cycle(r);{const t=new this.constructor;return e.cycle.call(t,r),t}}}}),e.dropwhile=Sk.abstr.buildIteratorClass(\"itertools.dropwhile\",{constructor:function dropwhile(t,e){this.predicate=t,this.iter=e,this.passed},iternext(){let t=this.iter.tp$iternext();for(;void 0===this.passed&&void 0!==t;){const e=Sk.misceval.callsimArray(this.predicate,[t]);if(!Sk.misceval.isTrue(e))return this.passed=!0,t;t=this.iter.tp$iternext()}return t},slots:{tp$doc:\"dropwhile(predicate, iterable) --\\x3e dropwhile object\\n\\nDrop items from the iterable while predicate(item) is true.\\nAfterwards, return every element until the iterable is exhausted.\",tp$new(t,i){Sk.abstr.checkNoKwargs(\"dropwhile\",i),Sk.abstr.checkArgsLen(\"dropwhile\",t,2,2);const r=t[0],s=Sk.abstr.iter(t[1]);if(this===e.dropwhile.prototype)return new e.dropwhile(r,s);{const t=new this.constructor;return e.dropwhile.call(t,r,s),t}}}}),e.filterfalse=Sk.abstr.buildIteratorClass(\"itertools.filterfalse\",{constructor:function filterfalse(t,e){this.predicate=t,this.iter=e},iternext(t){let e=this.iter.tp$iternext();if(void 0===e)return;let i=Sk.misceval.callsimArray(this.predicate,[e]);for(;Sk.misceval.isTrue(i);){if(e=this.iter.tp$iternext(),void 0===e)return;i=Sk.misceval.callsimArray(this.predicate,[e])}return e},slots:{tp$doc:\"filterfalse(function or None, sequence) --\\x3e filterfalse object\\n\\nReturn those items of sequence for which function(item) is false.\\nIf function is None, return the items that are false.\",tp$new(t,i){Sk.abstr.checkNoKwargs(\"filterfalse\",i),Sk.abstr.checkArgsLen(\"filterfalse\",t,2,2);const r=Sk.builtin.checkNone(t[0])?Sk.builtin.bool:t[0],s=Sk.abstr.iter(t[1]);if(this===e.filterfalse.prototype)return new e.filterfalse(r,s);{const t=new this.constructor;return e.filterfalse.call(t,r,s),t}}}}),e._grouper=Sk.abstr.buildIteratorClass(\"itertools._grouper\",{constructor:function _grouper(t,e){this.groupby=t,this.tgtkey=t.tgtkey,this.id=t.id},iternext(t){const e=Sk.misceval.richCompareBool(this.groupby.currkey,this.tgtkey,\"Eq\");if(this.groupby.id===this.id&&e){let t=this.groupby.currval;return this.groupby.currval=this.groupby.iter.tp$iternext(),void 0!==this.groupby.currval&&(this.groupby.currkey=Sk.misceval.callsimArray(this.groupby.keyf,[this.groupby.currval])),t}}}),e.groupby=Sk.abstr.buildIteratorClass(\"itertools.groupby\",{constructor:function groupby(t,e){this.iter=t,this.keyf=e,this.currval,this.currkey=this.tgtkey=new Sk.builtin.object,this.id},iternext(t){this.id=new Object;let i=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,\"Eq\");for(;i;){if(this.currval=this.iter.tp$iternext(),void 0===this.currval)return;this.currkey=Sk.misceval.callsimArray(this.keyf,[this.currval]),i=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,\"Eq\")}this.tgtkey=this.currkey;const r=new e._grouper(this);return new Sk.builtin.tuple([this.currkey,r])},slots:{tp$doc:\"groupby(iterable, key=None) -> make an iterator that returns consecutive\\nkeys and groups from the iterable. If the key function is not specified or\\nis None, the element itself is used for grouping.\\n\",tp$new(t,i){let r,s;if([r,s]=Sk.abstr.copyKeywordsToNamedArgs(\"groupby\",[\"iterable\",\"key\"],t,i,[Sk.builtin.none.none$]),r=Sk.abstr.iter(r),s=Sk.builtin.checkNone(s)?new Sk.builtin.func((t=>t)):s,this===e.groupby.prototype)return new e.groupby(r,s);{const t=new this.constructor;return e.groupby.call(t,r,s),t}}}}),e.islice=Sk.abstr.buildIteratorClass(\"itertools.islice\",{constructor:function islice(t,e,i,r){this.iter=t,this.previt=e,this.stop=i,this.step=r,this.tp$iternext=()=>{if(this.tp$iternext=this.constructor.prototype.tp$iternext,!(this.previt>=this.stop)){for(let t=0;t=this.stop)){for(let t=this.previt+1;tNumber.MAX_SAFE_INTEGER)throw new Sk.builtin.ValueError(\"Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(!Sk.builtin.checkNone(s)&&!Sk.misceval.isIndex(s))throw new Sk.builtin.ValueError(\"Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(s=Sk.builtin.checkNone(s)?0:Sk.misceval.asIndexSized(s),s<0||s>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.ValueError(\"Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\");if(!Sk.builtin.checkNone(o)&&!Sk.misceval.isIndex(o))throw new Sk.builtin.ValueError(\"Step for islice() must be a positive integer or None\");if(o=Sk.builtin.checkNone(o)?1:Sk.misceval.asIndexSized(o),o<=0||o>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.ValueError(\"Step for islice() must be a positive integer or None.\");if(this===e.islice.prototype)return new e.islice(r,s,n,o);{const t=new this.constructor;return e.islice.call(t,r,s,n,o),t}}}}),e.permutations=Sk.abstr.buildIteratorClass(\"itertools.permutations\",{constructor:function permutations(t,e){this.pool=t,this.r=e;const i=t.length;this.indices=new Array(i).fill().map(((t,e)=>e)),this.cycles=new Array(e).fill().map(((t,e)=>i-e)),this.n=i,this.tp$iternext=()=>{if(!(this.r>this.n))return this.tp$iternext=this.constructor.prototype.tp$iternext,new Sk.builtin.tuple(this.pool.slice(0,this.r))}},iternext(t){for(let e=this.r-1;e>=0;e--){if(this.cycles[e]--,0!=this.cycles[e]){const t=this.cycles[e];[this.indices[e],this.indices[this.n-t]]=[this.indices[this.n-t],this.indices[e]];const i=this.indices.map((t=>this.pool[t])).slice(0,this.r);return new Sk.builtin.tuple(i)}this.indices.push(this.indices.splice(e,1)[0]),this.cycles[e]=this.n-e}this.r=0},slots:{tp$doc:\"permutations(iterable[, r]) --\\x3e permutations object\\n\\nReturn successive r-length permutations of elements in the iterable.\\n\\npermutations(range(3), 2) --\\x3e (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)\",tp$new(t,i){let r,s;[r,s]=Sk.abstr.copyKeywordsToNamedArgs(\"permutations\",[\"iterable\",\"r\"],t,i,[Sk.builtin.none.none$]);const n=Sk.misceval.arrayFromIterable(r);if(s=Sk.builtin.checkNone(s)?n.length:Sk.misceval.asIndexSized(s,Sk.builtin.OverFlowError),s<0)throw new Sk.builtin.ValueError(\"r must be non-negative\");if(this===e.permutations.prototype)return new e.permutations(n,s);{const t=new this.constructor;return e.permutations.call(t,n,s),t}}}}),e.product=Sk.abstr.buildIteratorClass(\"itertools.product\",{constructor:function product(t){this.pools=t,this.n=t.length,this.indices=Array(t.length).fill(0),this.pool_sizes=t.map((t=>t.length)),this.tp$iternext=()=>{this.tp$iternext=this.constructor.prototype.tp$iternext;const t=this.indices.map(((t,e)=>this.pools[e][this.indices[e]]));if(!t.some((t=>void 0===t)))return new Sk.builtin.tuple(t);this.n=0}},iternext(t){let e=this.n-1;for(;e>=0&&e=this.pool_sizes[e]?(this.indices[e]=-1,e--):e++;if(this.n&&!this.indices.every((t=>-1===t))){const t=this.indices.map(((t,e)=>this.pools[e][this.indices[e]]));return new Sk.builtin.tuple(t)}this.n=0},slots:{tp$doc:\"product(*iterables, repeat=1) --\\x3e product object\\n\\nCartesian product of input iterables. Equivalent to nested for-loops.\\n\\nFor example, product(A, B) returns the same as: ((x,y) for x in A for y in B).\\nThe leftmost iterators are in the outermost for-loop, so the output tuples\\ncycle in a manner similar to an odometer (with the rightmost element changing\\non every iteration).\\n\\nTo compute the product of an iterable with itself, specify the number\\nof repetitions with the optional repeat keyword argument. For example,\\nproduct(A, repeat=4) means the same as product(A, A, A, A).\\n\\nproduct('ab', range(3)) --\\x3e ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2)\\nproduct((0,1), (0,1), (0,1)) --\\x3e (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ...\",tp$new(t,i){let[r]=Sk.abstr.copyKeywordsToNamedArgs(\"product\",[\"repeat\"],[],i,[new Sk.builtin.int_(1)]);if(r=Sk.misceval.asIndexSized(r,Sk.builtin.OverFlowError),r<0)throw new Sk.builtin.ValueError(\"repeat argument cannot be negative\");const s=[];for(let e=0;ethis.object)},iternext(t){return this.times-- >0?this.object:void 0},slots:{tp$doc:\"repeat(object [,times]) -> create an iterator which returns the object\\nfor the specified number of times. If not specified, returns the object\\nendlessly.\",tp$new(t,i){let r,s;if([r,s]=Sk.abstr.copyKeywordsToNamedArgs(\"repeat\",[\"object\",\"times\"],t,i,[null]),s=null!==s?Sk.misceval.asIndexSized(s,Sk.builtin.OverFlowError):void 0,this===e.repeat.prototype)return new e.repeat(r,s);{const t=new this.constructor;return e.repeat.call(t,r,s),t}},$r(){const t=Sk.misceval.objectRepr(this.object),e=void 0===this.times?\"\":\", \"+(this.times>=0?this.times:0);return new Sk.builtin.str(Sk.abstr.typeName(this)+\"(\"+t+e+\")\")}},methods:{__lenght_hint__:{$meth(){if(void 0===this.times)throw new Sk.builtin.TypeError(\"len() of unsized object\");return new Sk.builtin.int_(this.times)},$flags:{NoArgs:!0},$textsig:null}}}),e.starmap=Sk.abstr.buildIteratorClass(\"itertools.starmap\",{constructor:function starmap(t,e){this.func=t,this.iter=e},iternext(t){const e=this.iter.tp$iternext();if(void 0===e)return;const i=Sk.misceval.arrayFromIterable(e);return Sk.misceval.callsimArray(this.func,i)},slots:{tp$new(t,i){let r,s;if([r,s]=Sk.abstr.copyKeywordsToNamedArgs(\"starmap\",[\"func\",\"iterable\"],t,i,[]),s=Sk.abstr.iter(s),r=Sk.builtin.checkNone(r)?Sk.builtin.bool:r,this===e.starmap.prototype)return new e.starmap(r,s);{const t=new this.constructor;return e.starmap.call(t,r,s),t}}}}),e.takewhile=Sk.abstr.buildIteratorClass(\"itertools.takewhile\",{constructor:function takewhile(t,e){this.predicate=t,this.iter=e},iternext(){const t=this.iter.tp$iternext();if(void 0!==t){const e=Sk.misceval.callsimArray(this.predicate,[t]);if(Sk.misceval.isTrue(e))return t;this.tp$iternext=()=>{}}},slots:{tp$doc:\"takewhile(predicate, iterable) --\\x3e takewhile object\\n\\nReturn successive entries from an iterable as long as the \\npredicate evaluates to true for each entry.\",tp$new(t,i){Sk.abstr.checkNoKwargs(\"takewhile\",i),Sk.abstr.checkArgsLen(\"takewhile\",t,2,2);const r=t[0],s=Sk.abstr.iter(t[1]);if(this===e.takewhile.prototype)return new e.takewhile(r,s);{const t=new this.constructor;return e.takewhile.call(t,r,s),t}}}}),e.tee=new Sk.builtin.func((function(){throw new Sk.builtin.NotImplementedError(\"tee is not yet implemented in Skulpt\")})),e.zip_longest=Sk.abstr.buildIteratorClass(\"itertools.zip_longest\",{constructor:function zip_longest(t,e){this.iters=t,this.fillvalue=e,this.active=this.iters.length},iternext(t){if(!this.active)return;let i;const r=[];for(let s=0;s{throw new a(e+\" is not yet implemented in skulpt\")}))}const j=E.JSONDecodeError=N(\"json.JSONDecodeError\",{base:l,constructor:function JSONDecodeError(e,t,n){const r=t.slice(0,n),o=r.split(\"\\n\").length,s=n-r.lastIndexOf(\"\\n\"),i=`${e}: line ${o} column ${s} (char ${n})`;l.call(this,i),this.$msg=e,this.$doc=t,this.$pos=n,this.$lineno=o,this.$colno=s},getsets:Object.fromEntries([\"msg\",\"doc\",\"pos\",\"lineno\",\"colno\"].map((e=>[e,{$get(){return g(this[\"$\"+e])}}])))});class JSONEncoder{constructor(e,t,n,r,o,s,i,l){this.skipkeys=e,this.ensure_ascii=t,this.check_circular=n,this.allow_nan=r,this.indent=o,this.separators=s,this.sort_keys=l,this.item_separator=\", \",this.key_separator=\": \",null!==this.separators?[this.item_separator,this.key_separator]=this.separators:null!==this.indent&&(this.item_separator=\",\"),null!==i&&(this.default=i),this.encoder=this.make_encoder()}default(e){throw new i(`Object of type ${y(e)} is not JSON serializable`)}encode(t){return new e(this.encoder(t))}make_encoder(){let e,t;e=this.check_circular?new Set:null,t=(this.ensure_ascii,JSON.stringify);return function _make_iterencode(e,t,n,r,s,a,u,h,d){null!==r&&\"string\"!=typeof r&&(r=\" \".repeat(r));let f,p,g,w;null!==e?(f=t=>{if(e.has(t))throw new l(\"Circular reference detected\");e.add(t)},p=t=>e.delete(t)):(f=e=>{},p=e=>{});null!==r?(g=(e,t)=>{t+=1;const n=\"\\n\"+r.repeat(t);return[e+=n,t,u+n]},w=(e,t,n)=>(n-=1,e+=\"\\n\"+r.repeat(n)+t)):(g=(e,t)=>[e,t,u],w=(e,t,n)=>e+t);const _unhandled=(e,n)=>{f(e);const r=_iterencode(t(e),n);return p(e),r},_iterencode_list=(e,t)=>{if(!e.length)return\"[]\";let n,r;f(e),[n,t,r]=g(\"[\",t);let o=!0;for(let s of e)o?o=!1:n+=r,n+=_iterencode(s,t);return p(e),w(n,\"]\",t)},_iterencode_dict=(e,t)=>{if(!e.sq$length())return\"{}\";let r,l;f(e),[r,t,l]=g(\"{\",t);let u=!0;if(h){const t=$(e.tp$getattr(v)),n=c(t);e=$(o,[n])}for(let[o,c]of e.$items()){const e=o.valueOf(),h=typeof e;if(\"string\"===h)o=e;else if(\"number\"===h)o=s(o);else if(\"boolean\"===h||null===e)o=String(e);else{if(!JSBI.__isBigInt(e)){if(d)continue;throw new i(\"keys must be str, int, float, bool or None, not \"+y(o))}o=e.toString()}u?u=!1:r+=l,r+=n(o),r+=a,r+=_iterencode(c,t)}return p(e),w(r,\"}\",t)},_iterencode=(e,t=0)=>String(m(e,{stringHook:e=>n(e),numberHook:(e,t)=>s(t),bigintHook:e=>e.toString(),dictHook:e=>_iterencode_dict(e,t),arrayHook:e=>_iterencode_list(e,t),setHook:e=>_unhandled(e,t),funcHook:(e,n)=>_unhandled(n,t),objecthook:(e,n)=>_unhandled(n,t),unhandledHook:e=>_unhandled(e,t)}));return _iterencode}(e,this.default,t,this.indent,((e,t=this.allow_nan)=>{const n=e.valueOf();let r;if(Number.isFinite(n))return J(e);if(r=n.toString(),!t)throw new l(\"Out of range float values are not JSON compliant: \"+J(e));return r}),this.key_separator,this.item_separator,this.sort_keys,this.skipkeys)}}const v=new e(\"items\");const x=[!1,!0,!0,!0,null,null,null,!1],D=new JSONEncoder(...x),F=/(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?/;const I=/\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"/m;function scanstring(t,n){const r=t.substring(n-1).match(I);if(null===r)throw new j(\"Unterminated string starting at\",t,n-1);try{return[new e(JSON.parse(r[0])),n+r[0].length-1]}catch(o){let e=o.message.match(/(?:column|position) (\\d+)/);e=e&&Number(e[1]);n=n+(e||0)-(void 0===o.columnNumber?1:2);const r=o.message.replace(\"JSON.parse: \",\"\").replace(/ at line \\d+ column \\d+ of the JSON data/,\"\").replace(/ in JSON at position \\d+$/,\"\");throw new j(r,t,n)}}const A=/[ \\t\\n\\r]*/;function JSONArray(e,t,r){const o=[];let s=e[t];const adjust_white_space=()=>{if(\" \"===s||\"\\t\"===s||\"\\n\"===s||\"\\r\"===s){const n=e.substring(t).match(A);t+=n[0].length,s=e[t]}};if(adjust_white_space(),\"]\"===s)return[new n([]),t+1];for(;;){let n;if([n,t]=r(e,t),void 0===n)throw new j(\"Expecting value\",e,t);if(o.push(n),s=e[t],adjust_white_space(),t++,\"]\"===s)break;if(\",\"!==s)throw new j(\"Expecting ',' delimiter\",e,t-1);s=e[t],adjust_white_space()}return[new n(o),t]}function JSONObject(e,t,s,i,l){let a=[],c=e[t];const adjust_white_space=()=>{if(\" \"===c||\"\\t\"===c||\"\\n\"===c||\"\\r\"===c){const n=e.substring(t).match(A);t+=n[0].length,c=e[t]}};if('\"'!==c){if(adjust_white_space(),\"}\"===c){if(null!==l){return[l(new n([])),t+1]}return a=new o([]),null!==i&&(a=i(a)),[a,t+1]}if('\"'!==c)throw new j(\"Expecting property name enclosed in double quotes\",e,t)}let u,h;for(t+=1;;){if([u,t]=scanstring(e,t),\":\"!==(c=e[t])&&(adjust_white_space(),\":\"!==e[t]))throw new j(\"Expecting ':' delimiter\",e,t);if(c=e[++t],adjust_white_space(),[h,t]=s(e,t),void 0===h)throw new j(\"Expecting value\",e,t);if(c=e[t],a.push([u,h]),adjust_white_space(),t++,\"}\"===c)break;if(\",\"!==c)throw new j(\"Expecting ',' delimiter\",e,t-1);if(c=e[t],adjust_white_space(),t++,'\"'!==c)throw new j(\"Expecting property name enclosed in double quotes\",e,t-1)}if(null!==l){return[l(new n(a.map((e=>new r(e))))),t]}return a=new o(a.flat()),null!==i&&(a=i(a)),[a,t]}const H={NaN:new t(NaN),Infinity:new t(1/0),\"-Infinity\":new t(-1/0)};class JSONDecoder{constructor(e,t,n,r,o){this.object_hook=e,this.parse_float=t||w,this.parse_int=n||_,this.parse_constant=r||(e=>H[e]),this.object_pairs_hook=o,this.parse_object=JSONObject,this.parse_array=JSONArray,this.parse_string=scanstring,this.scan_once=function make_scanner(e){const{parse_object:t,parse_array:n,parse_string:r,parse_float:o,parse_int:s,parse_constant:i,object_hook:l,object_pairs_hook:a}=e,scan_once=(e,c)=>{const f=e[c];if(void 0===f)return[f,c];if('\"'===f)return r(e,c+1);if(\"{\"===f)return t(e,c+1,scan_once,l,a);if(\"[\"===f)return n(e,c+1,scan_once);if(\"n\"===f&&\"null\"===e.substring(c,c+4))return[u,c+4];if(\"t\"===f&&\"true\"===e.substring(c,c+4))return[h,c+4];if(\"f\"===f&&\"false\"===e.substring(c,c+5))return[d,c+5];const p=e.substring(c).match(F);if(null!==p){let e;const[t,n,r,i]=p;return e=r||i?o(n+(r||\"\")+(i||\"\")):s(n),[e,c+t.length]}return\"N\"===f&&\"NaN\"===e.substring(c,c+3)?[i(\"NaN\"),c+3]:\"I\"==f&&\"Infinity\"===e.substring(c,c+8)?[i(\"Infinity\"),c+8]:\"-\"==f&&\"-Infinity\"===e.substring(c,c+9)?[i(\"-Infinity\"),c+9]:[void 0,c]};return scan_once}(this)}white(e,t){const n=(0===t?e:e.substring(t)).match(A);return null!==n&&(t+=n[0].length),t}decode(e){e=e.toString();let[t,n]=this.scan_once(e,this.white(e,0));if(void 0===t)throw new j(\"Expecting value\",e,n);if(n=this.white(e,n),n!==e.length)throw new j(\"Extra data\",e,n);return t}}const T=Array(5).fill(null),C=new JSONDecoder(...T);function convertToNullOrFunc(e){return null===e||e===u?null:t=>$(e,[g(t)])}return k(\"json\",E,{loads:{$meth(e,t){O(\"dumps\",e);let n=e[0];if(f(n));else{if(!p(n))throw new i(`the JSON object must be str or bytes, not ${y(n)}`);n=(new TextDecoder).decode(n.valueOf())}const r=S(\"dumps\",[\"object_hook\",\"parse_float\",\"parse_int\",\"parse_constant\",\"object_pairs_hook\"],[],t,T).map(convertToNullOrFunc);return r.every((e=>null===e))?C.decode(n):new JSONDecoder(...r).decode(n)},$doc:\"Deserialize ``s`` (a ``str`` or ``bytes`` instance containing a JSON document) to a Python object.\",$flags:{FastCall:!0}},dumps:{$meth(e,t){O(\"dumps\",e);const n=e[0];let[r,o,s,l,a,c,u,h]=S(\"loads\",[\"skipkeys\",\"ensure_ascii\",\"check_circular\",\"allow_nan\",\"indent\",\"separators\",\"default\",\"sort_keys\"],[],t,x);if(r=b(r),o=b(o),s=b(s),l=b(l),a=m(a),c=m(c),u=convertToNullOrFunc(u),h=b(h),!r&&o&&s&&l&&null===a&&null===c&&null===u&&!h)return D.encode(n);if(null===c);else if(!Array.isArray(c)||2!==c.length||\"string\"!=typeof c[0]||\"string\"!=typeof c[1])throw new i(\"separators shuld be a list or tuple of strings of length 2\");return new JSONEncoder(r,o,s,l,a,c,u,h).encode(n)},$doc:\"Serialize ``obj`` to a JSON formatted ``str``\",$flags:{FastCall:!0}}}),E}","src/lib/keyword.js":"function $builtinmodule(){const{ffi:{remapToPy:t},builtin:{frozenset:e,str:s}}=Sk,i=new s(\"keyword\"),n=t([\"iskeyword\",\"issoftkeyword\",\"kwlist\",\"softkwlist\"]),o=t([\"False\",\"None\",\"True\",\"and\",\"as\",\"assert\",\"async\",\"await\",\"break\",\"class\",\"continue\",\"def\",\"del\",\"elif\",\"else\",\"except\",\"finally\",\"for\",\"from\",\"global\",\"if\",\"import\",\"in\",\"is\",\"lambda\",\"nonlocal\",\"not\",\"or\",\"pass\",\"raise\",\"return\",\"try\",\"while\",\"with\",\"yield\"]),a=t([\"_\",\"case\",\"match\"]);return{__name__:i,__all__:n,kwlist:o,softkwlist:a,iskeyword:new e(o).tp$getattr(s.$contains),issoftkeyword:new e(a).tp$getattr(s.$contains)}}","src/lib/math.js":"const $builtinmodule=function(e){const{builtin:{str:t,int_:n,float_:i,TypeError:r,pyCheckType:u,checkNumber:l},abstr:{lookupSpecial:o},misceval:{callsimOrSuspendArray:a}}=Sk,s={pi:new Sk.builtin.float_(Math.PI),e:new Sk.builtin.float_(Math.E),tau:new Sk.builtin.float_(2*Math.PI),nan:new Sk.builtin.float_(NaN),inf:new Sk.builtin.float_(1/0)},b=new t(\"__ceil__\");const get_sign=function(e){return e=e?e<0?-1:1:1/e<0?-1:1};function factorial(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));let t=Sk.builtin.asnum$(e);if((e=Math.floor(t))!=t)throw new Sk.builtin.ValueError(\"factorial() only accepts integral values\");if(e<0)throw new Sk.builtin.ValueError(\"factorial() not defined for negative numbers\");let n=1;for(let i=2;i<=e&&i<=18;i++)n*=i;if(e<=18)return new Sk.builtin.int_(n);n=JSBI.BigInt(n);for(let i=19;i<=e;i++)n=JSBI.multiply(n,JSBI.BigInt(i));return new Sk.builtin.int_(n)}const c=new t(\"__floor__\");function _gcd_internal(e,t){let n;return\"number\"==typeof e&&\"number\"==typeof t?(n=function _gcd(e,t){return 0==t?e:_gcd(t,e%t)}(e=Math.abs(e),t=Math.abs(t)),n=n<0?-n:n):(n=function _biggcd(e,t){return JSBI.equal(t,JSBI.__ZERO)?e:_biggcd(t,JSBI.remainder(e,t))}(e=JSBI.BigInt(e),t=JSBI.BigInt(t)),JSBI.lessThan(n,JSBI.__ZERO)&&(n=JSBI.multiply(n,JSBI.BigInt(-1)))),n}return Sk.abstr.setUpModuleMethods(\"math\",s,{acos:{$meth:function acos(e){return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.acos(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the arc cosine (measured in radians) of x.\"},acosh:{$meth:function acosh(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=(e=Sk.builtin.asnum$(e))+Math.sqrt(e*e-1);return new Sk.builtin.float_(Math.log(t))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the inverse hyperbolic cosine of x.\"},asin:{$meth:function asin(e){return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.asin(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the arc sine (measured in radians) of x.\"},asinh:{$meth:function asinh(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=(e=Sk.builtin.asnum$(e))+Math.sqrt(e*e+1);return new Sk.builtin.float_(Math.log(t))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the inverse hyperbolic sine of x.\"},atan:{$meth:function atan(e){return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.atan(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the arc tangent (measured in radians) of x.\"},atan2:{$meth:function atan2(e,t){return Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(t)),new Sk.builtin.float_(Math.atan2(Sk.builtin.asnum$(e),Sk.builtin.asnum$(t)))},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, y, x, /)\",$doc:\"Return the arc tangent (measured in radians) of y/x.\\n\\nUnlike atan(y/x), the signs of both x and y are considered.\"},atanh:{$meth:function atanh(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=(1+(e=Sk.builtin.asnum$(e)))/(1-e);return new Sk.builtin.float_(Math.log(t)/2)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the inverse hyperbolic tangent of x.\"},ceil:{$meth:function ceil(e){let t;if(e.ob$type!==i){const n=o(e,b);if(void 0!==n)return a(n);u(\"\",\"real number\",l(e)),t=Sk.builtin.asnum$(e)}else t=e.v;return new n(Math.ceil(t))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the ceiling of x as an Integral.\\n\\nThis is the smallest integer >= x.\"},comb:{$meth:function comb(e,t){let n=Sk.misceval.asIndexOrThrow(e),i=Sk.misceval.asIndexOrThrow(t);if(n<0)throw new Sk.builtin.ValueError(\"n must be an non-negative integer\");if(i<0)throw new Sk.builtin.ValueError(\"k must be a non-negative integer\");if(i>e)return new Sk.builtin.int_(0);e=new Sk.builtin.int_(n),t=new Sk.builtin.int_(i);let r=Sk.ffi.remapToJs(e.nb$subtract(t));if(rNumber.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError(\"min(n - k, k) must not exceed \"+Number.MAX_SAFE_INTEGER);const u=new Sk.builtin.int_(1);let l=e;for(let o=1;o n.\\n\\nIf k is not specified or is None, then k defaults to n\\nand the function returns n!.\\n\\nRaises TypeError if either of the arguments are not integers.\\nRaises ValueError if either of the arguments are negative.\"},copysign:{$meth:function copysign(e,t){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(t));const n=Sk.builtin.asnum$(t),i=Sk.builtin.asnum$(e),r=get_sign(i)*get_sign(n);return new Sk.builtin.float_(i*r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return a float with the magnitude (absolute value) of x but the sign of y.\\n\\nOn platforms that support signed zeros, copysign(1.0, -0.0)\\nreturns -1.0.\\n\"},cos:{$meth:function cos(e){return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.cos(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the cosine of x (measured in radians).\"},cosh:{$meth:function cosh(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),e=Sk.builtin.asnum$(e);const t=Math.E,n=Math.pow(t,e),i=(n+1/n)/2;return new Sk.builtin.float_(i)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the hyperbolic cosine of x.\"},degrees:{$meth:function degrees(e){Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e));const t=180/Math.PI*Sk.builtin.asnum$(e);return new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Convert angle x from radians to degrees.\"},erf:{$meth:function erf(e){throw new Sk.builtin.NotImplementedError(\"math.erf() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Error function at x.\"},erfc:{$meth:function erfc(e){throw new Sk.builtin.NotImplementedError(\"math.erfc() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Complementary error function at x.\"},exp:{$meth:function exp(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));let t=e.v;if(\"number\"!=typeof t&&(t=e.nb$float().v),t==1/0||t==-1/0||isNaN(t))return new Sk.builtin.float_(Math.exp(t));const n=Math.exp(t);if(!isFinite(n))throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(n)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return e raised to the power of x.\"},expm1:{$meth:function expm1(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);if(Math.abs(t)<.7){const e=Math.exp(t);if(1==e)return new Sk.builtin.float_(t);{const n=(e-1)*t/Math.log(e);return new Sk.builtin.float_(n)}}{const e=Math.exp(t)-1;return new Sk.builtin.float_(e)}},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return exp(x)-1.\\n\\nThis function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.\"},fabs:{$meth:function fabs(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));let t=e.v;return JSBI.__isBigInt(t)&&(t=e.nb$float().v),t=Math.abs(t),new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the absolute value of the float x.\"},factorial:{$meth:factorial,$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Find x!.\\n\\nRaise a ValueError if x is negative or non-integral.\"},floor:{$meth:function floor(e){let t;if(e.ob$type===i)t=e.v;else{const n=o(e,c);if(void 0!==n)return a(n);u(\"x\",\"number\",l(e)),t=Sk.builtin.asnum$(e)}return new n(Math.floor(t))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the floor of x as an Integral.\\n\\nThis is the largest integer <= x.\"},fmod:{$meth:function fmod(e,t){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(t));let n=e.v,i=t.v;if(\"number\"!=typeof n&&(n=e.nb$float().v),\"number\"!=typeof i&&(i=t.nb$float().v),(i==1/0||i==-1/0)&&isFinite(n))return new Sk.builtin.float_(n);const r=n%i;if(isNaN(r)&&!isNaN(n)&&!isNaN(i))throw new Sk.builtin.ValueError(\"math domain error\");return new Sk.builtin.float_(r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return fmod(x, y), according to platform C.\\n\\nx % y may differ.\"},frexp:{$meth:function frexp(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e),n=[t,0];if(0!==t&&Number.isFinite(t)){const e=Math.abs(t);let i=Math.max(-1023,Math.floor(Math.log2(e))+1),r=e*Math.pow(2,-i);for(;r<.5;)r*=2,i--;for(;r>=1;)r*=.5,i++;t<0&&(r=-r),n[0]=r,n[1]=i}return n[0]=new Sk.builtin.float_(n[0]),n[1]=new Sk.builtin.int_(n[1]),new Sk.builtin.tuple(n)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the mantissa and exponent of x, as pair (m, e).\\n\\nm is a float and e is an int, such that x = m * 2.**e.\\nIf x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.\"},fsum:{$meth:function fsum(e){if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError(\"'\"+Sk.abstr.typeName(e)+\"' object is not iterable\");let t,n,i,r=[];for(let l=(e=Sk.abstr.iter(e)).tp$iternext();void 0!==l;l=e.tp$iternext()){Sk.builtin.pyCheckType(\"\",\"real number\",Sk.builtin.checkNumber(l)),t=0;let e=l.v;\"number\"!=typeof e&&(e=l.nb$float().v),l=e;for(let u=0,o=r.length;u0;){n--;let t=a;a=JSBI.signedRightShift(u,JSBI.BigInt(n));const r=JSBI.subtract(JSBI.subtract(a,t),i),s=JSBI.leftShift(o,r),b=JSBI.add(JSBI.subtract(JSBI.subtract(l,t),a),i),c=JSBI.signedRightShift(e,b);o=JSBI.add(s,JSBI.divide(c,o))}let s=o;return JSBI.greaterThan(JSBI.multiply(s,s),e)&&(s=JSBI.subtract(s,i)),JSBI.lessThanOrEqual(s,JSBI.BigInt(Number.MAX_SAFE_INTEGER))&&(s=Number(s)),new Sk.builtin.int_(s)}(t)},$flags:{OneArg:!0},$textsig:\"($module, n, /)\",$doc:\"Return the integer part of the square root of the input.\"},lcm:{$meth:function lcm(...e){function abs(e){return\"number\"==typeof e?new Sk.builtin.int_(Math.abs(e)):JSBI.lessThan(e,JSBI.__ZERO)?new Sk.builtin.int_(JSBI.unaryMinus(e)):new Sk.builtin.int_(e)}const t=e.length;if(0===t)return new Sk.builtin.int_(1);let n;for(n=0;nNumber.MAX_SAFE_INTEGER?JSBI.BigInt(r):e}else r=JSBI.BigInt(r);\"number\"!=typeof r&&(i=JSBI.BigInt(i),r=JSBI.multiply(JSBI.divide(r,_gcd_internal(r,i)),i))}return abs(r)},$flags:{MinArgs:0},$textsig:\"($module, *integers, /)\",$doc:\"Return the least common multiple of the specified integer arguments. If all arguments are nonzero, then the returned value is the smallest positive integer that is a multiple of all arguments. If any of the arguments is zero, then the returned value is 0. lcm() without arguments returns 1.\"},ldexp:{$meth:function ldexp(e,t){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType(\"i\",\"integer\",Sk.builtin.checkInt(t));let n=e.v;\"number\"!=typeof n&&(n=e.nb$float().v);const i=Sk.builtin.asnum$(t);if(n==1/0||n==-1/0||0==n||isNaN(n))return new Sk.builtin.float_(n);const r=n*Math.pow(2,i);if(!isFinite(r))throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, i, /)\",$doc:\"Return x * (2**i).\\n\\nThis is essentially the inverse of frexp().\"},lgamma:{$meth:function lgamma(e){throw new Sk.builtin.NotImplementedError(\"math.lgamma() is not yet implemented in Skulpt\")},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Natural logarithm of absolute value of Gamma function at x.\"},log:{$meth:function log(e,t){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));let n,i,r=Sk.builtin.asnum$(e);if(r<=0)throw new Sk.builtin.ValueError(\"math domain error\");if(void 0===t?n=Math.E:(Sk.builtin.pyCheckType(\"base\",\"number\",Sk.builtin.checkNumber(t)),n=Sk.builtin.asnum$(t)),n<=0)throw new Sk.builtin.ValueError(\"math domain error\");if(Sk.builtin.checkFloat(e)||re)return new Sk.builtin.int_(0);if(0===t)return new Sk.builtin.int_(1);if(t>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError(\"k must not exceed \"+Number.MAX_SAFE_INTEGER);const n=new Sk.builtin.int_(1);let i=e=new Sk.builtin.int_(e);for(let r=1;r n.\\n\\nIf k is not specified or is None, then k defaults to n\\nand the function returns n!.\\n\\nRaises TypeError if either of the arguments are not integers.\\nRaises ValueError if either of the arguments are negative.'\"},prod:{$meth:function prod(e,t){Sk.abstr.checkArgsLen(\"prod\",e,1,1),e=Sk.abstr.copyKeywordsToNamedArgs(\"prod\",[null,\"start\"],e,t,[new Sk.builtin.int_(1)]);const n=Sk.abstr.iter(e[0]);let i,r=e[1];return i=r.constructor===Sk.builtin.int_?function fastProdInt(){return Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.int_)return e.constructor===Sk.builtin.float_?(r=r.nb$float().nb$multiply(e),new Sk.misceval.Break(\"float\")):(r=Sk.abstr.numberBinOp(r,e,\"Mult\"),new Sk.misceval.Break(\"slow\"));r=r.nb$multiply(e)}))}():r.constructor===Sk.builtin.float_?\"float\":\"slow\",Sk.misceval.chain(i,(e=>\"float\"===e?function fastProdFloat(){return Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.float_&&e.constructor!==Sk.builtin.int_)return r=Sk.abstr.numberBinOp(r,e,\"Mult\"),new Sk.misceval.Break(\"slow\");r=r.nb$multiply(e)}))}():e),(e=>{if(\"slow\"===e)return function slowProd(){return Sk.misceval.iterFor(n,(e=>{r=Sk.abstr.numberBinOp(r,e,\"Mult\")}))}()}),(()=>r))},$flags:{FastCall:!0},$textsig:\"($module, iterable, /, *, start=1)\",$doc:\"Calculate the product of all the elements in the input iterable. The default start value for the product is 1.\\n\\nWhen the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types.\"},pow:{$meth:function pow(e,t){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(t));let n=e.v,i=t.v;if(\"number\"!=typeof n&&(n=e.nb$float().v),\"number\"!=typeof i&&(i=t.nb$float().v),0==n&&i<0)throw new Sk.builtin.ValueError(\"math domain error\");if(1==n)return new Sk.builtin.float_(1);if(Number.isFinite(n)&&Number.isFinite(i)&&n<0&&!Number.isInteger(i))throw new Sk.builtin.ValueError(\"math domain error\");if(-1==n&&(i==-1/0||i==1/0))return new Sk.builtin.float_(1);const r=Math.pow(n,i);if(!Number.isFinite(n)||!Number.isFinite(i))return new Sk.builtin.float_(r);if(r==1/0||r==-1/0)throw new Sk.builtin.OverflowError(\"math range error\");return new Sk.builtin.float_(r)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Return x**y (x to the power of y).\"},radians:{$meth:function radians(e){Sk.builtin.pyCheckType(\"deg\",\"number\",Sk.builtin.checkNumber(e));const t=Math.PI/180*Sk.builtin.asnum$(e);return new Sk.builtin.float_(t)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Convert angle x from degrees to radians.\"},remainder:{$meth:function remainder(e,t){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType(\"y\",\"number\",Sk.builtin.checkNumber(t));let n=e.v,i=t.v;if(\"number\"!=typeof n&&(n=e.nb$float().v),\"number\"!=typeof i&&(i=t.nb$float().v),isFinite(n)&&isFinite(i)){let e,t,r,u,l;if(0==i)throw new Sk.builtin.ValueError(\"math domain error\");if(e=Math.abs(n),t=Math.abs(i),u=e%t,r=t-u,ur)l=-r;else{if(u!=r)throw new Sk.builtin.AssertionError;l=u-.5*(e-u)%t*2}return new Sk.builtin.float_(get_sign(n)*l)}if(isNaN(n))return e;if(isNaN(i))return t;if(n==1/0||n==-1/0)throw new Sk.builtin.ValueError(\"math domain error\");if(i!=1/0&&i!=-1/0)throw new Sk.builtin.AssertionError;return new Sk.builtin.float_(n)},$flags:{MinArgs:2,MaxArgs:2},$textsig:\"($module, x, y, /)\",$doc:\"Difference between x and the closest integer multiple of y.\\n\\nReturn x - n*y where n*y is the closest integer multiple of y.\\nIn the case where x is exactly halfway between two multiples of\\ny, the nearest even value of n is used. The result is always exact.\"},sin:{$meth:function sin(e){return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.sin(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the sine of x (measured in radians).\"},sinh:{$meth:function sinh(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e)),e=Sk.builtin.asnum$(e);const t=Math.E,n=Math.pow(t,e),i=(n-1/n)/2;return new Sk.builtin.float_(i)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the hyperbolic sine of x.\"},sqrt:{$meth:function sqrt(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);if(t<0)throw new Sk.builtin.ValueError(\"math domain error\");return new Sk.builtin.float_(Math.sqrt(t))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the square root of x.\"},tan:{$meth:function tan(e){return Sk.builtin.pyCheckType(\"rad\",\"number\",Sk.builtin.checkNumber(e)),new Sk.builtin.float_(Math.tan(Sk.builtin.asnum$(e)))},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the tangent of x (measured in radians).\"},tanh:{$meth:function tanh(e){Sk.builtin.pyCheckType(\"x\",\"number\",Sk.builtin.checkNumber(e));const t=Sk.builtin.asnum$(e);if(0===t)return new Sk.builtin.float_(t);const n=Math.E,i=Math.pow(n,t),r=1/i,u=(i-r)/2/((i+r)/2);return new Sk.builtin.float_(u)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Return the hyperbolic tangent of x.\"},trunc:{$meth:function trunc(e){if(e.ob$type===i)return e.nb$int();const n=o(e,t.$trunc);if(void 0===n)throw new r(`type ${e.tp$name} doesn't define __trunc__ method`);return a(n)},$flags:{OneArg:!0},$textsig:\"($module, x, /)\",$doc:\"Truncates the Real x to the nearest Integral toward 0.\\n\\nUses the __trunc__ magic method.\"}}),s};","src/lib/operator.js":"function $builtinmodule(e){const{builtin:{str:t,tuple:a,list:r,int_:o,bool:n,TypeError:s,ValueError:i,none:{none$:m},NotImplemented:{NotImplemented$:d},abs:l,len:h,checkString:u,checkInt:c},abstr:{buildNativeClass:M,checkNoKwargs:b,checkArgsLen:g,checkOneArg:f,numberUnaryOp:p,numberBinOp:A,numberInplaceBinOp:k,objectGetItem:$,objectDelItem:_,objectSetItem:w,sequenceConcat:v,sequenceContains:x,sequenceGetCountOf:j,sequenceGetIndexOf:O,sequenceInPlaceConcat:I,typeName:S,lookupSpecial:y,gattr:q,setUpModuleMethods:R},misceval:{richCompareBool:B,asIndexOrThrow:N,chain:E,callsimArray:T,callsimOrSuspendArray:C,objectRepr:D},generic:{getAttr:G}}=Sk,L=[\"abs\",\"add\",\"and_\",\"concat\",\"contains\",\"delitem\",\"eq\",\"floordiv\",\"ge\",\"getitem\",\"gt\",\"iadd\",\"iand\",\"iconcat\",\"ifloordiv\",\"ilshift\",\"imatmul\",\"imod\",\"imul\",\"index\",\"inv\",\"invert\",\"ior\",\"ipow\",\"irshift\",\"isub\",\"itruediv\",\"ixor\",\"le\",\"lshift\",\"lt\",\"matmul\",\"mod\",\"mul\",\"ne\",\"neg\",\"not_\",\"or_\",\"pos\",\"pow\",\"rshift\",\"setitem\",\"sub\",\"truediv\",\"xor\"],F=[\"attrgetter\",\"countOf\",\"indexOf\",\"is_\",\"is_not\",\"itemgetter\",\"length_hint\",\"methodcaller\",\"truth\",...L].sort(),P={__name__:new t(\"operator\"),__doc__:new t(\"Operator interface.\\n\\nThis module exports a set of functions implemented in javascript corresponding\\nto the intrinsic operators of Python. For example, operator.add(x, y)\\nis equivalent to the expression x+y. The function names are those\\nused for special methods; variants without leading and trailing\\n'__' are also provided for convenience.\"),__all__:new r(F.map((e=>new t(e))))};P.itemgetter=M(\"operator.itemgetter\",{constructor:function itemgetter(e){this.items=e,this.oneitem=1===e.length,this.item=e[0],this.in$repr=!1},slots:{tp$getattr:G,tp$new:(e,t)=>(b(\"itemgetter\",t),g(\"itemgetter\",e,1),new P.itemgetter(e)),tp$call(e,t){f(\"itemgetter\",e,t);const r=e[0];return this.oneitem?$(r,this.item,!0):new a(this.items.map((e=>$(r,e))))},tp$doc:\"Return a callable object that fetches the given item(s) from its operand.\\n After f = itemgetter(2), the call f(r) returns r[2].\\n After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])\",$r(){if(this.in$repr)return new t(this.tp$name+\"(...)\");this.in$repr=!0;const e=this.tp$name+\"(\"+this.items.map((e=>D(e))).join(\", \")+\")\";return this.in$repr=!1,e}}}),P.attrgetter=M(\"operator.attrgetter\",{constructor:function attrgetter(e){this.attrs=e,this.oneattr=1===e.length,this.attr=e[0],this.in$repr=!1},slots:{tp$getattr:G,tp$new(e,a){b(\"attrgetter\",a),g(\"attrgetter\",e,1);const r=[];for(let o=0;onew t(e)))):r.push([a])}return new P.attrgetter(r)},tp$call(e,t){f(\"attrgetter\",e,t);const r=e[0];if(this.oneattr)return this.attr.reduce(((e,t)=>q(e,t)),r);const o=this.attrs.map((e=>e.reduce(((e,t)=>q(e,t)),r)));return new a(o)},tp$doc:\"attrgetter(attr, ...) --\\x3e attrgetter object\\n\\nReturn a callable object that fetches the given attribute(s) from its operand.\\nAfter f = attrgetter('name'), the call f(r) returns r.name.\\nAfter g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).\\nAfter h = attrgetter('name.first', 'name.last'), the call h(r) returns\\n(r.name.first, r.name.last).\",$r(){if(this.in$repr)return new t(this.tp$name+\"(...)\");this.in$repr=!0;const e=this.tp$name+\"(\"+this.items.map((e=>D(e))).join(\", \")+\")\";return this.in$repr=!1,e}}}),P.methodcaller=M(\"operator.methodcaller\",{constructor:function methodcaller(e,t,a){this.$name=e,this.args=t,this.kwargs=a||[],this.in$repr=!1},slots:{tp$getattr:G,tp$new(e,t){g(\"methodcaller\",e,1);const a=e[0];if(!u(a))throw new s(\"method name must be a string\");return new P.methodcaller(a,e.slice(1),t)},tp$call(e,t){f(\"methodcaller\",e,t);const a=e[0];return E(q(a,this.$name,!0),(e=>C(e,this.args,this.kwargs)))},tp$doc:\"methodcaller(name, ...) --\\x3e methodcaller object\\n\\nReturn a callable object that calls the given method on its operand.\\nAfter f = methodcaller('name'), the call f(r) returns r.name().\\nAfter g = methodcaller('name', 'date', foo=1), the call g(r) returns\\nr.name('date', foo=1).\",$r(){if(this.in$repr)return new t(this.tp$name+\"(...)\");this.in$repr=!0;let e=[D(this.$name)];e.push(...this.args.map((e=>D(e))));for(let t=0;tn(B(e,t,\"Lt\"))),sameAs(\"a < b\")),le:makeModuleMethod(((e,t)=>n(B(e,t,\"LtE\"))),sameAs(\"a <= b\")),eq:makeModuleMethod(((e,t)=>n(B(e,t,\"Eq\"))),sameAs(\"a == b\")),ne:makeModuleMethod(((e,t)=>n(B(e,t,\"NotEq\"))),sameAs(\"a != b\")),ge:makeModuleMethod(((e,t)=>n(B(e,t,\"GtE\"))),sameAs(\"a >= b\")),gt:makeModuleMethod(((e,t)=>n(B(e,t,\"Gt\"))),sameAs(\"a > b\")),not_:makeModuleMethod((e=>p(e,\"Not\")),sameAs(\"not a\")),truth:makeModuleMethod((e=>n(e)),\"Return True if a is true, False otherwise.\"),is_:makeModuleMethod(((e,t)=>n(B(e,t,\"Is\"))),sameAs(\"a is b\")),is_not:makeModuleMethod(((e,t)=>n(B(e,t,\"IsNot\"))),sameAs(\"a is not b\")),abs:makeModuleMethod((e=>l(e)),sameAs(\"abs(a)\")),add:makeModuleMethod(((e,t)=>A(e,t,\"Add\")),sameAs(\"a + b\")),and_:makeModuleMethod(((e,t)=>A(e,t,\"BitAnd\")),sameAs(\"a & b\")),floordiv:makeModuleMethod(((e,t)=>A(e,t,\"FloorDiv\")),sameAs(\"a // b\")),index:makeModuleMethod((e=>new o(N(e))),sameAs(\"a.__index__()\")),inv:makeModuleMethod((e=>p(e,\"Invert\")),sameAs(\"~a\")),invert:makeModuleMethod((e=>p(e,\"Invert\")),sameAs(\"~a\")),lshift:makeModuleMethod(((e,t)=>A(e,t,\"LShift\")),sameAs(\"a << b\")),mod:makeModuleMethod(((e,t)=>A(e,t,\"Mod\")),sameAs(\"a % b\")),mul:makeModuleMethod(((e,t)=>A(e,t,\"Mult\")),sameAs(\"a * b\")),matmul:makeModuleMethod(((e,t)=>A(e,t,\"MatMult\")),sameAs(\"a @ b\")),neg:makeModuleMethod((e=>p(e,\"USub\")),sameAs(\"-a\")),or_:makeModuleMethod(((e,t)=>A(e,t,\"BitOr\")),sameAs(\"a | b\")),pos:makeModuleMethod((e=>p(e,\"UAdd\")),sameAs(\"+a\")),pow:makeModuleMethod(((e,t)=>A(e,t,\"Pow\")),sameAs(\"a ** b\")),rshift:makeModuleMethod(((e,t)=>A(e,t,\"RShift\")),sameAs(\"a >> b\")),sub:makeModuleMethod(((e,t)=>A(e,t,\"Sub\")),sameAs(\"a - b\")),truediv:makeModuleMethod(((e,t)=>A(e,t,\"Div\")),sameAs(\"a / b\")),xor:makeModuleMethod(((e,t)=>A(e,t,\"BitXor\")),sameAs(\"a ^ b\")),concat:makeModuleMethod(((e,t)=>v(e,t)),sameAs(\"a + b, for a and b sequences\")),contains:makeModuleMethod(((e,t)=>E(x(e,t),n)),sameAs(\"b in a (note reversed operands)\")),countOf:makeModuleMethod(((e,t)=>j(e,t)),\"Return thenumber of times b occurs in a.\"),delitem:makeModuleMethod(((e,t)=>E(_(e,t,!0),(()=>m))),sameAs(\"del a[b]\")),getitem:makeModuleMethod(((e,t)=>$(e,t,!0)),sameAs(\"a[b]\")),indexOf:makeModuleMethod(((e,t)=>O(e,t)),\"Return the first index of b in a\"),setitem:makeModuleMethod(((e,t,a)=>E(w(e,t,a,!0),(()=>m))),sameAs(\"a[b] = c\")),length_hint:{$meth:function length_hint(e,a){if(void 0===a)a=new o(0);else if(!c(a))throw new s(\"'\"+S(a)+\"' object cannot be interpreted as an integer\");try{return h(e)}catch(m){if(!(m instanceof s))throw m}const r=y(e,t.$length_hint);if(void 0===r)return a;let n;try{n=T(r,[])}catch(m){if(!(m instanceof s))throw m;return a}if(n===d)return a;if(!c(n))throw new s(\"__length_hint__ must be an integer, not \"+S(n));if(n.nb$isnegative())throw new i(\"__length_hint__() should return >= 0\");return n},$flags:{MinArgs:1,MaxArgs:2},$textsig:\"($module, obj, default=0, /)\",$doc:\"Return an estimate of the number of items in obj.\\n\\nThis is useful for presizing containers when building from an iterable.\\n\\nIf the object supports len(), the result will be exact.\\nOtherwise, it may over- or under-estimate by an arbitrary amount.\\nThe result will be an integer >= 0.\"},iadd:makeModuleMethod(((e,t)=>k(e,t,\"Add\")),sameAs(\"a += b\")),iand:makeModuleMethod(((e,t)=>k(e,t,\"BitAnd\")),sameAs(\"a &= b\")),iconcat:makeModuleMethod(((e,t)=>I(e,t)),sameAs(\"a += b, for a and b sequences\")),ifloordiv:makeModuleMethod(((e,t)=>k(e,t,\"FloorDiv\")),sameAs(\"a //= b\")),ilshift:makeModuleMethod(((e,t)=>k(e,t,\"LShift\")),sameAs(\"a <<= b\")),imod:makeModuleMethod(((e,t)=>k(e,t,\"Mod\")),sameAs(\"a %= b\")),imul:makeModuleMethod(((e,t)=>k(e,t,\"Mult\")),sameAs(\"a *= b\")),imatmul:makeModuleMethod(((e,t)=>k(e,t,\"MatMult\")),sameAs(\"a @= b\")),ior:makeModuleMethod(((e,t)=>k(e,t,\"BitOr\")),sameAs(\"a |= b\")),ipow:makeModuleMethod(((e,t)=>k(e,t,\"Pow\")),sameAs(\"a **= b\")),irshift:makeModuleMethod(((e,t)=>k(e,t,\"RShift\")),sameAs(\"a >>= b\")),isub:makeModuleMethod(((e,t)=>k(e,t,\"Sub\")),sameAs(\"a -= b\")),itruediv:makeModuleMethod(((e,t)=>k(e,t,\"Div\")),sameAs(\"a /= b\")),ixor:makeModuleMethod(((e,t)=>k(e,t,\"BitXor\")),sameAs(\"a ^= b\"))}),L.forEach((e=>{P[`__${e.replace(\"_\",\"\")}__`]=P[e]})),P.div=P.truediv,P.__div__=P.div,P}","src/lib/platform.js":"var $builtinmodule=function(n){var e={},i=\"undefined\"!=typeof window&&\"undefined\"!=typeof window.navigator;return e.python_implementation=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"python_implementation\",arguments.length,0,0),new Sk.builtin.str(\"Skulpt\")})),e.node=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"node\",arguments.length,0,0),new Sk.builtin.str(\"\")})),e.version=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"version\",arguments.length,0,0),new Sk.builtin.str(\"\")})),e.python_version=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen(\"python_version\",arguments.length,0,0),n=Sk.__future__.python_version?\"3.2.0\":\"2.7.0\",new Sk.builtin.str(n)})),e.system=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen(\"system\",arguments.length,0,0),n=i?window.navigator.appCodeName:\"\",new Sk.builtin.str(n)})),e.machine=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen(\"machine\",arguments.length,0,0),n=i?window.navigator.platform:\"\",new Sk.builtin.str(n)})),e.release=new Sk.builtin.func((function(){var n;return Sk.builtin.pyCheckArgsLen(\"release\",arguments.length,0,0),n=i?window.navigator.appVersion:\"\",new Sk.builtin.str(n)})),e.architecture=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"architecture\",arguments.length,0,0),new Sk.builtin.tuple([new Sk.builtin.str(\"64bit\"),new Sk.builtin.str(\"\")])})),e.processor=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"processor\",arguments.length,0,0),new Sk.builtin.str(\"\")})),e};","src/lib/processing.js":"var $builtinmodule=function(n){var i,e,t,u,o,s,l,c={__name__:new Sk.builtin.str(\"processing\")},r=[],v=!0,f=null;c.processing=null,c.p=null,c.X=new Sk.builtin.int_(0),c.Y=new Sk.builtin.int_(1),c.Z=new Sk.builtin.int_(2),c.R=new Sk.builtin.int_(3),c.G=new Sk.builtin.int_(4),c.B=new Sk.builtin.int_(5),c.A=new Sk.builtin.int_(6),c.U=new Sk.builtin.int_(7),c.V=new Sk.builtin.int_(8),c.NX=new Sk.builtin.int_(9),c.NY=new Sk.builtin.int_(10),c.NZ=new Sk.builtin.int_(11),c.EDGE=new Sk.builtin.int_(12),c.SR=new Sk.builtin.int_(13),c.SG=new Sk.builtin.int_(14),c.SB=new Sk.builtin.int_(15),c.SA=new Sk.builtin.int_(16),c.SW=new Sk.builtin.int_(17),c.TX=new Sk.builtin.int_(18),c.TY=new Sk.builtin.int_(19),c.TZ=new Sk.builtin.int_(20),c.VX=new Sk.builtin.int_(21),c.VY=new Sk.builtin.int_(22),c.VZ=new Sk.builtin.int_(23),c.VW=new Sk.builtin.int_(24),c.AR=new Sk.builtin.int_(25),c.AG=new Sk.builtin.int_(26),c.AB=new Sk.builtin.int_(27),c.DR=new Sk.builtin.int_(3),c.DG=new Sk.builtin.int_(4),c.DB=new Sk.builtin.int_(5),c.DA=new Sk.builtin.int_(6),c.SPR=new Sk.builtin.int_(28),c.SPG=new Sk.builtin.int_(29),c.SPB=new Sk.builtin.int_(30),c.SHINE=new Sk.builtin.int_(31),c.ER=new Sk.builtin.int_(32),c.EG=new Sk.builtin.int_(33),c.EB=new Sk.builtin.int_(34),c.BEEN_LIT=new Sk.builtin.int_(35),c.VERTEX_FIELD_COUNT=new Sk.builtin.int_(36),c.CENTER=new Sk.builtin.int_(3),c.RADIUS=new Sk.builtin.int_(2),c.CORNERS=new Sk.builtin.int_(1),c.CORNER=new Sk.builtin.int_(0),c.DIAMETER=new Sk.builtin.int_(3),c.BASELINE=new Sk.builtin.int_(0),c.TOP=new Sk.builtin.int_(101),c.BOTTOM=new Sk.builtin.int_(102),c.NORMAL=new Sk.builtin.int_(1),c.NORMALIZED=new Sk.builtin.int_(1),c.IMAGE=new Sk.builtin.int_(2),c.MODEL=new Sk.builtin.int_(4),c.SHAPE=new Sk.builtin.int_(5),c.AMBIENT=new Sk.builtin.int_(0),c.DIRECTIONAL=new Sk.builtin.int_(1),c.SPOT=new Sk.builtin.int_(3),c.RGB=new Sk.builtin.int_(1),c.ARGB=new Sk.builtin.int_(2),c.HSB=new Sk.builtin.int_(3),c.ALPHA=new Sk.builtin.int_(4),c.CMYK=new Sk.builtin.int_(5),c.TIFF=new Sk.builtin.int_(0),c.TARGA=new Sk.builtin.int_(1),c.JPEG=new Sk.builtin.int_(2),c.GIF=new Sk.builtin.int_(3),c.MITER=new Sk.builtin.str(\"miter\"),c.BEVEL=new Sk.builtin.str(\"bevel\"),c.ROUND=new Sk.builtin.str(\"round\"),c.SQUARE=new Sk.builtin.str(\"butt\"),c.PROJECT=new Sk.builtin.str(\"square\"),c.P2D=new Sk.builtin.int_(1),c.JAVA2D=new Sk.builtin.int_(1),c.WEBGL=new Sk.builtin.int_(2),c.P3D=new Sk.builtin.int_(2),c.OPENGL=new Sk.builtin.int_(2),c.PDF=new Sk.builtin.int_(0),c.DXF=new Sk.builtin.int_(0),c.OTHER=new Sk.builtin.int_(0),c.WINDOWS=new Sk.builtin.int_(1),c.MAXOSX=new Sk.builtin.int_(2),c.LINUX=new Sk.builtin.int_(3),c.EPSILON=new Sk.builtin.float_(1e-4),c.MAX_FLOAT=new Sk.builtin.float_(34028235e31),c.MIN_FLOAT=new Sk.builtin.float_(-34028235e31),c.MAX_INT=new Sk.builtin.int_(2147483647),c.MIN_INT=new Sk.builtin.int_(-2147483648),c.HALF_PI=new Sk.builtin.float_(Math.PI/2),c.THIRD_PI=new Sk.builtin.float_(Math.PI/3),c.PI=new Sk.builtin.float_(Math.PI),c.TWO_PI=new Sk.builtin.float_(2*Math.PI),c.TAU=new Sk.builtin.float_(2*Math.PI),c.QUARTER_PI=new Sk.builtin.float_(Math.PI/4),c.DEG_TO_RAD=new Sk.builtin.float_(Math.PI/180),c.RAD_TO_DEG=new Sk.builtin.float_(180/Math.PI),c.WHITESPACE=new Sk.builtin.str(\" \\t\\n\\r\\f \"),c.POINT=new Sk.builtin.int_(2),c.POINTS=new Sk.builtin.int_(2),c.LINE=new Sk.builtin.int_(4),c.LINES=new Sk.builtin.int_(4),c.TRIANGLE=new Sk.builtin.int_(8),c.TRIANGLES=new Sk.builtin.int_(9),c.TRIANGLE_FAN=new Sk.builtin.int_(11),c.TRIANGLE_STRIP=new Sk.builtin.int_(10),c.QUAD=new Sk.builtin.int_(16),c.QUADS=new Sk.builtin.int_(16),c.QUAD_STRIP=new Sk.builtin.int_(17),c.POLYGON=new Sk.builtin.int_(20),c.PATH=new Sk.builtin.int_(21),c.RECT=new Sk.builtin.int_(30),c.ELLIPSE=new Sk.builtin.int_(31),c.ARC=new Sk.builtin.int_(32),c.SPHERE=new Sk.builtin.int_(40),c.BOX=new Sk.builtin.int_(41),c.GROUP=new Sk.builtin.int_(0),c.PRIMITIVE=new Sk.builtin.int_(1),c.GEOMETRY=new Sk.builtin.int_(3),c.VERTEX=new Sk.builtin.int_(0),c.BEZIER_VERTEX=new Sk.builtin.int_(1),c.CURVE_VERTEX=new Sk.builtin.int_(2),c.BREAK=new Sk.builtin.int_(3),c.CLOSESHAPE=new Sk.builtin.int_(4),c.REPLACE=new Sk.builtin.int_(0),c.BLEND=new Sk.builtin.int_(1),c.ADD=new Sk.builtin.int_(2),c.SUBTRACT=new Sk.builtin.int_(4),c.LIGHTEST=new Sk.builtin.int_(8),c.DARKEST=new Sk.builtin.int_(16),c.DIFFERENCE=new Sk.builtin.int_(32),c.EXCLUSION=new Sk.builtin.int_(64),c.MULTIPLY=new Sk.builtin.int_(128),c.SCREEN=new Sk.builtin.int_(256),c.OVERLAY=new Sk.builtin.int_(512),c.HARD_LIGHT=new Sk.builtin.int_(1024),c.SOFT_LIGHT=new Sk.builtin.int_(2048),c.DODGE=new Sk.builtin.int_(4096),c.BURN=new Sk.builtin.int_(8192),c.ALPHA_MASK=new Sk.builtin.int_(4278190080),c.RED_MASK=new Sk.builtin.int_(16711680),c.GREEN_MASK=new Sk.builtin.int_(65280),c.BLUE_MASK=new Sk.builtin.int_(255),c.CUSTOM=new Sk.builtin.int_(0),c.ORTHOGRAPHIC=new Sk.builtin.int_(2),c.PERSPECTIVE=new Sk.builtin.int_(3),c.ARROW=new Sk.builtin.str(\"default\"),c.CROSS=new Sk.builtin.str(\"crosshair\"),c.HAND=new Sk.builtin.str(\"pointer\"),c.MOVE=new Sk.builtin.str(\"move\"),c.TEXT=new Sk.builtin.str(\"text\"),c.WAIT=new Sk.builtin.str(\"wait\"),c.NOCURSOR=Sk.builtin.assk$(\"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto\"),c.DISABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(1),c.ENABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(-1),c.ENABLE_OPENGL_4X_SMOOTH=new Sk.builtin.int_(2),c.ENABLE_NATIVE_FONTS=new Sk.builtin.int_(3),c.DISABLE_DEPTH_TEST=new Sk.builtin.int_(4),c.ENABLE_DEPTH_TEST=new Sk.builtin.int_(-4),c.ENABLE_DEPTH_SORT=new Sk.builtin.int_(5),c.DISABLE_DEPTH_SORT=new Sk.builtin.int_(-5),c.DISABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(6),c.ENABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(-6),c.ENABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(7),c.DISABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(-7),c.HINT_COUNT=new Sk.builtin.int_(10),c.OPEN=new Sk.builtin.int_(1),c.CLOSE=new Sk.builtin.int_(2),c.BLUR=new Sk.builtin.int_(11),c.GRAY=new Sk.builtin.int_(12),c.INVERT=new Sk.builtin.int_(13),c.OPAQUE=new Sk.builtin.int_(14),c.POSTERIZE=new Sk.builtin.int_(15),c.THRESHOLD=new Sk.builtin.int_(16),c.ERODE=new Sk.builtin.int_(17),c.DILATE=new Sk.builtin.int_(18),c.BACKSPACE=new Sk.builtin.int_(8),c.TAB=new Sk.builtin.int_(9),c.ENTER=new Sk.builtin.int_(10),c.RETURN=new Sk.builtin.int_(13),c.ESC=new Sk.builtin.int_(27),c.DELETE=new Sk.builtin.int_(127),c.CODED=new Sk.builtin.int_(65535),c.SHIFT=new Sk.builtin.int_(16),c.CONTROL=new Sk.builtin.int_(17),c.ALT=new Sk.builtin.int_(18),c.CAPSLK=new Sk.builtin.int_(20),c.PGUP=new Sk.builtin.int_(33),c.PGDN=new Sk.builtin.int_(34),c.END=new Sk.builtin.int_(35),c.HOME=new Sk.builtin.int_(36),c.LEFT=new Sk.builtin.int_(37),c.UP=new Sk.builtin.int_(38),c.RIGHT=new Sk.builtin.int_(39),c.DOWN=new Sk.builtin.int_(40),c.F1=new Sk.builtin.int_(112),c.F2=new Sk.builtin.int_(113),c.F3=new Sk.builtin.int_(114),c.F4=new Sk.builtin.int_(115),c.F5=new Sk.builtin.int_(116),c.F6=new Sk.builtin.int_(117),c.F7=new Sk.builtin.int_(118),c.F8=new Sk.builtin.int_(119),c.F9=new Sk.builtin.int_(120),c.F10=new Sk.builtin.int_(121),c.F11=new Sk.builtin.int_(122),c.F12=new Sk.builtin.int_(123),c.NUMLK=new Sk.builtin.int_(144),c.META=new Sk.builtin.int_(157),c.INSERT=new Sk.builtin.int_(155),c.SINCOS_LENGTH=new Sk.builtin.int_(720),c.PRECISIONB=new Sk.builtin.int_(15),c.PRECISIONF=new Sk.builtin.int_(32768),c.PREC_MAXVAL=new Sk.builtin.int_(32767),c.PREC_ALPHA_SHIFT=new Sk.builtin.int_(9),c.PREC_RED_SHIFT=new Sk.builtin.int_(1),c.NORMAL_MODE_AUTO=new Sk.builtin.int_(0),c.NORMAL_MODE_SHAPE=new Sk.builtin.int_(1),c.NORMAL_MODE_VERTEX=new Sk.builtin.int_(2),c.MAX_LIGHTS=new Sk.builtin.int_(8),c.line=new Sk.builtin.func((function(n,i,e,t){c.processing.line(n.v,i.v,e.v,t.v)})),c.ellipse=new Sk.builtin.func((function(n,i,e,t){c.processing.ellipse(n.v,i.v,e.v,t.v)})),c.circle=new Sk.builtin.func((function(n,i,e){c.processing.ellipse(n.v,i.v,e.v,e.v)})),c.text=new Sk.builtin.func((function(n,i,e){c.processing.text(n.v,i.v,e.v)})),c.point=new Sk.builtin.func((function(n,i){c.processing.point(n.v,i.v)})),c.arc=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.arc(n.v,i.v,e.v,t.v,u.v,o.v)})),c.quad=new Sk.builtin.func((function(n,i,e,t,u,o,s,l){c.processing.quad(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v)})),c.rect=new Sk.builtin.func((function(n,i,e,t,u){\"undefined\"==typeof u?c.processing.rect(n.v,i.v,e.v,t.v):c.processing.rect(n.v,i.v,e.v,t.v,u.v)})),c.triangle=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.triangle(n.v,i.v,e.v,t.v,u.v,o.v)})),c.bezier=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r,v,f,S){\"undefined\"==typeof r?c.processing.bezier(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):c.processing.bezier(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v,f.v,S.v)})),c.alpha=new Sk.builtin.func((function(n,i,e){return\"undefined\"==typeof i?new Sk.builtin.float_(c.processing.alpha(n.v)):\"undefined\"==typeof e?new Sk.builtin.float_(c.processing.alpha(n.v,i.v)):new Sk.builtin.float_(c.processing.alpha(n.v,i.v,e.v))})),c.ambient=new Sk.builtin.func((function(n,i,e){\"undefined\"==typeof i?c.processing.ambient(n.v):\"undefined\"==typeof e?c.processing.ambient(n.v,i.v):c.processing.ambient(n.v,i.v,e.v)})),c.ambientLight=new Sk.builtin.func((function(n,i,e,t,u,o){\"undefined\"==typeof t?c.processing.ambientLight(n.v,i.v,e.v):\"undefined\"==typeof u?c.processing.ambientLight(n.v,i.v,e.v,t.v):\"undefined\"==typeof o?c.processing.ambientLight(n.v,i.v,e.v,t.v,u.v):c.processing.ambientLight(n.v,i.v,e.v,t.v,u.v,o.v)})),c.beginCamera=new Sk.builtin.func((function(){c.processing.beginCamera()})),c.beginShape=new Sk.builtin.func((function(n){\"undefined\"==typeof n&&(n=c.POLYGON),c.processing.beginShape(n.v)})),c.bezierDetail=new Sk.builtin.func((function(n){n=\"undefined\"!=typeof n?n.v:20,c.processing.bezierDetail(n)})),c.bezierPoint=new Sk.builtin.func((function(n,i,e,t,u){c.processing.bezierPoint(n.v,i.v,e.v,t.v,u.v)})),c.bezierTangent=new Sk.builtin.func((function(n,i,e,t,u){c.processing.bezierTangent(n.v,i.v,e.v,t.v,u.v)})),c.bezierVertex=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r){\"undefined\"==typeof s?c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v):\"undefined\"==typeof l?c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v,s.v):\"undefined\"==typeof r?c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):c.processing.bezierVertex(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v)})),c.blend=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r,v){n instanceof Sk.builtin.int_||n instanceof Sk.builtin.float_?c.processing.blend(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v):c.processing.blend(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v)})),c.blendColor=new Sk.builtin.func((function(n,i,e){var t=Sk.misceval.callsimArray(c.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return t.v=c.processing.blendColor(n.v,i.v,e.v),t})),c.brightness=new Sk.builtin.func((function(n,i,e){return\"undefined\"==typeof i?new Sk.builtin.float_(c.processing.brightness(n.v)):\"undefined\"==typeof e?new Sk.builtin.float_(c.processing.brightness(n.v,i.v)):new Sk.builtin.float_(c.processing.brightness(n.v,i.v,e.v))})),c.camera=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r){\"undefined\"==typeof n?c.processing.camera():c.processing.camera(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v)})),c.constrain=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.constrain(n.v,i.v,e.v))})),c.copy=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r){n instanceof Sk.builtin.int_||n instanceof Sk.builtin.float_?c.processing.copy(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):c.processing.copy(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v)})),c.createFont=new Sk.builtin.func((function(n,i,e,t){var u=Sk.misceval.callsimArray(c.PFont);return u.v=\"undefined\"==typeof e?c.processing.createFont(n.v,i.v):\"undefined\"==typeof t?c.processing.createFont(n.v,i.v,e.v):c.processing.createFont(n.v,i.v,e.v,t.v),u})),c.createGraphics=new Sk.builtin.func((function(n,i,e,t){var u=Sk.misceval.callsimArray(c.PGraphics);return u.v=\"undefined\"==typeof t?c.processing.createGraphics(n.v,i.v,e.v):c.processing.createGraphics(n.v,i.v,e.v,t.v),u})),c.createImage=new Sk.builtin.func((function(n,i,e){var t=Sk.misceval.callsimArray(c.PImage);return t.v=c.processing.createImage(n.v,i.v,e.v),t})),c.cursor=new Sk.builtin.func((function(n,i,e){\"undefined\"==typeof n?c.processing.cursor():\"undefined\"==typeof i?c.processing.cursor(n.v):\"undefined\"==typeof e?c.processing.cursor(n.v,i.v):c.processing.cursor(n.v,i.v,e.v)})),c.curve=new Sk.builtin.func((function(n,i,e,t,u,o,s,l,r,v,f,S){\"undefined\"==typeof r?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v):\"undefined\"==typeof v?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v):\"undefined\"==typeof f?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v):\"undefined\"==typeof S?c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v,f.v):c.processing.curve(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v,r.v,v.v,f.v,S.v)})),c.curveDetail=new Sk.builtin.func((function(n){c.processing.curveDetail(n.v)})),c.curvePoint=new Sk.builtin.func((function(n,i,e,t,u){c.processing.curvePoint(n.v,i.v,e.v,t.v,u.v)})),c.curveTangent=new Sk.builtin.func((function(n,i,e,t,u){c.processing.curveTangent(n.v,i.v,e.v,t.v,u.v)})),c.curveTightness=new Sk.builtin.func((function(n){c.processing.curveTightness(n.v)})),c.curveVertex=new Sk.builtin.func((function(n,i,e){\"undefined\"==typeof e?c.processing.curveVertex(n.v,i.v):c.processing.curveVertex(n.v,i.v,e.v)})),c.day=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.day())})),c.degrees=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.degrees(n.v))})),c.directionalLight=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.directionalLight(n.v,i.v,e.v,t.v,u.v,o.v)})),c.dist=new Sk.builtin.func((function(n,i,e,t,u,o){return\"undefined\"==typeof u?new Sk.builtin.float_(c.processing.dist(n.v,i.v,e.v,t.v)):\"undefined\"==typeof o?new Sk.builtin.float_(c.processing.dist(n.v,i.v,e.v,t.v,u.v)):new Sk.builtin.float_(c.processing.dist(n.v,i.v,e.v,t.v,u.v,o.v))})),c.emissive=new Sk.builtin.func((function(n,i,e){\"undefined\"==typeof i?c.processing.emissive(n.v):\"undefined\"==typeof e?c.processing.emissive(n.v,i.v):c.processing.emissive(n.v,i.v,e.v)})),c.endCamera=new Sk.builtin.func((function(){c.processing.endCamera()})),c.endShape=new Sk.builtin.func((function(n){\"undefined\"==typeof n?c.processing.endShape():c.processing.endShape(n.v)})),c.filter=new Sk.builtin.func((function(n,i){\"undefined\"==typeof i?c.processing.filter(n.v):c.processing.filter(n.v,i.v)})),c.frustum=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.frustum(n,i,e,t,u,o)})),c.hint=new Sk.builtin.func((function(n){c.processing.hint(n)})),c.hour=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.hour())})),c.hue=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.hue(n.v))})),c.imageMode=new Sk.builtin.func((function(n){c.processing.imageMode(n.v)})),c.lerp=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.lerp(n.v,i.v,e.v))})),c.lerpColor=new Sk.builtin.func((function(n,i,e){var t=Sk.misceval.callsimArray(c.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return t.v=c.processing.lerpColor(n.v,i.v,e.v),t})),c.lightFalloff=new Sk.builtin.func((function(n,i,e){c.processing.lightFalloff(n.v,i.v,e.v)})),c.lights=new Sk.builtin.func((function(){c.processing.lights()})),c.lightSpecular=new Sk.builtin.func((function(n,i,e){c.processing.lightSpecular(n.v,i.v,e.v)})),c.loadBytes=new Sk.builtin.func((function(n){return new Sk.builtin.list(c.processing.loadBytes(n.v))})),c.loadFont=new Sk.builtin.func((function(n){var i=Sk.misceval.callsimArray(c.PFont);return i.v=c.processing.loadFont(n.v),i})),c.loadShape=new Sk.builtin.func((function(n){return Sk.misceval.callsimArray(c.PShapeSVG,[new Sk.builtin.str(\"string\"),n])})),c.loadStrings=new Sk.builtin.func((function(n){return new Sk.builtin.list(c.processing.loadStrings(n.v))})),c.mag=new Sk.builtin.func((function(n,i,e){return\"undefined\"==typeof e?new Sk.builtin.float_(c.processing.mag(n.v,i.v)):new Sk.builtin.float_(c.processing.mag(n.v,i.v,e.v))})),c.map=new Sk.builtin.func((function(n,i,e,t,u){return new Sk.builtin.float_(c.processing.map(n.v,i.v,e.v,t.v,u.v))})),c.millis=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.millis())})),c.minute=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.minute())})),c.modelX=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.modelX(n.v,i.v,e.v))})),c.modelY=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.modelY(n.v,i.v,e.v))})),c.modelZ=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.modelZ(n.v,i.v,e.v))})),c.month=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.month())})),c.noCursor=new Sk.builtin.func((function(){c.processing.noCursor()})),c.noise=new Sk.builtin.func((function(n,i,e){return\"undefined\"==typeof i?new Sk.builtin.float_(c.processing.noise(n.v)):\"undefined\"==typeof e?new Sk.builtin.float_(c.processing.noise(n.v,i.v)):new Sk.builtin.float_(c.processing.noise(n.v,i.v,e.v))})),c.noiseDetail=new Sk.builtin.func((function(n,i){c.processing.noiseDetail(n.v,i.v)})),c.noiseSeed=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.noiseSeed(n.v))})),c.noLights=new Sk.builtin.func((function(){c.processing.noLights()})),c.norm=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.norm(n.v,i.v,e.v))})),c.normal=new Sk.builtin.func((function(n,i,e){c.processing.normal(n.v,i.v,e.v)})),c.noTint=new Sk.builtin.func((function(){c.processing.noTint()})),c.ortho=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.ortho(n.v,i.v,e.v,t.v,u.v,o.v)})),c.perspective=new Sk.builtin.func((function(n,i,e,t){\"undefined\"==typeof n?c.processing.perspective():\"undefined\"==typeof i?c.processing.perspective(n.v):\"undefined\"==typeof e?c.processing.perspective(n.v,i.v):\"undefined\"==typeof t?c.processing.perspective(n.v,i.v,e.v):c.processing.perspective(n.v,i.v,e.v,t.v)})),c.pointLight=new Sk.builtin.func((function(n,i,e,t,u,o){c.processing.pointLight(n.v,i.v,e.v,t.v,u.v,o.v)})),c.printCamera=new Sk.builtin.func((function(){c.processing.printCamera()})),c.println=new Sk.builtin.func((function(n){c.processing.println(n.v)})),c.printProjection=new Sk.builtin.func((function(){c.processing.printProjection()})),c.radians=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.radians(n.v))})),c.randomSeed=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.randomSeed(n.v))})),c.random=new Sk.builtin.func((function(n,i){return\"undefined\"==typeof n?new Sk.builtin.float_(c.processing.random()):\"undefined\"==typeof i?new Sk.builtin.float_(c.processing.random(n.v)):new Sk.builtin.float_(c.processing.random(n.v,i.v))})),c.requestImage=new Sk.builtin.func((function(n,i){var e=Sk.misceval.callsimArray(c.PImage);return e.v=\"undefined\"==typeof i?c.processing.requestImage(n.v):c.processing.requestImage(n.v,i.v),e})),c.saturation=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.saturation(n.v))})),c.save=new Sk.builtin.func((function(n){c.processing.save(n.v)})),c.saveFrame=new Sk.builtin.func((function(n){\"undefined\"==typeof n?c.processing.saveFrame():c.processing.saveFrame(n.v)})),c.saveStrings=new Sk.builtin.func((function(n,i){c.processing.saveStrings(n.v,i.v)})),c.screenX=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.screenX(n.v,i.v,e.v))})),c.screenY=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.screenY(n.v,i.v,e.v))})),c.screenZ=new Sk.builtin.func((function(n,i,e){return new Sk.builtin.float_(c.processing.screenZ(n.v,i.v,e.v))})),c.second=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.second())})),c.shape=new Sk.builtin.func((function(n,i,e,t,u){\"undefined\"==typeof i?c.processing.shape(n.v):\"undefined\"==typeof e?c.processing.shape(n.v,i.v):\"undefined\"==typeof t?c.processing.shape(n.v,i.v,e.v):\"undefined\"==typeof u?c.processing.shape(n.v,i.v,e.v,t.v):c.processing.shape(n.v,i.v,e.v,t.v,u.v)})),c.shapeMode=new Sk.builtin.func((function(n){c.processing.shapeMode(n.v)})),c.shininess=new Sk.builtin.func((function(n){c.processing.shininess(n.v)})),c.specular=new Sk.builtin.func((function(n,i,e){\"undefined\"==typeof i?c.processing.specular(n.v):\"undefined\"==typeof e?c.processing.specular(n.v,i.v):c.processing.specular(n.v,i.v,e.v)})),c.spotLight=new Sk.builtin.func((function(n,i,e,t,u,o,s,l){c.processing.spotLight(n.v,i.v,e.v,t.v,u.v,o.v,s.v,l.v)})),c.sq=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.sq(n))})),c.status=new Sk.builtin.func((function(n){c.processing.status(n.v)})),c.textAlign=new Sk.builtin.func((function(n,i){\"undefined\"==typeof i?c.processing.textAlign(n.v):c.processing.textAlign(n.v,i.v)})),c.textAscent=new Sk.builtin.func((function(){return new Sk.builtin.float_(c.processing.textAscent())})),c.textDescent=new Sk.builtin.func((function(){return new Sk.builtin.float_(c.processing.textDescent())})),c.textFont=new Sk.builtin.func((function(n,i){\"undefined\"==typeof i?c.processing.textFont(n.v):c.processing.textFont(n.v,i.v)})),c.textLeading=new Sk.builtin.func((function(n){c.processing.textLeading(n.v)})),c.textMode=new Sk.builtin.func((function(n){c.processing.textMode(n.v)})),c.textSize=new Sk.builtin.func((function(n){c.processing.textSize(n.v)})),c.texture=new Sk.builtin.func((function(n){c.processing.texture(n.v)})),c.textureMode=new Sk.builtin.func((function(n){c.processing.textureMode(n.v)})),c.textWidth=new Sk.builtin.func((function(n){return new Sk.builtin.float_(c.processing.textWidth(n.v))})),c.tint=new Sk.builtin.func((function(n,i,e,t){\"undefined\"==typeof i?c.processing.tint(n.v):\"undefined\"==typeof e?c.processing.tint(n.v,i.v):\"undefined\"==typeof t?c.processing.tint(n.v,i.v,e.v):c.processing.tint(n.v,i.v,e.v,t.v)})),c.updatePixels=new Sk.builtin.func((function(){c.processing.updatePixels()})),c.vertex=new Sk.builtin.func((function(n,i,e,t,u){\"undefined\"==typeof e?c.processing.vertex(n.v,i.v):\"undefined\"==typeof t?c.processing.vertex(n.v,i.v,e.v):\"undefined\"==typeof u?c.processing.vertex(n.v,i.v,e.v,t.v):c.processing.vertex(n.v,i.v,e.v,t.v,u.v)})),c.year=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.year())})),c.box=new Sk.builtin.func((function(n){c.processing.box(n.v)})),c.sphere=new Sk.builtin.func((function(n){c.processing.sphere(n.v)})),c.sphereDetail=new Sk.builtin.func((function(n,i){\"undefined\"==typeof i?c.processing.sphereDetail(n.v):c.processing.sphereDetail(n.v,i.v)})),c.background=new Sk.builtin.func((function(n,i,e){\"undefined\"!=typeof i&&(i=i.v),\"undefined\"!=typeof e&&(e=e.v),c.processing.background(n.v,i,e)})),c.fill=new Sk.builtin.func((function(n,i,e,t){\"undefined\"!=typeof i&&(i=i.v),\"undefined\"!=typeof e&&(e=e.v),\"undefined\"!=typeof t&&(t=t.v),c.processing.fill(n.v,i,e,t)})),c.stroke=new Sk.builtin.func((function(n,i,e,t){\"undefined\"!=typeof i&&(i=i.v),\"undefined\"!=typeof e&&(e=e.v),\"undefined\"!=typeof t&&(t=t.v),c.processing.stroke(n.v,i,e,t)})),c.noStroke=new Sk.builtin.func((function(){c.processing.noStroke()})),c.colorMode=new Sk.builtin.func((function(n,i,e,t,u){i=\"undefined\"==typeof i?255:i.v,\"undefined\"!=typeof e&&(e=e.v),\"undefined\"!=typeof t&&(t=t.v),\"undefined\"!=typeof u&&(u=u.v),c.processing.colorMode(n.v,i,e,t,u)})),c.noFill=new Sk.builtin.func((function(){c.processing.noFill()})),c.loop=new Sk.builtin.func((function(){if(null===c.processing)throw new Sk.builtin.Exception(\"loop() should be called after run()\");v=!0,c.processing.loop()})),c.noLoop=new Sk.builtin.func((function(){if(null===c.processing)throw new Sk.builtin.Exception(\"noLoop() should be called after run()\");v=!1,c.processing.noLoop()})),c.frameRate=new Sk.builtin.func((function(n){c.processing.frameRate(n.v)})),c.width=new Sk.builtin.int_(0),c.height=new Sk.builtin.int_(0),c.renderMode=c.P2D,c.size=new Sk.builtin.func((function(n,i,e){\"undefined\"==typeof e&&(e=c.P2D),c.processing.size(n.v,i.v,e.v),c.width=new Sk.builtin.int_(c.processing.width),c.height=new Sk.builtin.int_(c.processing.height),c.renderMode=e})),c.exitp=new Sk.builtin.func((function(){c.processing.exit()})),c.mouseX=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.mouseX)})),c.mouseY=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.mouseY)})),c.pmouseX=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.pmouseX)})),c.pmouseY=new Sk.builtin.func((function(){return new Sk.builtin.int_(c.processing.pmouseY)})),c.rectMode=new Sk.builtin.func((function(n){c.processing.rectMode(n.v)})),c.strokeWeight=new Sk.builtin.func((function(n){c.processing.strokeWeight(n.v)})),c.smooth=new Sk.builtin.func((function(){c.processing.smooth()})),c.noSmooth=new Sk.builtin.func((function(){c.processing.noSmooth()})),c.ellipseMode=new Sk.builtin.func((function(n){c.processing.ellipseMode(n.v)})),c.strokeCap=new Sk.builtin.func((function(n){c.processing.strokeCap(n.v)})),c.strokeJoin=new Sk.builtin.func((function(n){c.processing.strokeJoin(n.v)})),c.rotate=new Sk.builtin.func((function(n){c.processing.rotate(n.v)})),c.rotateX=new Sk.builtin.func((function(n){c.processing.rotateX(n.v)})),c.rotateY=new Sk.builtin.func((function(n){c.processing.rotateY(n.v)})),c.rotateZ=new Sk.builtin.func((function(n){c.processing.rotateZ(n.v)})),c.scale=new Sk.builtin.func((function(n,i,e){i=\"undefined\"==typeof i?1:i.v,e=\"undefined\"==typeof e?1:e.v,c.processing.scale(n.v,i,e)})),c.translate=new Sk.builtin.func((function(n,i,e){i=\"undefined\"==typeof i?1:i.v,e=\"undefined\"==typeof e?1:e.v,c.processing.translate(n.v,i,e)})),c.popMatrix=new Sk.builtin.func((function(){c.processing.popMatrix()})),c.pushMatrix=new Sk.builtin.func((function(){c.processing.pushMatrix()})),c.applyMatrix=new Sk.builtin.func((function(){var n,i=Array.prototype.slice.call(arguments,0,16);for(n=0;n>>0,this.mti=1;this.mti>>30,this.mt[this.mti]=(1812433253*((4294901760&n)>>>16)<<16)+1812433253*(65535&n)+this.mti,this.mt[this.mti]>>>=0},MersenneTwister.prototype.init_by_array=function(n,t){var i,e,r;for(this.init_genrand(19650218),i=1,e=0,r=this.N>t?this.N:t;r;r--){var u=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(1664525*((4294901760&u)>>>16)<<16)+1664525*(65535&u))+n[e]+e,this.mt[i]>>>=0,e++,++i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1),e>=t&&(e=0)}for(r=this.N-1;r;r--){u=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(1566083941*((4294901760&u)>>>16)<<16)+1566083941*(65535&u))-i,this.mt[i]>>>=0,++i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1)}this.mt[0]=2147483648},MersenneTwister.prototype.genrand_int32=function(){var n,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var i;for(this.mti==this.N+1&&this.init_genrand(5489),i=0;i>>1^t[1&n];for(;i>>1^t[1&n];n=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^n>>>1^t[1&n],this.mti=0}return n=this.mt[this.mti++],n^=n>>>11,n^=n<<7&2636928640,n^=n<<15&4022730752,(n^=n>>>18)>>>0},MersenneTwister.prototype.genrand_int31=function(){return this.genrand_int32()>>>1},MersenneTwister.prototype.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},MersenneTwister.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},MersenneTwister.prototype.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},MersenneTwister.prototype.genrand_res53=function(){return(67108864*(this.genrand_int32()>>>5)+(this.genrand_int32()>>>6))*(1/9007199254740992)};var $builtinmodule=function(n){var t={},i=new MersenneTwister,e=void 0;t.seed=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen(\"seed\",arguments.length,0,1),n=Sk.builtin.asnum$(n),i=arguments.length>0?new MersenneTwister(n):new MersenneTwister,Sk.builtin.none.none$})),t.random=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"random\",arguments.length,0,0),new Sk.builtin.float_(i.genrand_res53())}));var toInt=function(n){return 0|n},randrange=function(n,t,e){var r,u,s;if(!Sk.builtin.checkInt(n))throw new Sk.builtin.ValueError(\"non-integer first argument for randrange()\");if(void 0===t)return s=toInt(i.genrand_res53()*n),new Sk.builtin.int_(s);if(!Sk.builtin.checkInt(t))throw new Sk.builtin.ValueError(\"non-integer stop for randrange()\");if(void 0===e&&(e=1),r=t-n,1==e&&r>0)return s=n+toInt(i.genrand_res53()*r),new Sk.builtin.int_(s);if(1==e)throw new Sk.builtin.ValueError(\"empty range for randrange() (\"+n+\", \"+t+\", \"+r+\")\");if(!Sk.builtin.checkInt(e))throw new Sk.builtin.ValueError(\"non-integer step for randrange()\");if(e>0)u=toInt((r+e-1)/e);else{if(!(e<0))throw new Sk.builtin.ValueError(\"zero step for randrange()\");u=toInt((r+e+1)/e)}if(u<=0)throw new Sk.builtin.ValueError(\"empty range for randrange()\");return s=n+e*toInt(i.genrand_res53()*u),new Sk.builtin.int_(s)};t.randint=new Sk.builtin.func((function(n,t){return Sk.builtin.pyCheckArgsLen(\"randint\",arguments.length,2,2),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),randrange(n,t+1)})),t.randrange=new Sk.builtin.func((function(n,t,i){return Sk.builtin.pyCheckArgsLen(\"randrange\",arguments.length,1,3),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),i=Sk.builtin.asnum$(i),randrange(n,t,i)})),t.uniform=new Sk.builtin.func((function(n,t){Sk.builtin.pyCheckArgsLen(\"uniform\",arguments.length,2,2),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t);var e=i.genrand_res53();const r=n+e*(t-n);return new Sk.builtin.float_(r)})),t.triangular=new Sk.builtin.func((function(n,t,e){var r,u,s;return Sk.builtin.pyCheckArgsLen(\"triangular\",arguments.length,2,3),Sk.builtin.pyCheckType(\"low\",\"number\",Sk.builtin.checkNumber(n)),Sk.builtin.pyCheckType(\"high\",\"number\",Sk.builtin.checkNumber(t)),(n=Sk.builtin.asnum$(n))>(t=Sk.builtin.asnum$(t))&&(s=n,n=t,t=s),void 0===e||e===Sk.builtin.none.none$?e=(t-n)/2:(Sk.builtin.pyCheckType(\"mode\",\"number\",Sk.builtin.checkNumber(e)),e=Sk.builtin.asnum$(e)),u=(r=i.genrand_res53())<(e-n)/(t-n)?n+Math.sqrt(r*(t-n)*(e-n)):t-Math.sqrt((1-r)*(t-n)*(t-e)),new Sk.builtin.float_(u)}));var normalSample=function(n,t){var r,u,s,h,l;return void 0!==e?(l=e,e=void 0):(r=i.genrand_res53(),u=i.genrand_res53(),s=Math.sqrt(-2*Math.log(r)),h=2*Math.PI*u,l=s*Math.cos(h),e=s*Math.sin(h)),n+t*l};return t.gauss=new Sk.builtin.func((function(n,t){return Sk.builtin.pyCheckArgsLen(\"gauss\",arguments.length,2,2),Sk.builtin.pyCheckType(\"mu\",\"number\",Sk.builtin.checkNumber(n)),Sk.builtin.pyCheckType(\"sigma\",\"number\",Sk.builtin.checkNumber(t)),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),new Sk.builtin.float_(normalSample(n,t))})),t.normalvariate=t.gauss,t.lognormvariate=new Sk.builtin.func((function(n,t){return Sk.builtin.pyCheckArgsLen(\"lognormvariate\",arguments.length,2,2),Sk.builtin.pyCheckType(\"mu\",\"number\",Sk.builtin.checkNumber(n)),Sk.builtin.pyCheckType(\"sigma\",\"number\",Sk.builtin.checkNumber(t)),n=Sk.builtin.asnum$(n),t=Sk.builtin.asnum$(t),new Sk.builtin.float_(Math.exp(normalSample(n,t)))})),t.expovariate=new Sk.builtin.func((function(n){Sk.builtin.pyCheckArgsLen(\"expovariate\",arguments.length,1,1),Sk.builtin.pyCheckType(\"lambd\",\"number\",Sk.builtin.checkNumber(n)),n=Sk.builtin.asnum$(n);var t=i.genrand_res53();return new Sk.builtin.float_(-Math.log(t)/n)})),t.choice=new Sk.builtin.func((function(n){if(Sk.builtin.pyCheckArgsLen(\"choice\",arguments.length,1,1),Sk.builtin.pyCheckType(\"seq\",\"sequence\",Sk.builtin.checkSequence(n)),void 0!==n.sq$length){var t=new Sk.builtin.int_(toInt(i.genrand_res53()*n.sq$length()));return n.mp$subscript(t)}throw new Sk.builtin.TypeError(\"object has no length\")})),t.shuffle=new Sk.builtin.func((function(n){if(Sk.builtin.pyCheckArgsLen(\"shuffle\",arguments.length,1,1),Sk.builtin.pyCheckType(\"x\",\"sequence\",Sk.builtin.checkSequence(n)),n.constructor===Sk.builtin.list){const u=n.v;for(var t=u.length-1;t>0;t-=1){var e=u[r=toInt(i.genrand_res53()*(t+1))];u[r]=u[t],u[t]=e}}else{if(void 0===n.sq$length)throw new Sk.builtin.TypeError(\"object has no length\");if(void 0===n.mp$ass_subscript)throw new Sk.builtin.TypeError(\"object is immutable\");for(t=n.sq$length()-1;t>0;t-=1){var r=new Sk.builtin.int_(toInt(i.genrand_res53()*(t+1)));t=new Sk.builtin.int_(t);e=n.mp$subscript(r);n.mp$ass_subscript(r,n.mp$subscript(t)),n.mp$ass_subscript(t,e)}}return Sk.builtin.none.none$})),t.sample=new Sk.builtin.func((function(n,t){var e,r,u,s,h;for(Sk.builtin.pyCheckArgsLen(\"sample\",arguments.length,2,2),Sk.builtin.pyCheckType(\"population\",\"iterable\",Sk.builtin.checkIterable(n)),Sk.builtin.pyCheckType(\"k\",\"integer\",Sk.builtin.checkInt(t)),t=Sk.builtin.asnum$(t),h=[],e=0,s=(u=Sk.abstr.iter(n)).tp$iternext();void 0!==s;e++,s=u.tp$iternext())r=Math.floor(i.genrand_res53()*(e+1)),enew pyStr(e))))},_value2member={},RegexFlagMeta=buildNativeClass(\"RegexFlagMeta\",{constructor:function RegexFlagMeta(){},base:pyType,slots:{tp$iter(){const e=Object.values(_members)[Symbol.iterator]();return new pyIterator((()=>e.next().value))},sq$contains(e){if(!(e instanceof this))throw new TypeError(\"unsupported operand type(s) for 'in': '\"+typeName(e)+\"' and '\"+typeName(this)+\"'\");return Object.values(_members).includes(e)}}});re.RegexFlag=buildNativeClass(\"RegexFlag\",{meta:RegexFlagMeta,base:pyInt,constructor:function RegexFlag(e){const t=_value2member[e];if(t)return t;this.v=e,_value2member[e]=this},slots:{tp$new(e,t){checkOneArg(\"RegexFlag\",e,t);const r=e[0].valueOf();if(!checkInt(r))throw new ValueError(objectRepr(r)+\" is not a valid RegexFlag\");return new re.RegexFlag(r)},$r(){let e=this.valueOf();const t=e<0;e=t?~e:e;const r=[];Object.entries(_members).forEach((([t,n])=>{const s=n.valueOf();e&s&&(e&=~s,r.push(\"re.\"+t))})),e&&r.push(hex(e).toString());let n=r.join(\"|\");return t&&(n=r.length>1?\"~(\"+n+\")\":\"~\"+n),new pyStr(n)},sq$contains(e){if(!(e instanceof re.RegexFlag))throw new TypeError(\"'in' requires a RegexFlag not \"+typeName(e));return this.nb$and(e)===e},nb$and:flagBitSlot(((e,t)=>e&t),JSBI.bitwiseAnd),nb$or:flagBitSlot(((e,t)=>e|t),JSBI.bitwiseOr),nb$xor:flagBitSlot(((e,t)=>e^t),JSBI.bitwiseXor),nb$invert:function(){const e=this.v;return\"number\"==typeof e?new re.RegexFlag(~e):new re.RegexFlag(JSBI.bitwiseNot(e))}},proto:{valueOf(){return this.v}},flags:{sk$acceptable_as_base_class:!1}}),re.TEMPLATE=re.T=new re.RegexFlag(1),re.IGNORECASE=re.I=new re.RegexFlag(2),re.LOCALE=re.L=new re.RegexFlag(4),re.MULTILINE=re.M=new re.RegexFlag(8),re.DOTALL=re.S=new re.RegexFlag(16),re.UNICODE=re.U=new re.RegexFlag(32),re.VERBOSE=re.X=new re.RegexFlag(64),re.DEBUG=new re.RegexFlag(128),re.ASCII=re.A=new re.RegexFlag(256);const _members={ASCII:re.A,IGNORECASE:re.I,LOCALE:re.L,UNICODE:re.U,MULTILINE:re.M,DOTALL:re.S,VERBOSE:re.X,TEMPLATE:re.T,DEBUG:re.DEBUG};function flagBitSlot(e,t){return function(r){if(r instanceof re.RegexFlag||r instanceof pyInt){let n=this.v,s=r.v;if(\"number\"==typeof n&&\"number\"==typeof s){let t=e(n,s);return t<0&&(t+=4294967296),new re.RegexFlag(t)}return n=JSBI.BigUp(n),s=JSBI.BigUp(s),new re.RegexFlag(JSBI.numberIfSafe(t(n,s)))}return pyNotImplemented}}const jsFlags={i:re.I,m:re.M,s:re.S,u:re.U},jsInlineFlags={i:re.I,a:re.A,s:re.S,L:re.L,m:re.M,u:re.U,x:re.X};RegExp.prototype.hasOwnProperty(\"sticky\")||delete jsFlags.s,RegExp.prototype.hasOwnProperty(\"unicode\")||delete jsFlags.u;const flagFails=Object.entries({\"cannot use LOCALE flag with a str pattern\":re.L,\"ASCII and UNICODE flags are incompatible\":new re.RegexFlag(re.A.valueOf()|re.U.valueOf())}),inline_regex=/\\(\\?([isamux]+)\\)/g;function adjustFlags(e,t){let r=e.toString(),n=\"g\",s=0;return r=r.replace(inline_regex,((e,t)=>{for(let r of t){const e=jsInlineFlags[r];s|=e.valueOf()}return\"\"})),flagFails.forEach((([e,t])=>{if((t.valueOf()&s)===t.valueOf())throw new re.error(\"bad bad inline flags: \"+e)})),t=numberBinOp(new re.RegexFlag(s),t,\"BitOr\"),flagFails.forEach((([e,r])=>{if(numberBinOp(r,t,\"BitAnd\")===r)throw new ValueError(e)})),numberBinOp(re.A,t,\"BitAnd\")!==re.A&&(t=numberBinOp(re.U,t,\"BitOr\")),Object.entries(jsFlags).forEach((([e,r])=>{numberBinOp(r,t,\"BitAnd\")===r&&(n+=e)})),t=new re.RegexFlag(t.valueOf()),[r,n,t]}let neg_lookbehind_A=\"(?)(?!(?:\\]|[^\\[]*[^\\\\]\\]))/g,py_to_js_unicode_escape=/\\\\[\\t\\r\\n \\v\\f#&~\"'!:,;`<>]|\\\\-(?!(?:\\]|[^\\[]*[^\\\\]\\]))/g,quantifierErrors=/Incomplete quantifier|Lone quantifier/g,_compiled_patterns=Object.create(null);function compile_pattern(e,t){let r,n;[r,n,t]=adjustFlags(e,t);const s=_compiled_patterns[e.toString()];if(s&&s.$flags===t)return s;const i={};let o,a;r=\"_\"+r,r=r.replace(initialUnescapedBracket,\"$1$2\\\\]$3\"),r=r.replace(py_to_js_regex,((t,r,n,s,o,a)=>{switch(n){case\"\\\\A\":return r+neg_lookbehind_A+\"^\";case\"\\\\Z\":return r+\"$(?!\\\\n)\";case\"{,\":return r+\"{0,\";case\"$\":return r+\"(?:(?=\\\\n$)|$)\";default:if(n.endsWith(\">\"))return i[o]=!0,r+\"(?<\"+o+\">\";if(!i[s])throw new re.error(\"unknown group name \"+s+\" at position \"+a+1,e,new pyInt(a+1));return r+\"\\\\k<\"+s+\">\"}})),r=r.slice(1);let l=r;n.includes(\"u\")&&(l=r.replace(py_to_js_unicode_escape,(e=>{switch(e){case\"\\\\ \":return\" \";case\"\\\\\\t\":return\"\\\\t\";case\"\\\\\\n\":return\"\\\\n\";case\"\\\\\\v\":return\"\\\\v\";case\"\\\\\\f\":return\"\\\\f\";case\"\\\\r\":return\"\\\\r\";default:return e.slice(1)}})));try{o=new RegExp(l,n)}catch(g){if(!quantifierErrors.test(g.message))throw a=g.message.substring(g.message.lastIndexOf(\":\")+2)+\" in pattern: \"+e.toString(),new re.error(a,e);try{o=new RegExp(r,n.replace(\"u\",\"\"))}catch(g){throw a=g.message.substring(g.message.lastIndexOf(\":\")+2)+\" in pattern: \"+e.toString(),new re.error(a,e)}}const p=new re.Pattern(o,e,t);return _compiled_patterns[e.toString()]=p,p}function _compile(e,t){if(e instanceof re.Pattern){if(t!==zero||t.valueOf())throw new ValueError(\"cannot process flags argument with compiled pattern\");return e}if(!checkString(e))throw new TypeError(\"first argument must be string or compiled pattern\");return compile_pattern(e,t)}re.error=buildNativeClass(\"re.error\",{base:Exception,constructor:function error(e,t,r){this.$pattern=t,this.$msg=e,this.$pos=r||pyNone,Exception.call(this,e)},slots:{tp$doc:\"Exception raised for invalid regular expressions.\\n\\n Attributes:\\n\\n msg: The unformatted error message\\n pattern: The regular expression pattern\\n\",tp$init(e,t){const[r,n,s]=copyKeywordToNamedArgs(\"re.error\",[\"msg\",\"pattern\",\"pos\"],e,t,[pyNone,pyNone]);this.$pattern=n,this.$pos=s,this.$msg=r}},getsets:{msg:{$get(){return this.$msg}},pattern:{$get(){return this.$pattern}},pos:{$get(){return this.$pos}}}});const zero=new pyInt(0),maxsize=Number.MAX_SAFE_INTEGER;re.Pattern=buildNativeClass(\"re.Pattern\",{constructor:function(e,t,r){this.v=e,this.str=t,this.$flags=r,this.$groups=null,this.$groupindex=null},slots:{$r(){const e=objectRepr(this.str).slice(0,200),t=objectRepr(this.$flags.nb$and(re.U.nb$invert()));return new pyStr(\"re.compile(\"+e+(t?\", \"+t:\"\")+\")\")},tp$richcompare(e,t){if(\"Eq\"!==t&&\"NotEq\"!==t||!(e instanceof re.Pattern))return pyNotImplemented;const r=this.str===e.str&&this.$flags===e.$flags;return\"Eq\"===t?r:!r},tp$hash(){},tp$doc:\"Compiled regular expression object.\"},methods:{match:{$meth:function match(e,t,r){return this.$match(e,t,r)},$flags:{NamedArgs:[\"string\",\"pos\",\"endpos\"],Defaults:[zero,maxsize]},$textsig:\"($self, /, string, pos=0, endpos=sys.maxsize)\",$doc:\"Matches zero or more characters at the beginning of the string.\"},fullmatch:{$meth:function fullmatch(e,t,r){return this.full$match(e,t,r)},$flags:{NamedArgs:[\"string\",\"pos\",\"endpos\"],Defaults:[zero,maxsize]},$textsig:\"($self, /, string, pos=0, endpos=sys.maxsize)\",$doc:\"Matches against all of the string.\"},search:{$meth:function search(e,t,r){return this.$search(e,t,r)},$flags:{NamedArgs:[\"string\",\"pos\",\"endpos\"],Defaults:[zero,maxsize]},$textsig:\"($self, /, string, pos=0, endpos=sys.maxsize)\",$doc:\"Scan through string looking for a match, and return a corresponding match object instance.\\n\\nReturn None if no position in the string matches.\"},sub:{$meth:function sub(e,t,r){return this.$sub(e,t,r)},$flags:{NamedArgs:[\"repl\",\"string\",\"count\"],Defaults:[zero]},$textsig:\"($self, /, repl, string, count=0)\",$doc:\"Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.\"},subn:{$meth:function(e,t,r){return this.$subn(e,t,r)},$flags:{NamedArgs:[\"repl\",\"string\",\"count\"],Defaults:[zero]},$textsig:\"($self, /, repl, string, count=0)\",$doc:\"Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.\"},findall:{$meth:function findall(e,t,r){return this.find$all(e,t,r)},$flags:{NamedArgs:[\"string\",\"pos\",\"endpos\"],Defaults:[zero,maxsize]},$textsig:\"($self, /, string, pos=0, endpos=sys.maxsize)\",$doc:\"Return a list of all non-overlapping matches of pattern in string.\"},split:{$meth:function split(e,t){return this.$split(e,t)},$flags:{NamedArgs:[\"string\",\"maxsplit\"],Defaults:[zero]},$textsig:\"($self, /, string, maxsplit=0)\",$doc:\"Split string by the occurrences of pattern.\"},finditer:{$meth:function finditer(e,t,r){return this.find$iter(e,t,r)},$flags:{NamedArgs:[\"string\",\"pos\",\"endpos\"],Defaults:[zero,maxsize]},$textsig:\"($self, /, string, pos=0, endpos=sys.maxsize)\",$doc:\"Return an iterator over all non-overlapping matches for the RE pattern in string.\\n\\nFor each match, the iterator returns a match object.\"},scanner:{$meth:function scanner(e,t,r){return this.$scanner(e,t,r)},$flags:{NamedArgs:[\"string\",\"pos\",\"endpos\"],Defaults:[zero,maxsize]},$textsig:\"($self, /, string, pos=0, endpos=sys.maxsize)\",$doc:null},__copy__:{$meth:function copy(){return this},$flags:{NoArgs:!0},$textsig:\"($self, /)\",$doc:null},__deepcopy__:{$meth:function(){return this},$flags:{OneArg:!0},$textsig:\"($self, memo, /)\",$doc:null}},getsets:{pattern:{$get(){return this.str},$doc:\"The pattern string from which the RE object was compiled.\"},flags:{$get(){return this.$flags},$doc:\"The regex matching flags.\"},groups:{$get(){if(null===this.$groups){const e=(this.str.v.match(this.group$regex)||[]).length;this.$groups=new pyInt(e)}return this.$groups},$doc:\"The number of capturing groups in the pattern.\"},groupindex:{$get(){if(null===this.$groupindex){const e=this.str.v.matchAll(this.group$regex),t=[];let r=1;for(const n of e)n[1]&&(t.push(new pyStr(n[1])),t.push(new pyInt(r))),r++;this.$groupindex=new pyMappingProxy(new pyDict(t))}return this.$groupindex},$doc:\"A dictionary mapping group names to group numbers.\"}},proto:{group$regex:/\\((?!\\?(?!P<).*)(?:\\?P<([^\\d\\W]\\w*)>)?(?![^\\[]*\\])/g,get$count:e=>(e=asIndexSized(e,OverflowError))||Number.POSITIVE_INFINITY,get$jsstr(e,t,r){if(!checkString(e))throw new TypeError(\"expected string or bytes-like object\");if(t===zero&&r===maxsize||void 0===t&&void 0===r)return{jsstr:e.toString(),pos:zero.valueOf(),endpos:e.sq$length()};const{start:n,end:s}=pySlice.startEnd$wrt(e,t,r);return{jsstr:e.toString().slice(n,s),pos:n,endpos:s}},find$all(e,t,r){let{jsstr:n}=this.get$jsstr(e,t,r);const s=this.v,i=n.matchAll(s),o=[];for(let a of i)o.push(1===a.length?new pyStr(a[0]):2===a.length?new pyStr(a[1]):new pyTuple(a.slice(1).map((e=>new pyStr(e)))));return new pyList(o)},$split(e,t){t=(t=asIndexSized(t))||Number.POSITIVE_INFINITY;let{jsstr:r}=this.get$jsstr(e);const n=this.v,s=[];let i,o=0,a=0;for(;null!==(i=n.exec(r))&&o1&&s.push(...i.slice(1).map((e=>void 0===e?pyNone:new pyStr(e)))),o++,a=n.lastIndex,i.index===n.lastIndex){if(!r)break;r=r.slice(i.index),a=0,n.lastIndex=1}return n.lastIndex=0,s.push(new pyStr(r.slice(a))),new pyList(s)},match$from_repl(e,t,r,n){let s;const i=e[e.length-1];return\"object\"==typeof i?(s=e.slice(0,e.length-3),Object.assign(s,{groups:i}),s.index=e[e.length-3]):(s=e.slice(0,e.length-2),s.groups=void 0,s.index=e[e.length-2]),new re.Match(s,this.str,t,r,n)},do$sub(e,t,r){const{jsstr:n,pos:s,endpos:i}=this.get$jsstr(t);let o;checkCallable(e)?o=t=>{const r=pyCall(e,[t]);if(!checkString(r))throw new TypeError(\"expected str instance, \"+typeName(r)+\" found\");return r.toString()}:(e=this.get$jsstr(e).jsstr,o=t=>t.template$repl(e)),r=this.get$count(r);let a=0;const l=n.replace(this.v,((...e)=>{if(a>=r)return e[0];a++;const n=this.match$from_repl(e,t,s,i);return o(n)}));return[new pyStr(l),new pyInt(a)]},$sub(e,t,r){const[n]=this.do$sub(e,t,r);return n},$subn(e,t,r){return new pyTuple(this.do$sub(e,t,r))},do$match(e,t,r,n){let s;({jsstr:s,pos:r,endpos:n}=this.get$jsstr(t,r,n));const i=s.match(e);return null===i?pyNone:new re.Match(i,this,t,r,n)},$search(e,t,r){var n=new RegExp(this.v.source,this.v.flags.replace(\"g\",\"\"));return this.do$match(n,e,t,r)},$match(e,t,r){let n=this.v.source,s=this.v.flags.replace(\"g\",\"\").replace(\"m\",\"\");n=\"^\"+n;var i=new RegExp(n,s);return this.do$match(i,e,t,r)},full$match(e,t,r){let n=this.v.source,s=this.v.flags.replace(\"g\",\"\").replace(\"m\",\"\");n=\"^(?:\"+n+\")$\";var i=new RegExp(n,s);return this.do$match(i,e,t,r)},find$iter(e,t,r){let n;({jsstr:n,pos:t,endpos:r}=this.get$jsstr(e,t,r));const s=n.matchAll(this.v);return new pyIterator((()=>{const n=s.next().value;if(void 0!==n)return new re.Match(n,this,e,t,r)}))}},flags:{sk$acceptable_as_base_class:!1}}),re.Match=buildNativeClass(\"re.Match\",{constructor:function(e,t,r,n,s){this.v=e,this.$match=new pyStr(this.v[0]),this.str=r,this.$re=t,this.$pos=n,this.$endpos=s,this.$groupdict=null,this.$groups=null,this.$lastindex=null,this.$lastgroup=null,this.$regs=null},slots:{tp$doc:\"The result of re.match() and re.search().\\nMatch objects always have a boolean value of True.\",$r(){let e=\"\",new pyStr(e)},tp$as_squence_or_mapping:!0,mp$subscript(e){const t=this.get$group(e);return void 0===t?pyNone:new pyStr(t)}},methods:{group:{$meth:function group(...e){let t;return e.length<=1?(t=this.get$group(e[0]),void 0===t?pyNone:new pyStr(t)):(t=[],e.forEach((e=>{e=this.get$group(e),t.push(void 0===e?pyNone:new pyStr(e))})),new pyTuple(t))},$flags:{MinArgs:0},$textsig:null,$doc:\"group([group1, ...]) -> str or tuple.\\n Return subgroup(s) of the match by indices or names.\\n For 0 returns the entire match.\"},start:{$meth:function start(e){const t=this.get$group(e);return new pyInt(void 0===t?-1:this.str.v.indexOf(t,this.v.index+this.$pos))},$flags:{MinArgs:0,MaxArgs:1},$textsig:\"($self, group=0, /)\",$doc:\"Return index of the start of the substring matched by group.\"},end:{$meth:function end(e){const t=this.get$group(e);return new pyInt(void 0===t?-1:this.str.v.indexOf(t,this.v.index+this.$pos)+[...t].length)},$flags:{MinArgs:0,MaxArgs:1},$textsig:\"($self, group=0, /)\",$doc:\"Return index of the end of the substring matched by group.\"},span:{$meth:function span(e){return this.$span(e)},$flags:{MinArgs:0,MaxArgs:1},$textsig:\"($self, group=0, /)\",$doc:\"For match object m, return the 2-tuple (m.start(group), m.end(group)).\"},groups:{$meth:function groups(e){return null!==this.$groups||(this.$groups=Array.from(this.v.slice(1),(t=>void 0===t?e:new pyStr(t))),this.$groups=new pyTuple(this.$groups)),this.$groups},$flags:{NamedArgs:[\"default\"],Defaults:[pyNone]},$textsig:\"($self, /, default=None)\",$doc:\"Return a tuple containing all the subgroups of the match, from 1.\\n\\n default\\n Is used for groups that did not participate in the match.\"},groupdict:{$meth:function groupdict(e){if(null!==this.$groupdict)return this.$groupdict;if(void 0===this.v.groups)this.$groupdict=new pyDict;else{const t=[];Object.entries(this.v.groups).forEach((([r,n])=>{t.push(new pyStr(r)),t.push(void 0===n?e:new pyStr(n))})),this.$groupdict=new pyDict(t)}return this.$groupdict},$flags:{NamedArgs:[\"default\"],Defaults:[pyNone]},$textsig:\"($self, /, default=None)\",$doc:\"Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\\n\\n default\\n Is used for groups that did not participate in the match.\"},expand:{$meth:function expand(e){if(!checkString(e))throw new TypeError(\"expected str instance got \"+typeName(e));return e=e.toString(),e=this.template$repl(e),new pyStr(e)},$flags:{OneArg:!0},$textsig:\"($self, /, template)\",$doc:\"Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.\"},__copy__:{$meth:function __copy__(){return this},$flags:{NoArgs:!0},$textsig:\"($self, /)\",$doc:null},__deepcopy__:{$meth:function __deepcopy__(){return this},$flags:{OneArg:!0},$textsig:\"($self, memo, /)\",$doc:null}},getsets:{lastindex:{$get(){if(null!==this.$lastindex)return this.$lastindex;let e,t=0;return this.v.forEach(((r,n)=>{n&&void 0!==r&&e!==r&&(t=n,e=r)})),this.$lastindex=t?new pyInt(t):pyNone,this.$lastindex},$doc:\"The integer index of the last matched capturing group.\"},lastgroup:{$get(){if(null!==this.$lastgroup)return this.$lastgroup;if(void 0===this.v.groups)this.$lastgroup=pyNone;else{let e;Object.entries(this.v.groups).forEach((([t,r])=>{void 0!==r&&(e=t)})),this.$lastgroup=void 0===e?pyNone:new pyStr(e)}return this.$lastgroup},$doc:\"The name of the last matched capturing group.\"},regs:{$get(){if(null!==this.$regs)return this.$regs;const e=[];return this.v.forEach(((t,r)=>{e.push(this.$span(r))})),this.$regs=new pyTuple(e),this.$regs}},string:{$get(){return this.str},$doc:\"The string passed to match() or search().\"},re:{$get(){return this.$re},$doc:\"The regular expression object.\"},pos:{$get(){return new pyInt(this.$pos)},$doc:\"The index into the string at which the RE engine started looking for a match.\"},endpos:{$get(){return new pyInt(this.$endpos)},$doc:\"The index into the string beyond which the RE engine will not go.\"}},proto:{get$group(e){if(void 0===e)return this.v[0];if(checkString(e)){if(e=e.toString(),this.v.groups&&Object.prototype.hasOwnProperty.call(this.v.groups,e))return this.v.groups[e]}else if(isIndex(e)&&(e=asIndexSized(e))>=0&&e|\\\\g<([^\\d\\W]\\w*)>|\\\\g?/g,template$repl(e){return e.replace(this.template$regex,((e,t,r,n,s,i)=>{let o;if(void 0!==(t=t||r)?o=t{delete _compiled_patterns[e]})),pyNone},$flags:{NoArgs:!0},$textsig:\"($module, / )\",$doc:\"Clear the regular expression caches\"},template:{$meth:function template(e,t){return _compile(e,numberBinOp(re.T,t,\"BitOr\"))},$flags:{NamedArgs:[\"pattern\",\"flags\"],Defaults:[zero]},$textsig:\"($module, / , pattern, flags=0)\",$doc:\"Compile a template pattern, returning a Pattern object\"},escape:{$meth:function(e){if(!checkString(e))throw new TypeError(\"expected a str instances, got \"+typeName(e));return e=(e=e.toString()).replace(escape_chrs,\"\\\\$&\"),new pyStr(e)},$flags:{NamedArgs:[\"pattern\"],Defaults:[]},$textsig:\"($module, / , pattern)\",$doc:\"\\n Escape special characters in a string.\\n \"}});const escape_chrs=/[\\&\\~\\#.*+\\-?^${}()|[\\]\\\\\\t\\r\\v\\f\\n ]/g;return re}","src/lib/signal.js":"var $builtinmodule=function(n){var i={};return i.SIG_DFL=new Sk.builtin.int_(0),i.SIG_IGN=new Sk.builtin.int_(1),i.CTRL_C_EVENT=new Sk.builtin.int_(0),i.CTRL_BREAK_EVENT=new Sk.builtin.int_(0),i.NSIG=new Sk.builtin.int_(23),i.SIGHUP=new Sk.builtin.int_(1),i.SIGNINT=new Sk.builtin.int_(2),i.SIGILL=new Sk.builtin.int_(4),i.SIGFPE=new Sk.builtin.int_(8),i.SIGKILL=new Sk.builtin.int_(9),i.SIGSEGV=new Sk.builtin.int_(11),i.SIGTERM=new Sk.builtin.int_(15),i.SIGBREAK=new Sk.builtin.int_(21),i.SIGABRT=new Sk.builtin.int_(22),i.pause=new Sk.builtin.func((function(){Sk.builtin.pyCheckArgsLen(\"pause\",arguments.length,0,0);var n=new Sk.misceval.Suspension;return n.resume=function(){return Sk.builtin.none.none$},n.data={type:\"Sk.promise\",promise:new Promise((function(n,i){if(null!=Sk.signals&&Sk.signals.addEventListener){Sk.signals.addEventListener((function handleSignal(i){Sk.signals.removeEventListener(handleSignal),n()}))}else console.warn(\"signal.pause() not supported\"),Sk.misceval.print_(\"signal.pause() not supported\"),n()}))},n})),i.signal=new Sk.builtin.func((function(){throw new Sk.builtin.NotImplementedError(\"signal.signal is not supported.\")})),i};","src/lib/string.js":"var $builtinmodule=function(i){var t={};return t.ascii_lowercase=new Sk.builtin.str(\"abcdefghijklmnopqrstuvwxyz\"),t.ascii_uppercase=new Sk.builtin.str(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"),t.ascii_letters=new Sk.builtin.str(t.ascii_lowercase.v+t.ascii_uppercase.v),t.lowercase=new Sk.builtin.str(\"abcdefghijklmnopqrstuvwxyz\"),t.uppercase=new Sk.builtin.str(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"),t.letters=new Sk.builtin.str(t.lowercase.v+t.uppercase.v),t.digits=new Sk.builtin.str(\"0123456789\"),t.hexdigits=new Sk.builtin.str(\"0123456789abcdefABCDEF\"),t.octdigits=new Sk.builtin.str(\"01234567\"),t.punctuation=new Sk.builtin.str(\"!\\\"#$%&'()*+,-./:;<=>?@[\\\\]^_`{|}~\"),t.whitespace=new Sk.builtin.str(\"\\t\\n\\v\\f\\r \"),t.printable=new Sk.builtin.str(t.digits.v+t.letters.v+t.punctuation.v+\" \\t\\n\\r\\v\\f\"),t.split=new Sk.builtin.func((function(...i){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.split,i)})),t.capitalize=new Sk.builtin.func((function(i){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.capitalize,[i])})),t.join=new Sk.builtin.func((function(i,t){return void 0===t&&(t=new Sk.builtin.str(\" \")),Sk.misceval.callsimArray(Sk.builtin.str.prototype.join,[t,i])})),t.capwords=new Sk.builtin.func((function(i,n){if(Sk.builtin.pyCheckArgsLen(\"capwords\",arguments.length,1,2),!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError(\"s must be a string\");if(void 0===n&&(n=new Sk.builtin.str(\" \")),!Sk.builtin.checkString(n))throw new Sk.builtin.TypeError(\"sep must be a string\");for(var e=Sk.misceval.callsimArray(t.split,[i,n]).v,r=[],l=0;l1&&function isLeapYear(t){return 0==(3&t)&&(t%100!=0||t%400==0)}(e?t.getUTCFullYear():t.getFullYear())&&u++,u}function stdTimezoneOffset(){var t=new Date(2002,0,1),e=new Date(2002,6,1);return Math.max(t.getTimezoneOffset(),e.getTimezoneOffset())}function dst(t){return t.getTimezoneOffset()1)return n[1];if(void 0===e)return null;try{return(n=t.toLocaleString(e,{timeZoneName:\"short\"}).split(\" \"))[n.length-1]}catch(i){return null}}function from_seconds(t,e){var i=new Date;if(t){Sk.builtin.pyCheckType(\"secs\",\"number\",Sk.builtin.checkNumber(t));var u=Sk.builtin.asnum$(t);i.setTime(1e3*u)}return function date_to_struct_time(t,e){let i;if(e=e||!1)i=[new Sk.builtin.str(\"UTC\"),new Sk.builtin.int_(0)];else{var u=-t.getTimezoneOffset()/60,r=(u<0?\"-\":\"+\")+(\"\"+Math.abs(u)).padStart(2,\"0\");i=[new Sk.builtin.str(r),new Sk.builtin.int_(3600*u)]}return new n([Sk.builtin.assk$(e?t.getUTCFullYear():t.getFullYear()),Sk.builtin.assk$((e?t.getUTCMonth():t.getMonth())+1),Sk.builtin.assk$(e?t.getUTCDate():t.getDate()),Sk.builtin.assk$(e?t.getUTCHours():t.getHours()),Sk.builtin.assk$(e?t.getUTCMinutes():t.getMinutes()),Sk.builtin.assk$(e?t.getUTCSeconds():t.getSeconds()),Sk.builtin.assk$(((e?t.getUTCDay():t.getDay())+6)%7),Sk.builtin.assk$(getDayOfYear(t,e)),Sk.builtin.assk$(e?0:dst(t)?1:0)],i)}(i,e)}e.struct_time=n,e.time=new Sk.builtin.func((function(){return Sk.builtin.pyCheckArgsLen(\"time\",arguments.length,0,0),new Sk.builtin.float_(Date.now()/1e3)})),e.sleep=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen(\"sleep\",arguments.length,1,1),Sk.builtin.pyCheckType(\"delay\",\"float\",Sk.builtin.checkNumber(t)),new Sk.misceval.promiseToSuspension(new Promise((function(e){Sk.setTimeout((function(){e(Sk.builtin.none.none$)}),1e3*Sk.ffi.remapToJs(t))})))})),e.localtime=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen(\"localtime\",arguments.length,0,1),from_seconds(t,!1)})),e.gmtime=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen(\"gmtime\",arguments.length,0,1),from_seconds(t,!0)}));var i=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],u=[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\"];function asctime_f(t){if(Sk.builtin.pyCheckArgsLen(\"asctime\",arguments.length,0,1),!t||Sk.builtin.checkNone(t)?t=from_seconds():t instanceof n||(t=new n(t)),t instanceof Sk.builtin.tuple&&9==t.v.length){var e=[];return e.push(u[Sk.builtin.asnum$(t.v[6])]),e.push(i[Sk.builtin.asnum$(t.v[1])-1]),e.push(padLeft(Sk.builtin.asnum$(t.v[2]).toString(),2,\"0\")),e.push(padLeft(Sk.builtin.asnum$(t.v[3]).toString(),2,\"0\")+\":\"+padLeft(Sk.builtin.asnum$(t.v[4]).toString(),2,\"0\")+\":\"+padLeft(Sk.builtin.asnum$(t.v[5]).toString(),2,\"0\")),e.push(padLeft(Sk.builtin.asnum$(t.v[0]).toString(),4,\"0\")),new Sk.builtin.str(e.join(\" \"))}}function mktime_f(t){if(Sk.builtin.pyCheckArgsLen(\"mktime\",arguments.length,1,1),t instanceof Sk.builtin.tuple&&9==t.v.length){var e=new Date(Sk.builtin.asnum$(t.v[0]),Sk.builtin.asnum$(t.v[1])-1,Sk.builtin.asnum$(t.v[2]),Sk.builtin.asnum$(t.v[3]),Sk.builtin.asnum$(t.v[4]),Sk.builtin.asnum$(t.v[5]));return Sk.builtin.assk$(e.getTime()/1e3,void 0)}throw new Sk.builtin.TypeError(\"mktime() requires a struct_time or 9-tuple\")}e.asctime=new Sk.builtin.func(asctime_f),e.ctime=new Sk.builtin.func((function(t){return Sk.builtin.pyCheckArgsLen(\"ctime\",arguments.length,0,1),asctime_f(from_seconds(t))})),e.mktime=new Sk.builtin.func(mktime_f),e.timezone=new Sk.builtin.int_(60*stdTimezoneOffset()),e.altzone=new Sk.builtin.int_(60*function altTimezoneOffset(){var t=new Date(2002,0,1),e=new Date(2002,6,1);return Math.min(t.getTimezoneOffset(),e.getTimezoneOffset())}()),e.daylight=new Sk.builtin.int_(function daylight_check(){const t=new Date(2002,0,1),e=new Date(2002,6,1);return t.getTimezoneOffset()!=e.getTimezoneOffset()}()?1:0),e.tzname=new Sk.builtin.tuple(function timeZoneNames(){var t=new Date(2002,0,1),e=new Date(2002,6,1);return dst(t)?[new Sk.builtin.str(timeZoneName(e)),new Sk.builtin.str(timeZoneName(t))]:[new Sk.builtin.str(timeZoneName(t)),new Sk.builtin.str(timeZoneName(e))]}()),e.accept2dyear=Sk.builtin.assk$(1),e.clock=new Sk.builtin.func((function(){var t=0;return t=Sk.global.performance&&Sk.global.performance.now?performance.now()/1e3:(new Date).getTime()/1e3,new Sk.builtin.float_(t)})),e.strftime=new Sk.builtin.func((function strftime_f(t,e){var i;if(Sk.builtin.pyCheckArgsLen(\"strftime\",arguments.length,1,2),!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError(\"format must be a string\");return e?e instanceof n||(e=new n(e)):e=from_seconds(),check_struct_time(e),i=Sk.ffi.remapToJs(t),Sk.ffi.remapToPy(Sk.global.strftime(i,new Date(1e3*mktime_f(e).v)))})),e.tzset=new Sk.builtin.func((function tzset_f(){throw new Sk.builtin.NotImplementedError(\"time.tzset() is not yet implemented\")}));let r=null;return e.strptime=new Sk.builtin.func((function strptime_f(...t){return Sk.builtin.pyCheckArgsLen(\"strptime\",t.length,1,2),null===r?Sk.misceval.chain(Sk.importModule(\"_strptime\",!1,!0),(e=>(r=e.tp$getattr(new Sk.builtin.str(\"_strptime_time\")),r.tp$call(t)))):r.tp$call(t)})),e};","src/lib/token.js":"var $builtinmodule=function(n){var e={};e.__file__=new Sk.builtin.str(\"/src/lib/token.py\");const t=[];for(let i in Sk.token.tok_name){const n=Sk.token.tok_name[i].slice(2),k=parseInt(i,10);t.push(Sk.ffi.remapToPy(k)),t.push(Sk.ffi.remapToPy(n)),e[n]=Sk.ffi.remapToPy(k)}return e.tok_name=new Sk.builtin.dict(t),e.ISTERMINAL=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen(\"ISTERMINAL\",arguments.length,1,1),Sk.token.ISTERMINAL(Sk.ffi.remapToJs(n))})),e.ISNONTERMINAL=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen(\"ISNONTERMINAL\",arguments.length,1,1),Sk.token.ISNONTERMINAL(Sk.ffi.remapToJs(n))})),e.ISEOF=new Sk.builtin.func((function(n){return Sk.builtin.pyCheckArgsLen(\"ISEOF\",arguments.length,1,1),Sk.token.ISEOF(Sk.ffi.remapToJs(n))})),e};","src/lib/tokenize.js":"var $builtinmodule=function(e){var i={};return i.tokenize=new Sk.builtin.func((function(e){Sk.builtin.pyCheckArgsLen(\"tokenize\",1,1),Sk.builtin.checkFunction(e);const i=[];return Sk._tokenize(\"\",(function jsReadline(){const i=Sk.misceval.callsimArray(e);return Sk.ffi.remapToJs(i)}),\"UTF-8\",(function receiveToken(e){i.push(new Sk.builtin.tuple([Sk.ffi.remapToPy(e.type),Sk.ffi.remapToPy(e.string),new Sk.builtin.tuple([Sk.ffi.remapToPy(e.start[0]),Sk.ffi.remapToPy(e.start[1])]),new Sk.builtin.tuple([Sk.ffi.remapToPy(e.end[0]),Sk.ffi.remapToPy(e.end[1])]),Sk.ffi.remapToPy(e.line)]))})),new Sk.builtin.list(i)})),i};","src/lib/turtle.js":"var $builtinmodule=function(e){\"use strict\";var t=function getConfiguredTarget(){var e,t;for(t=\"string\"==typeof(e=Sk.TurtleGraphics&&Sk.TurtleGraphics.target||\"turtle\")?document.getElementById(e):e;t.firstChild;)t.removeChild(t.firstChild);return t}();return t.turtleInstance?t.turtleInstance.reset():t.turtleInstance=function generateTurtleModule(e){var t,n,r,i,s,a,o,l,u={__name__:new Sk.builtin.str(\"turtle\")},c=!0,h=1e3/30,d={},f={},_={target:\"turtle\",width:400,height:400,worldWidth:0,worldHeight:0,animate:!0,bufferSize:0,allowUndo:!0,assets:{}};function getAsset(e){var t=i.assets,n=\"function\"==typeof t?t(e):t[e];return\"string\"==typeof n?new Promise((function(t,r){var s=new Image;s.onload=function(){i.assets[e]=this,t(s)},s.onerror=function(){r(new Error(\"Missing asset: \"+n))},s.src=n})):new InstantPromise(void 0,n)}function InstantPromise(e,t){this.lastResult=t,this.lastError=e}function FrameManager(){this.reset()}function getFrameManager(){return o||(o=new FrameManager),o}function MouseHandler(){var e=this;for(var t in this._target=getTarget(),this._managers={},this._handlers={mousedown:function(t){e.onEvent(\"mousedown\",t)},mouseup:function(t){e.onEvent(\"mouseup\",t)},mousemove:function(t){e.onEvent(\"mousemove\",t)}},this._handlers)this._target.addEventListener(t,this._handlers[t])}function EventManager(e,t){this._type=e,this._target=t,this._handlers=void 0,function getMouseHandler(){return a||(a=new MouseHandler),a}().addManager(e,this)}function Turtle(e){if(getFrameManager().addTurtle(this),this._screen=getScreen(),this._managers={},this._shape=e.v,!d.hasOwnProperty(this._shape))throw new Sk.builtin.ValueError(\"Shape:'\"+this._shape+\"' not in default shape, please check shape again!\");this.reset()}function Screen(){var e,t;this._frames=1,this._delay=void 0,this._bgcolor=\"none\",this._mode=\"standard\",this._managers={},this._keyLogger={},e=(i.worldWidth||i.width||getWidth())/2,t=(i.worldHeight||i.height||getHeight())/2,this.setUpWorld(-e,-t,e,t)}function ensureAnonymous(){return s||(s=Sk.misceval.callsimArray(u.Turtle)),s.instance}function getTarget(){return e}function getScreen(){return r||(r=new Screen),r}function getWidth(){return 0|(r&&r._width||i.width||getTarget().clientWidth||_.width)}function getHeight(){return 0|(r&&r._height||i.height||getTarget().clientHeight||_.height)}function createLayer(e,t){var n,r=document.createElement(\"canvas\"),i=getWidth(),s=getHeight(),a=getTarget().firstChild?-s+\"px\":\"0\";return r.width=i,r.height=s,r.style.position=\"relative\",r.style.display=\"block\",r.style.setProperty(\"margin-top\",a),r.style.setProperty(\"z-index\",e),t&&(r.style.display=\"none\"),getTarget().appendChild(r),(n=r.getContext(\"2d\")).lineCap=\"round\",n.lineJoin=\"round\",applyWorld(getScreen(),n),n}function cancelAnimationFrame(){t&&((window.cancelAnimationFrame||window.mozCancelAnimationFrame)(t),t=void 0),n&&(window.clearTimeout(n),n=void 0)}function applyWorld(e,t){var n=e.llx,r=(e.lly,e.urx,e.ury),i=e.xScale,s=e.yScale;t&&(clearLayer(t),t.restore(),t.save(),t.scale(1/i,1/s),t.translate(-n,-r))}function pushUndo(e){var t,n,r;if(i.allowUndo&&e._bufferSize){for(e._undoBuffer||(e._undoBuffer=[]);e._undoBuffer.length>e._bufferSize;)e._undoBuffer.shift();for(n={},t=\"x y angle radians color fill down filling shown shape size\".split(\" \"),r=0;r=0;)this._turtles[e].reset();this._turtles=[],this._frames=[],this._frameCount=0,this._buffer=1,this._rate=0,this._animationFrame=animationFrame()},e.addFrame=function(e,t){return t&&(this._frameCount+=1),this.frames().push(e),!i.animate||this._buffer&&this._frameCount===this.frameBuffer()?this.update():new InstantPromise},e.frames=function(){return this._frames},e.frameBuffer=function(e){return\"number\"==typeof e&&(this._buffer=0|e,e&&e<=this._frameCount)?this.update():this._buffer},e.refreshInterval=function(e){return\"number\"==typeof e&&(this._rate=0|e,this._animationFrame=animationFrame(e)),this._rate},e.update=function(){return this._frames&&this._frames.length?this.requestAnimationFrame():new InstantPromise},e.requestAnimationFrame=function(){var e,t,n=this._frames,r=this._animationFrame,i=this._turtles,s=getScreen().spriteLayer();return this._frames=[],this._frameCount=0,new Promise((function(a){r((function paint(){for(t=0;t=0;)l[a].test(n,r,i,s)&&l[a].canMove(\"mousedown\"===e);if(o&&o.length)for(computeCoordinates(),a=o.length;--a>=0;)(\"mousemove\"===e&&o[a].canMove()&&o[a].test(n,r,i,s)||\"mousedown\"===e&&o[a].test(n,r,i,s))&&o[a].trigger([i,s])},l.reset=function(){this._managers={}},l.addManager=function(e,t){this._managers[e]||(this._managers[e]=[]),this._managers[e].push(t)},function(e){e.reset=function(){this._handlers=void 0},e.canMove=function(e){return!(!this._target||!this._target.hitTest)&&(void 0!==e&&(this._target.hitTest.hit=e),this._target.hitTest.hit)},e.test=function(e,t,n,r){return this._target&&this._target.hitTest?this._target.hitTest(e,t,n,r):!!this._target},e.trigger=function(e){var t,n=this._handlers;if(n&&n.length)for(t=0;t.5&&e<10.5?Sk.builtin.asnum$(Sk.builtin.round(Sk.builtin.assk$(e))):0,this._speed=e,this._computed_speed=2*e,this.addUpdate(void 0,!1,{speed:this._computed_speed})},e.$speed.minArgs=0,e.$speed.co_varnames=[\"speed\"],e.$pencolor=function(e,t,n,r){return void 0!==e?(this._color=createColor(this._colorMode,e,t,n,r),this.addUpdate(void 0,this._shown,{color:this._color})):hexToRGB(this._color)},e.$pencolor.co_varnames=[\"r\",\"g\",\"b\",\"a\"],e.$pencolor.minArgs=0,e.$pencolor.returnType=f.COLOR,e.$fillcolor=function(e,t,n,r){return void 0!==e?(this._fill=createColor(this._colorMode,e,t,n,r),this.addUpdate(void 0,this._shown,{fill:this._fill})):hexToRGB(this._fill)},e.$fillcolor.co_varnames=[\"r\",\"g\",\"b\",\"a\"],e.$fillcolor.minArgs=0,e.$fillcolor.returnType=f.COLOR,e.$color=function(e,t,n,r){return void 0!==e?(void 0===t||void 0!==n?(this._color=createColor(this._colorMode,e,t,n,r),this._fill=this._color):(this._color=createColor(this._colorMode,e),this._fill=createColor(this._colorMode,t)),this.addUpdate(void 0,this._shown,{color:this._color,fill:this._fill})):[this.$pencolor(),this.$fillcolor()]},e.$color.minArgs=0,e.$color.co_varnames=[\"color\",\"fill\",\"b\",\"a\"],e.$color.returnType=function(e){return new Sk.builtin.tuple([f.COLOR(e[0]),f.COLOR(e[1])])},e.$fill=function(e){if(void 0!==e){if((e=!!e)===this._filling)return;return this._filling=e,e?(pushUndo(this),this.addUpdate(void 0,!1,{filling:!0,fillBuffer:[{x:this._x,y:this._y}]})):(pushUndo(this),this.addUpdate((function(){this.fillBuffer.push(this),drawFill.call(this)}),!0,{filling:!1,fillBuffer:void 0}))}return this._filling},e.$fill.co_varnames=[\"flag\"],e.$fill.minArgs=0,e.$begin_fill=function(){return this.$fill(!0)},e.$end_fill=function(){return this.$fill(!1)},e.$stamp=function(){return pushUndo(this),this.addUpdate((function(){drawTurtle(this,this.context())}),!0)},e.$dot=function(e,t,n,r,i){return pushUndo(this),e=\"number\"==typeof(e=Sk.builtin.asnum$(e))?Math.max(1,0|Math.abs(e)):Math.max(this._size+4,2*this._size),t=void 0!==t?createColor(this._colorMode,t,n,r,i):this._color,this.addUpdate(drawDot,!0,void 0,e,t)},e.$dot.co_varnames=[\"size\",\"color\",\"g\",\"b\",\"a\"],e.$write=function(e,t,n,r){var i,s,a,o,l,u=this;return pushUndo(this),e=String(e),r&&r.constructor===Array&&(s=\"string\"==typeof r[0]?r[0]:\"Arial\",a=String(r[1]||\"12pt\"),o=\"string\"==typeof r[2]?r[2]:\"normal\",/^\\d+$/.test(a)&&(a+=\"pt\"),r=[o,a,s].join(\" \")),n||(n=\"left\"),i=this.addUpdate(drawText,!0,void 0,e,n,r),!t||\"left\"!==n&&\"center\"!==n||(l=function measureText(e,t){return t&&(p.font=t),p.measureText(e).width}(e,r),\"center\"===n&&(l/=2),i=i.then((function(){var e=u.getState();return u.translate(e.x,e.y,l,0,!0)}))),i},e.$write.co_varnames=[\"message\",\"move\",\"align\",\"font\"],e.$write.minArgs=1,e.$pensize=e.$width=function(e){return void 0!==e?(this._size=e,this.addUpdate(void 0,this._shown,{size:e})):this._size},e.$pensize.minArgs=e.$width.minArgs=0,e.$pensize.co_varnames=e.$width.co_varnames=[\"width\"],e.$showturtle=e.$st=function(){return this._shown=!0,this.addUpdate(void 0,!0,{shown:!0})},e.$hideturtle=e.$ht=function(){return this._shown=!1,this.addUpdate(void 0,!0,{shown:!1})},e.$isvisible=function(){return this._shown},e.$shape=function(e){return e&&d[e]?(this._shape=e,this.addUpdate(void 0,this._shown,{shape:e})):this._shape},e.$shape.minArgs=0,e.$shape.co_varnames=[\"name\"],e.$window_width=function(){return this._screen.$window_width()},e.$window_height=function(){return this._screen.$window_height()},e.$tracer=function(e,t){return this._screen.$tracer(e,t)},e.$tracer.minArgs=0,e.$tracer.co_varnames=[\"n\",\"delay\"],e.$update=function(){return this._screen.$update()},e.$delay=function(e){return this._screen.$delay(e)},e.$delay.minArgs=0,e.$delay.co_varnames=[\"delay\"],e.$reset=function(){return this.reset(),this.$clear()},e.$mainloop=e.$done=function(){return this._screen.$mainloop()},e.$clear=function(){return this.addUpdate((function(){clearLayer(this.context())}),!0)},e.$dot.minArgs=0,e.$onclick=function(e,t,n){this.getManager(\"mousedown\").addHandler(e,n)},e.$onclick.minArgs=1,e.$onclick.co_varnames=[\"method\",\"btn\",\"add\"],e.$onrelease=function(e,t,n){this.getManager(\"mouseup\").addHandler(e,n)},e.$onrelease.minArgs=1,e.$onrelease.co_varnames=[\"method\",\"btn\",\"add\"],e.$ondrag=function(e,t,n){this.getManager(\"mousemove\").addHandler(e,n)},e.$ondrag.minArgs=1,e.$ondrag.co_varnames=[\"method\",\"btn\",\"add\"],e.$getscreen=function(){return Sk.misceval.callsimArray(u.Screen)},e.$getscreen.isSk=!0,e.$clone=function(){var e=Sk.misceval.callsimOrSuspendArray(u.Turtle);return e.instance._x=this._x,e.instance._y=this._y,e.instance._angle=this._angle,e.instance._radians=this._radians,e.instance._shape=this._shape,e.instance._color=this._color,e.instance._fill=this._fill,e.instance._filling=this._filling,e.instance._size=this._size,e.instance._computed_speed=this._computed_speed,e.instance._down=this._down,e.instance._shown=this._shown,e.instance._colorMode=this._colorMode,e.instance._isRadians=this._isRadians,e.instance._fullCircle=this._fullCircle,e.instance._bufferSize=this._bufferSize,e.instance._undoBuffer=this._undoBuffer,e._clonedFrom=this,e},e.$clone.returnType=function(e){return e},e.$getturtle=e.$getpen=function(){return this.skInstance},e.$getturtle.isSk=!0}(Turtle.prototype),function(e){e.spriteLayer=function(){return this._sprites||(this._sprites=createLayer(3))},e.bgLayer=function(){return this._background||(this._background=createLayer(1))},e.hitTestLayer=function(){return this._hitTest||(this._hitTest=createLayer(0,!0))},e.getManager=function(e){return this._managers[e]||(this._managers[e]=new EventManager(e,this)),this._managers[e]},e.reset=function(){var e;for(e in this._keyListeners=void 0,this._keyLogger)window.clearInterval(this._keyLogger[e]),window.clearTimeout(this._keyLogger[e]),delete this._keyLogger[e];for(e in this._keyDownListener&&(getTarget().removeEventListener(\"keydown\",this._keyDownListener),this._keyDownListener=void 0),this._keyUpListener&&(getTarget().removeEventListener(\"keyup\",this._keyUpListener),this._keyUpListener=void 0),this._timer&&(window.clearTimeout(this._timer),this._timer=void 0),this._managers)this._managers[e].reset();this._mode=\"standard\",removeLayer(this._sprites),this._sprites=void 0,removeLayer(this._background),this._background=void 0},e.setUpWorld=function(e,t,n,r){var i=this;i.llx=e,i.lly=t,i.urx=n,i.ury=r,i.xScale=(n-e)/getWidth(),i.yScale=-1*(r-t)/getHeight(),i.lineScale=Math.min(Math.abs(i.xScale),Math.abs(i.yScale))},e.$setup=function(e,t,n,r){return isNaN(parseFloat(e))&&(e=getWidth()),isNaN(parseFloat(t))&&(t=getHeight()),e<=1&&(e=getWidth()*e),t<=1&&(t=getHeight()*t),this._width=e,this._height=t,this._xOffset=void 0===n||isNaN(parseInt(n))?0:parseInt(n),this._yOffset=void 0===r||isNaN(parseInt(r))?0:parseInt(r),\"world\"===this._mode?this._setworldcoordinates(this.llx,this.lly,this.urx,this.ury):this._setworldcoordinates(-e/2,-t/2,e/2,t/2)},e.$setup.minArgs=0,e.$setup.co_varnames=[\"width\",\"height\",\"startx\",\"starty\"],e.$register_shape=e.$addshape=function(e,t){if(!t)return getAsset(e).then((function(t){d[e]=t}));d[e]=t},e.$register_shape.minArgs=1,e.$register_shape.co_varnames=[\"name\",\"shape\"],e.$getshapes=function(){return Object.keys(d)},e.$tracer=function(e,t){return void 0!==e||void 0!==t?(\"number\"==typeof t&&(this._delay=t,getFrameManager().refreshInterval(t)),\"number\"==typeof e?(this._frames=e,getFrameManager().frameBuffer(e)):void 0):this._frames},e.$tracer.co_varnames=[\"frames\",\"delay\"],e.$tracer.minArgs=0,e.$delay=function(e){return void 0!==e?this.$tracer(void 0,e):void 0===this._delay?h:this._delay},e.$delay.co_varnames=[\"delay\"],e._setworldcoordinates=function(e,t,n,r){return getFrameManager().turtles(),this.setUpWorld(e,t,n,r),this._sprites&&applyWorld(this,this._sprites),this._background&&applyWorld(this,this._background),this.$clear()},e.$setworldcoordinates=function(e,t,n,r){return this._mode=\"world\",this._setworldcoordinates(e,t,n,r)},e.$setworldcoordinates.co_varnames=[\"llx\",\"lly\",\"urx\",\"ury\"],e.minArgs=4,e.$clear=e.$clearscreen=function(){return this.reset(),this.$reset()},e.$update=function(){return getFrameManager().update()},e.$reset=e.$resetscreen=function(){var e=this,t=getFrameManager().turtles();return getFrameManager().addFrame((function(){applyWorld(e,e._sprites),applyWorld(e,e._background);for(var n=0;n1&&t[s]&&t[s].test(r),r===a||i){e._keyListeners[r](),e._createKeyRepeater(r,s),n.preventDefault();break}}},getTarget().addEventListener(\"keydown\",this._keyDownListener))},e._createKeyUpListener=function(){var e=this;this._keyUpListener||(this._keyUpListener=function(t){var n=e._keyLogger[t.charCode||t.keyCode];void 0!==n&&(t.preventDefault(),window.clearInterval(n),window.clearTimeout(n),delete e._keyLogger[t.charCode||t.keyCode])},getTarget().addEventListener(\"keyup\",this._keyUpListener))},e.$title=function(e){document.title=e},e.$title.minArgs=1,e.$title.co_varnames=[\"title\"],e.$listen=function(){this._createKeyUpListener(),this._createKeyDownListener()},e.$onkey=function(e,t){if(\"function\"==typeof t){var n=e;e=t,t=n}t=String(t).toLowerCase(),e&&\"function\"==typeof e?(this._keyListeners||(this._keyListeners={}),this._keyListeners[t]=e):delete this._keyListeners[t]},e.$onkey.minArgs=2,e.$onkey.co_varnames=[\"method\",\"keyValue\"],e.$onscreenclick=function(e,t,n){this.getManager(\"mousedown\").addHandler(e,n)},e.$onscreenclick.minArgs=1,e.$onscreenclick.co_varnames=[\"method\",\"btn\",\"add\"],e.$ontimer=function(e,t){this._timer&&(window.clearTimeout(this._timer),this._timer=void 0),e&&\"number\"==typeof t&&(this._timer=window.setTimeout(e,Math.max(0,0|t)))},e.$ontimer.minArgs=0,e.$ontimer.co_varnames=[\"method\",\"interval\"]}(Screen.prototype);var g=new Image;function removeLayer(e){e&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas)}function clearLayer(e,t,n){e&&(e.save(),e.setTransform(1,0,0,1,0,0),t?(e.fillStyle=t,e.fillRect(0,0,e.canvas.width,e.canvas.height)):e.clearRect(0,0,e.canvas.width,e.canvas.height),n&&e.drawImage(n,0,0),e.restore())}function drawTurtle(e,t){var n,r,i,s=d[e.shape],a=getScreen(),o=(getWidth(),getHeight(),a.xScale),l=a.yScale;if(t){if(n=Math.cos(e.radians)/o,r=Math.sin(e.radians)/l,i=Math.atan2(r,n)-Math.PI/2,t.save(),t.translate(e.x,e.y),t.scale(o,l),s.nodeName){var u=s.naturalWidth,c=s.naturalHeight;t.drawImage(s,0,0,u,c,-u/2,-c/2,u,c)}else{t.rotate(i),t.beginPath(),t.lineWidth=1,t.strokeStyle=e.color,t.fillStyle=e.fill,t.moveTo(-s[0][0],s[0][1]);for(var h=1;ho)throw u=l===o?\"exactly \"+o:\"between \"+l+\" and \"+o,new Sk.builtin.TypeError(a+\"() takes \"+u+\" positional argument(s) (\"+d.length+\" given)\");for(e=d.length;--e>=0;)void 0!==d[e]&&(d[e]instanceof Sk.builtin.func?d[e]=pythonToJavascriptFunction(d[e]):d[e]instanceof Sk.builtin.method?d[e]=pythonToJavascriptFunction(d[e].im_func,d[e].im_self):d[e]&&d[e].$d instanceof Sk.builtin.dict&&d[e].instance?d[e]=d[e].instance:d[e]=Sk.ffi.remapToJs(d[e]));var _=d.slice(0);for(d=[],e=_.length;e>=0;--e)null!==_[e]&&(d[e]=_[e]);try{t=f[n].apply(f,d)}catch(g){throw window&&window.console&&(window.console.log(\"wrapped method failed\"),window.console.log(g.stack)),g}return t instanceof InstantPromise&&(t=t.lastResult),t instanceof Promise?(t=t.catch((function(e){throw window&&window.console&&(window.console.log(\"promise failed\"),window.console.log(e.stack)),e})),(i=new Sk.misceval.Suspension).resume=function(){return void 0===s?Sk.builtin.none.none$:Sk.ffi.remapToPy(s)},i.data={type:\"Sk.promise\",promise:t.then((function(e){return s=e,e}))},i):void 0===t?Sk.builtin.none.none$:h?t:\"function\"==typeof c?c(t):Sk.ffi.remapToPy(t)},i.co_name=new Sk.builtin.str(a),i.co_varnames=u.slice(),i.$defaults=[];for(var d=l;d\")})),e.__iter__=new Sk.builtin.func((function(n){var e=n.lineList;return Sk.builtin.makeGenerator((function(){if(!(this.$index>=this.$lines.length))return new Sk.builtin.str(this.$lines[this.$index++])}),{$obj:n,$index:0,$lines:e})})),e.read=new Sk.builtin.func((function(n,e){if(n.closed)throw new Sk.builtin.ValueError(\"I/O operation on closed file\");var i=n.data$.length;void 0===e&&(e=i);var t=new Sk.builtin.str(n.data$.substr(n.pos$,e));return n.pos$+=e,n.pos$>=i&&(n.pos$=i),t})),e.readline=new Sk.builtin.func((function(n,e){var i=\"\";return n.currentLinee===o)).length)throw new i(\"one of the hex, bytes, bytes_le, fields, or int arguments must be given\");if(u!==o){u=u.toString().replace(\"urn:\",\"\").replace(\"uuid:\",\"\");let e=0,i=u.length-1;for(;\"{}\".indexOf(u[e])>=0;)e++;for(;\"{}\".indexOf(u[i])>=0;)i--;if(u=u.slice(e,i+1),u=u.replace(S,\"\"),32!==u.length)throw new s(\"badly formed hexadecimal UUID string\");f=d(n,[new t(u),U])}if(c!==o){if(!(c instanceof e))throw new i(\"bytes_le should be a bytes instance\");if(c=c.valueOf(),16!==c.length)throw new s(\"bytes_le is not a 16-char string\");h=switchBytesBytesLe(c),h=new e(h)}if(h!==o){if(!(h instanceof e))throw new i(\"bytes_le should be a bytes instance\");if(16!==h.valueOf().length)throw new s(\"bytes is not a 16-char string\");f=d(w,[h],[\"byteorder\",v])}if(p!==o)throw new r(\"fields argument is not yet supported\");if(f!==o&&(g(f,_,\"Lt\")||((e,t)=>g(e,t,\"GtE\"))(f,y)))throw new s(\"int is out of range (need a 128-bit value)\");this.$int=f,this.$isSafe=I},tp$str(){const e=E.nb$remainder(this.$int).toString();return new t(`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`)},$r(){const e=u(this.ob$type,t.$name),n=c(this.tp$str());return new t(`${e}(${n})`)},tp$hash(){return this.$int.tp$hash()},tp$richcompare(e,t){return e instanceof R?this.$int.tp$richcompare(e.$int,t):l},tp$as_number:!0,nb$int(){return this.$int}},getsets:{int:{$get(){return this.$int}},is_safe:{$get(){return this.$isSafe}},bytes:{$get(){return d(b,[this.$int,U,v])}},bytes_le:{$get(){const n=this.tp$getattr(new t(\"bytes\")).valueOf();return new e(switchBytesBytesLe(n))}},fields:{$get:()=>notImplemented()},time_low:{$get:()=>notImplemented()},time_mid:{$get:()=>notImplemented()},time_hi_version:{$get:()=>notImplemented()},clock_seq_hi_variant:{$get:()=>notImplemented()},clock_seq_low:{$get:()=>notImplemented()},time:{$get:()=>notImplemented()},clock_seq:{$get:()=>notImplemented()},node:{$get:()=>notImplemented()},hex:{$get(){return E.nb$remainder(this.$int)}},urn:{$get(){return new t(`urn:uuid:${this}`)}},variant:{$get:()=>notImplemented()},version:{$get:()=>notImplemented()}}});return h(\"uuid\",p,{uuid1:{$meth(){notImplemented()},$flags:{FastCall:!0}},uuid2:{$meth(){notImplemented()},$flags:{FastCall:!0}},uuid3:{$meth(){notImplemented()},$flags:{FastCall:!0}},uuid4:{$meth(){const t=new e(f.getRandomValues(new Uint8Array(16)));return d(R,[],[\"bytes\",t,\"version\",I])},$flags:{NoArgs:!0}},uuid5:{$meth(){notImplemented()},$flags:{FastCall:!0}}}),p}","src/lib/webbrowser.js":"var $builtinmodule=function(n){var e={},t=\"undefined\"!=typeof window&&\"undefined\"!=typeof window.navigator;function open_tab(n){return Sk.builtin.pyCheckType(\"url\",\"string\",Sk.builtin.checkString(n)),t?(n=n.$jsstr(),window.open(n,\"_blank\"),Sk.builtin.bool.true$):Sk.builtin.bool.false$}return e.__name__=new Sk.builtin.str(\"webbrowser\"),e.open=new Sk.builtin.func((function open(n){return Sk.builtin.pyCheckArgsLen(\"open\",arguments.length+1,1,3),open_tab(n)})),e.open_new=new Sk.builtin.func((function open_new(n){return Sk.builtin.pyCheckArgsLen(\"open_new\",arguments.length,1,1),open_tab(n)})),e.open_new_tab=new Sk.builtin.func((function open_new_tab(n){return Sk.builtin.pyCheckArgsLen(\"open_new_tab\",arguments.length,1,1),open_tab(n)})),e.DefaultBrowser=Sk.misceval.buildClass(e,(function dflbrowser(n,e){e.__init__=new Sk.builtin.func((function __init__(n){return Sk.builtin.none.none$})),e.open=new Sk.builtin.func((function open(n,e){return Sk.builtin.pyCheckArgsLen(\"open\",arguments.length,2,4),open_tab(e)})),e.open_new=new Sk.builtin.func((function open_new(n,e){return Sk.builtin.pyCheckArgsLen(\"open_new\",arguments.length,2,2),open_tab(e)})),e.open_new_tab=new Sk.builtin.func((function open_new_tab(n,e){return Sk.builtin.pyCheckArgsLen(\"open_new_tab\",arguments.length,2,2),open_tab(e)}))}),\"DefaultBrowser\",[]),e.get=new Sk.builtin.func((function get(){return Sk.builtin.pyCheckArgsLen(\"get\",arguments.length,0,1),Sk.misceval.callsimArray(e.DefaultBrowser,[])})),e};","src/lib/webgl/__init__.js":"var $builtinmodule=function(n){var t={__name__:new Sk.builtin.str(\"webgl\")},makeFailHTML=function(n){return'
'+n+\"
\"},e='This page requires a browser that supports WebGL.
Click here to upgrade your browser.';return t.Context=Sk.misceval.buildClass(t,(function(n,t){t.__init__=new Sk.builtin.func((function(n,t){var i=document.getElementById(t.v),r=function(n,t){var i=document.getElementById(n);if(t||(t=i.getElementsByTagName(\"canvas\")[0]),t){var r=function(n){for(var t=[\"webgl\",\"experimental-webgl\",\"webkit-3d\",\"moz-webgl\"],e=null,i=0;i7||7==a.Chrome[0]&&a.Chrome[1]>0||7==a.Chrome[0]&&0==a.Chrome[1]&&a.Chrome[2]>=521)?i.innerHTML=makeFailHTML('It doesn\\'t appear your computer can support WebGL.
Click here for more information.'):i.innerHTML=makeFailHTML(e)}return r}i.innerHTML=makeFailHTML(e)}(t.v,i);if(!r)throw new Error(\"Your browser does not appear to support WebGL.\");for(var u in n.gl=r,r.__proto__)if(\"number\"==typeof r.__proto__[u])Sk.abstr.objectSetItem(n.$d,new Sk.builtin.str(u),r.__proto__[u]);else if(\"function\"==typeof r.__proto__[u])switch(u){case\"bufferData\":case\"clearColor\":case\"drawArrays\":case\"getAttribLocation\":case\"getUniformLocation\":case\"shaderSource\":case\"uniformMatrix4fv\":case\"vertexAttribPointer\":case\"viewport\":break;default:!function(t){Sk.abstr.objectSetItem(n.$d,new Sk.builtin.str(u),new Sk.builtin.func((function(){var n=r.__proto__[t];return n.apply(r,arguments)})))}(u)}r.clearColor(100/255,149/255,237/255,1),r.clear(r.COLOR_BUFFER_BIT)})),t.tp$getattr=Sk.generic.getAttr,t.bufferData=new Sk.builtin.func((function(n,t,e,i){n.gl.bufferData(t,e.v,i)})),t.clearColor=new Sk.builtin.func((function(n,t,e,i,r){n.gl.clearColor(Sk.builtin.asnum$(t),Sk.builtin.asnum$(e),Sk.builtin.asnum$(i),Sk.builtin.asnum$(r))})),t.getAttribLocation=new Sk.builtin.func((function(n,t,e){return n.gl.getAttribLocation(t,e.v)})),t.getUniformLocation=new Sk.builtin.func((function(n,t,e){return n.gl.getUniformLocation(t,e.v)})),t.shaderSource=new Sk.builtin.func((function(n,t,e){n.gl.shaderSource(t,e.v)})),t.drawArrays=new Sk.builtin.func((function(n,t,e,i){n.gl.drawArrays(Sk.builtin.asnum$(t),Sk.builtin.asnum$(e),Sk.builtin.asnum$(i))})),t.vertexAttribPointer=new Sk.builtin.func((function(n,t,e,i,r,u,a){n.gl.vertexAttribPointer(t,Sk.builtin.asnum$(e),Sk.builtin.asnum$(i),r,Sk.builtin.asnum$(u),Sk.builtin.asnum$(a))})),t.viewport=new Sk.builtin.func((function(n,t,e,i,r){n.gl.viewport(Sk.builtin.asnum$(t),Sk.builtin.asnum$(e),Sk.builtin.asnum$(i),Sk.builtin.asnum$(r))})),t.uniformMatrix4fv=new Sk.builtin.func((function(n,t,e,i){n.gl.uniformMatrix4fv(Sk.builtin.asnum$(t),e,i.v)})),t.setDrawFunc=new Sk.builtin.func((function(n,t){var e=(new Date).getTime();setInterval((function(){Sk.misceval.callsimArray(t,[n,(new Date).getTime()-e])}),1e3/60)}))}),\"Context\",[]),t.Float32Array=Sk.misceval.buildClass(t,(function(n,t){t.__init__=new Sk.builtin.func((function(n,t){n.v=\"number\"==typeof t?new Float32Array(t):new Float32Array(Sk.ffi.remapToJs(t))})),t.__repr__=new Sk.builtin.func((function(n){for(var t=[],e=0;e0&&(i=(l/=v)*l,a=(s/=v)*s,c=(m/=v)*m,u=l*s,r=s*m,f=m*l,o=l*_,k=s*_,S=m*_,y=1-w,(b=Sk.misceval.callsimArray(n.Mat44)).elements[0]=y*i+w,b.elements[1]=y*u-S,b.elements[2]=y*f+k,b.elements[3]=0,b.elements[4]=y*u+S,b.elements[5]=y*a+w,b.elements[6]=y*r-o,b.elements[7]=0,b.elements[8]=y*f-k,b.elements[9]=y*r+o,b.elements[10]=y*c+w,b.elements[11]=0,b.elements[12]=0,b.elements[13]=0,b.elements[14]=0,b.elements[15]=1,b=b.multiply(e),e.elements=b.elements);return e})),t.multiply=new Sk.builtin.func((function(e,t){for(var l=Sk.misceval.callsimArray(n.Mat44),s=0;s<4;s++)l.elements[4*s+0]=e.elements[4*s+0]*t.elements[0]+e.elements[4*s+1]*t.elements[4]+e.elements[4*s+2]*t.elements[8]+e.elements[4*s+3]*t.elements[12],l.elements[4*s+1]=e.elements[4*s+0]*t.elements[1]+e.elements[4*s+1]*t.elements[5]+e.elements[4*s+2]*t.elements[9]+e.elements[4*s+3]*t.elements[13],l.elements[4*s+2]=e.elements[4*s+0]*t.elements[2]+e.elements[4*s+1]*t.elements[6]+e.elements[4*s+2]*t.elements[10]+e.elements[4*s+3]*t.elements[14],l.elements[4*s+3]=e.elements[4*s+0]*t.elements[3]+e.elements[4*s+1]*t.elements[7]+e.elements[4*s+2]*t.elements[11]+e.elements[4*s+3]*t.elements[15];return e.elements=l.elements,e})),t.lookAt=new Sk.builtin.func((function(e,t,l,s,m,i,a,c,u,r){var f=[t-m,l-i,s-a],o=Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2]);o&&(f[0]/=o,f[1]/=o,f[2]/=o);var k=[c,u,r],S=[];S[0]=k[1]*f[2]-k[2]*f[1],S[1]=-k[0]*f[2]+k[2]*f[0],S[2]=k[0]*f[1]-k[1]*f[0],k[0]=f[1]*S[2]-f[2]*S[1],k[1]=-f[0]*S[2]+f[2]*S[0],k[2]=f[0]*S[1]-f[1]*S[0],(o=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]))&&(S[0]/=o,S[1]/=o,S[2]/=o),(o=Math.sqrt(k[0]*k[0]+k[1]*k[1]+k[2]*k[2]))&&(k[0]/=o,k[1]/=o,k[2]/=o);var y=Sk.misceval.callsimArray(n.Mat44);return y.elements[0]=S[0],y.elements[4]=S[1],y.elements[8]=S[2],y.elements[12]=0,y.elements[1]=k[0],y.elements[5]=k[1],y.elements[9]=k[2],y.elements[13]=0,y.elements[2]=f[0],y.elements[6]=f[1],y.elements[10]=f[2],y.elements[14]=0,y.elements[3]=0,y.elements[7]=0,y.elements[11]=0,y.elements[15]=1,y=y.multiply(e),e.elements=y.elements,e.translate(-t,-l,-s),e}))}),\"Mat44\",[]),n.Mat33=Sk.misceval.buildClass(n,(function(e,n){n.__init__=new Sk.builtin.func((function(e){Sk.misceval.callsimArray(n.loadIdentity,[e])})),n.loadIdentity=new Sk.builtin.func((function(e){e.elements=[1,0,0,0,1,0,0,0,1]}))}),\"Mat33\",[]),n.Vec3=Sk.misceval.buildClass(n,(function(e,t){t.__init__=new Sk.builtin.func((function(e,n,t,l){e.x=n,e.y=t,e.z=l})),t.__sub__=new Sk.builtin.func((function(e,t){return Sk.misceval.callsimArray(n.Vec3,[e.x-t.x,e.y-t.y,e.z-t.z])}))}),\"Vec3\",[]),n.cross=new Sk.builtin.func((function(e,t){return Sk.asserts.assert(e instanceof n.Vec3&&t instanceof n.Vec3),Sk.misceval.callsimArray(n.Vec3,[e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x])})),n};","src/lib/webgl/matrix4.js":"var $builtinmodule=function(n){var r={},t=new Float32Array(3),a=new Float32Array(3),u=new Float32Array(3),e=(new Float32Array(4),new Float32Array(4),new Float32Array(4),new Float32Array(16),new Float32Array(16),new Float32Array(16),function(n,r){for(var t=0,a=r.length,u=0;u1e-5)for(u=0;u{const n=e.$d;var r={},Buffer=function(t,e){var r=e||n.ARRAY_BUFFER,i=n.createBuffer();if(this.target=r,this.buf=i,this.set(t),this.numComponents_=t.numComponents,this.numElements_=t.numElements,this.totalComponents_=this.numComponents_*this.numElements_,t.buffer instanceof Float32Array)this.type_=n.FLOAT;else if(t.buffer instanceof Uint8Array)this.type_=n.UNSIGNED_BYTE;else if(t.buffer instanceof Int8Array)this.type_=n._BYTE;else if(t.buffer instanceof Uint16Array)this.type_=n.UNSIGNED_SHORT;else{if(!(t.buffer instanceof Int16Array))throw\"unhandled type:\"+typeof t.buffer;this.type_=n.SHORT}};return Buffer.prototype.set=function(t){n.bindBuffer(this.target,this.buf),n.bufferData(this.target,t.buffer,n.STATIC_DRAW)},Buffer.prototype.type=function(){return this.type_},Buffer.prototype.numComponents=function(){return this.numComponents_},Buffer.prototype.numElements=function(){return this.numElements_},Buffer.prototype.totalComponents=function(){return this.totalComponents_},Buffer.prototype.buffer=function(){return this.buf},Buffer.prototype.stride=function(){return 0},Buffer.prototype.offset=function(){return 0},r.Model=Sk.misceval.buildClass(r,(function(e,r){r.__init__=new Sk.builtin.func((function(e,r,i,f){e.buffers={};var setBuffer=function(t,r){var i=\"indices\"==t?n.ELEMENT_ARRAY_BUFFER:n.ARRAY_BUFFER;let f=e.buffers[t];f?f.set(r):f=new Buffer(r,i),e.buffers[t]=f};for(t in i)setBuffer(t,i[t]);var o={},s=0;for(var u in f)o[u]=s++;e.mode=n.TRIANGLES,e.textures=f.v,e.textureUnits=o,e.shader=r})),r.drawPrep=new Sk.builtin.func((function(t,e){var r=t.shader,i=t.buffers,f=t.textures;for(var o in e=Sk.ffi.remapToJs(e),Sk.misceval.callsimArray(r.use,[r]),i){var s=i[o];if(\"indices\"==o)n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,s.buffer());else{var u=r.attrib[o];u&&u(s)}}for(var a in f){var m=t.textureUnits[a];r.setUniform$impl(r,f,m),f[a].bindToUnit(m)}for(var p in e)r.setUniform$impl(r,p,e[p])})),r.draw=new Sk.builtin.func((function(t,e,r){var i=t.shader;e=Sk.ffi.remapToJs(e);for(let n in e)i.setUniform$impl(i,n,e[n]);if(r)for(var f in r){var o=t.textureUnits[f];i.setUniform$impl(i,f,o),r[f].bindToUnit(o)}var s=t.buffers;n.drawElements(t.mode,s.indices.totalComponents(),n.UNSIGNED_SHORT,0)}))}),\"Model\",[]),r}))};","src/lib/webgl/primitives.js":"var $builtinmodule=function(t){var n={},AttribBuffer=function(t,n,e){e=e||\"Float32Array\";var r=window[e];n.length?(this.buffer=new r(n),n=this.buffer.length/t,this.cursor=n):(this.buffer=new r(t*n),this.cursor=0),this.numComponents=t,this.numElements=n,this.type=e};return AttribBuffer.prototype.stride=function(){return 0},AttribBuffer.prototype.offset=function(){return 0},AttribBuffer.prototype.getElement=function(t){for(var n=t*this.numComponents,e=[],r=0;r