21 lines
1.5 MiB
21 lines
1.5 MiB
(()=>{var e={301:e=>{!function(){function t(e){return e&&e.__esModule?{d:e.default}:{d:e}}function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}var i,r=this,s={},o={},a={};!function(e,t){"object"==typeof a?a=t(function(){try{return n("poly-decomp")}catch(e){}}()):"object"==typeof a?(i=t(function(){try{return n("poly-decomp")}catch(e){}}()),a.Matter=i):e.Matter=t(e.decomp)}(a,(function(e){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([function(e,t){var n={};e.exports=n,function(){n._nextId=0,n._seed=0,n._nowStartTime=+new Date,n.extend=function(e,t){var i,r;"boolean"==typeof t?(i=2,r=t):(i=1,r=!0);for(var s=i;s<arguments.length;s++){var o=arguments[s];if(o)for(var a in o)r&&o[a]&&o[a].constructor===Object?e[a]&&e[a].constructor!==Object?e[a]=o[a]:(e[a]=e[a]||{},n.extend(e[a],r,o[a])):e[a]=o[a]}return e},n.clone=function(e,t){return n.extend({},t,e)},n.keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)t.push(n);return t},n.values=function(e){var t=[];if(Object.keys){for(var n=Object.keys(e),i=0;i<n.length;i++)t.push(e[n[i]]);return t}for(var r in e)t.push(e[r]);return t},n.get=function(e,t,n,i){t=t.split(".").slice(n,i);for(var r=0;r<t.length;r+=1)e=e[t[r]];return e},n.set=function(e,t,i,r,s){var o=t.split(".").slice(r,s);return n.get(e,t,0,-1)[o[o.length-1]]=i,i},n.shuffle=function(e){for(var t=e.length-1;t>0;t--){var i=Math.floor(n.random()*(t+1)),r=e[t];e[t]=e[i],e[i]=r}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return e<t?t:e>n?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1},n.map=function(e,t){if(e.map)return e.map(t);for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n},n.topologicalSort=function(e){var t=[],i=[],r=[];for(var s in e)i[s]||r[s]||n._topologicalSort(s,i,r,e,t);return t},n._topologicalSort=function(e,t,i,r,s){var o=r[e]||[];i[e]=!0;for(var a=0;a<o.length;a+=1){var l=o[a];i[l]||t[l]||n._topologicalSort(l,t,i,r,s)}i[e]=!1,t[e]=!0,s.push(e)},n.chain=function(){for(var e=[],t=0;t<arguments.length;t+=1){var n=arguments[t];n._chained?e.push.apply(e,n._chained):e.push(n)}var i=function(){for(var t,n=new Array(arguments.length),i=0,r=arguments.length;i<r;i++)n[i]=arguments[i];for(i=0;i<e.length;i+=1){var s=e[i].apply(t,n);void 0!==s&&(t=s)}return t};return i._chained=e,i},n.chainPathBefore=function(e,t,i){return n.set(e,t,n.chain(i,n.get(e,t)))},n.chainPathAfter=function(e,t,i){return n.set(e,t,n.chain(n.get(e,t),i))}}()},function(e,t){var n={};e.exports=n,n.create=function(e){var t={min:{x:0,y:0},max:{x:0,y:0}};return e&&n.update(t,e),t},n.update=function(e,t,n){e.min.x=1/0,e.max.x=-1/0,e.min.y=1/0,e.max.y=-1/0;for(var i=0;i<t.length;i++){var r=t[i];r.x>e.max.x&&(e.max.x=r.x),r.x<e.min.x&&(e.min.x=r.x),r.y>e.max.y&&(e.max.y=r.y),r.y<e.min.y&&(e.min.y=r.y)}n&&(n.x>0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,i=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+i}},function(e,t){var n={};e.exports=n,n.create=function(e,t){return{x:e||0,y:t||0}},n.clone=function(e){return{x:e.x,y:e.y}},n.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},n.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},n.rotate=function(e,t,n){var i=Math.cos(t),r=Math.sin(t);n||(n={});var s=e.x*i-e.y*r;return n.y=e.x*r+e.y*i,n.x=s,n},n.rotateAbout=function(e,t,n,i){var r=Math.cos(t),s=Math.sin(t);i||(i={});var o=n.x+((e.x-n.x)*r-(e.y-n.y)*s);return i.y=n.y+((e.x-n.x)*s+(e.y-n.y)*r),i.x=o,i},n.normalise=function(e){var t=n.magnitude(e);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}},n.dot=function(e,t){return e.x*t.x+e.y*t.y},n.cross=function(e,t){return e.x*t.y-e.y*t.x},n.cross3=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)},n.add=function(e,t,n){return n||(n={}),n.x=e.x+t.x,n.y=e.y+t.y,n},n.sub=function(e,t,n){return n||(n={}),n.x=e.x-t.x,n.y=e.y-t.y,n},n.mult=function(e,t){return{x:e.x*t,y:e.y*t}},n.div=function(e,t){return{x:e.x/t,y:e.y/t}},n.perp=function(e,t){return{x:(t=!0===t?-1:1)*-e.y,y:t*e.x}},n.neg=function(e){return{x:-e.x,y:-e.y}},n.angle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(e,t,n){var i={};e.exports=i;var r=n(2),s=n(0);i.create=function(e,t){for(var n=[],i=0;i<e.length;i++){var r=e[i],s={x:r.x,y:r.y,index:i,body:t,isInternal:!1};n.push(s)}return n},i.fromPath=function(e,t){var n=[];return e.replace(/L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/gi,(function(e,t,i){n.push({x:parseFloat(t),y:parseFloat(i)})})),i.create(n,t)},i.centre=function(e){for(var t,n,s,o=i.area(e,!0),a={x:0,y:0},l=0;l<e.length;l++)s=(l+1)%e.length,t=r.cross(e[l],e[s]),n=r.mult(r.add(e[l],e[s]),t),a=r.add(a,n);return r.div(a,6*o)},i.mean=function(e){for(var t={x:0,y:0},n=0;n<e.length;n++)t.x+=e[n].x,t.y+=e[n].y;return r.div(t,e.length)},i.area=function(e,t){for(var n=0,i=e.length-1,r=0;r<e.length;r++)n+=(e[i].x-e[r].x)*(e[i].y+e[r].y),i=r;return t?n/2:Math.abs(n)/2},i.inertia=function(e,t){for(var n,i,s=0,o=0,a=e,l=0;l<a.length;l++)i=(l+1)%a.length,s+=(n=Math.abs(r.cross(a[i],a[l])))*(r.dot(a[i],a[i])+r.dot(a[i],a[l])+r.dot(a[l],a[l])),o+=n;return t/6*(s/o)},i.translate=function(e,t,n){var i;if(n)for(i=0;i<e.length;i++)e[i].x+=t.x*n,e[i].y+=t.y*n;else for(i=0;i<e.length;i++)e[i].x+=t.x,e[i].y+=t.y;return e},i.rotate=function(e,t,n){if(0!==t){for(var i=Math.cos(t),r=Math.sin(t),s=0;s<e.length;s++){var o=e[s],a=o.x-n.x,l=o.y-n.y;o.x=n.x+(a*i-l*r),o.y=n.y+(a*r+l*i)}return e}},i.contains=function(e,t){for(var n=0;n<e.length;n++){var i=e[n],r=e[(n+1)%e.length];if((t.x-i.x)*(r.y-i.y)+(t.y-i.y)*(i.x-r.x)>0)return!1}return!0},i.scale=function(e,t,n,s){if(1===t&&1===n)return e;var o,a;s=s||i.centre(e);for(var l=0;l<e.length;l++)o=e[l],a=r.sub(o,s),e[l].x=s.x+a.x*t,e[l].y=s.y+a.y*n;return e},i.chamfer=function(e,t,n,i,o){t="number"==typeof t?[t]:t||[8],n=void 0!==n?n:-1,i=i||2,o=o||14;for(var a=[],l=0;l<e.length;l++){var u=e[l-1>=0?l-1:e.length-1],c=e[l],p=e[(l+1)%e.length],h=t[l<t.length?l:t.length-1];if(0!==h){var d=r.normalise({x:c.y-u.y,y:u.x-c.x}),f=r.normalise({x:p.y-c.y,y:c.x-p.x}),_=Math.sqrt(2*Math.pow(h,2)),m=r.mult(s.clone(d),h),b=r.normalise(r.mult(r.add(d,f),.5)),g=r.sub(c,r.mult(b,_)),S=n;-1===n&&(S=1.75*Math.pow(h,.32)),(S=s.clamp(S,i,o))%2==1&&(S+=1);for(var k=Math.acos(r.dot(d,f))/S,y=0;y<S;y++)a.push(r.add(r.rotate(m,k*y),g))}else a.push(c)}return a},i.clockwiseSort=function(e){var t=i.mean(e);return e.sort((function(e,n){return r.angle(t,e)-r.angle(t,n)})),e},i.isConvex=function(e){var t,n,i,r,s=0,o=e.length;if(o<3)return null;for(t=0;t<o;t++)if(i=(t+2)%o,r=(e[n=(t+1)%o].x-e[t].x)*(e[i].y-e[n].y),(r-=(e[n].y-e[t].y)*(e[i].x-e[n].x))<0?s|=1:r>0&&(s|=2),3===s)return!1;return 0!==s||null},i.hull=function(e){var t,n,i=[],s=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n<e.length;n+=1){for(t=e[n];s.length>=2&&r.cross3(s[s.length-2],s[s.length-1],t)<=0;)s.pop();s.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];i.length>=2&&r.cross3(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}return i.pop(),s.pop(),i.concat(s)}},function(e,t,n){var i={};e.exports=i;var r=n(0);i.on=function(e,t,n){for(var i,r=t.split(" "),s=0;s<r.length;s++)i=r[s],e.events=e.events||{},e.events[i]=e.events[i]||[],e.events[i].push(n);return n},i.off=function(e,t,n){if(t){"function"==typeof t&&(n=t,t=r.keys(e.events).join(" "));for(var i=t.split(" "),s=0;s<i.length;s++){var o=e.events[i[s]],a=[];if(n&&o)for(var l=0;l<o.length;l++)o[l]!==n&&a.push(o[l]);e.events[i[s]]=a}}else e.events={}},i.trigger=function(e,t,n){var i,s,o,a,l=e.events;if(l&&r.keys(l).length>0){n||(n={}),i=t.split(" ");for(var u=0;u<i.length;u++)if(o=l[s=i[u]]){(a=r.clone(n,!1)).name=s,a.source=e;for(var c=0;c<o.length;c++)o[c].apply(e,[a])}}}},function(e,t,n){var i={};e.exports=i;var r=n(4),s=n(0),o=n(1),a=n(6);i.create=function(e){return s.extend({id:s.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{}},e)},i.setModified=function(e,t,n,r){if(e.isModified=t,n&&e.parent&&i.setModified(e.parent,t,n,r),r)for(var s=0;s<e.composites.length;s++){var o=e.composites[s];i.setModified(o,t,n,r)}},i.add=function(e,t){var n=[].concat(t);r.trigger(e,"beforeAdd",{object:t});for(var o=0;o<n.length;o++){var a=n[o];switch(a.type){case"body":if(a.parent!==a){s.warn("Composite.add: skipped adding a compound body part (you must add its parent instead)");break}i.addBody(e,a);break;case"constraint":i.addConstraint(e,a);break;case"composite":i.addComposite(e,a);break;case"mouseConstraint":i.addConstraint(e,a.constraint)}}return r.trigger(e,"afterAdd",{object:t}),e},i.remove=function(e,t,n){var s=[].concat(t);r.trigger(e,"beforeRemove",{object:t});for(var o=0;o<s.length;o++){var a=s[o];switch(a.type){case"body":i.removeBody(e,a,n);break;case"constraint":i.removeConstraint(e,a,n);break;case"composite":i.removeComposite(e,a,n);break;case"mouseConstraint":i.removeConstraint(e,a.constraint)}}return r.trigger(e,"afterRemove",{object:t}),e},i.addComposite=function(e,t){return e.composites.push(t),t.parent=e,i.setModified(e,!0,!0,!1),e},i.removeComposite=function(e,t,n){var r=s.indexOf(e.composites,t);if(-1!==r&&(i.removeCompositeAt(e,r),i.setModified(e,!0,!0,!1)),n)for(var o=0;o<e.composites.length;o++)i.removeComposite(e.composites[o],t,!0);return e},i.removeCompositeAt=function(e,t){return e.composites.splice(t,1),i.setModified(e,!0,!0,!1),e},i.addBody=function(e,t){return e.bodies.push(t),i.setModified(e,!0,!0,!1),e},i.removeBody=function(e,t,n){var r=s.indexOf(e.bodies,t);if(-1!==r&&(i.removeBodyAt(e,r),i.setModified(e,!0,!0,!1)),n)for(var o=0;o<e.composites.length;o++)i.removeBody(e.composites[o],t,!0);return e},i.removeBodyAt=function(e,t){return e.bodies.splice(t,1),i.setModified(e,!0,!0,!1),e},i.addConstraint=function(e,t){return e.constraints.push(t),i.setModified(e,!0,!0,!1),e},i.removeConstraint=function(e,t,n){var r=s.indexOf(e.constraints,t);if(-1!==r&&i.removeConstraintAt(e,r),n)for(var o=0;o<e.composites.length;o++)i.removeConstraint(e.composites[o],t,!0);return e},i.removeConstraintAt=function(e,t){return e.constraints.splice(t,1),i.setModified(e,!0,!0,!1),e},i.clear=function(e,t,n){if(n)for(var r=0;r<e.composites.length;r++)i.clear(e.composites[r],t,!0);return t?e.bodies=e.bodies.filter((function(e){return e.isStatic})):e.bodies.length=0,e.constraints.length=0,e.composites.length=0,i.setModified(e,!0,!0,!1),e},i.allBodies=function(e){for(var t=[].concat(e.bodies),n=0;n<e.composites.length;n++)t=t.concat(i.allBodies(e.composites[n]));return t},i.allConstraints=function(e){for(var t=[].concat(e.constraints),n=0;n<e.composites.length;n++)t=t.concat(i.allConstraints(e.composites[n]));return t},i.allComposites=function(e){for(var t=[].concat(e.composites),n=0;n<e.composites.length;n++)t=t.concat(i.allComposites(e.composites[n]));return t},i.get=function(e,t,n){var r,s;switch(n){case"body":r=i.allBodies(e);break;case"constraint":r=i.allConstraints(e);break;case"composite":r=i.allComposites(e).concat(e)}return r?0===(s=r.filter((function(e){return e.id.toString()===t.toString()}))).length?null:s[0]:null},i.move=function(e,t,n){return i.remove(e,t),i.add(n,t),e},i.rebase=function(e){for(var t=i.allBodies(e).concat(i.allConstraints(e)).concat(i.allComposites(e)),n=0;n<t.length;n++)t[n].id=s.nextId();return i.setModified(e,!0,!0,!1),e},i.translate=function(e,t,n){for(var r=n?i.allBodies(e):e.bodies,s=0;s<r.length;s++)a.translate(r[s],t);return i.setModified(e,!0,!0,!1),e},i.rotate=function(e,t,n,r){for(var s=Math.cos(t),o=Math.sin(t),l=r?i.allBodies(e):e.bodies,u=0;u<l.length;u++){var c=l[u],p=c.position.x-n.x,h=c.position.y-n.y;a.setPosition(c,{x:n.x+(p*s-h*o),y:n.y+(p*o+h*s)}),a.rotate(c,t)}return i.setModified(e,!0,!0,!1),e},i.scale=function(e,t,n,r,s){for(var o=s?i.allBodies(e):e.bodies,l=0;l<o.length;l++){var u=o[l],c=u.position.x-r.x,p=u.position.y-r.y;a.setPosition(u,{x:r.x+c*t,y:r.y+p*n}),a.scale(u,t,n)}return i.setModified(e,!0,!0,!1),e},i.bounds=function(e){for(var t=i.allBodies(e),n=[],r=0;r<t.length;r+=1){var s=t[r];n.push(s.bounds.min,s.bounds.max)}return o.create(n)}},function(e,t,n){var i={};e.exports=i;var r=n(3),s=n(2),o=n(7),a=(n(10),n(0)),l=n(1),u=n(15);!function(){i._inertiaScale=4,i._nextCollidingGroupId=1,i._nextNonCollidingGroupId=-1,i._nextCategory=1,i.create=function(t){var n={id:a.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:r.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,_original:null},i=a.extend(n,t);return e(i,t),i},i.nextGroup=function(e){return e?i._nextNonCollidingGroupId--:i._nextCollidingGroupId++},i.nextCategory=function(){return i._nextCategory=i._nextCategory<<1,i._nextCategory};var e=function(e,t){t=t||{},i.set(e,{bounds:e.bounds||l.create(e.vertices),positionPrev:e.positionPrev||s.clone(e.position),anglePrev:e.anglePrev||e.angle,vertices:e.vertices,parts:e.parts||[e],isStatic:e.isStatic,isSleeping:e.isSleeping,parent:e.parent||e}),r.rotate(e.vertices,e.angle,e.position),u.rotate(e.axes,e.angle),l.update(e.bounds,e.vertices,e.velocity),i.set(e,{axes:t.axes||e.axes,area:t.area||e.area,mass:t.mass||e.mass,inertia:t.inertia||e.inertia});var n=e.isStatic?"#14151f":a.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),o=e.isStatic?"#555":"#ccc",c=e.isStatic&&null===e.render.fillStyle?1:0;e.render.fillStyle=e.render.fillStyle||n,e.render.strokeStyle=e.render.strokeStyle||o,e.render.lineWidth=e.render.lineWidth||c,e.render.sprite.xOffset+=-(e.bounds.min.x-e.position.x)/(e.bounds.max.x-e.bounds.min.x),e.render.sprite.yOffset+=-(e.bounds.min.y-e.position.y)/(e.bounds.max.y-e.bounds.min.y)};i.set=function(e,t,n){var r;for(r in"string"==typeof t&&(r=t,(t={})[r]=n),t)if(Object.prototype.hasOwnProperty.call(t,r))switch(n=t[r],r){case"isStatic":i.setStatic(e,n);break;case"isSleeping":o.set(e,n);break;case"mass":i.setMass(e,n);break;case"density":i.setDensity(e,n);break;case"inertia":i.setInertia(e,n);break;case"vertices":i.setVertices(e,n);break;case"position":i.setPosition(e,n);break;case"angle":i.setAngle(e,n);break;case"velocity":i.setVelocity(e,n);break;case"angularVelocity":i.setAngularVelocity(e,n);break;case"parts":i.setParts(e,n);break;case"centre":i.setCentre(e,n);break;default:e[r]=n}},i.setStatic=function(e,t){for(var n=0;n<e.parts.length;n++){var i=e.parts[n];i.isStatic=t,t?(i._original={restitution:i.restitution,friction:i.friction,mass:i.mass,inertia:i.inertia,density:i.density,inverseMass:i.inverseMass,inverseInertia:i.inverseInertia},i.restitution=0,i.friction=1,i.mass=i.inertia=i.density=1/0,i.inverseMass=i.inverseInertia=0,i.positionPrev.x=i.position.x,i.positionPrev.y=i.position.y,i.anglePrev=i.angle,i.angularVelocity=0,i.speed=0,i.angularSpeed=0,i.motion=0):i._original&&(i.restitution=i._original.restitution,i.friction=i._original.friction,i.mass=i._original.mass,i.inertia=i._original.inertia,i.density=i._original.density,i.inverseMass=i._original.inverseMass,i.inverseInertia=i._original.inverseInertia,i._original=null)}},i.setMass=function(e,t){var n=e.inertia/(e.mass/6);e.inertia=n*(t/6),e.inverseInertia=1/e.inertia,e.mass=t,e.inverseMass=1/e.mass,e.density=e.mass/e.area},i.setDensity=function(e,t){i.setMass(e,t*e.area),e.density=t},i.setInertia=function(e,t){e.inertia=t,e.inverseInertia=1/e.inertia},i.setVertices=function(e,t){t[0].body===e?e.vertices=t:e.vertices=r.create(t,e),e.axes=u.fromVertices(e.vertices),e.area=r.area(e.vertices),i.setMass(e,e.density*e.area);var n=r.centre(e.vertices);r.translate(e.vertices,n,-1),i.setInertia(e,i._inertiaScale*r.inertia(e.vertices,e.mass)),r.translate(e.vertices,e.position),l.update(e.bounds,e.vertices,e.velocity)},i.setParts=function(e,t,n){var s;for(t=t.slice(0),e.parts.length=0,e.parts.push(e),e.parent=e,s=0;s<t.length;s++){var o=t[s];o!==e&&(o.parent=e,e.parts.push(o))}if(1!==e.parts.length){if(n=void 0===n||n){var a=[];for(s=0;s<t.length;s++)a=a.concat(t[s].vertices);r.clockwiseSort(a);var l=r.hull(a),u=r.centre(l);i.setVertices(e,l),r.translate(e.vertices,u)}var c=i._totalProperties(e);e.area=c.area,e.parent=e,e.position.x=c.centre.x,e.position.y=c.centre.y,e.positionPrev.x=c.centre.x,e.positionPrev.y=c.centre.y,i.setMass(e,c.mass),i.setInertia(e,c.inertia),i.setPosition(e,c.centre)}},i.setCentre=function(e,t,n){n?(e.positionPrev.x+=t.x,e.positionPrev.y+=t.y,e.position.x+=t.x,e.position.y+=t.y):(e.positionPrev.x=t.x-(e.position.x-e.positionPrev.x),e.positionPrev.y=t.y-(e.position.y-e.positionPrev.y),e.position.x=t.x,e.position.y=t.y)},i.setPosition=function(e,t){var n=s.sub(t,e.position);e.positionPrev.x+=n.x,e.positionPrev.y+=n.y;for(var i=0;i<e.parts.length;i++){var o=e.parts[i];o.position.x+=n.x,o.position.y+=n.y,r.translate(o.vertices,n),l.update(o.bounds,o.vertices,e.velocity)}},i.setAngle=function(e,t){var n=t-e.angle;e.anglePrev+=n;for(var i=0;i<e.parts.length;i++){var o=e.parts[i];o.angle+=n,r.rotate(o.vertices,n,e.position),u.rotate(o.axes,n),l.update(o.bounds,o.vertices,e.velocity),i>0&&s.rotateAbout(o.position,n,e.position,o.position)}},i.setVelocity=function(e,t){e.positionPrev.x=e.position.x-t.x,e.positionPrev.y=e.position.y-t.y,e.velocity.x=t.x,e.velocity.y=t.y,e.speed=s.magnitude(e.velocity)},i.setAngularVelocity=function(e,t){e.anglePrev=e.angle-t,e.angularVelocity=t,e.angularSpeed=Math.abs(e.angularVelocity)},i.translate=function(e,t){i.setPosition(e,s.add(e.position,t))},i.rotate=function(e,t,n){if(n){var r=Math.cos(t),s=Math.sin(t),o=e.position.x-n.x,a=e.position.y-n.y;i.setPosition(e,{x:n.x+(o*r-a*s),y:n.y+(o*s+a*r)}),i.setAngle(e,e.angle+t)}else i.setAngle(e,e.angle+t)},i.scale=function(e,t,n,s){var o=0,a=0;s=s||e.position;for(var c=0;c<e.parts.length;c++){var p=e.parts[c];r.scale(p.vertices,t,n,s),p.axes=u.fromVertices(p.vertices),p.area=r.area(p.vertices),i.setMass(p,e.density*p.area),r.translate(p.vertices,{x:-p.position.x,y:-p.position.y}),i.setInertia(p,i._inertiaScale*r.inertia(p.vertices,p.mass)),r.translate(p.vertices,{x:p.position.x,y:p.position.y}),c>0&&(o+=p.area,a+=p.inertia),p.position.x=s.x+(p.position.x-s.x)*t,p.position.y=s.y+(p.position.y-s.y)*n,l.update(p.bounds,p.vertices,e.velocity)}e.parts.length>1&&(e.area=o,e.isStatic||(i.setMass(e,e.density*o),i.setInertia(e,a))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},i.update=function(e,t,n,i){var o=Math.pow(t*n*e.timeScale,2),a=1-e.frictionAir*n*e.timeScale,c=e.position.x-e.positionPrev.x,p=e.position.y-e.positionPrev.y;e.velocity.x=c*a*i+e.force.x/e.mass*o,e.velocity.y=p*a*i+e.force.y/e.mass*o,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.angularVelocity=(e.angle-e.anglePrev)*a*i+e.torque/e.inertia*o,e.anglePrev=e.angle,e.angle+=e.angularVelocity,e.speed=s.magnitude(e.velocity),e.angularSpeed=Math.abs(e.angularVelocity);for(var h=0;h<e.parts.length;h++){var d=e.parts[h];r.translate(d.vertices,e.velocity),h>0&&(d.position.x+=e.velocity.x,d.position.y+=e.velocity.y),0!==e.angularVelocity&&(r.rotate(d.vertices,e.angularVelocity,e.position),u.rotate(d.axes,e.angularVelocity),h>0&&s.rotateAbout(d.position,e.angularVelocity,e.position,d.position)),l.update(d.bounds,d.vertices,e.velocity)}},i.applyForce=function(e,t,n){e.force.x+=n.x,e.force.y+=n.y;var i=t.x-e.position.x,r=t.y-e.position.y;e.torque+=i*n.y-r*n.x},i._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n<e.parts.length;n++){var i=e.parts[n],r=i.mass!==1/0?i.mass:1;t.mass+=r,t.area+=i.area,t.inertia+=i.inertia,t.centre=s.add(t.centre,s.mult(i.position,r))}return t.centre=s.div(t.centre,t.mass),t}}()},function(e,t,n){var i={};e.exports=i;var r=n(4);i._motionWakeThreshold=.18,i._motionSleepThreshold=.08,i._minBias=.9,i.update=function(e,t){for(var n=t*t*t,r=0;r<e.length;r++){var s=e[r],o=s.speed*s.speed+s.angularSpeed*s.angularSpeed;if(0===s.force.x&&0===s.force.y){var a=Math.min(s.motion,o),l=Math.max(s.motion,o);s.motion=i._minBias*a+(1-i._minBias)*l,s.sleepThreshold>0&&s.motion<i._motionSleepThreshold*n?(s.sleepCounter+=1,s.sleepCounter>=s.sleepThreshold&&i.set(s,!0)):s.sleepCounter>0&&(s.sleepCounter-=1)}else i.set(s,!1)}},i.afterCollisions=function(e,t){for(var n=t*t*t,r=0;r<e.length;r++){var s=e[r];if(s.isActive){var o=s.collision,a=o.bodyA.parent,l=o.bodyB.parent;if(!(a.isSleeping&&l.isSleeping||a.isStatic||l.isStatic)&&(a.isSleeping||l.isSleeping)){var u=a.isSleeping&&!a.isStatic?a:l,c=u===a?l:a;!u.isStatic&&c.motion>i._motionWakeThreshold*n&&i.set(u,!1)}}}},i.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||r.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&r.trigger(e,"sleepEnd"))}},function(e,t,n){var i={};e.exports=i;var r=n(3),s=n(2),o=n(7),a=n(1),l=n(15),u=n(0);i._warming=.4,i._torqueDampen=1,i._minLength=1e-6,i.create=function(e){var t=e;t.bodyA&&!t.pointA&&(t.pointA={x:0,y:0}),t.bodyB&&!t.pointB&&(t.pointB={x:0,y:0});var n=t.bodyA?s.add(t.bodyA.position,t.pointA):t.pointA,i=t.bodyB?s.add(t.bodyB.position,t.pointB):t.pointB,r=s.magnitude(s.sub(n,i));t.length=void 0!==t.length?t.length:r,t.id=t.id||u.nextId(),t.label=t.label||"Constraint",t.type="constraint",t.stiffness=t.stiffness||(t.length>0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var o={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(o.type="pin",o.anchors=!1):t.stiffness<.9&&(o.type="spring"),t.render=u.extend(o,t.render),t},i.preSolveAll=function(e){for(var t=0;t<e.length;t+=1){var n=e[t],i=n.constraintImpulse;n.isStatic||0===i.x&&0===i.y&&0===i.angle||(n.position.x+=i.x,n.position.y+=i.y,n.angle+=i.angle)}},i.solveAll=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n],s=!r.bodyA||r.bodyA&&r.bodyA.isStatic,o=!r.bodyB||r.bodyB&&r.bodyB.isStatic;(s||o)&&i.solve(e[n],t)}for(n=0;n<e.length;n+=1)s=!(r=e[n]).bodyA||r.bodyA&&r.bodyA.isStatic,o=!r.bodyB||r.bodyB&&r.bodyB.isStatic,s||o||i.solve(e[n],t)},i.solve=function(e,t){var n=e.bodyA,r=e.bodyB,o=e.pointA,a=e.pointB;if(n||r){n&&!n.isStatic&&(s.rotate(o,n.angle-e.angleA,o),e.angleA=n.angle),r&&!r.isStatic&&(s.rotate(a,r.angle-e.angleB,a),e.angleB=r.angle);var l=o,u=a;if(n&&(l=s.add(n.position,o)),r&&(u=s.add(r.position,a)),l&&u){var c=s.sub(l,u),p=s.magnitude(c);p<i._minLength&&(p=i._minLength);var h,d,f,_,m,b=(p-e.length)/p,g=e.stiffness<1?e.stiffness*t:e.stiffness,S=s.mult(c,b*g),k=(n?n.inverseMass:0)+(r?r.inverseMass:0),y=k+((n?n.inverseInertia:0)+(r?r.inverseInertia:0));if(e.damping){var v=s.create();f=s.div(c,p),m=s.sub(r&&s.sub(r.position,r.positionPrev)||v,n&&s.sub(n.position,n.positionPrev)||v),_=s.dot(f,m)}n&&!n.isStatic&&(d=n.inverseMass/k,n.constraintImpulse.x-=S.x*d,n.constraintImpulse.y-=S.y*d,n.position.x-=S.x*d,n.position.y-=S.y*d,e.damping&&(n.positionPrev.x-=e.damping*f.x*_*d,n.positionPrev.y-=e.damping*f.y*_*d),h=s.cross(o,S)/y*i._torqueDampen*n.inverseInertia*(1-e.angularStiffness),n.constraintImpulse.angle-=h,n.angle-=h),r&&!r.isStatic&&(d=r.inverseMass/k,r.constraintImpulse.x+=S.x*d,r.constraintImpulse.y+=S.y*d,r.position.x+=S.x*d,r.position.y+=S.y*d,e.damping&&(r.positionPrev.x+=e.damping*f.x*_*d,r.positionPrev.y+=e.damping*f.y*_*d),h=s.cross(a,S)/y*i._torqueDampen*r.inverseInertia*(1-e.angularStiffness),r.constraintImpulse.angle+=h,r.angle+=h)}}},i.postSolveAll=function(e){for(var t=0;t<e.length;t++){var n=e[t],u=n.constraintImpulse;if(!(n.isStatic||0===u.x&&0===u.y&&0===u.angle)){o.set(n,!1);for(var c=0;c<n.parts.length;c++){var p=n.parts[c];r.translate(p.vertices,u),c>0&&(p.position.x+=u.x,p.position.y+=u.y),0!==u.angle&&(r.rotate(p.vertices,u.angle,n.position),l.rotate(p.axes,u.angle),c>0&&s.rotateAbout(p.position,u.angle,n.position,p.position)),a.update(p.bounds,p.vertices,n.velocity)}u.angle*=i._warming,u.x*=i._warming,u.y*=i._warming}}},i.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+e.pointA.x,y:(e.bodyA?e.bodyA.position.y:0)+e.pointA.y}},i.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+e.pointB.x,y:(e.bodyB?e.bodyB.position.y:0)+e.pointB.y}}},function(e,t,n){var i={};e.exports=i;var r=n(18);i.create=function(e,t){var n=e.bodyA,r=e.bodyB,s=e.parentA,o=e.parentB,a={id:i.id(n,r),bodyA:n,bodyB:r,contacts:{},activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||r.isSensor,timeCreated:t,timeUpdated:t,inverseMass:s.inverseMass+o.inverseMass,friction:Math.min(s.friction,o.friction),frictionStatic:Math.max(s.frictionStatic,o.frictionStatic),restitution:Math.max(s.restitution,o.restitution),slop:Math.max(s.slop,o.slop)};return i.update(a,e,t),a},i.update=function(e,t,n){var s=e.contacts,o=t.supports,a=e.activeContacts,l=t.parentA,u=t.parentB;if(e.collision=t,e.inverseMass=l.inverseMass+u.inverseMass,e.friction=Math.min(l.friction,u.friction),e.frictionStatic=Math.max(l.frictionStatic,u.frictionStatic),e.restitution=Math.max(l.restitution,u.restitution),e.slop=Math.max(l.slop,u.slop),a.length=0,t.collided){for(var c=0;c<o.length;c++){var p=o[c],h=r.id(p),d=s[h];d?a.push(d):a.push(s[h]=r.create(p))}e.separation=t.depth,i.setActive(e,!0,n)}else!0===e.isActive&&i.setActive(e,!1,n)},i.setActive=function(e,t,n){t?(e.isActive=!0,e.timeUpdated=n):(e.isActive=!1,e.activeContacts.length=0)},i.id=function(e,t){return e.id<t.id?"A"+e.id+"B"+t.id:"A"+t.id+"B"+e.id}},function(e,t,n){var i={};e.exports=i;var r=n(0),s=n(5),o=n(1),a=n(4),l=n(11),u=n(2),c=n(14);!function(){var e,t;"undefined"!=typeof window&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout((function(){e(r.now())}),1e3/60)},t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),i.create=function(e){var t={controller:i,engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",hasBounds:!!e.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showBroadphase:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showShadows:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},s=r.extend(t,e);return s.canvas&&(s.canvas.width=s.options.width||s.canvas.width,s.canvas.height=s.options.height||s.canvas.height),s.mouse=e.mouse,s.engine=e.engine,s.canvas=s.canvas||n(s.options.width,s.options.height),s.context=s.canvas.getContext("2d"),s.textures={},s.bounds=s.bounds||{min:{x:0,y:0},max:{x:s.canvas.width,y:s.canvas.height}},1!==s.options.pixelRatio&&i.setPixelRatio(s,s.options.pixelRatio),r.isElement(s.element)?s.element.appendChild(s.canvas):s.canvas.parentNode||r.log("Render.create: options.element was undefined, render.canvas was created but not appended","warn"),s},i.run=function(t){!function n(r){t.frameRequestId=e(n),i.world(t)}()},i.stop=function(e){t(e.frameRequestId)},i.setPixelRatio=function(e,t){var n=e.options,i=e.canvas;"auto"===t&&(t=p(i)),n.pixelRatio=t,i.setAttribute("data-pixel-ratio",t),i.width=n.width*t,i.height=n.height*t,i.style.width=n.width+"px",i.style.height=n.height+"px"},i.lookAt=function(e,t,n,i){i=void 0===i||i,t=r.isArray(t)?t:[t],n=n||{x:0,y:0};for(var s={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},o=0;o<t.length;o+=1){var a=t[o],l=a.bounds?a.bounds.min:a.min||a.position||a,u=a.bounds?a.bounds.max:a.max||a.position||a;l&&u&&(l.x<s.min.x&&(s.min.x=l.x),u.x>s.max.x&&(s.max.x=u.x),l.y<s.min.y&&(s.min.y=l.y),u.y>s.max.y&&(s.max.y=u.y))}var p=s.max.x-s.min.x+2*n.x,h=s.max.y-s.min.y+2*n.y,d=e.canvas.height,f=e.canvas.width/d,_=p/h,m=1,b=1;_>f?b=_/f:m=f/_,e.options.hasBounds=!0,e.bounds.min.x=s.min.x,e.bounds.max.x=s.min.x+p*m,e.bounds.min.y=s.min.y,e.bounds.max.y=s.min.y+h*b,i&&(e.bounds.min.x+=.5*p-p*m*.5,e.bounds.max.x+=.5*p-p*m*.5,e.bounds.min.y+=.5*h-h*b*.5,e.bounds.max.y+=.5*h-h*b*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(c.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),c.setOffset(e.mouse,e.bounds.min))},i.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,i=t/e.options.width,r=n/e.options.height;e.context.setTransform(e.options.pixelRatio/i,0,0,e.options.pixelRatio/r,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},i.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},i.world=function(e){var t,n=e.engine,r=n.world,p=e.canvas,h=e.context,f=e.options,_=s.allBodies(r),m=s.allConstraints(r),b=f.wireframes?f.wireframeBackground:f.background,g=[],S=[],k={timestamp:n.timing.timestamp};if(a.trigger(e,"beforeRender",k),e.currentBackground!==b&&d(e,b),h.globalCompositeOperation="source-in",h.fillStyle="transparent",h.fillRect(0,0,p.width,p.height),h.globalCompositeOperation="source-over",f.hasBounds){for(t=0;t<_.length;t++){var y=_[t];o.overlaps(y.bounds,e.bounds)&&g.push(y)}for(t=0;t<m.length;t++){var v=m[t],T=v.bodyA,E=v.bodyB,I=v.pointA,w=v.pointB;T&&(I=u.add(T.position,v.pointA)),E&&(w=u.add(E.position,v.pointB)),I&&w&&(o.contains(e.bounds,I)||o.contains(e.bounds,w))&&S.push(v)}i.startViewTransform(e),e.mouse&&(c.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.options.width,y:(e.bounds.max.y-e.bounds.min.y)/e.options.height}),c.setOffset(e.mouse,e.bounds.min))}else S=m,g=_,1!==e.options.pixelRatio&&e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0);!f.wireframes||n.enableSleeping&&f.showSleeping?i.bodies(e,g,h):(f.showConvexHulls&&i.bodyConvexHulls(e,g,h),i.bodyWireframes(e,g,h)),f.showBounds&&i.bodyBounds(e,g,h),(f.showAxes||f.showAngleIndicator)&&i.bodyAxes(e,g,h),f.showPositions&&i.bodyPositions(e,g,h),f.showVelocity&&i.bodyVelocity(e,g,h),f.showIds&&i.bodyIds(e,g,h),f.showSeparations&&i.separations(e,n.pairs.list,h),f.showCollisions&&i.collisions(e,n.pairs.list,h),f.showVertexNumbers&&i.vertexNumbers(e,g,h),f.showMousePosition&&i.mousePosition(e,e.mouse,h),i.constraints(S,h),f.showBroadphase&&n.broadphase.controller===l&&i.grid(e,n.broadphase,h),f.showDebug&&i.debug(e,h),f.hasBounds&&i.endViewTransform(e),a.trigger(e,"afterRender",k)},i.debug=function(e,t){var n=t,i=e.engine,r=i.world,o=i.metrics,a=e.options,u=s.allBodies(r);if(i.timing.timestamp-(e.debugTimestamp||0)>=500){var c="";o.timing&&(c+="fps: "+Math.round(o.timing.fps)+" "),o.extended&&(o.timing&&(c+="delta: "+o.timing.delta.toFixed(3)+" ",c+="correction: "+o.timing.correction.toFixed(3)+" "),c+="bodies: "+u.length+" ",i.broadphase.controller===l&&(c+="buckets: "+o.buckets+" "),c+="\n",c+="collisions: "+o.collisions+" ",c+="pairs: "+i.pairs.list.length+" ",c+="broad: "+o.broadEff+" ",c+="mid: "+o.midEff+" ",c+="narrow: "+o.narrowEff+" "),e.debugString=c,e.debugTimestamp=i.timing.timestamp}if(e.debugString){n.font="12px Arial",a.wireframes?n.fillStyle="rgba(255,255,255,0.5)":n.fillStyle="rgba(0,0,0,0.5)";for(var p=e.debugString.split("\n"),h=0;h<p.length;h++)n.fillText(p[h],50,50+18*h)}},i.constraints=function(e,t){for(var n=t,i=0;i<e.length;i++){var s=e[i];if(s.render.visible&&s.pointA&&s.pointB){var o,a,l=s.bodyA,c=s.bodyB;if(o=l?u.add(l.position,s.pointA):s.pointA,"pin"===s.render.type)n.beginPath(),n.arc(o.x,o.y,3,0,2*Math.PI),n.closePath();else{if(a=c?u.add(c.position,s.pointB):s.pointB,n.beginPath(),n.moveTo(o.x,o.y),"spring"===s.render.type)for(var p,h=u.sub(a,o),d=u.perp(u.normalise(h)),f=Math.ceil(r.clamp(s.length/5,12,20)),_=1;_<f;_+=1)p=_%2==0?1:-1,n.lineTo(o.x+h.x*(_/f)+d.x*p*4,o.y+h.y*(_/f)+d.y*p*4);n.lineTo(a.x,a.y)}s.render.lineWidth&&(n.lineWidth=s.render.lineWidth,n.strokeStyle=s.render.strokeStyle,n.stroke()),s.render.anchors&&(n.fillStyle=s.render.strokeStyle,n.beginPath(),n.arc(o.x,o.y,3,0,2*Math.PI),n.arc(a.x,a.y,3,0,2*Math.PI),n.closePath(),n.fill())}}},i.bodyShadows=function(e,t,n){for(var i=n,r=(e.engine,0);r<t.length;r++){var s=t[r];if(s.render.visible){if(s.circleRadius)i.beginPath(),i.arc(s.position.x,s.position.y,s.circleRadius,0,2*Math.PI),i.closePath();else{i.beginPath(),i.moveTo(s.vertices[0].x,s.vertices[0].y);for(var o=1;o<s.vertices.length;o++)i.lineTo(s.vertices[o].x,s.vertices[o].y);i.closePath()}var a=s.position.x-.5*e.options.width,l=s.position.y-.2*e.options.height,u=Math.abs(a)+Math.abs(l);i.shadowColor="rgba(0,0,0,0.15)",i.shadowOffsetX=.05*a,i.shadowOffsetY=.05*l,i.shadowBlur=1+12*Math.min(1,u/1e3),i.fill(),i.shadowColor=null,i.shadowOffsetX=null,i.shadowOffsetY=null,i.shadowBlur=null}}},i.bodies=function(e,t,n){var i,r,s,o,a=n,l=(e.engine,e.options),u=l.showInternalEdges||!l.wireframes;for(s=0;s<t.length;s++)if((i=t[s]).render.visible)for(o=i.parts.length>1?1:0;o<i.parts.length;o++)if((r=i.parts[o]).render.visible){if(l.showSleeping&&i.isSleeping?a.globalAlpha=.5*r.render.opacity:1!==r.render.opacity&&(a.globalAlpha=r.render.opacity),r.render.sprite&&r.render.sprite.texture&&!l.wireframes){var c=r.render.sprite,p=h(e,c.texture);a.translate(r.position.x,r.position.y),a.rotate(r.angle),a.drawImage(p,p.width*-c.xOffset*c.xScale,p.height*-c.yOffset*c.yScale,p.width*c.xScale,p.height*c.yScale),a.rotate(-r.angle),a.translate(-r.position.x,-r.position.y)}else{if(r.circleRadius)a.beginPath(),a.arc(r.position.x,r.position.y,r.circleRadius,0,2*Math.PI);else{a.beginPath(),a.moveTo(r.vertices[0].x,r.vertices[0].y);for(var d=1;d<r.vertices.length;d++)!r.vertices[d-1].isInternal||u?a.lineTo(r.vertices[d].x,r.vertices[d].y):a.moveTo(r.vertices[d].x,r.vertices[d].y),r.vertices[d].isInternal&&!u&&a.moveTo(r.vertices[(d+1)%r.vertices.length].x,r.vertices[(d+1)%r.vertices.length].y);a.lineTo(r.vertices[0].x,r.vertices[0].y),a.closePath()}l.wireframes?(a.lineWidth=1,a.strokeStyle="#bbb",a.stroke()):(a.fillStyle=r.render.fillStyle,r.render.lineWidth&&(a.lineWidth=r.render.lineWidth,a.strokeStyle=r.render.strokeStyle,a.stroke()),a.fill())}a.globalAlpha=1}},i.bodyWireframes=function(e,t,n){var i,r,s,o,a,l=n,u=e.options.showInternalEdges;for(l.beginPath(),s=0;s<t.length;s++)if((i=t[s]).render.visible)for(a=i.parts.length>1?1:0;a<i.parts.length;a++){for(r=i.parts[a],l.moveTo(r.vertices[0].x,r.vertices[0].y),o=1;o<r.vertices.length;o++)!r.vertices[o-1].isInternal||u?l.lineTo(r.vertices[o].x,r.vertices[o].y):l.moveTo(r.vertices[o].x,r.vertices[o].y),r.vertices[o].isInternal&&!u&&l.moveTo(r.vertices[(o+1)%r.vertices.length].x,r.vertices[(o+1)%r.vertices.length].y);l.lineTo(r.vertices[0].x,r.vertices[0].y)}l.lineWidth=1,l.strokeStyle="#bbb",l.stroke()},i.bodyConvexHulls=function(e,t,n){var i,r,s,o=n;for(o.beginPath(),r=0;r<t.length;r++)if((i=t[r]).render.visible&&1!==i.parts.length){for(o.moveTo(i.vertices[0].x,i.vertices[0].y),s=1;s<i.vertices.length;s++)o.lineTo(i.vertices[s].x,i.vertices[s].y);o.lineTo(i.vertices[0].x,i.vertices[0].y)}o.lineWidth=1,o.strokeStyle="rgba(255,255,255,0.2)",o.stroke()},i.vertexNumbers=function(e,t,n){var i,r,s,o=n;for(i=0;i<t.length;i++){var a=t[i].parts;for(s=a.length>1?1:0;s<a.length;s++){var l=a[s];for(r=0;r<l.vertices.length;r++)o.fillStyle="rgba(255,255,255,0.2)",o.fillText(i+"_"+r,l.position.x+.8*(l.vertices[r].x-l.position.x),l.position.y+.8*(l.vertices[r].y-l.position.y))}}},i.mousePosition=function(e,t,n){var i=n;i.fillStyle="rgba(255,255,255,0.8)",i.fillText(t.position.x+" "+t.position.y,t.position.x+5,t.position.y-5)},i.bodyBounds=function(e,t,n){var i=n,r=(e.engine,e.options);i.beginPath();for(var s=0;s<t.length;s++)if(t[s].render.visible)for(var o=t[s].parts,a=o.length>1?1:0;a<o.length;a++){var l=o[a];i.rect(l.bounds.min.x,l.bounds.min.y,l.bounds.max.x-l.bounds.min.x,l.bounds.max.y-l.bounds.min.y)}r.wireframes?i.strokeStyle="rgba(255,255,255,0.08)":i.strokeStyle="rgba(0,0,0,0.1)",i.lineWidth=1,i.stroke()},i.bodyAxes=function(e,t,n){var i,r,s,o,a=n,l=(e.engine,e.options);for(a.beginPath(),r=0;r<t.length;r++){var u=t[r],c=u.parts;if(u.render.visible)if(l.showAxes)for(s=c.length>1?1:0;s<c.length;s++)for(i=c[s],o=0;o<i.axes.length;o++){var p=i.axes[o];a.moveTo(i.position.x,i.position.y),a.lineTo(i.position.x+20*p.x,i.position.y+20*p.y)}else for(s=c.length>1?1:0;s<c.length;s++)for(i=c[s],o=0;o<i.axes.length;o++)a.moveTo(i.position.x,i.position.y),a.lineTo((i.vertices[0].x+i.vertices[i.vertices.length-1].x)/2,(i.vertices[0].y+i.vertices[i.vertices.length-1].y)/2)}l.wireframes?(a.strokeStyle="indianred",a.lineWidth=1):(a.strokeStyle="rgba(255, 255, 255, 0.4)",a.globalCompositeOperation="overlay",a.lineWidth=2),a.stroke(),a.globalCompositeOperation="source-over"},i.bodyPositions=function(e,t,n){var i,r,s,o,a=n,l=(e.engine,e.options);for(a.beginPath(),s=0;s<t.length;s++)if((i=t[s]).render.visible)for(o=0;o<i.parts.length;o++)r=i.parts[o],a.arc(r.position.x,r.position.y,3,0,2*Math.PI,!1),a.closePath();for(l.wireframes?a.fillStyle="indianred":a.fillStyle="rgba(0,0,0,0.5)",a.fill(),a.beginPath(),s=0;s<t.length;s++)(i=t[s]).render.visible&&(a.arc(i.positionPrev.x,i.positionPrev.y,2,0,2*Math.PI,!1),a.closePath());a.fillStyle="rgba(255,165,0,0.8)",a.fill()},i.bodyVelocity=function(e,t,n){var i=n;i.beginPath();for(var r=0;r<t.length;r++){var s=t[r];s.render.visible&&(i.moveTo(s.position.x,s.position.y),i.lineTo(s.position.x+2*(s.position.x-s.positionPrev.x),s.position.y+2*(s.position.y-s.positionPrev.y)))}i.lineWidth=3,i.strokeStyle="cornflowerblue",i.stroke()},i.bodyIds=function(e,t,n){var i,r,s=n;for(i=0;i<t.length;i++)if(t[i].render.visible){var o=t[i].parts;for(r=o.length>1?1:0;r<o.length;r++){var a=o[r];s.font="12px Arial",s.fillStyle="rgba(255,255,255,0.5)",s.fillText(a.id,a.position.x+10,a.position.y-10)}}},i.collisions=function(e,t,n){var i,r,s,o,a=n,l=e.options;for(a.beginPath(),s=0;s<t.length;s++)if((i=t[s]).isActive)for(r=i.collision,o=0;o<i.activeContacts.length;o++){var u=i.activeContacts[o].vertex;a.rect(u.x-1.5,u.y-1.5,3.5,3.5)}for(l.wireframes?a.fillStyle="rgba(255,255,255,0.7)":a.fillStyle="orange",a.fill(),a.beginPath(),s=0;s<t.length;s++)if((i=t[s]).isActive&&(r=i.collision,i.activeContacts.length>0)){var c=i.activeContacts[0].vertex.x,p=i.activeContacts[0].vertex.y;2===i.activeContacts.length&&(c=(i.activeContacts[0].vertex.x+i.activeContacts[1].vertex.x)/2,p=(i.activeContacts[0].vertex.y+i.activeContacts[1].vertex.y)/2),r.bodyB===r.supports[0].body||!0===r.bodyA.isStatic?a.moveTo(c-8*r.normal.x,p-8*r.normal.y):a.moveTo(c+8*r.normal.x,p+8*r.normal.y),a.lineTo(c,p)}l.wireframes?a.strokeStyle="rgba(255,165,0,0.7)":a.strokeStyle="orange",a.lineWidth=1,a.stroke()},i.separations=function(e,t,n){var i,r,s,o,a,l=n,u=e.options;for(l.beginPath(),a=0;a<t.length;a++)if((i=t[a]).isActive){s=(r=i.collision).bodyA;var c=1;(o=r.bodyB).isStatic||s.isStatic||(c=.5),o.isStatic&&(c=0),l.moveTo(o.position.x,o.position.y),l.lineTo(o.position.x-r.penetration.x*c,o.position.y-r.penetration.y*c),c=1,o.isStatic||s.isStatic||(c=.5),s.isStatic&&(c=0),l.moveTo(s.position.x,s.position.y),l.lineTo(s.position.x+r.penetration.x*c,s.position.y+r.penetration.y*c)}u.wireframes?l.strokeStyle="rgba(255,165,0,0.5)":l.strokeStyle="orange",l.stroke()},i.grid=function(e,t,n){var i=n;e.options.wireframes?i.strokeStyle="rgba(255,180,0,0.1)":i.strokeStyle="rgba(255,180,0,0.5)",i.beginPath();for(var s=r.keys(t.buckets),o=0;o<s.length;o++){var a=s[o];if(!(t.buckets[a].length<2)){var l=a.split(/C|R/);i.rect(.5+parseInt(l[1],10)*t.bucketWidth,.5+parseInt(l[2],10)*t.bucketHeight,t.bucketWidth,t.bucketHeight)}}i.lineWidth=1,i.stroke()},i.inspector=function(e,t){e.engine;var n,i=e.selected,r=e.render,s=r.options;if(s.hasBounds){var o=r.bounds.max.x-r.bounds.min.x,a=r.bounds.max.y-r.bounds.min.y,l=o/r.options.width,u=a/r.options.height;t.scale(1/l,1/u),t.translate(-r.bounds.min.x,-r.bounds.min.y)}for(var c=0;c<i.length;c++){var p=i[c].data;switch(t.translate(.5,.5),t.lineWidth=1,t.strokeStyle="rgba(255,165,0,0.9)",t.setLineDash([1,2]),p.type){case"body":n=p.bounds,t.beginPath(),t.rect(Math.floor(n.min.x-3),Math.floor(n.min.y-3),Math.floor(n.max.x-n.min.x+6),Math.floor(n.max.y-n.min.y+6)),t.closePath(),t.stroke();break;case"constraint":var h=p.pointA;p.bodyA&&(h=p.pointB),t.beginPath(),t.arc(h.x,h.y,10,0,2*Math.PI),t.closePath(),t.stroke()}t.setLineDash([]),t.translate(-.5,-.5)}null!==e.selectStart&&(t.translate(.5,.5),t.lineWidth=1,t.strokeStyle="rgba(255,165,0,0.6)",t.fillStyle="rgba(255,165,0,0.1)",n=e.selectBounds,t.beginPath(),t.rect(Math.floor(n.min.x),Math.floor(n.min.y),Math.floor(n.max.x-n.min.x),Math.floor(n.max.y-n.min.y)),t.closePath(),t.stroke(),t.fill(),t.translate(-.5,-.5)),s.hasBounds&&t.setTransform(1,0,0,1,0,0)};var n=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n.oncontextmenu=function(){return!1},n.onselectstart=function(){return!1},n},p=function(e){var t=e.getContext("2d");return(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)},h=function(e,t){var n=e.textures[t];return n||((n=e.textures[t]=new Image).src=t,n)},d=function(e,t){var n=t;/(jpg|gif|png)$/.test(t)&&(n="url("+t+")"),e.canvas.style.background=n,e.canvas.style.backgroundSize="contain",e.currentBackground=t}}()},function(e,t,n){var i={};e.exports=i;var r=n(9),s=n(12),o=n(0);i.create=function(e){var t={controller:i,detector:s.collisions,buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return o.extend(t,e)},i.update=function(e,t,n,r){var s,o,a,l,u,c=n.world,p=e.buckets,h=!1,d=n.metrics;for(d.broadphaseTests=0,s=0;s<t.length;s++){var f=t[s];if((!f.isSleeping||r)&&!(f.bounds.max.x<c.bounds.min.x||f.bounds.min.x>c.bounds.max.x||f.bounds.max.y<c.bounds.min.y||f.bounds.min.y>c.bounds.max.y)){var _=i._getRegion(e,f);if(!f.region||_.id!==f.region.id||r){d.broadphaseTests+=1,f.region&&!r||(f.region=_);var m=i._regionUnion(_,f.region);for(o=m.startCol;o<=m.endCol;o++)for(a=m.startRow;a<=m.endRow;a++){l=p[u=i._getBucketId(o,a)];var b=o>=_.startCol&&o<=_.endCol&&a>=_.startRow&&a<=_.endRow,g=o>=f.region.startCol&&o<=f.region.endCol&&a>=f.region.startRow&&a<=f.region.endRow;!b&&g&&g&&l&&i._bucketRemoveBody(e,l,f),(f.region===_||b&&!g||r)&&(l||(l=i._createBucket(p,u)),i._bucketAddBody(e,l,f))}f.region=_,h=!0}}}h&&(e.pairsList=i._createActivePairsList(e))},i.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},i._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),r=Math.max(e.endCol,t.endCol),s=Math.min(e.startRow,t.startRow),o=Math.max(e.endRow,t.endRow);return i._createRegion(n,r,s,o)},i._getRegion=function(e,t){var n=t.bounds,r=Math.floor(n.min.x/e.bucketWidth),s=Math.floor(n.max.x/e.bucketWidth),o=Math.floor(n.min.y/e.bucketHeight),a=Math.floor(n.max.y/e.bucketHeight);return i._createRegion(r,s,o,a)},i._createRegion=function(e,t,n,i){return{id:e+","+t+","+n+","+i,startCol:e,endCol:t,startRow:n,endRow:i}},i._getBucketId=function(e,t){return"C"+e+"R"+t},i._createBucket=function(e,t){return e[t]=[]},i._bucketAddBody=function(e,t,n){for(var i=0;i<t.length;i++){var s=t[i];if(!(n.id===s.id||n.isStatic&&s.isStatic)){var o=r.id(n,s),a=e.pairs[o];a?a[2]+=1:e.pairs[o]=[n,s,1]}}t.push(n)},i._bucketRemoveBody=function(e,t,n){t.splice(o.indexOf(t,n),1);for(var i=0;i<t.length;i++){var s=t[i],a=r.id(n,s),l=e.pairs[a];l&&(l[2]-=1)}},i._createActivePairsList=function(e){var t,n,i=[];t=o.keys(e.pairs);for(var r=0;r<t.length;r++)(n=e.pairs[t[r]])[2]>0?i.push(n):delete e.pairs[t[r]];return i}},function(e,t,n){var i={};e.exports=i;var r=n(13),s=n(9),o=n(1);i.collisions=function(e,t){for(var n=[],a=t.pairs.table,l=t.metrics,u=0;u<e.length;u++){var c=e[u][0],p=e[u][1];if((!c.isStatic&&!c.isSleeping||!p.isStatic&&!p.isSleeping)&&i.canCollide(c.collisionFilter,p.collisionFilter)&&(l.midphaseTests+=1,o.overlaps(c.bounds,p.bounds)))for(var h=c.parts.length>1?1:0;h<c.parts.length;h++)for(var d=c.parts[h],f=p.parts.length>1?1:0;f<p.parts.length;f++){var _=p.parts[f];if(d===c&&_===p||o.overlaps(d.bounds,_.bounds)){var m,b=a[s.id(d,_)];m=b&&b.isActive?b.collision:null;var g=r.collides(d,_,m);l.narrowphaseTests+=1,g.reused&&(l.narrowReuseCount+=1),g.collided&&(n.push(g),l.narrowDetections+=1)}}}return n},i.canCollide=function(e,t){return e.group===t.group&&0!==e.group?e.group>0:!!(e.mask&t.category)&&!!(t.mask&e.category)}},function(e,t,n){var i={};e.exports=i;var r=n(3),s=n(2);i.collides=function(e,t,n){var o,a,l,u,c=!1;if(n){var p=e.parent,h=t.parent,d=p.speed*p.speed+p.angularSpeed*p.angularSpeed+h.speed*h.speed+h.angularSpeed*h.angularSpeed;c=n&&n.collided&&d<.2,u=n}else u={collided:!1,bodyA:e,bodyB:t};if(n&&c){var f=u.axisBody,_=f===e?t:e,m=[f.axes[n.axisNumber]];if(l=i._overlapAxes(f.vertices,_.vertices,m),u.reused=!0,l.overlap<=0)return u.collided=!1,u}else{if((o=i._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return u.collided=!1,u;if((a=i._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return u.collided=!1,u;o.overlap<a.overlap?(l=o,u.axisBody=e):(l=a,u.axisBody=t),u.axisNumber=l.axisNumber}u.bodyA=e.id<t.id?e:t,u.bodyB=e.id<t.id?t:e,u.collided=!0,u.depth=l.overlap,u.parentA=u.bodyA.parent,u.parentB=u.bodyB.parent,e=u.bodyA,t=u.bodyB,s.dot(l.axis,s.sub(t.position,e.position))<0?u.normal={x:l.axis.x,y:l.axis.y}:u.normal={x:-l.axis.x,y:-l.axis.y},u.tangent=s.perp(u.normal),u.penetration=u.penetration||{},u.penetration.x=u.normal.x*u.depth,u.penetration.y=u.normal.y*u.depth;var b=i._findSupports(e,t,u.normal),g=[];if(r.contains(e.vertices,b[0])&&g.push(b[0]),r.contains(e.vertices,b[1])&&g.push(b[1]),g.length<2){var S=i._findSupports(t,e,s.neg(u.normal));r.contains(t.vertices,S[0])&&g.push(S[0]),g.length<2&&r.contains(t.vertices,S[1])&&g.push(S[1])}return g.length<1&&(g=[b[0]]),u.supports=g,u},i._overlapAxes=function(e,t,n){for(var r,o,a=s._temp[0],l=s._temp[1],u={overlap:Number.MAX_VALUE},c=0;c<n.length;c++){if(o=n[c],i._projectToAxis(a,e,o),i._projectToAxis(l,t,o),(r=Math.min(a.max-l.min,l.max-a.min))<=0)return u.overlap=r,u;r<u.overlap&&(u.overlap=r,u.axis=o,u.axisNumber=c)}return u},i._projectToAxis=function(e,t,n){for(var i=s.dot(t[0],n),r=i,o=1;o<t.length;o+=1){var a=s.dot(t[o],n);a>r?r=a:a<i&&(i=a)}e.min=i,e.max=r},i._findSupports=function(e,t,n){for(var i,r,o,a,l=Number.MAX_VALUE,u=s._temp[0],c=t.vertices,p=e.position,h=0;h<c.length;h++)r=c[h],u.x=r.x-p.x,u.y=r.y-p.y,(i=-s.dot(n,u))<l&&(l=i,o=r);return r=c[o.index-1>=0?o.index-1:c.length-1],u.x=r.x-p.x,u.y=r.y-p.y,l=-s.dot(n,u),a=r,r=c[(o.index+1)%c.length],u.x=r.x-p.x,u.y=r.y-p.y,(i=-s.dot(n,u))<l&&(a=r),[o,a]}},function(e,t,n){var i={};e.exports=i;var r=n(0);i.create=function(e){var t={};return e||r.log("Mouse.create: element was undefined, defaulting to document.body","warn"),t.element=e||document.body,t.absolute={x:0,y:0},t.position={x:0,y:0},t.mousedownPosition={x:0,y:0},t.mouseupPosition={x:0,y:0},t.offset={x:0,y:0},t.scale={x:1,y:1},t.wheelDelta=0,t.button=-1,t.pixelRatio=parseInt(t.element.getAttribute("data-pixel-ratio"),10)||1,t.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},t.mousemove=function(e){var n=i._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&(t.button=0,e.preventDefault()),t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.sourceEvents.mousemove=e},t.mousedown=function(e){var n=i._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches?(t.button=0,e.preventDefault()):t.button=e.button,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mousedownPosition.x=t.position.x,t.mousedownPosition.y=t.position.y,t.sourceEvents.mousedown=e},t.mouseup=function(e){var n=i._getRelativeMousePosition(e,t.element,t.pixelRatio);e.changedTouches&&e.preventDefault(),t.button=-1,t.absolute.x=n.x,t.absolute.y=n.y,t.position.x=t.absolute.x*t.scale.x+t.offset.x,t.position.y=t.absolute.y*t.scale.y+t.offset.y,t.mouseupPosition.x=t.position.x,t.mouseupPosition.y=t.position.y,t.sourceEvents.mouseup=e},t.mousewheel=function(e){t.wheelDelta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),e.preventDefault()},i.setElement(t,t.element),t},i.setElement=function(e,t){e.element=t,t.addEventListener("mousemove",e.mousemove),t.addEventListener("mousedown",e.mousedown),t.addEventListener("mouseup",e.mouseup),t.addEventListener("mousewheel",e.mousewheel),t.addEventListener("DOMMouseScroll",e.mousewheel),t.addEventListener("touchmove",e.mousemove),t.addEventListener("touchstart",e.mousedown),t.addEventListener("touchend",e.mouseup)},i.clearSourceEvents=function(e){e.sourceEvents.mousemove=null,e.sourceEvents.mousedown=null,e.sourceEvents.mouseup=null,e.sourceEvents.mousewheel=null,e.wheelDelta=0},i.setOffset=function(e,t){e.offset.x=t.x,e.offset.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},i.setScale=function(e,t){e.scale.x=t.x,e.scale.y=t.y,e.position.x=e.absolute.x*e.scale.x+e.offset.x,e.position.y=e.absolute.y*e.scale.y+e.offset.y},i._getRelativeMousePosition=function(e,t,n){var i,r,s=t.getBoundingClientRect(),o=document.documentElement||document.body.parentNode||document.body,a=void 0!==window.pageXOffset?window.pageXOffset:o.scrollLeft,l=void 0!==window.pageYOffset?window.pageYOffset:o.scrollTop,u=e.changedTouches;return u?(i=u[0].pageX-s.left-a,r=u[0].pageY-s.top-l):(i=e.pageX-s.left-a,r=e.pageY-s.top-l),{x:i/(t.clientWidth/(t.width||t.clientWidth)*n),y:r/(t.clientHeight/(t.height||t.clientHeight)*n)}}},function(e,t,n){var i={};e.exports=i;var r=n(2),s=n(0);i.fromVertices=function(e){for(var t={},n=0;n<e.length;n++){var i=(n+1)%e.length,o=r.normalise({x:e[i].y-e[n].y,y:e[n].x-e[i].x}),a=0===o.y?1/0:o.x/o.y;t[a=a.toFixed(3).toString()]=o}return s.values(t)},i.rotate=function(e,t){if(0!==t)for(var n=Math.cos(t),i=Math.sin(t),r=0;r<e.length;r++){var s,o=e[r];s=o.x*n-o.y*i,o.y=o.x*i+o.y*n,o.x=s}}},function(e,t,n){var i={};e.exports=i;var r=n(3),s=n(0),o=n(6),a=n(1),l=n(2);i._decompWarned=!1,i.rectangle=function(e,t,n,i,a){a=a||{};var l={label:"Rectangle Body",position:{x:e,y:t},vertices:r.fromPath("L 0 0 L "+n+" 0 L "+n+" "+i+" L 0 "+i)};if(a.chamfer){var u=a.chamfer;l.vertices=r.chamfer(l.vertices,u.radius,u.quality,u.qualityMin,u.qualityMax),delete a.chamfer}return o.create(s.extend({},l,a))},i.trapezoid=function(e,t,n,i,a,l){l=l||{};var u,c=n*(a*=.5),p=c+(1-2*a)*n,h=p+c;u=a<.5?"L 0 0 L "+c+" "+-i+" L "+p+" "+-i+" L "+h+" 0":"L 0 0 L "+p+" "+-i+" L "+h+" 0";var d={label:"Trapezoid Body",position:{x:e,y:t},vertices:r.fromPath(u)};if(l.chamfer){var f=l.chamfer;d.vertices=r.chamfer(d.vertices,f.radius,f.quality,f.qualityMin,f.qualityMax),delete l.chamfer}return o.create(s.extend({},d,l))},i.circle=function(e,t,n,r,o){r=r||{};var a={label:"Circle Body",circleRadius:n};o=o||25;var l=Math.ceil(Math.max(10,Math.min(o,n)));return l%2==1&&(l+=1),i.polygon(e,t,l,n,s.extend({},a,r))},i.polygon=function(e,t,n,a,l){if(l=l||{},n<3)return i.circle(e,t,a,l);for(var u=2*Math.PI/n,c="",p=.5*u,h=0;h<n;h+=1){var d=p+h*u,f=Math.cos(d)*a,_=Math.sin(d)*a;c+="L "+f.toFixed(3)+" "+_.toFixed(3)+" "}var m={label:"Polygon Body",position:{x:e,y:t},vertices:r.fromPath(c)};if(l.chamfer){var b=l.chamfer;m.vertices=r.chamfer(m.vertices,b.radius,b.quality,b.qualityMin,b.qualityMax),delete l.chamfer}return o.create(s.extend({},m,l))},i.fromVertices=function(e,t,u,c,p,h,d,f){var _,m,b,g,S,k,y,v,T,E,I;try{_=n(27)}catch(e){_=null}for(m=Boolean(_&&_.quickDecomp),c=c||{},g=[],p=void 0!==p&&p,h=void 0!==h?h:.01,d=void 0!==d?d:10,f=void 0!==f?f:.01,s.isArray(u[0])||(u=[u]),E=0;E<u.length;E+=1)if(k=u[E],!!(S=r.isConvex(k))||m||i._decompWarned||(s.warn("Could not resolve the expected 'poly-decomp' package for concave vertices in 'Bodies.fromVertices'"),s.warn("Try 'npm install poly-decomp --save' or as a global e.g. 'window.decomp'"),i._decompWarned=!0),S||!m)k=S?r.clockwiseSort(k):r.hull(k),g.push({position:{x:e,y:t},vertices:k});else{var w=k.map((function(e){return[e.x,e.y]}));_.makeCCW(w),!1!==h&&_.removeCollinearPoints(w,h),!1!==f&&_.removeDuplicatePoints&&_.removeDuplicatePoints(w,f);var x=_.quickDecomp(w);for(y=0;y<x.length;y++){var A=x[y].map((function(e){return{x:e[0],y:e[1]}}));d>0&&r.area(A)<d||g.push({position:r.centre(A),vertices:A})}}for(y=0;y<g.length;y++)g[y]=o.create(s.extend(g[y],c));if(p)for(y=0;y<g.length;y++){var $=g[y];for(v=y+1;v<g.length;v++){var O=g[v];if(a.overlaps($.bounds,O.bounds)){var M=$.vertices,C=O.vertices;for(T=0;T<$.vertices.length;T++)for(I=0;I<O.vertices.length;I++){var R=l.magnitudeSquared(l.sub(M[(T+1)%M.length],C[I])),N=l.magnitudeSquared(l.sub(M[T],C[(I+1)%C.length]));R<5&&N<5&&(M[T].isInternal=!0,C[I].isInternal=!0)}}}}return g.length>1?(b=o.create(s.extend({parts:g.slice(0)},c)),o.setPosition(b,{x:e,y:t}),b):g[0]}},function(e,t,n){var i={};e.exports=i;var r=n(0);i._registry={},i.register=function(e){if(i.isPlugin(e)||r.warn("Plugin.register:",i.toString(e),"does not implement all required fields."),e.name in i._registry){var t=i._registry[e.name],n=i.versionParse(e.version).number,s=i.versionParse(t.version).number;n>s?(r.warn("Plugin.register:",i.toString(t),"was upgraded to",i.toString(e)),i._registry[e.name]=e):n<s?r.warn("Plugin.register:",i.toString(t),"can not be downgraded to",i.toString(e)):e!==t&&r.warn("Plugin.register:",i.toString(e),"is already registered to different plugin object")}else i._registry[e.name]=e;return e},i.resolve=function(e){return i._registry[i.dependencyParse(e).name]},i.toString=function(e){return"string"==typeof e?e:(e.name||"anonymous")+"@"+(e.version||e.range||"0.0.0")},i.isPlugin=function(e){return e&&e.name&&e.version&&e.install},i.isUsed=function(e,t){return e.used.indexOf(t)>-1},i.isFor=function(e,t){var n=e.for&&i.dependencyParse(e.for);return!e.for||t.name===n.name&&i.versionSatisfies(t.version,n.range)},i.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=i.dependencies(e),s=r.topologicalSort(n),o=[],a=0;a<s.length;a+=1)if(s[a]!==e.name){var l=i.resolve(s[a]);l?i.isUsed(e,l.name)||(i.isFor(l,e)||(r.warn("Plugin.use:",i.toString(l),"is for",l.for,"but installed on",i.toString(e)+"."),l._warned=!0),l.install?l.install(e):(r.warn("Plugin.use:",i.toString(l),"does not specify an install function."),l._warned=!0),l._warned?(o.push("🔶 "+i.toString(l)),delete l._warned):o.push("✅ "+i.toString(l)),e.used.push(l.name)):o.push("❌ "+s[a])}o.length>0&&r.info(o.join(" "))}else r.warn("Plugin.use:",i.toString(e),"does not specify any dependencies to install.")},i.dependencies=function(e,t){var n=i.dependencyParse(e),s=n.name;if(!(s in(t=t||{}))){e=i.resolve(e)||e,t[s]=r.map(e.uses||[],(function(t){i.isPlugin(t)&&i.register(t);var s=i.dependencyParse(t),o=i.resolve(t);return o&&!i.versionSatisfies(o.version,s.range)?(r.warn("Plugin.dependencies:",i.toString(o),"does not satisfy",i.toString(s),"used by",i.toString(n)+"."),o._warned=!0,e._warned=!0):o||(r.warn("Plugin.dependencies:",i.toString(t),"used by",i.toString(n),"could not be resolved."),e._warned=!0),s.name}));for(var o=0;o<t[s].length;o+=1)i.dependencies(t[s][o],t);return t}},i.dependencyParse=function(e){return r.isString(e)?(/^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?))?$/.test(e)||r.warn("Plugin.dependencyParse:",e,"is not a valid dependency string."),{name:e.split("@")[0],range:e.split("@")[1]||"*"}):{name:e.name,range:e.range||e.version}},i.versionParse=function(e){var t=/^(\*)|(\^|~|>=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-]+)?$/;t.test(e)||r.warn("Plugin.versionParse:",e,"is not a valid version or range.");var n=t.exec(e),i=Number(n[4]),s=Number(n[5]),o=Number(n[6]);return{isRange:Boolean(n[1]||n[2]),version:n[3],range:e,operator:n[1]||n[2]||"",major:i,minor:s,patch:o,parts:[i,s,o],prerelease:n[7],number:1e8*i+1e4*s+o}},i.versionSatisfies=function(e,t){t=t||"*";var n=i.versionParse(t),r=i.versionParse(e);if(n.isRange){if("*"===n.operator||"*"===e)return!0;if(">"===n.operator)return r.number>n.number;if(">="===n.operator)return r.number>=n.number;if("~"===n.operator)return r.major===n.major&&r.minor===n.minor&&r.patch>=n.patch;if("^"===n.operator)return n.major>0?r.major===n.major&&r.number>=n.number:n.minor>0?r.minor===n.minor&&r.patch>=n.patch:r.patch===n.patch}return e===t||"*"===e}},function(e,t){var n={};e.exports=n,n.create=function(e){return{id:n.id(e),vertex:e,normalImpulse:0,tangentImpulse:0}},n.id=function(e){return e.body.id+"_"+e.index}},function(e,t,n){var i={};e.exports=i;var r=n(5),s=(n(8),n(0));i.create=function(e){var t=r.create();return s.extend(t,{label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}},e)}},function(e,t,n){var i={};e.exports=i;var r=n(9),s=n(0);i._pairMaxIdleLife=1e3,i.create=function(e){return s.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},i.update=function(e,t,n){var i,s,o,a,l=e.list,u=e.table,c=e.collisionStart,p=e.collisionEnd,h=e.collisionActive;for(c.length=0,p.length=0,h.length=0,a=0;a<l.length;a++)l[a].confirmedActive=!1;for(a=0;a<t.length;a++)(i=t[a]).collided&&((o=u[s=r.id(i.bodyA,i.bodyB)])?(o.isActive?h.push(o):c.push(o),r.update(o,i,n),o.confirmedActive=!0):(o=r.create(i,n),u[s]=o,c.push(o),l.push(o)));for(a=0;a<l.length;a++)(o=l[a]).isActive&&!o.confirmedActive&&(r.setActive(o,!1,n),p.push(o))},i.removeOld=function(e,t){var n,r,s,o,a=e.list,l=e.table,u=[];for(o=0;o<a.length;o++)(r=(n=a[o]).collision).bodyA.isSleeping||r.bodyB.isSleeping?n.timeUpdated=t:t-n.timeUpdated>i._pairMaxIdleLife&&u.push(o);for(o=0;o<u.length;o++)delete l[(n=a[s=u[o]-o]).id],a.splice(s,1)},i.clear=function(e){return e.table={},e.list.length=0,e.collisionStart.length=0,e.collisionActive.length=0,e.collisionEnd.length=0,e}},function(e,t,n){var i={};e.exports=i;var r=n(3),s=n(2),o=n(0),a=n(1);i._restingThresh=4,i._restingThreshTangent=6,i._positionDampen=.9,i._positionWarming=.8,i._frictionNormalMultiplier=5,i.preSolvePosition=function(e){var t,n,i;for(t=0;t<e.length;t++)(n=e[t]).isActive&&(i=n.activeContacts.length,n.collision.parentA.totalContacts+=i,n.collision.parentB.totalContacts+=i)},i.solvePosition=function(e,t){var n,r,o,a,l,u,c,p,h,d=s._temp[0],f=s._temp[1],_=s._temp[2],m=s._temp[3];for(n=0;n<e.length;n++)(r=e[n]).isActive&&!r.isSensor&&(a=(o=r.collision).parentA,l=o.parentB,u=o.normal,c=s.sub(s.add(l.positionImpulse,l.position,d),s.add(a.positionImpulse,s.sub(l.position,o.penetration,f),_),m),r.separation=s.dot(u,c));for(n=0;n<e.length;n++)(r=e[n]).isActive&&!r.isSensor&&(a=(o=r.collision).parentA,l=o.parentB,u=o.normal,h=(r.separation-r.slop)*t,(a.isStatic||l.isStatic)&&(h*=2),a.isStatic||a.isSleeping||(p=i._positionDampen/a.totalContacts,a.positionImpulse.x+=u.x*h*p,a.positionImpulse.y+=u.y*h*p),l.isStatic||l.isSleeping||(p=i._positionDampen/l.totalContacts,l.positionImpulse.x-=u.x*h*p,l.positionImpulse.y-=u.y*h*p))},i.postSolvePosition=function(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.totalContacts=0,0!==n.positionImpulse.x||0!==n.positionImpulse.y){for(var o=0;o<n.parts.length;o++){var l=n.parts[o];r.translate(l.vertices,n.positionImpulse),a.update(l.bounds,l.vertices,n.velocity),l.position.x+=n.positionImpulse.x,l.position.y+=n.positionImpulse.y}n.positionPrev.x+=n.positionImpulse.x,n.positionPrev.y+=n.positionImpulse.y,s.dot(n.positionImpulse,n.velocity)<0?(n.positionImpulse.x=0,n.positionImpulse.y=0):(n.positionImpulse.x*=i._positionWarming,n.positionImpulse.y*=i._positionWarming)}}},i.preSolveVelocity=function(e){var t,n,i,r,o,a,l,u,c,p,h,d,f,_,m=s._temp[0],b=s._temp[1];for(t=0;t<e.length;t++)if((i=e[t]).isActive&&!i.isSensor)for(r=i.activeContacts,a=(o=i.collision).parentA,l=o.parentB,u=o.normal,c=o.tangent,n=0;n<r.length;n++)h=(p=r[n]).vertex,d=p.normalImpulse,f=p.tangentImpulse,0===d&&0===f||(m.x=u.x*d+c.x*f,m.y=u.y*d+c.y*f,a.isStatic||a.isSleeping||(_=s.sub(h,a.position,b),a.positionPrev.x+=m.x*a.inverseMass,a.positionPrev.y+=m.y*a.inverseMass,a.anglePrev+=s.cross(_,m)*a.inverseInertia),l.isStatic||l.isSleeping||(_=s.sub(h,l.position,b),l.positionPrev.x-=m.x*l.inverseMass,l.positionPrev.y-=m.y*l.inverseMass,l.anglePrev-=s.cross(_,m)*l.inverseInertia))},i.solveVelocity=function(e,t){for(var n=t*t,r=s._temp[0],a=s._temp[1],l=s._temp[2],u=s._temp[3],c=s._temp[4],p=s._temp[5],h=0;h<e.length;h++){var d=e[h];if(d.isActive&&!d.isSensor){var f=d.collision,_=f.parentA,m=f.parentB,b=f.normal,g=f.tangent,S=d.activeContacts,k=1/S.length;_.velocity.x=_.position.x-_.positionPrev.x,_.velocity.y=_.position.y-_.positionPrev.y,m.velocity.x=m.position.x-m.positionPrev.x,m.velocity.y=m.position.y-m.positionPrev.y,_.angularVelocity=_.angle-_.anglePrev,m.angularVelocity=m.angle-m.anglePrev;for(var y=0;y<S.length;y++){var v=S[y],T=v.vertex,E=s.sub(T,_.position,a),I=s.sub(T,m.position,l),w=s.add(_.velocity,s.mult(s.perp(E),_.angularVelocity),u),x=s.add(m.velocity,s.mult(s.perp(I),m.angularVelocity),c),A=s.sub(w,x,p),$=s.dot(b,A),O=s.dot(g,A),M=Math.abs(O),C=o.sign(O),R=(1+d.restitution)*$,N=o.clamp(d.separation+$,0,1)*i._frictionNormalMultiplier,L=O,D=1/0;M>d.friction*d.frictionStatic*N*n&&(D=M,L=o.clamp(d.friction*C*n,-D,D));var P=s.cross(E,b),F=s.cross(I,b),B=k/(_.inverseMass+m.inverseMass+_.inverseInertia*P*P+m.inverseInertia*F*F);if(R*=B,L*=B,$<0&&$*$>i._restingThresh*n)v.normalImpulse=0;else{var j=v.normalImpulse;v.normalImpulse=Math.min(v.normalImpulse+R,0),R=v.normalImpulse-j}if(O*O>i._restingThreshTangent*n)v.tangentImpulse=0;else{var V=v.tangentImpulse;v.tangentImpulse=o.clamp(v.tangentImpulse+L,-D,D),L=v.tangentImpulse-V}r.x=b.x*R+g.x*L,r.y=b.y*R+g.y*L,_.isStatic||_.isSleeping||(_.positionPrev.x+=r.x*_.inverseMass,_.positionPrev.y+=r.y*_.inverseMass,_.anglePrev+=s.cross(E,r)*_.inverseInertia),m.isStatic||m.isSleeping||(m.positionPrev.x-=r.x*m.inverseMass,m.positionPrev.y-=r.y*m.inverseMass,m.anglePrev-=s.cross(I,r)*m.inverseInertia)}}}}},function(e,t,n){var i={};e.exports=i;var r=n(19),s=n(7),o=n(21),a=n(10),l=n(20),u=n(23),c=n(11),p=n(4),h=n(5),d=n(8),f=n(0),_=n(6);i.create=function(e,t){t=(t=f.isElement(e)?t:e)||{},((e=f.isElement(e)?e:null)||t.render)&&f.warn("Engine.create: engine.render is deprecated (see docs)");var n={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},timing:{timestamp:0,timeScale:1},broadphase:{controller:c}},i=f.extend(n,t);if(e||i.render){var s={element:e,controller:a};i.render=f.extend(s,i.render)}return i.render&&i.render.controller&&(i.render=i.render.controller.create(i.render)),i.render&&(i.render.engine=i),i.world=t.world||r.create(i.world),i.pairs=l.create(),i.broadphase=i.broadphase.controller.create(i.broadphase),i.metrics=i.metrics||{extended:!1},i.metrics=u.create(i.metrics),i},i.update=function(e,t,n){t=t||1e3/60,n=n||1;var r,a=e.world,c=e.timing,f=e.broadphase,_=[];c.timestamp+=t*c.timeScale;var m={timestamp:c.timestamp};p.trigger(e,"beforeUpdate",m);var b=h.allBodies(a),g=h.allConstraints(a);for(u.reset(e.metrics),e.enableSleeping&&s.update(b,c.timeScale),i._bodiesApplyGravity(b,a.gravity),i._bodiesUpdate(b,t,c.timeScale,n,a.bounds),d.preSolveAll(b),r=0;r<e.constraintIterations;r++)d.solveAll(g,c.timeScale);d.postSolveAll(b),f.controller?(a.isModified&&f.controller.clear(f),f.controller.update(f,b,e,a.isModified),_=f.pairsList):_=b,a.isModified&&h.setModified(a,!1,!1,!0);var S=f.detector(_,e),k=e.pairs,y=c.timestamp;for(l.update(k,S,y),l.removeOld(k,y),e.enableSleeping&&s.afterCollisions(k.list,c.timeScale),k.collisionStart.length>0&&p.trigger(e,"collisionStart",{pairs:k.collisionStart}),o.preSolvePosition(k.list),r=0;r<e.positionIterations;r++)o.solvePosition(k.list,c.timeScale);for(o.postSolvePosition(b),d.preSolveAll(b),r=0;r<e.constraintIterations;r++)d.solveAll(g,c.timeScale);for(d.postSolveAll(b),o.preSolveVelocity(k.list),r=0;r<e.velocityIterations;r++)o.solveVelocity(k.list,c.timeScale);return k.collisionActive.length>0&&p.trigger(e,"collisionActive",{pairs:k.collisionActive}),k.collisionEnd.length>0&&p.trigger(e,"collisionEnd",{pairs:k.collisionEnd}),u.update(e.metrics,e),i._bodiesClearForces(b),p.trigger(e,"afterUpdate",m),e},i.merge=function(e,t){if(f.extend(e,t),t.world){e.world=t.world,i.clear(e);for(var n=h.allBodies(e.world),r=0;r<n.length;r++){var o=n[r];s.set(o,!1),o.id=f.nextId()}}},i.clear=function(e){var t=e.world;l.clear(e.pairs);var n=e.broadphase;if(n.controller){var i=h.allBodies(t);n.controller.clear(n),n.controller.update(n,i,e,!0)}},i._bodiesClearForces=function(e){for(var t=0;t<e.length;t++){var n=e[t];n.force.x=0,n.force.y=0,n.torque=0}},i._bodiesApplyGravity=function(e,t){var n=void 0!==t.scale?t.scale:.001;if((0!==t.x||0!==t.y)&&0!==n)for(var i=0;i<e.length;i++){var r=e[i];r.isStatic||r.isSleeping||(r.force.y+=r.mass*t.y*n,r.force.x+=r.mass*t.x*n)}},i._bodiesUpdate=function(e,t,n,i,r){for(var s=0;s<e.length;s++){var o=e[s];o.isStatic||o.isSleeping||_.update(o,t,n,i)}}},function(e,t,n){var i={};e.exports=i;var r=n(5),s=n(0);i.create=function(e){return s.extend({extended:!1,narrowDetections:0,narrowphaseTests:0,narrowReuse:0,narrowReuseCount:0,midphaseTests:0,broadphaseTests:0,narrowEff:1e-4,midEff:1e-4,broadEff:1e-4,collisions:0,buckets:0,bodies:0,pairs:0},!1,e)},i.reset=function(e){e.extended&&(e.narrowDetections=0,e.narrowphaseTests=0,e.narrowReuse=0,e.narrowReuseCount=0,e.midphaseTests=0,e.broadphaseTests=0,e.narrowEff=0,e.midEff=0,e.broadEff=0,e.collisions=0,e.buckets=0,e.pairs=0,e.bodies=0)},i.update=function(e,t){if(e.extended){var n=t.world,i=r.allBodies(n);e.collisions=e.narrowDetections,e.pairs=t.pairs.list.length,e.bodies=i.length,e.midEff=(e.narrowDetections/(e.midphaseTests||1)).toFixed(2),e.narrowEff=(e.narrowDetections/(e.narrowphaseTests||1)).toFixed(2),e.broadEff=(1-e.broadphaseTests/(i.length||1)).toFixed(2),e.narrowReuse=(e.narrowReuseCount/(e.narrowphaseTests||1)).toFixed(2)}}},function(e,t,n){var i=e.exports=n(25);i.Body=n(6),i.Composite=n(5),i.World=n(19),i.Contact=n(18),i.Detector=n(12),i.Grid=n(11),i.Pairs=n(20),i.Pair=n(9),i.Query=n(26),i.Resolver=n(21),i.SAT=n(13),i.Constraint=n(8),i.MouseConstraint=n(28),i.Common=n(0),i.Engine=n(22),i.Events=n(4),i.Mouse=n(14),i.Runner=n(29),i.Sleeping=n(7),i.Plugin=n(17),i.Metrics=n(23),i.Bodies=n(16),i.Composites=n(30),i.Axes=n(15),i.Bounds=n(1),i.Svg=n(31),i.Vector=n(2),i.Vertices=n(3),i.Render=n(10),i.RenderPixi=n(32),i.World.add=i.Composite.add,i.World.remove=i.Composite.remove,i.World.addComposite=i.Composite.addComposite,i.World.addBody=i.Composite.addBody,i.World.addConstraint=i.Composite.addConstraint,i.World.clear=i.Composite.clear,i.Engine.run=i.Runner.run},function(e,t,n){var i={};e.exports=i;var r=n(17),s=n(0);i.name="matter-js",i.version="0.16.1",i.uses=[],i.used=[],i.use=function(){r.use(i,Array.prototype.slice.call(arguments))},i.before=function(e,t){return e=e.replace(/^Matter./,""),s.chainPathBefore(i,e,t)},i.after=function(e,t){return e=e.replace(/^Matter./,""),s.chainPathAfter(i,e,t)}},function(e,t,n){var i={};e.exports=i;var r=n(2),s=n(13),o=n(1),a=n(16),l=n(3);i.collides=function(e,t){for(var n=[],i=0;i<t.length;i++){var r=t[i];if(o.overlaps(r.bounds,e.bounds))for(var a=1===r.parts.length?0:1;a<r.parts.length;a++){var l=r.parts[a];if(o.overlaps(l.bounds,e.bounds)){var u=s.collides(l,e);if(u.collided){n.push(u);break}}}}return n},i.ray=function(e,t,n,s){s=s||1e-100;for(var o=r.angle(t,n),l=r.magnitude(r.sub(t,n)),u=.5*(n.x+t.x),c=.5*(n.y+t.y),p=a.rectangle(u,c,l,s,{angle:o}),h=i.collides(p,e),d=0;d<h.length;d+=1){var f=h[d];f.body=f.bodyB=f.bodyA}return h},i.region=function(e,t,n){for(var i=[],r=0;r<e.length;r++){var s=e[r],a=o.overlaps(s.bounds,t);(a&&!n||!a&&n)&&i.push(s)}return i},i.point=function(e,t){for(var n=[],i=0;i<e.length;i++){var r=e[i];if(o.contains(r.bounds,t))for(var s=1===r.parts.length?0:1;s<r.parts.length;s++){var a=r.parts[s];if(o.contains(a.bounds,t)&&l.contains(a.vertices,t)){n.push(r);break}}}return n}},function(t,n){if(void 0===e){var i=new Error("Cannot find module 'undefined'");throw i.code="MODULE_NOT_FOUND",i}t.exports=e},function(e,t,n){var i={};e.exports=i;var r=n(3),s=n(7),o=n(14),a=n(4),l=n(12),u=n(8),c=n(5),p=n(0),h=n(1);i.create=function(e,t){var n=(e?e.mouse:null)||(t?t.mouse:null);n||(e&&e.render&&e.render.canvas?n=o.create(e.render.canvas):t&&t.element?n=o.create(t.element):(n=o.create(),p.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var r={type:"mouseConstraint",mouse:n,element:null,body:null,constraint:u.create({label:"Mouse Constraint",pointA:n.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),collisionFilter:{category:1,mask:4294967295,group:0}},s=p.extend(r,t);return a.on(e,"beforeUpdate",(function(){var t=c.allBodies(e.world);i.update(s,t),i._triggerEvents(s)})),s},i.update=function(e,t){var n=e.mouse,i=e.constraint,o=e.body;if(0===n.button){if(i.bodyB)s.set(i.bodyB,!1),i.pointA=n.position;else for(var u=0;u<t.length;u++)if(o=t[u],h.contains(o.bounds,n.position)&&l.canCollide(o.collisionFilter,e.collisionFilter))for(var c=o.parts.length>1?1:0;c<o.parts.length;c++){var p=o.parts[c];if(r.contains(p.vertices,n.position)){i.pointA=n.position,i.bodyB=e.body=o,i.pointB={x:n.position.x-o.position.x,y:n.position.y-o.position.y},i.angleB=o.angle,s.set(o,!1),a.trigger(e,"startdrag",{mouse:n,body:o});break}}}else i.bodyB=e.body=null,i.pointB=null,o&&a.trigger(e,"enddrag",{mouse:n,body:o})},i._triggerEvents=function(e){var t=e.mouse,n=t.sourceEvents;n.mousemove&&a.trigger(e,"mousemove",{mouse:t}),n.mousedown&&a.trigger(e,"mousedown",{mouse:t}),n.mouseup&&a.trigger(e,"mouseup",{mouse:t}),o.clearSourceEvents(t)}},function(e,t,n){var i={};e.exports=i;var r=n(4),s=n(22),o=n(0);!function(){var e,t,n;"undefined"!=typeof window&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),e||(e=function(e){n=setTimeout((function(){e(o.now())}),1e3/60)},t=function(){clearTimeout(n)}),i.create=function(e){var t=o.extend({fps:60,correction:1,deltaSampleSize:60,counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,timeScalePrev:1,frameRequestId:null,isFixed:!1,enabled:!0},e);return t.delta=t.delta||1e3/t.fps,t.deltaMin=t.deltaMin||1e3/t.fps,t.deltaMax=t.deltaMax||1e3/(.5*t.fps),t.fps=1e3/t.delta,t},i.run=function(t,n){return void 0!==t.positionIterations&&(n=t,t=i.create()),function r(s){t.frameRequestId=e(r),s&&t.enabled&&i.tick(t,n,s)}(),t},i.tick=function(e,t,n){var i,o=t.timing,a=1,l={timestamp:o.timestamp};r.trigger(e,"beforeTick",l),r.trigger(t,"beforeTick",l),e.isFixed?i=e.delta:(i=n-e.timePrev||e.delta,e.timePrev=n,e.deltaHistory.push(i),e.deltaHistory=e.deltaHistory.slice(-e.deltaSampleSize),a=(i=(i=(i=Math.min.apply(null,e.deltaHistory))<e.deltaMin?e.deltaMin:i)>e.deltaMax?e.deltaMax:i)/e.delta,e.delta=i),0!==e.timeScalePrev&&(a*=o.timeScale/e.timeScalePrev),0===o.timeScale&&(a=0),e.timeScalePrev=o.timeScale,e.correction=a,e.frameCounter+=1,n-e.counterTimestamp>=1e3&&(e.fps=e.frameCounter*((n-e.counterTimestamp)/1e3),e.counterTimestamp=n,e.frameCounter=0),r.trigger(e,"tick",l),r.trigger(t,"tick",l),t.world.isModified&&t.render&&t.render.controller&&t.render.controller.clear&&t.render.controller.clear(t.render),r.trigger(e,"beforeUpdate",l),s.update(t,i,a),r.trigger(e,"afterUpdate",l),t.render&&t.render.controller&&(r.trigger(e,"beforeRender",l),r.trigger(t,"beforeRender",l),t.render.controller.world(t.render),r.trigger(e,"afterRender",l),r.trigger(t,"afterRender",l)),r.trigger(e,"afterTick",l),r.trigger(t,"afterTick",l)},i.stop=function(e){t(e.frameRequestId)},i.start=function(e,t){i.run(e,t)}}()},function(e,t,n){var i={};e.exports=i;var r=n(5),s=n(8),o=n(0),a=n(6),l=n(16);i.stack=function(e,t,n,i,s,o,l){for(var u,c=r.create({label:"Stack"}),p=e,h=t,d=0,f=0;f<i;f++){for(var _=0,m=0;m<n;m++){var b=l(p,h,m,f,u,d);if(b){var g=b.bounds.max.y-b.bounds.min.y,S=b.bounds.max.x-b.bounds.min.x;g>_&&(_=g),a.translate(b,{x:.5*S,y:.5*g}),p=b.bounds.max.x+s,r.addBody(c,b),u=b,d+=1}else p+=s}h+=_+o,p=e}return c},i.chain=function(e,t,n,i,a,l){for(var u=e.bodies,c=1;c<u.length;c++){var p=u[c-1],h=u[c],d=p.bounds.max.y-p.bounds.min.y,f=p.bounds.max.x-p.bounds.min.x,_=h.bounds.max.y-h.bounds.min.y,m={bodyA:p,pointA:{x:f*t,y:d*n},bodyB:h,pointB:{x:(h.bounds.max.x-h.bounds.min.x)*i,y:_*a}},b=o.extend(m,l);r.addConstraint(e,s.create(b))}return e.label+=" Chain",e},i.mesh=function(e,t,n,i,a){var l,u,c,p,h,d=e.bodies;for(l=0;l<n;l++){for(u=1;u<t;u++)c=d[u-1+l*t],p=d[u+l*t],r.addConstraint(e,s.create(o.extend({bodyA:c,bodyB:p},a)));if(l>0)for(u=0;u<t;u++)c=d[u+(l-1)*t],p=d[u+l*t],r.addConstraint(e,s.create(o.extend({bodyA:c,bodyB:p},a))),i&&u>0&&(h=d[u-1+(l-1)*t],r.addConstraint(e,s.create(o.extend({bodyA:h,bodyB:p},a)))),i&&u<t-1&&(h=d[u+1+(l-1)*t],r.addConstraint(e,s.create(o.extend({bodyA:h,bodyB:p},a))))}return e.label+=" Mesh",e},i.pyramid=function(e,t,n,r,s,o,l){return i.stack(e,t,n,r,s,o,(function(t,i,o,u,c,p){var h=Math.min(r,Math.ceil(n/2)),d=c?c.bounds.max.x-c.bounds.min.x:0;if(!(u>h||o<(u=h-u)||o>n-1-u))return 1===p&&a.translate(c,{x:(o+(n%2==1?1:-1))*d,y:0}),l(e+(c?o*d:0)+o*s,i,o,u,c,p)}))},i.newtonsCradle=function(e,t,n,i,o){for(var a=r.create({label:"Newtons Cradle"}),u=0;u<n;u++){var c=l.circle(e+u*(1.9*i),t+o,i,{inertia:1/0,restitution:1,friction:0,frictionAir:1e-4,slop:1}),p=s.create({pointA:{x:e+u*(1.9*i),y:t},bodyB:c});r.addBody(a,c),r.addConstraint(a,p)}return a},i.car=function(e,t,n,i,o){var u=a.nextGroup(!0),c=.5*-n+20,p=.5*n-20,h=r.create({label:"Car"}),d=l.rectangle(e,t,n,i,{collisionFilter:{group:u},chamfer:{radius:.5*i},density:2e-4}),f=l.circle(e+c,t+0,o,{collisionFilter:{group:u},friction:.8}),_=l.circle(e+p,t+0,o,{collisionFilter:{group:u},friction:.8}),m=s.create({bodyB:d,pointB:{x:c,y:0},bodyA:f,stiffness:1,length:0}),b=s.create({bodyB:d,pointB:{x:p,y:0},bodyA:_,stiffness:1,length:0});return r.addBody(h,d),r.addBody(h,f),r.addBody(h,_),r.addConstraint(h,m),r.addConstraint(h,b),h},i.softBody=function(e,t,n,r,s,a,u,c,p,h){p=o.extend({inertia:1/0},p),h=o.extend({stiffness:.2,render:{type:"line",anchors:!1}},h);var d=i.stack(e,t,n,r,s,a,(function(e,t){return l.circle(e,t,c,p)}));return i.mesh(d,n,r,u,h),d.label="Soft Body",d}},function(e,t,n){var i={};e.exports=i,n(1);var r=n(0);i.pathToVertices=function(e,t){"undefined"==typeof window||"SVGPathSeg"in window||r.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var n,s,o,a,l,u,c,p,h,d,f,_=[],m=0,b=0,g=0;t=t||15;var S=function(e,t,n){var i=n%2==1&&n>1;if(!h||e!=h.x||t!=h.y){h&&i?(d=h.x,f=h.y):(d=0,f=0);var r={x:d+e,y:f+t};!i&&h||(h=r),_.push(r),b=d+e,g=f+t}},k=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":b=e.x,g=e.y;break;case"H":b=e.x;break;case"V":g=e.y}S(b,g,e.pathSegType)}};for(i._svgPathToAbsolute(e),o=e.getTotalLength(),u=[],n=0;n<e.pathSegList.numberOfItems;n+=1)u.push(e.pathSegList.getItem(n));for(c=u.concat();m<o;){if((l=u[e.getPathSegAtLength(m)])!=p){for(;c.length&&c[0]!=l;)k(c.shift());p=l}switch(l.pathSegTypeAsLetter.toUpperCase()){case"C":case"T":case"S":case"Q":case"A":a=e.getPointAtLength(m),S(a.x,a.y,0)}m+=t}for(n=0,s=c.length;n<s;++n)k(c[n]);return _},i._svgPathToAbsolute=function(e){for(var t,n,i,r,s,o,a=e.pathSegList,l=0,u=0,c=a.numberOfItems,p=0;p<c;++p){var h=a.getItem(p),d=h.pathSegTypeAsLetter;if(/[MLHVCSQTA]/.test(d))"x"in h&&(l=h.x),"y"in h&&(u=h.y);else switch("x1"in h&&(i=l+h.x1),"x2"in h&&(s=l+h.x2),"y1"in h&&(r=u+h.y1),"y2"in h&&(o=u+h.y2),"x"in h&&(l+=h.x),"y"in h&&(u+=h.y),d){case"m":a.replaceItem(e.createSVGPathSegMovetoAbs(l,u),p);break;case"l":a.replaceItem(e.createSVGPathSegLinetoAbs(l,u),p);break;case"h":a.replaceItem(e.createSVGPathSegLinetoHorizontalAbs(l),p);break;case"v":a.replaceItem(e.createSVGPathSegLinetoVerticalAbs(u),p);break;case"c":a.replaceItem(e.createSVGPathSegCurvetoCubicAbs(l,u,i,r,s,o),p);break;case"s":a.replaceItem(e.createSVGPathSegCurvetoCubicSmoothAbs(l,u,s,o),p);break;case"q":a.replaceItem(e.createSVGPathSegCurvetoQuadraticAbs(l,u,i,r),p);break;case"t":a.replaceItem(e.createSVGPathSegCurvetoQuadraticSmoothAbs(l,u),p);break;case"a":a.replaceItem(e.createSVGPathSegArcAbs(l,u,h.r1,h.r2,h.angle,h.largeArcFlag,h.sweepFlag),p);break;case"z":case"Z":l=t,u=n}"M"!=d&&"m"!=d||(t=l,n=u)}}},function(e,t,n){var i={};e.exports=i;var r=n(1),s=n(5),o=n(0),a=n(4),l=n(2);!function(){var e,t;"undefined"!=typeof window&&(e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout((function(){e(o.now())}),1e3/60)},t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),i.create=function(e){o.warn("RenderPixi.create: Matter.RenderPixi is deprecated (see docs)");var t={controller:i,engine:null,element:null,frameRequestId:null,canvas:null,renderer:null,container:null,spriteContainer:null,pixiOptions:null,options:{width:800,height:600,background:"#fafafa",wireframeBackground:"#222",hasBounds:!1,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showBroadphase:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showShadows:!1}},n=o.extend(t,e),r=!n.options.wireframes&&"transparent"===n.options.background;return n.pixiOptions=n.pixiOptions||{view:n.canvas,transparent:r,antialias:!0,backgroundColor:e.background},n.mouse=e.mouse,n.engine=e.engine,n.renderer=n.renderer||new PIXI.WebGLRenderer(n.options.width,n.options.height,n.pixiOptions),n.container=n.container||new PIXI.Container,n.spriteContainer=n.spriteContainer||new PIXI.Container,n.canvas=n.canvas||n.renderer.view,n.bounds=n.bounds||{min:{x:0,y:0},max:{x:n.options.width,y:n.options.height}},a.on(n.engine,"beforeUpdate",(function(){i.clear(n)})),n.textures={},n.sprites={},n.primitives={},n.container.addChild(n.spriteContainer),o.isElement(n.element)?n.element.appendChild(n.canvas):o.warn('No "render.element" passed, "render.canvas" was not inserted into document.'),n.canvas.oncontextmenu=function(){return!1},n.canvas.onselectstart=function(){return!1},n},i.run=function(t){!function n(r){t.frameRequestId=e(n),i.world(t)}()},i.stop=function(e){t(e.frameRequestId)},i.clear=function(e){for(var t=e.container,n=e.spriteContainer;t.children[0];)t.removeChild(t.children[0]);for(;n.children[0];)n.removeChild(n.children[0]);var i=e.sprites["bg-0"];e.textures={},e.sprites={},e.primitives={},e.sprites["bg-0"]=i,i&&t.addChildAt(i,0),e.container.addChild(e.spriteContainer),e.currentBackground=null,t.scale.set(1,1),t.position.set(0,0)},i.setBackground=function(e,t){if(e.currentBackground!==t){var n=t.indexOf&&-1!==t.indexOf("#"),i=e.sprites["bg-0"];if(n){var r=o.colorToNumber(t);e.renderer.backgroundColor=r,i&&e.container.removeChild(i)}else if(!i){var s=c(e,t);(i=e.sprites["bg-0"]=new PIXI.Sprite(s)).position.x=0,i.position.y=0,e.container.addChildAt(i,0)}e.currentBackground=t}},i.world=function(e){var t,n=e.engine.world,o=e.renderer,a=e.container,u=e.options,c=s.allBodies(n),p=s.allConstraints(n),h=[];u.wireframes?i.setBackground(e,u.wireframeBackground):i.setBackground(e,u.background);var d=e.bounds.max.x-e.bounds.min.x,f=e.bounds.max.y-e.bounds.min.y,_=d/e.options.width,m=f/e.options.height;if(u.hasBounds){for(t=0;t<c.length;t++){var b=c[t];b.render.sprite.visible=r.overlaps(b.bounds,e.bounds)}for(t=0;t<p.length;t++){var g=p[t],S=g.bodyA,k=g.bodyB,y=g.pointA,v=g.pointB;S&&(y=l.add(S.position,g.pointA)),k&&(v=l.add(k.position,g.pointB)),y&&v&&(r.contains(e.bounds,y)||r.contains(e.bounds,v))&&h.push(g)}a.scale.set(1/_,1/m),a.position.set(-e.bounds.min.x*(1/_),-e.bounds.min.y*(1/m))}else h=p;for(t=0;t<c.length;t++)i.body(e,c[t]);for(t=0;t<h.length;t++)i.constraint(e,h[t]);o.render(a)},i.constraint=function(e,t){e.engine;var n=t.bodyA,i=t.bodyB,r=t.pointA,s=t.pointB,a=e.container,l=t.render,u="c-"+t.id,c=e.primitives[u];c||(c=e.primitives[u]=new PIXI.Graphics),l.visible&&t.pointA&&t.pointB?(-1===o.indexOf(a.children,c)&&a.addChild(c),c.clear(),c.beginFill(0,0),c.lineStyle(l.lineWidth,o.colorToNumber(l.strokeStyle),1),n?c.moveTo(n.position.x+r.x,n.position.y+r.y):c.moveTo(r.x,r.y),i?c.lineTo(i.position.x+s.x,i.position.y+s.y):c.lineTo(s.x,s.y),c.endFill()):c.clear()},i.body=function(e,t){e.engine;var i=t.render;if(i.visible)if(i.sprite&&i.sprite.texture){var r="b-"+t.id,s=e.sprites[r],a=e.spriteContainer;s||(s=e.sprites[r]=n(e,t)),-1===o.indexOf(a.children,s)&&a.addChild(s),s.position.x=t.position.x,s.position.y=t.position.y,s.rotation=t.angle,s.scale.x=i.sprite.xScale||1,s.scale.y=i.sprite.yScale||1}else{var l="b-"+t.id,c=e.primitives[l],p=e.container;c||((c=e.primitives[l]=u(e,t)).initialAngle=t.angle),-1===o.indexOf(p.children,c)&&p.addChild(c),c.position.x=t.position.x,c.position.y=t.position.y,c.rotation=t.angle-c.initialAngle}};var n=function(e,t){var n=t.render.sprite.texture,i=c(e,n),r=new PIXI.Sprite(i);return r.anchor.x=t.render.sprite.xOffset,r.anchor.y=t.render.sprite.yOffset,r},u=function(e,t){var n,i=t.render,r=e.options,s=new PIXI.Graphics,a=o.colorToNumber(i.fillStyle),l=o.colorToNumber(i.strokeStyle),u=o.colorToNumber(i.strokeStyle),c=o.colorToNumber("#bbb"),p=o.colorToNumber("#CD5C5C");s.clear();for(var h=t.parts.length>1?1:0;h<t.parts.length;h++){n=t.parts[h],r.wireframes?(s.beginFill(0,0),s.lineStyle(1,c,1)):(s.beginFill(a,1),s.lineStyle(i.lineWidth,l,1)),s.moveTo(n.vertices[0].x-t.position.x,n.vertices[0].y-t.position.y);for(var d=1;d<n.vertices.length;d++)s.lineTo(n.vertices[d].x-t.position.x,n.vertices[d].y-t.position.y);s.lineTo(n.vertices[0].x-t.position.x,n.vertices[0].y-t.position.y),s.endFill(),(r.showAngleIndicator||r.showAxes)&&(s.beginFill(0,0),r.wireframes?s.lineStyle(1,p,1):s.lineStyle(1,u),s.moveTo(n.position.x-t.position.x,n.position.y-t.position.y),s.lineTo((n.vertices[0].x+n.vertices[n.vertices.length-1].x)/2-t.position.x,(n.vertices[0].y+n.vertices[n.vertices.length-1].y)/2-t.position.y),s.endFill())}return s},c=function(e,t){var n=e.textures[t];return n||(n=e.textures[t]=PIXI.Texture.fromImage(t)),n}}()}])}));(function(){function e(e){this._engine=a.Engine.create(),this._pixiObjects=[],a.Engine.run(this.engine);var t=a.MouseConstraint.create(this.engine,{mouse:a.Mouse.create(e.stage)});a.World.add(this.engine.world,t)}Object.defineProperty(e.prototype,"engine",{get:function(){return this._engine},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixiObjects",{get:function(){return this._pixiObjects},enumerable:!1,configurable:!0}),e.prototype.update=function(){this._pixiObjects.forEach((function(e){return e.update()}))},e.prototype.addToWorld=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.forEach((function(t){return a.World.addBody(e.engine.world,t.body)})),this._pixiObjects=this._pixiObjects.concat(t)},e.prototype.removeFromWorld=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.forEach((function(t){return a.World.remove(e.engine.world,t.body)})),this._pixiObjects=this._pixiObjects.filter((function(e){return!t.includes(e)}))}})(),function(){function e(e,t,n){void 0===t&&(t={});var i=e.x,r=e.y,s=e.width,o=e.height;e.texture,this._sprite=e,this._update=n,this.physicsOptions=t,t.isCircle?this._body=a.Bodies.circle(i,r,s/2,t):this._body=a.Bodies.rectangle(i,r,s,o,t)}Object.defineProperty(e.prototype,"body",{get:function(){return this._body},enumerable:!1,configurable:!0}),e.prototype.update=function(){this._update?this._update({position:this._body.position,rotation:this._body.angle}):(this._sprite.position=this._body.position,this._sprite.rotation=this._body.angle)}}();var l,u,c={},p=/iPhone/i,h=/iPod/i,d=/iPad/i,f=/\biOS-universal(?:.+)Mac\b/i,_=/\bAndroid(?:.+)Mobile\b/i,m=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,g=/Silk/i,S=/Windows Phone/i,k=/\bWindows(?:.+)ARM\b/i,y=/BlackBerry/i,v=/BB10/i,T=/Opera Mini/i,E=/\b(CriOS|Chrome)(?:.+)Mobile/i,I=/Mobile(?:.+)Firefox\b/i,w=function(e){return void 0!==e&&"MacIntel"===e.platform&&"number"==typeof e.maxTouchPoints&&e.maxTouchPoints>1&&"undefined"==typeof MSStream};var x=function(e){var t={userAgent:"",platform:"",maxTouchPoints:0};e||"undefined"==typeof navigator?"string"==typeof e?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0}):t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var n=t.userAgent,i=n.split("[FBAN");void 0!==i[1]&&(n=i[0]),void 0!==(i=n.split("Twitter"))[1]&&(n=i[0]);var r=function(e){return function(t){return t.test(e)}}(n),s={apple:{phone:r(p)&&!r(S),ipod:r(h),tablet:!r(p)&&(r(d)||w(t))&&!r(S),universal:r(f),device:(r(p)||r(h)||r(d)||r(f)||w(t))&&!r(S)},amazon:{phone:r(b),tablet:!r(b)&&r(g),device:r(b)||r(g)},android:{phone:!r(S)&&r(b)||!r(S)&&r(_),tablet:!r(S)&&!r(b)&&!r(_)&&(r(g)||r(m)),device:!r(S)&&(r(b)||r(g)||r(_)||r(m))||r(/\bokhttp\b/i)},windows:{phone:r(S),tablet:r(k),device:r(S)||r(k)},other:{blackberry:r(y),blackberry10:r(v),opera:r(T),firefox:r(I),chrome:r(E),device:r(y)||r(v)||r(T)||r(I)||r(E)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}(self.navigator);var A,$,O,M,C,R,N,L,D,P,F,B,j,V,U,Y,G,X,H={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:function(e){var t,n=!0;return(x.tablet||x.phone)&&(x.apple.device&&(t=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(t[1],10)<11&&(n=!1),x.android.device&&(t=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(t[1],10)<7&&(n=!1)),n?e:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:0,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:33071,SCALE_MODE:1,PRECISION_VERTEX:"highp",PRECISION_FRAGMENT:x.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!x.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};(X=A||(A={}))[X.WEBGL_LEGACY=0]="WEBGL_LEGACY",X[X.WEBGL=1]="WEBGL",X[X.WEBGL2=2]="WEBGL2",function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.WEBGL=1]="WEBGL",e[e.CANVAS=2]="CANVAS"}($||($={})),function(e){e[e.COLOR=16384]="COLOR",e[e.DEPTH=256]="DEPTH",e[e.STENCIL=1024]="STENCIL"}(O||(O={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.ADD=1]="ADD",e[e.MULTIPLY=2]="MULTIPLY",e[e.SCREEN=3]="SCREEN",e[e.OVERLAY=4]="OVERLAY",e[e.DARKEN=5]="DARKEN",e[e.LIGHTEN=6]="LIGHTEN",e[e.COLOR_DODGE=7]="COLOR_DODGE",e[e.COLOR_BURN=8]="COLOR_BURN",e[e.HARD_LIGHT=9]="HARD_LIGHT",e[e.SOFT_LIGHT=10]="SOFT_LIGHT",e[e.DIFFERENCE=11]="DIFFERENCE",e[e.EXCLUSION=12]="EXCLUSION",e[e.HUE=13]="HUE",e[e.SATURATION=14]="SATURATION",e[e.COLOR=15]="COLOR",e[e.LUMINOSITY=16]="LUMINOSITY",e[e.NORMAL_NPM=17]="NORMAL_NPM",e[e.ADD_NPM=18]="ADD_NPM",e[e.SCREEN_NPM=19]="SCREEN_NPM",e[e.NONE=20]="NONE",e[e.SRC_OVER=0]="SRC_OVER",e[e.SRC_IN=21]="SRC_IN",e[e.SRC_OUT=22]="SRC_OUT",e[e.SRC_ATOP=23]="SRC_ATOP",e[e.DST_OVER=24]="DST_OVER",e[e.DST_IN=25]="DST_IN",e[e.DST_OUT=26]="DST_OUT",e[e.DST_ATOP=27]="DST_ATOP",e[e.ERASE=26]="ERASE",e[e.SUBTRACT=28]="SUBTRACT",e[e.XOR=29]="XOR"}(M||(M={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(C||(C={})),function(e){e[e.RGBA=6408]="RGBA",e[e.RGB=6407]="RGB",e[e.ALPHA=6406]="ALPHA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(R||(R={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(N||(N={})),function(e){e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.FLOAT=5126]="FLOAT",e[e.HALF_FLOAT=36193]="HALF_FLOAT"}(L||(L={})),function(e){e[e.NEAREST=0]="NEAREST",e[e.LINEAR=1]="LINEAR"}(D||(D={})),function(e){e[e.CLAMP=33071]="CLAMP",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(P||(P={})),function(e){e[e.OFF=0]="OFF",e[e.POW2=1]="POW2",e[e.ON=2]="ON",e[e.ON_MANUAL=3]="ON_MANUAL"}(F||(F={})),function(e){e[e.NPM=0]="NPM",e[e.UNPACK=1]="UNPACK",e[e.PMA=2]="PMA",e[e.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",e[e.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",e[e.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(B||(B={})),function(e){e[e.NO=0]="NO",e[e.YES=1]="YES",e[e.AUTO=2]="AUTO",e[e.BLEND=0]="BLEND",e[e.CLEAR=1]="CLEAR",e[e.BLIT=2]="BLIT"}(j||(j={})),function(e){e[e.AUTO=0]="AUTO",e[e.MANUAL=1]="MANUAL"}(V||(V={})),function(e){e.LOW="lowp",e.MEDIUM="mediump",e.HIGH="highp"}(U||(U={})),function(e){e[e.NONE=0]="NONE",e[e.SCISSOR=1]="SCISSOR",e[e.STENCIL=2]="STENCIL",e[e.SPRITE=3]="SPRITE"}(Y||(Y={})),function(e){e[e.NONE=0]="NONE",e[e.LOW=2]="LOW",e[e.MEDIUM=4]="MEDIUM",e[e.HIGH=8]="HIGH"}(G||(G={}));var z,q=Object.prototype.hasOwnProperty,W="~";function K(){}function J(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function Q(e,t,n,i,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new J(n,i||e,r),o=W?W+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],s]:e._events[o].push(s):(e._events[o]=s,e._eventsCount++),e}function Z(e,t){0==--e._eventsCount?e._events=new K:delete e._events[t]}function ee(){this._events=new K,this._eventsCount=0}Object.create&&(K.prototype=Object.create(null),(new K).__proto__||(W=!1)),ee.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)q.call(e,t)&&n.push(W?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},ee.prototype.listeners=function(e){var t=W?W+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,r=n.length,s=new Array(r);i<r;i++)s[i]=n[i].fn;return s},ee.prototype.listenerCount=function(e){var t=W?W+e:e,n=this._events[t];return n?n.fn?1:n.length:0},ee.prototype.emit=function(e,t,n,i,r,s){var o=W?W+e:e;if(!this._events[o])return!1;var a,l,u=this._events[o],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,r),!0;case 6:return u.fn.call(u.context,t,n,i,r,s),!0}for(l=1,a=new Array(c-1);l<c;l++)a[l-1]=arguments[l];u.fn.apply(u.context,a)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),c){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,n);break;case 4:u[l].fn.call(u[l].context,t,n,i);break;default:if(!a)for(p=1,a=new Array(c-1);p<c;p++)a[p-1]=arguments[p];u[l].fn.apply(u[l].context,a)}}return!0},ee.prototype.on=function(e,t,n){return Q(this,e,t,n,!1)},ee.prototype.once=function(e,t,n){return Q(this,e,t,n,!0)},ee.prototype.removeListener=function(e,t,n,i){var r=W?W+e:e;if(!this._events[r])return this;if(!t)return Z(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||Z(this,r);else{for(var o=0,a=[],l=s.length;o<l;o++)(s[o].fn!==t||i&&!s[o].once||n&&s[o].context!==n)&&a.push(s[o]);a.length?this._events[r]=1===a.length?a[0]:a:Z(this,r)}return this},ee.prototype.removeAllListeners=function(e){var t;return e?(t=W?W+e:e,this._events[t]&&Z(this,t)):(this._events=new K,this._eventsCount=0),this},ee.prototype.off=ee.prototype.removeListener,ee.prototype.addListener=ee.prototype.on,ee.prefixed=W,ee.EventEmitter=ee,z=ee;var te={};function ne(e,t,n){n=n||2;var i,r,s,o,a,l,u,c=t&&t.length,p=c?t[0]*n:e.length,h=ie(e,0,p,n,!0),d=[];if(!h||h.next===h.prev)return d;if(c&&(h=function(e,t,n,i){var r,s,o,a=[];for(r=0,s=t.length;r<s;r++)(o=ie(e,t[r]*i,r<s-1?t[r+1]*i:e.length,i,!1))===o.next&&(o.steiner=!0),a.push(fe(o));for(a.sort(ce),r=0;r<a.length;r++)pe(a[r],n),n=re(n,n.next);return n}(e,t,h,n)),e.length>80*n){i=s=e[0],r=o=e[1];for(var f=n;f<p;f+=n)(a=e[f])<i&&(i=a),(l=e[f+1])<r&&(r=l),a>s&&(s=a),l>o&&(o=l);u=0!==(u=Math.max(s-i,o-r))?1/u:0}return se(h,d,n,i,r,u),d}function ie(e,t,n,i,r){var s,o;if(r===xe(e,t,n,i)>0)for(s=t;s<n;s+=i)o=Ee(s,e[s],e[s+1],o);else for(s=n-i;s>=t;s-=i)o=Ee(s,e[s],e[s+1],o);return o&&ge(o,o.next)&&(Ie(o),o=o.next),o}function re(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!ge(i,i.next)&&0!==be(i.prev,i,i.next))i=i.next;else{if(Ie(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function se(e,t,n,i,r,s,o){if(e){!o&&s&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=de(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,s,o,a,l,u=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t<u&&(a++,i=i.nextZ);t++);for(l=u;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,u*=2}while(o>1)}(r)}(e,i,r,s);for(var a,l,u=e;e.prev!==e.next;)if(a=e.prev,l=e.next,s?ae(e,i,r,s):oe(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),Ie(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?se(e=le(re(e),t,n),t,n,i,r,s,2):2===o&&ue(e,t,n,i,r,s):se(re(e),t,n,i,r,s,1);break}}}function oe(e){var t=e.prev,n=e,i=e.next;if(be(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(_e(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&be(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ae(e,t,n,i){var r=e.prev,s=e,o=e.next;if(be(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,l=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,p=de(a,l,t,n,i),h=de(u,c,t,n,i),d=e.prevZ,f=e.nextZ;d&&d.z>=p&&f&&f.z<=h;){if(d!==e.prev&&d!==e.next&&_e(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&be(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&_e(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&be(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=p;){if(d!==e.prev&&d!==e.next&&_e(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&be(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&_e(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&be(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function le(e,t,n){var i=e;do{var r=i.prev,s=i.next.next;!ge(r,s)&&Se(r,i,i.next,s)&&ve(r,s)&&ve(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),Ie(i),Ie(i.next),i=e=s),i=i.next}while(i!==e);return re(i)}function ue(e,t,n,i,r,s){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&me(o,a)){var l=Te(o,a);return o=re(o,o.next),l=re(l,l.next),se(o,t,n,i,r,s),void se(l,t,n,i,r,s)}a=a.next}o=o.next}while(o!==e)}function ce(e,t){return e.x-t.x}function pe(e,t){if(t=function(e,t){var n,i=t,r=e.x,s=e.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=r&&a>o){if(o=a,a===r){if(s===i.y)return i;if(s===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n;var l,u=n,c=n.x,p=n.y,h=1/0;i=n;do{r>=i.x&&i.x>=c&&r!==i.x&&_e(s<p?r:o,s,c,p,s<p?o:r,s,i.x,i.y)&&(l=Math.abs(s-i.y)/(r-i.x),ve(i,e)&&(l<h||l===h&&(i.x>n.x||i.x===n.x&&he(n,i)))&&(n=i,h=l)),i=i.next}while(i!==u);return n}(e,t)){var n=Te(t,e);re(t,t.next),re(n,n.next)}}function he(e,t){return be(e.prev,e,t.prev)<0&&be(t.next,e,e.next)<0}function de(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function fe(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function _e(e,t,n,i,r,s,o,a){return(r-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function me(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Se(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ve(e,t)&&ve(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(be(e.prev,e,t.prev)||be(e,t.prev,t))||ge(e,t)&&be(e.prev,e,e.next)>0&&be(t.prev,t,t.next)>0)}function be(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ge(e,t){return e.x===t.x&&e.y===t.y}function Se(e,t,n,i){var r=ye(be(e,t,n)),s=ye(be(e,t,i)),o=ye(be(n,i,e)),a=ye(be(n,i,t));return r!==s&&o!==a||!(0!==r||!ke(e,n,t))||!(0!==s||!ke(e,i,t))||!(0!==o||!ke(n,e,i))||!(0!==a||!ke(n,t,i))}function ke(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ye(e){return e>0?1:e<0?-1:0}function ve(e,t){return be(e.prev,e,e.next)<0?be(e,t,e.next)>=0&&be(e,e.prev,t)>=0:be(e,t,e.prev)<0||be(e,e.next,t)<0}function Te(e,t){var n=new we(e.i,e.x,e.y),i=new we(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Ee(e,t,n,i){var r=new we(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ie(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function we(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function xe(e,t,n,i){for(var r=0,s=t,o=n-i;s<n;s+=i)r+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return r}(te=ne).default=ne,ne.deviation=function(e,t,n,i){var r=t&&t.length,s=r?t[0]*n:e.length,o=Math.abs(xe(e,0,s,n));if(r)for(var a=0,l=t.length;a<l;a++){var u=t[a]*n,c=a<l-1?t[a+1]*n:e.length;o-=Math.abs(xe(e,u,c,n))}var p=0;for(a=0;a<i.length;a+=3){var h=i[a]*n,d=i[a+1]*n,f=i[a+2]*n;p+=Math.abs((e[h]-e[f])*(e[d+1]-e[h+1])-(e[h]-e[d])*(e[f+1]-e[h+1]))}return 0===o&&0===p?0:Math.abs((p-o)/o)},ne.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,r=0;r<e.length;r++){for(var s=0;s<e[r].length;s++)for(var o=0;o<t;o++)n.vertices.push(e[r][s][o]);r>0&&(i+=e[r-1].length,n.holes.push(i))}return n};var Ae=function(){var e=this,t={exports:this};return function(n){var i="object"==typeof e&&e&&!e.nodeType&&e,s="object"==typeof t&&t&&!t.nodeType&&t,o="object"==typeof r&&r;o.global!==o&&o.window!==o&&o.self!==o||(n=o);var a,l,u=2147483647,c=36,p=26,h=38,d=700,f=/^xn--/,_=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=c-1,S=Math.floor,k=String.fromCharCode;function y(e){throw new RangeError(b[e])}function v(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function T(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+v((e=e.replace(m,".")).split("."),t).join(".")}function E(e){for(var t,n,i=[],r=0,s=e.length;r<s;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<s?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function I(e){return v(e,(function(e){var t="";return e>65535&&(t+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+k(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function x(e,t,n){var i=0;for(e=n?S(e/d):e>>1,e+=S(e/t);e>g*p>>1;i+=c)e=S(e/g);return S(i+(g+1)*e/(e+h))}function A(e){var t,n,i,r,s,o,a,l,h,d,f,_=[],m=e.length,b=0,g=128,k=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&y("not-basic"),_.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<m;){for(s=b,o=1,a=c;r>=m&&y("invalid-input"),((l=(f=e.charCodeAt(r++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:c)>=c||l>S((u-b)/o))&&y("overflow"),b+=l*o,!(l<(h=a<=k?1:a>=k+p?p:a-k));a+=c)o>S(u/(d=c-h))&&y("overflow"),o*=d;k=x(b-s,t=_.length+1,0==s),S(b/t)>u-g&&y("overflow"),g+=S(b/t),b%=t,_.splice(b++,0,g)}return I(_)}function $(e){var t,n,i,r,s,o,a,l,h,d,f,_,m,b,g,v=[];for(_=(e=E(e)).length,t=128,n=0,s=72,o=0;o<_;++o)(f=e[o])<128&&v.push(k(f));for(i=r=v.length,r&&v.push("-");i<_;){for(a=u,o=0;o<_;++o)(f=e[o])>=t&&f<a&&(a=f);for(a-t>S((u-n)/(m=i+1))&&y("overflow"),n+=(a-t)*m,t=a,o=0;o<_;++o)if((f=e[o])<t&&++n>u&&y("overflow"),f==t){for(l=n,h=c;!(l<(d=h<=s?1:h>=s+p?p:h-s));h+=c)g=l-d,b=c-d,v.push(k(w(d+g%b,0))),l=S(g/b);v.push(k(w(l,0))),s=x(n,m,i==r),n=0,++i}++n,++t}return v.join("")}if(a={version:"1.4.1",ucs2:{decode:E,encode:I},decode:A,encode:$,toASCII:function(e){return T(e,(function(e){return _.test(e)?"xn--"+$(e):e}))},toUnicode:function(e){return T(e,(function(e){return f.test(e)?A(e.slice(4).toLowerCase()):e}))}},i&&s)if(t.exports==i)s.exports=a;else for(l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);else n.punycode=a}(this),t.exports}.call({}),$e={};$e={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}};var Oe,Me,Ce=!1;function Re(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ne,Le,De,Pe,Fe=!1;function Be(e,t){if(e.map)return e.map(t);for(var n=[],i=0;i<e.length;i++)n.push(t(e[i],i));return n}Ce||(Ce=!0,Oe={},Oe=function(e,t,n,i){t=t||"&",n=n||"=";var r={};if("string"!=typeof e||0===e.length)return r;var s=/\+/g;e=e.split(t);var o=1e3;i&&"number"==typeof i.maxKeys&&(o=i.maxKeys);var a=e.length;o>0&&a>o&&(a=o);for(var l=0;l<a;++l){var u,c,p,h,d=e[l].replace(s,"%20"),f=d.indexOf(n);f>=0?(u=d.substr(0,f),c=d.substr(f+1)):(u=d,c=""),p=decodeURIComponent(u),h=decodeURIComponent(c),Re(r,p)?Me(r[p])?r[p].push(h):r[p]=[r[p],h]:r[p]=h}return r},Me=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}),je=Oe,Fe||(Fe=!0,Ne={},Le=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Ne=function(e,t,n,i){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Be(Pe(e),(function(i){var r=encodeURIComponent(Le(i))+n;return De(e[i])?Be(e[i],(function(e){return r+encodeURIComponent(Le(e))})).join(t):r+encodeURIComponent(Le(e[i]))})).join(t):i?encodeURIComponent(Le(i))+n+encodeURIComponent(Le(e)):""},De=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Pe=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),Ve=Ne;var je,Ve,Ue=rt,Ye=function(e,t){return rt(e,!1,!0).resolve(t)},Ge=function(e){return $e.isString(e)&&(e=rt(e)),e instanceof Xe?e.format():Xe.prototype.format.call(e)};function Xe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var He=/^([a-z0-9.+-]+:)/i,ze=/:[0-9]*$/,qe=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,We=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Ke=["'"].concat(We),Je=["%","/","?",";","#"].concat(Ke),Qe=["/","?","#"],Ze=/^[+a-z0-9A-Z_-]{0,63}$/,et=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,tt={javascript:!0,"javascript:":!0},nt={javascript:!0,"javascript:":!0},it={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function rt(e,t,n){if(e&&$e.isObject(e)&&e instanceof Xe)return e;var i=new Xe;return i.parse(e,t,n),i}Xe.prototype.parse=function(e,t,n){if(!$e.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),r=-1!==i&&i<e.indexOf("#")?"?":"#",s=e.split(r);s[0]=s[0].replace(/\\/g,"/");var o=e=s.join(r);if(o=o.trim(),!n&&1===e.split("#").length){var a=qe.exec(o);if(a)return this.path=o,this.href=o,this.pathname=a[1],a[2]?(this.search=a[2],this.query=t?je(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=He.exec(o);if(l){var u=(l=l[0]).toLowerCase();this.protocol=u,o=o.substr(l.length)}if(n||l||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var c="//"===o.substr(0,2);!c||l&&nt[l]||(o=o.substr(2),this.slashes=!0)}if(!nt[l]&&(c||l&&!it[l])){for(var p,h,d=-1,f=0;f<Qe.length;f++)-1!==(_=o.indexOf(Qe[f]))&&(-1===d||_<d)&&(d=_);for(-1!==(h=-1===d?o.lastIndexOf("@"):o.lastIndexOf("@",d))&&(p=o.slice(0,h),o=o.slice(h+1),this.auth=decodeURIComponent(p)),d=-1,f=0;f<Je.length;f++){var _;-1!==(_=o.indexOf(Je[f]))&&(-1===d||_<d)&&(d=_)}-1===d&&(d=o.length),this.host=o.slice(0,d),o=o.slice(d),this.parseHost(),this.hostname=this.hostname||"";var m="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!m)for(var b=this.hostname.split(/\./),g=(f=0,b.length);f<g;f++){var S=b[f];if(S&&!S.match(Ze)){for(var k="",y=0,v=S.length;y<v;y++)S.charCodeAt(y)>127?k+="x":k+=S[y];if(!k.match(Ze)){var T=b.slice(0,f),E=b.slice(f+1),I=S.match(et);I&&(T.push(I[1]),E.unshift(I[2])),E.length&&(o="/"+E.join(".")+o),this.hostname=T.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=Ae.toASCII(this.hostname));var w=this.port?":"+this.port:"",x=this.hostname||"";this.host=x+w,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!tt[u])for(f=0,g=Ke.length;f<g;f++){var A=Ke[f];if(-1!==o.indexOf(A)){var $=encodeURIComponent(A);$===A&&($=escape(A)),o=o.split(A).join($)}}var O=o.indexOf("#");-1!==O&&(this.hash=o.substr(O),o=o.slice(0,O));var M=o.indexOf("?");if(-1!==M?(this.search=o.substr(M),this.query=o.substr(M+1),t&&(this.query=je(this.query)),o=o.slice(0,M)):t&&(this.search="",this.query={}),o&&(this.pathname=o),it[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){w=this.pathname||"";var C=this.search||"";this.path=w+C}return this.href=this.format(),this},Xe.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",i=this.hash||"",r=!1,s="";this.host?r=e+this.host:this.hostname&&(r=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&$e.isObject(this.query)&&Object.keys(this.query).length&&(s=Ve(this.query));var o=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||it[t])&&!1!==r?(r="//"+(r||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):r||(r=""),i&&"#"!==i.charAt(0)&&(i="#"+i),o&&"?"!==o.charAt(0)&&(o="?"+o),t+r+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(o=o.replace("#","%23"))+i},Xe.prototype.resolve=function(e){return this.resolveObject(rt(e,!1,!0)).format()},Xe.prototype.resolveObject=function(e){if($e.isString(e)){var t=new Xe;t.parse(e,!1,!0),e=t}for(var n=new Xe,i=Object.keys(this),r=0;r<i.length;r++){var s=i[r];n[s]=this[s]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var o=Object.keys(e),a=0;a<o.length;a++){var l=o[a];"protocol"!==l&&(n[l]=e[l])}return it[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!it[e.protocol]){for(var u=Object.keys(e),c=0;c<u.length;c++){var p=u[c];n[p]=e[p]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||nt[e.protocol])n.pathname=e.pathname;else{for(var h=(e.pathname||"").split("/");h.length&&!(e.host=h.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),n.pathname=h.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var d=n.pathname||"",f=n.search||"";n.path=d+f}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var _=n.pathname&&"/"===n.pathname.charAt(0),m=e.host||e.pathname&&"/"===e.pathname.charAt(0),b=m||_||n.host&&e.pathname,g=b,S=n.pathname&&n.pathname.split("/")||[],k=(h=e.pathname&&e.pathname.split("/")||[],n.protocol&&!it[n.protocol]);if(k&&(n.hostname="",n.port=null,n.host&&(""===S[0]?S[0]=n.host:S.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),b=b&&(""===h[0]||""===S[0])),m)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,S=h;else if(h.length)S||(S=[]),S.pop(),S=S.concat(h),n.search=e.search,n.query=e.query;else if(!$e.isNullOrUndefined(e.search))return k&&(n.hostname=n.host=S.shift(),(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,$e.isNull(n.pathname)&&$e.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var y=S.slice(-1)[0],v=(n.host||e.host||S.length>1)&&("."===y||".."===y)||""===y,T=0,E=S.length;E>=0;E--)"."===(y=S[E])?S.splice(E,1):".."===y?(S.splice(E,1),T++):T&&(S.splice(E,1),T--);if(!b&&!g)for(;T--;T)S.unshift("..");!b||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),v&&"/"!==S.join("/").substr(-1)&&S.push("");var I,w=""===S[0]||S[0]&&"/"===S[0].charAt(0);return k&&(n.hostname=n.host=w?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(b=b||n.host&&S.length)&&!w&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),$e.isNull(n.pathname)&&$e.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},Xe.prototype.parseHost=function(){var e=this.host,t=ze.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var st=t(z),ot=t(te),at={parse:Ue,format:Ge,resolve:Ye};H.RETINA_PREFIX=/@([0-9\.]+)x/,H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var lt,ut=!1;function ct(e,t){return void 0===t&&(t=[]),t[0]=(e>>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}var pt=function(){for(var e=[],t=[],n=0;n<32;n++)e[n]=n,t[n]=n;e[M.NORMAL_NPM]=M.NORMAL,e[M.ADD_NPM]=M.ADD,e[M.SCREEN_NPM]=M.SCREEN,t[M.NORMAL]=M.NORMAL_NPM,t[M.ADD]=M.ADD_NPM,t[M.SCREEN]=M.SCREEN_NPM;var i=[];return i.push(t),i.push(e),i}();function ht(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var n=e>>16&255,i=e>>8&255,r=255&e;return(255*t<<24)+((n=n*t+.5|0)<<16)+((i=i*t+.5|0)<<8)+(r*t+.5|0)}Float32Array,Uint32Array,Int32Array,Uint8Array;function dt(e){return e+=0===e?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)}function ft(e){return!(e&e-1||!e)}function _t(e){var t=(e>65535?1:0)<<4,n=((e>>>=t)>255?1:0)<<3;return t|=n,t|=n=((e>>>=n)>15?1:0)<<2,(t|=n=((e>>>=n)>3?1:0)<<1)|(e>>>=n)>>1}function mt(e,t,n){var i,r=e.length;if(!(t>=r||0===n)){var s=r-(n=t+n>r?r-t:n);for(i=t;i<s;++i)e[i]=e[i+n];e.length=s}}var bt=0;function gt(){return++bt}var St={};function kt(e,t,n){if(void 0===n&&(n=3),!St[t]){var i=(new Error).stack;void 0===i?console.warn("PixiJS Deprecation Warning: ",t+"\nDeprecated since v"+e):(i=i.split("\n").splice(n).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",t+"\nDeprecated since v"+e),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",t+"\nDeprecated since v"+e),console.warn(i))),St[t]=!0}}var yt,vt={},Tt=Object.create(null),Et=Object.create(null);!function(){function e(e,t,n){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=n||H.RESOLUTION,this.resize(e,t)}e.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},e.prototype.resize=function(e,t){this.canvas.width=e*this.resolution,this.canvas.height=t*this.resolution},e.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=e},enumerable:!1,configurable:!0})}();function It(e,t){var n=H.RETINA_PREFIX.exec(e);return n?parseFloat(n[1]):void 0!==t?t:1}var wt,xt,At=function(){function e(e){this.items=[],this._name=e,this._aliasCount=0}return e.prototype.emit=function(e,t,n,i,r,s,o,a){if(arguments.length>8)throw new Error("max arguments reached");var l=this.name,u=this.items;this._aliasCount++;for(var c=0,p=u.length;c<p;c++)u[c][l](e,t,n,i,r,s,o,a);return u===this.items&&this._aliasCount--,this},e.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},e.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},e.prototype.remove=function(e){var t=this.items.indexOf(e);return-1!==t&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this},e.prototype.contains=function(e){return-1!==this.items.indexOf(e)},e.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},e.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(e.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e}();Object.defineProperties(At.prototype,{dispatch:{value:At.prototype.emit},run:{value:At.prototype.emit}}),H.TARGET_FPMS=.06,(xt=wt||(wt={}))[xt.INTERACTION=50]="INTERACTION",xt[xt.HIGH=25]="HIGH",xt[xt.NORMAL=0]="NORMAL",xt[xt.LOW=-25]="LOW",xt[xt.UTILITY=-50]="UTILITY";var $t,Ot,Mt=function(){function e(e,t,n,i){void 0===t&&(t=null),void 0===n&&(n=0),void 0===i&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=n,this.once=i}return e.prototype.match=function(e,t){return void 0===t&&(t=null),this.fn===e&&this.context===t},e.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t},e.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},e.prototype.destroy=function(e){void 0===e&&(e=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var t=this.next;return this.next=e?null:t,this.previous=null,t},e}(),Ct=function(){function e(){var e=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Mt(null,null,1/0),this.deltaMS=1/H.TARGET_FPMS,this.elapsedMS=1/H.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&null===e._requestId&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return e.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},e.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},e.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},e.prototype.add=function(e,t,n){return void 0===n&&(n=wt.NORMAL),this._addListener(new Mt(e,t,n))},e.prototype.addOnce=function(e,t,n){return void 0===n&&(n=wt.NORMAL),this._addListener(new Mt(e,t,n,!0))},e.prototype._addListener=function(e){var t=this._head.next,n=this._head;if(t){for(;t;){if(e.priority>t.priority){e.connect(n);break}n=t,t=t.next}e.previous||e.connect(n)}else e.connect(n);return this._startIfPossible(),this},e.prototype.remove=function(e,t){for(var n=this._head.next;n;)n=n.match(e,t)?n.destroy():n.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(e.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},e.prototype.update=function(e){var t;if(void 0===e&&(e=performance.now()),e>this.lastTime){if((t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var n=e-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=e-n%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*H.TARGET_FPMS;for(var i=this._head,r=i.next;r;)r=r.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e},Object.defineProperty(e.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(e){var t=Math.min(this.maxFPS,e),n=Math.min(Math.max(0,t)/1e3,H.TARGET_FPMS);this._maxElapsedMS=1/n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(e){if(0===e)this._minElapsedMS=0;else{var t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shared",{get:function(){if(!e._shared){var t=e._shared=new e;t.autoStart=!0,t._protected=!0}return e._shared},enumerable:!1,configurable:!0}),Object.defineProperty(e,"system",{get:function(){if(!e._system){var t=e._system=new e;t.autoStart=!0,t._protected=!0}return e._system},enumerable:!1,configurable:!0}),e}(),Rt=(function(){function e(){}e.init=function(e){var t=this;e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set:function(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,wt.LOW)},get:function(){return this._ticker}}),this.stop=function(){t._ticker.stop()},this.start=function(){t._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Ct.shared:new Ct,e.autoStart&&this.start()},e.destroy=function(){if(this._ticker){var e=this._ticker;this.ticker=null,e.destroy()}}}(),2*Math.PI),Nt=180/Math.PI,Lt=Math.PI/180;!function(e){e[e.POLY=0]="POLY",e[e.RECT=1]="RECT",e[e.CIRC=2]="CIRC",e[e.ELIP=3]="ELIP",e[e.RREC=4]="RREC"}(Ot||($t=Ot={},$t));var Dt=function(){function e(e,t,n,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=Number(e),this.y=Number(t),this.width=Number(n),this.height=Number(i),this.type=Ot.RECT}return Object.defineProperty(e.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EMPTY",{get:function(){return new e(0,0,0,0)},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},e.prototype.copyTo=function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},e.prototype.contains=function(e,t){return!(this.width<=0||this.height<=0)&&e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height},e.prototype.pad=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this.x-=e,this.y-=t,this.width+=2*e,this.height+=2*t,this},e.prototype.fit=function(e){var t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),r=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=i,this.height=Math.max(r-i,0),this},e.prototype.ceil=function(e,t){void 0===e&&(e=1),void 0===t&&(t=.001);var n=Math.ceil((this.x+this.width-t)*e)/e,i=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=i-this.y,this},e.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),r=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=i,this.height=r-i,this},e.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},e}(),Pt=function(){function e(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),this.x=e,this.y=t,this.radius=n,this.type=Ot.CIRC}return e.prototype.clone=function(){return new e(this.x,this.y,this.radius)},e.prototype.contains=function(e,t){if(this.radius<=0)return!1;var n=this.radius*this.radius,i=this.x-e,r=this.y-t;return(i*=i)+(r*=r)<=n},e.prototype.getBounds=function(){return new Dt(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},e}(),Ft=function(){function e(e,t,n,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=e,this.y=t,this.width=n,this.height=i,this.type=Ot.ELIP}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var n=(e-this.x)/this.width,i=(t-this.y)/this.height;return(n*=n)+(i*=i)<=1},e.prototype.getBounds=function(){return new Dt(this.x-this.width,this.y-this.height,this.width,this.height)},e.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},e}(),Bt=function(){function e(){for(var e=arguments,t=[],n=0;n<arguments.length;n++)t[n]=e[n];var i=Array.isArray(t[0])?t[0]:t;if("number"!=typeof i[0]){for(var r=[],s=0,o=i.length;s<o;s++)r.push(i[s].x,i[s].y);i=r}this.points=i,this.type=Ot.POLY,this.closeStroke=!0}return e.prototype.clone=function(){var t=new e(this.points.slice());return t.closeStroke=this.closeStroke,t},e.prototype.contains=function(e,t){for(var n=!1,i=this.points.length/2,r=0,s=i-1;r<i;s=r++){var o=this.points[2*r],a=this.points[2*r+1],l=this.points[2*s],u=this.points[2*s+1];a>t!=u>t&&e<(t-a)/(u-a)*(l-o)+o&&(n=!n)}return n},e.prototype.toString=function(){return"[@pixi/math:PolygoncloseStroke="+this.closeStroke+"points="+this.points.reduce((function(e,t){return e+", "+t}),"")+"]"},e}(),jt=function(){function e(e,t,n,i,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===r&&(r=20),this.x=e,this.y=t,this.width=n,this.height=i,this.radius=r,this.type=Ot.RREC}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height,this.radius)},e.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var n=e-(this.x+this.radius),i=t-(this.y+this.radius),r=this.radius*this.radius;if(n*n+i*i<=r)return!0;if((n=e-(this.x+this.width-this.radius))*n+i*i<=r)return!0;if(n*n+(i=t-(this.y+this.height-this.radius))*i<=r)return!0;if((n=e-(this.x+this.radius))*n+i*i<=r)return!0}return!1},e.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"},e}(),Vt=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},e.prototype.copyTo=function(e){return e.set(this.x,this.y),e},e.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},e.prototype.set=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this.x=e,this.y=t,this},e.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},e}(),Ut=function(){function e(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=0),this._x=n,this._y=i,this.cb=e,this.scope=t}return e.prototype.clone=function(t,n){return void 0===t&&(t=this.cb),void 0===n&&(n=this.scope),new e(t,n,this._x,this._y)},e.prototype.set=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this._x===e&&this._y===t||(this._x=e,this._y=t,this.cb.call(this.scope)),this},e.prototype.copyFrom=function(e){return this._x===e.x&&this._y===e.y||(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},e.prototype.copyTo=function(e){return e.set(this._x,this._y),e},e.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},e.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),e}(),Yt=function(){function e(e,t,n,i,r,s){void 0===e&&(e=1),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=1),void 0===r&&(r=0),void 0===s&&(s=0),this.array=null,this.a=e,this.b=t,this.c=n,this.d=i,this.tx=r,this.ty=s}return e.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},e.prototype.set=function(e,t,n,i,r,s){return this.a=e,this.b=t,this.c=n,this.d=i,this.tx=r,this.ty=s,this},e.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n},e.prototype.apply=function(e,t){t=t||new Vt;var n=e.x,i=e.y;return t.x=this.a*n+this.c*i+this.tx,t.y=this.b*n+this.d*i+this.ty,t},e.prototype.applyInverse=function(e,t){t=t||new Vt;var n=1/(this.a*this.d+this.c*-this.b),i=e.x,r=e.y;return t.x=this.d*n*i+-this.c*n*r+(this.ty*this.c-this.tx*this.d)*n,t.y=this.a*n*r+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,t},e.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},e.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},e.prototype.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),i=this.a,r=this.c,s=this.tx;return this.a=i*t-this.b*n,this.b=i*n+this.b*t,this.c=r*t-this.d*n,this.d=r*n+this.d*t,this.tx=s*t-this.ty*n,this.ty=s*n+this.ty*t,this},e.prototype.append=function(e){var t=this.a,n=this.b,i=this.c,r=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*n+e.b*r,this.c=e.c*t+e.d*i,this.d=e.c*n+e.d*r,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*n+e.ty*r+this.ty,this},e.prototype.setTransform=function(e,t,n,i,r,s,o,a,l){return this.a=Math.cos(o+l)*r,this.b=Math.sin(o+l)*r,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=e-(n*this.a+i*this.c),this.ty=t-(n*this.b+i*this.d),this},e.prototype.prepend=function(e){var t=this.tx;if(1!==e.a||0!==e.b||0!==e.c||1!==e.d){var n=this.a,i=this.c;this.a=n*e.a+this.b*e.c,this.b=n*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},e.prototype.decompose=function(e){var t=this.a,n=this.b,i=this.c,r=this.d,s=e.pivot,o=-Math.atan2(-i,r),a=Math.atan2(n,t),l=Math.abs(o+a);return l<1e-5||Math.abs(Rt-l)<1e-5?(e.rotation=a,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=a),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(i*i+r*r),e.position.x=this.tx+(s.x*t+s.y*i),e.position.y=this.ty+(s.x*n+s.y*r),e},e.prototype.invert=function(){var e=this.a,t=this.b,n=this.c,i=this.d,r=this.tx,s=e*i-t*n;return this.a=i/s,this.b=-t/s,this.c=-n/s,this.d=e/s,this.tx=(n*this.ty-i*r)/s,this.ty=-(e*this.ty-t*r)/s,this},e.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},e.prototype.clone=function(){var t=new e;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},e.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},e.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},e.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(e,"IDENTITY",{get:function(){return new e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"TEMP_MATRIX",{get:function(){return new e},enumerable:!1,configurable:!0}),e}(),Gt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Xt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ht=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],zt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],qt=[],Wt=[],Kt=Math.sign;!function(){for(var e=0;e<16;e++){var t=[];qt.push(t);for(var n=0;n<16;n++)for(var i=Kt(Gt[e]*Gt[n]+Ht[e]*Xt[n]),r=Kt(Xt[e]*Gt[n]+zt[e]*Xt[n]),s=Kt(Gt[e]*Ht[n]+Ht[e]*zt[n]),o=Kt(Xt[e]*Ht[n]+zt[e]*zt[n]),a=0;a<16;a++)if(Gt[a]===i&&Xt[a]===r&&Ht[a]===s&&zt[a]===o){t.push(a);break}}for(e=0;e<16;e++){var l=new Yt;l.set(Gt[e],Xt[e],Ht[e],zt[e],0,0),Wt.push(l)}}();var Jt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(e){return Gt[e]},uY:function(e){return Xt[e]},vX:function(e){return Ht[e]},vY:function(e){return zt[e]},inv:function(e){return 8&e?15&e:7&-e},add:function(e,t){return qt[e][t]},sub:function(e,t){return qt[e][Jt.inv(t)]},rotate180:function(e){return 4^e},isVertical:function(e){return 2==(3&e)},byDirection:function(e,t){return 2*Math.abs(e)<=Math.abs(t)?t>=0?Jt.S:Jt.N:2*Math.abs(t)<=Math.abs(e)?e>0?Jt.E:Jt.W:t>0?e>0?Jt.SE:Jt.SW:e>0?Jt.NE:Jt.NW},matrixAppendRotationInv:function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var r=Wt[Jt.inv(t)];r.tx=n,r.ty=i,e.append(r)}},Qt=function(){function e(){this.worldTransform=new Yt,this.localTransform=new Yt,this.position=new Ut(this.onChange,this,0,0),this.scale=new Ut(this.onChange,this,1,1),this.pivot=new Ut(this.onChange,this,0,0),this.skew=new Ut(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return e.prototype.onChange=function(){this._localID++},e.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},e.prototype.toString=function(){return"[@pixi/math:Transform position=("+this.position.x+", "+this.position.y+") rotation="+this.rotation+" scale=("+this.scale.x+", "+this.scale.y+") skew=("+this.skew.x+", "+this.skew.y+") ]"},e.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},e.prototype.updateTransform=function(e){var t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){var n=e.worldTransform,i=this.worldTransform;i.a=t.a*n.a+t.b*n.c,i.b=t.a*n.b+t.b*n.d,i.c=t.c*n.a+t.d*n.c,i.d=t.c*n.b+t.d*n.d,i.tx=t.tx*n.a+t.ty*n.c+n.tx,i.ty=t.tx*n.b+t.ty*n.d+n.ty,this._parentID=e._worldID,this._worldID++}},e.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),e.IDENTITY=new e,e}();H.PREFER_ENV=x.any?A.WEBGL:A.WEBGL2,H.STRICT_TEXTURE_CACHE=!1;var Zt=[];function en(e,t){if(!e)return null;var n="";if("string"==typeof e){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(e);i&&(n=i[1].toLowerCase())}for(var r=Zt.length-1;r>=0;--r){var s=Zt[r];if(s.test&&s.test(e,n))return new s(e,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var tn=function(e,t){return(tn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function nn(e,t){function n(){this.constructor=e}tn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var rn=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new At("setRealSize"),this.onUpdate=new At("update"),this.onError=new At("onError")}return e.prototype.bind=function(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},e.prototype.unbind=function(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)},e.prototype.resize=function(e,t){e===this._width&&t===this._height||(this._width=e,this._height=t,this.onResize.emit(e,t))},Object.defineProperty(e.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),e.prototype.update=function(){this.destroyed||this.onUpdate.emit()},e.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),e.prototype.style=function(e,t,n){return!1},e.prototype.dispose=function(){},e.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},e.test=function(e,t){return!1},e}(),sn=function(e){function t(t,n){var i=this,r=n||{},s=r.width,o=r.height;if(!s||!o)throw new Error("BufferResource width or height invalid");return(i=e.call(this,s,o)||this).data=t,i}return nn(t,e),t.prototype.upload=function(e,t,n){var i=e.gl;return i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===B.UNPACK),n.width===t.width&&n.height===t.height?i.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.type,this.data):(n.width=t.width,n.height=t.height,i.texImage2D(t.target,0,n.internalFormat,t.width,t.height,0,t.format,n.type,this.data)),!0},t.prototype.dispose=function(){this.data=null},t.test=function(e){return e instanceof Float32Array||e instanceof Uint8Array||e instanceof Uint32Array},t}(rn),on={scaleMode:D.NEAREST,format:R.RGBA,alphaMode:B.NPM},an=function(e){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var i=e.call(this)||this,r=(n=n||{}).alphaMode,s=n.mipmap,o=n.anisotropicLevel,a=n.scaleMode,l=n.width,u=n.height,c=n.wrapMode,p=n.format,h=n.type,d=n.target,f=n.resolution,_=n.resourceOptions;return!t||t instanceof rn||((t=en(t,_)).internal=!0),i.width=l||0,i.height=u||0,i.resolution=f||H.RESOLUTION,i.mipmap=void 0!==s?s:H.MIPMAP_TEXTURES,i.anisotropicLevel=void 0!==o?o:H.ANISOTROPIC_LEVEL,i.wrapMode=c||H.WRAP_MODE,i.scaleMode=void 0!==a?a:H.SCALE_MODE,i.format=p||R.RGBA,i.type=h||L.UNSIGNED_BYTE,i.target=d||N.TEXTURE_2D,i.alphaMode=void 0!==r?r:B.UNPACK,i.uid=gt(),i.touched=0,i.isPowerOfTwo=!1,i._refreshPOT(),i._glTextures={},i.dirtyId=0,i.dirtyStyleId=0,i.cacheId=null,i.valid=l>0&&u>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(t),i}return nn(t,e),Object.defineProperty(t.prototype,"realWidth",{get:function(){return Math.ceil(this.width*this.resolution-1e-4)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realHeight",{get:function(){return Math.ceil(this.height*this.resolution-1e-4)},enumerable:!1,configurable:!0}),t.prototype.setStyle=function(e,t){var n;return void 0!==e&&e!==this.scaleMode&&(this.scaleMode=e,n=!0),void 0!==t&&t!==this.mipmap&&(this.mipmap=t,n=!0),n&&this.dirtyStyleId++,this},t.prototype.setSize=function(e,t,n){return this.resolution=n||this.resolution,this.width=e,this.height=t,this._refreshPOT(),this.update(),this},t.prototype.setRealSize=function(e,t,n){return this.resolution=n||this.resolution,this.width=e/this.resolution,this.height=t/this.resolution,this._refreshPOT(),this.update(),this},t.prototype._refreshPOT=function(){this.isPowerOfTwo=ft(this.realWidth)&&ft(this.realHeight)},t.prototype.setResolution=function(e){var t=this.resolution;return t===e||(this.resolution=e,this.valid&&(this.width=this.width*t/e,this.height=this.height*t/e,this.emit("update",this)),this._refreshPOT()),this},t.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},t.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},t.prototype.onError=function(e){this.emit("error",this,e)},t.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Et[this.cacheId],delete Tt[this.cacheId],this.cacheId=null),this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},t.prototype.dispose=function(){this.emit("dispose",this)},t.prototype.castToBaseTexture=function(){return this},t.from=function(e,n,i){void 0===i&&(i=H.STRICT_TEXTURE_CACHE);var r="string"==typeof e,s=null;if(r)s=e;else{if(!e._pixiId){var o=n&&n.pixiIdPrefix||"pixiid";e._pixiId=o+"_"+gt()}s=e._pixiId}var a=Et[s];if(r&&i&&!a)throw new Error('The cacheId "'+s+'" does not exist in BaseTextureCache.');return a||((a=new t(e,n)).cacheId=s,t.addToCache(a,s)),a},t.fromBuffer=function(e,n,i,r){e=e||new Float32Array(n*i*4);var s=new sn(e,{width:n,height:i}),o=e instanceof Float32Array?L.FLOAT:L.UNSIGNED_BYTE;return new t(s,Object.assign(on,r||{width:n,height:i,type:o}))},t.addToCache=function(e,t){t&&(-1===e.textureCacheIds.indexOf(t)&&e.textureCacheIds.push(t),Et[t]&&console.warn("BaseTexture added to the cache with an id ["+t+"] that already had an entry"),Et[t]=e)},t.removeFromCache=function(e){if("string"==typeof e){var t=Et[e];if(t){var n=t.textureCacheIds.indexOf(e);return n>-1&&t.textureCacheIds.splice(n,1),delete Et[e],t}}else if(e&&e.textureCacheIds){for(var i=0;i<e.textureCacheIds.length;++i)delete Et[e.textureCacheIds[i]];return e.textureCacheIds.length=0,e}return null},t._globalBatch=0,t}(st.d),ln=function(e){function t(t,n){var i=this,r=n||{},s=r.width,o=r.height;(i=e.call(this,s,o)||this).items=[],i.itemDirtyIds=[];for(var a=0;a<t;a++){var l=new an;i.items.push(l),i.itemDirtyIds.push(-2)}return i.length=t,i._load=null,i.baseTexture=null,i}return nn(t,e),t.prototype.initFromArray=function(e,t){for(var n=0;n<this.length;n++)e[n]&&(e[n].castToBaseTexture?this.addBaseTextureAt(e[n].castToBaseTexture(),n):e[n]instanceof rn?this.addResourceAt(e[n],n):this.addResourceAt(en(e[n],t),n))},t.prototype.dispose=function(){for(var e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},t.prototype.addResourceAt=function(e,t){if(!this.items[t])throw new Error("Index "+t+" is out of bounds");return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this},t.prototype.bind=function(t){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");e.prototype.bind.call(this,t);for(var n=0;n<this.length;n++)this.items[n].parentTextureArray=t,this.items[n].on("update",t.update,t)},t.prototype.unbind=function(t){e.prototype.unbind.call(this,t);for(var n=0;n<this.length;n++)this.items[n].parentTextureArray=null,this.items[n].off("update",t.update,t)},t.prototype.load=function(){var e=this;if(this._load)return this._load;var t=this.items.map((function(e){return e.resource})).filter((function(e){return e})).map((function(e){return e.load()}));return this._load=Promise.all(t).then((function(){var t=e.items[0],n=t.realWidth,i=t.realHeight;return e.resize(n,i),Promise.resolve(e)})),this._load},t}(rn),un=function(e){function t(t,n){var i,r,s=this,o=n||{},a=o.width,l=o.height;return Array.isArray(t)?(i=t,r=t.length):r=t,s=e.call(this,r,{width:a,height:l})||this,i&&s.initFromArray(i,n),s}return nn(t,e),t.prototype.addBaseTextureAt=function(e,t){if(!e.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(e.resource,t),this},t.prototype.bind=function(t){e.prototype.bind.call(this,t),t.target=N.TEXTURE_2D_ARRAY},t.prototype.upload=function(e,t,n){var i=this.length,r=this.itemDirtyIds,s=this.items,o=e.gl;n.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,t.format,this._width,this._height,i,0,t.format,t.type,null);for(var a=0;a<i;a++){var l=s[a];r[a]<l.dirtyId&&(r[a]=l.dirtyId,l.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,a,l.resource.width,l.resource.height,1,t.format,t.type,l.resource.source))}return!0},t}(ln),cn=function(e){function t(t){var n=this,i=t,r=i.naturalWidth||i.videoWidth||i.width,s=i.naturalHeight||i.videoHeight||i.height;return(n=e.call(this,r,s)||this).source=t,n.noSubImage=!1,n}return nn(t,e),t.crossOrigin=function(e,t,n){void 0===n&&0!==t.indexOf("data:")?e.crossOrigin=function(e,t){if(void 0===t&&(t=self.location),0===e.indexOf("data:"))return"";t=t||self.location,yt||(yt=document.createElement("a")),yt.href=e;var n=at.parse(yt.href),i=!n.port&&""===t.port||n.port===t.port;return n.hostname===t.hostname&&i&&n.protocol===t.protocol?"":"anonymous"}(t):!1!==n&&(e.crossOrigin="string"==typeof n?n:"anonymous")},t.prototype.upload=function(e,t,n,i){var r=e.gl,s=t.realWidth,o=t.realHeight;return i=i||this.source,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===B.UNPACK),this.noSubImage||t.target!==r.TEXTURE_2D||n.width!==s||n.height!==o?(n.width=s,n.height=o,r.texImage2D(t.target,0,t.format,t.format,t.type,i)):r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.format,t.type,i),!0},t.prototype.update=function(){if(!this.destroyed){var t=this.source,n=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(n,i),e.prototype.update.call(this)}},t.prototype.dispose=function(){this.source=null},t}(rn),pn=function(e){function t(t){return e.call(this,t)||this}return nn(t,e),t.test=function(e){var t=self.OffscreenCanvas;return!!(t&&e instanceof t)||self.HTMLCanvasElement&&e instanceof HTMLCanvasElement},t}(cn),hn=function(e){function t(n,i){var r=this,s=i||{},o=s.width,a=s.height,l=s.autoLoad,u=s.linkBaseTexture;if(n&&n.length!==t.SIDES)throw new Error("Invalid length. Got "+n.length+", expected 6");r=e.call(this,6,{width:o,height:a})||this;for(var c=0;c<t.SIDES;c++)r.items[c].target=N.TEXTURE_CUBE_MAP_POSITIVE_X+c;return r.linkBaseTexture=!1!==u,n&&r.initFromArray(n,i),!1!==l&&r.load(),r}return nn(t,e),t.prototype.bind=function(t){e.prototype.bind.call(this,t),t.target=N.TEXTURE_CUBE_MAP},t.prototype.addBaseTextureAt=function(e,t,n){if(void 0===n&&(n=this.linkBaseTexture),!this.items[t])throw new Error("Index "+t+" is out of bounds");if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,t)}else e.target=N.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this},t.prototype.upload=function(e,n,i){for(var r=this.itemDirtyIds,s=0;s<t.SIDES;s++){var o=this.items[s];r[s]<o.dirtyId&&(o.valid&&o.resource?(o.resource.upload(e,o,i),r[s]=o.dirtyId):r[s]<-1&&(e.gl.texImage2D(o.target,0,i.internalFormat,n.realWidth,n.realHeight,0,n.format,i.type,null),r[s]=-1))}return!0},t.test=function(e){return Array.isArray(e)&&e.length===t.SIDES},t.SIDES=6,t}(ln),dn=function(e){function t(t,n){var i=this;if(n=n||{},!(t instanceof HTMLImageElement)){var r=new Image;cn.crossOrigin(r,t,n.crossorigin),r.src=t,t=r}return i=e.call(this,t)||this,!t.complete&&i._width&&i._height&&(i._width=0,i._height=0),i.url=t.src,i._process=null,i.preserveBitmap=!1,i.createBitmap=(void 0!==n.createBitmap?n.createBitmap:H.CREATE_IMAGE_BITMAP)&&!!self.createImageBitmap,i.alphaMode="number"==typeof n.alphaMode?n.alphaMode:null,i.bitmap=null,i._load=null,!1!==n.autoLoad&&i.load(),i}return nn(t,e),t.prototype.load=function(e){var t=this;return this._load||(void 0!==e&&(this.createBitmap=e),this._load=new Promise((function(e,n){var i=t.source;t.url=i.src;var r=function(){t.destroyed||(i.onload=null,i.onerror=null,t.resize(i.width,i.height),t._load=null,t.createBitmap?e(t.process()):e(t))};i.complete&&i.src?r():(i.onload=r,i.onerror=function(e){n(e),t.onError.emit(e)})}))),this._load},t.prototype.process=function(){var e=this,t=this.source;return null!==this._process?this._process:null===this.bitmap&&self.createImageBitmap?(this._process=self.createImageBitmap(t,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===B.UNPACK?"premultiply":"none"}).then((function(t){return e.destroyed?Promise.reject():(e.bitmap=t,e.update(),e._process=null,Promise.resolve(e))})),this._process):Promise.resolve(this)},t.prototype.upload=function(t,n,i){if("number"==typeof this.alphaMode&&(n.alphaMode=this.alphaMode),!this.createBitmap)return e.prototype.upload.call(this,t,n,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(e.prototype.upload.call(this,t,n,i,this.bitmap),!this.preserveBitmap){var r=!0,s=n._glTextures;for(var o in s){var a=s[o];if(a!==i&&a.dirtyId!==n.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},t.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,e.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},t.test=function(e){return"string"==typeof e||e instanceof HTMLImageElement},t}(cn),fn=function(e){function t(t,n){var i=this;return n=n||{},(i=e.call(this,document.createElement("canvas"))||this)._width=0,i._height=0,i.svg=t,i.scale=n.scale||1,i._overrideWidth=n.width,i._overrideHeight=n.height,i._resolve=null,i._crossorigin=n.crossorigin,i._load=null,!1!==n.autoLoad&&i.load(),i}return nn(t,e),t.prototype.load=function(){var e=this;return this._load||(this._load=new Promise((function(t){if(e._resolve=function(){e.resize(e.source.width,e.source.height),t(e)},/^\<svg/.test(e.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");e.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e.svg)))}e._loadSvg()}))),this._load},t.prototype._loadSvg=function(){var e=this,t=new Image;cn.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=function(n){e._resolve&&(t.onerror=null,e.onError.emit(n))},t.onload=function(){if(e._resolve){var n=t.width,i=t.height;if(!n||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var r=n*e.scale,s=i*e.scale;(e._overrideWidth||e._overrideHeight)&&(r=e._overrideWidth||e._overrideHeight/i*n,s=e._overrideHeight||e._overrideWidth/n*i),r=Math.round(r),s=Math.round(s);var o=e.source;o.width=r,o.height=s,o._pixiId="canvas_"+gt(),o.getContext("2d").drawImage(t,0,0,n,i,0,0,r,s),e._resolve(),e._resolve=null}}},t.getSize=function(e){var n=t.SVG_SIZE.exec(e),i={};return n&&(i[n[1]]=Math.round(parseFloat(n[3])),i[n[5]]=Math.round(parseFloat(n[7]))),i},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},t.test=function(e,t){return"svg"===t||"string"==typeof e&&/^data:image\/svg\+xml(;(charset=utf8|utf8))?;base64/.test(e)||"string"==typeof e&&0===e.indexOf("<svg")},t.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,t}(cn),_n=function(e){function t(n,i){var r=this;if(i=i||{},!(n instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),"string"==typeof n&&(n=[n]);var o=n[0].src||n[0];cn.crossOrigin(s,o,i.crossorigin);for(var a=0;a<n.length;++a){var l=document.createElement("source"),u=n[a],c=u.src,p=u.mime,h=(c=c||n[a]).split("?").shift().toLowerCase(),d=h.substr(h.lastIndexOf(".")+1);p=p||t.MIME_TYPES[d]||"video/"+d,l.src=c,l.type=p,s.appendChild(l)}n=s}return(r=e.call(this,n)||this).noSubImage=!0,r._autoUpdate=!0,r._isConnectedToTicker=!1,r._updateFPS=i.updateFPS||0,r._msToNextUpdate=0,r.autoPlay=!1!==i.autoPlay,r._load=null,r._resolve=null,r._onCanPlay=r._onCanPlay.bind(r),r._onError=r._onError.bind(r),!1!==i.autoLoad&&r.load(),r}return nn(t,e),t.prototype.update=function(t){if(!this.destroyed){var n=Ct.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-n),(!this._updateFPS||this._msToNextUpdate<=0)&&(e.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},t.prototype.load=function(){var e=this;if(this._load)return this._load;var t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart.bind(this)),t.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((function(n){e.valid?n(e):(e._resolve=n,t.load())})),this._load},t.prototype._onError=function(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)},t.prototype._isSourcePlaying=function(){var e=this.source;return e.currentTime>0&&!1===e.paused&&!1===e.ended&&e.readyState>2},t.prototype._isSourceReady=function(){var e=this.source;return 3===e.readyState||4===e.readyState},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Ct.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Ct.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var t=this.valid;this.resize(e.videoWidth,e.videoHeight),!t&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&Ct.shared.remove(this.update,this);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Ct.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Ct.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,n){return self.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(n)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(cn),mn=function(e){function t(t){return e.call(this,t)||this}return nn(t,e),t.test=function(e){return!!self.createImageBitmap&&e instanceof ImageBitmap},t}(cn);Zt.push(dn,mn,pn,_n,fn,sn,hn,un);var bn={__proto__:null,Resource:rn,BaseImageResource:cn,INSTALLED:Zt,autoDetectResource:en,AbstractMultiResource:ln,ArrayResource:un,BufferResource:sn,CanvasResource:pn,CubeResource:hn,ImageResource:dn,SVGResource:fn,VideoResource:_n,ImageBitmapResource:mn},gn=function(){function e(e){this.renderer=e}return e.prototype.destroy=function(){this.renderer=null},e}(),Sn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return nn(t,e),t.prototype.upload=function(e,t,n){var i=e.gl;return i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===B.UNPACK),n.width===t.width&&n.height===t.height?i.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.type,this.data):(n.width=t.width,n.height=t.height,i.texImage2D(t.target,0,1===e.context.webGLVersion?i.DEPTH_COMPONENT:i.DEPTH_COMPONENT16,t.width,t.height,0,t.format,t.type,this.data)),!0},t}(sn),kn=function(){function e(e,t){this.width=Math.ceil(e||100),this.height=Math.ceil(t||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new At("disposeFramebuffer"),this.multisample=G.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,t){return void 0===e&&(e=0),this.colorTextures[e]=t||new an(null,{scaleMode:D.NEAREST,resolution:1,mipmap:F.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new an(new Sn(null,{width:this.width,height:this.height}),{scaleMode:D.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:F.OFF,format:R.DEPTH_COMPONENT,type:L.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(e,t){if(e=Math.ceil(e),t=Math.ceil(t),e!==this.width||t!==this.height){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var n=0;n<this.colorTextures.length;n++){var i=this.colorTextures[n],r=i.resolution;i.setSize(e/r,t/r)}this.depthTexture&&(r=this.depthTexture.resolution,this.depthTexture.setSize(e/r,t/r))}},e.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},e.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},e}(),yn=function(e){function t(t){var n=this;"number"==typeof t&&(t={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),n=e.call(this,null,t)||this;var i=t||{},r=i.width,s=i.height;return n.mipmap=0,n.width=Math.ceil(r)||100,n.height=Math.ceil(s)||100,n.valid=!0,n.clearColor=[0,0,0,0],n.framebuffer=new kn(n.width*n.resolution,n.height*n.resolution).addColorTexture(0,n),n.maskStack=[],n.filterStack=[{}],n}return nn(t,e),t.prototype.resize=function(e,t){e=Math.ceil(e),t=Math.ceil(t),this.framebuffer.resize(e*this.resolution,t*this.resolution)},t.prototype.dispose=function(){this.framebuffer.dispose(),e.prototype.dispose.call(this)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},t}(an),vn=function(){function e(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return e.prototype.set=function(e,t,n){var i=t.width,r=t.height;if(n){var s=e.width/2/i,o=e.height/2/r,a=e.x/i+s,l=e.y/r+o;n=Jt.add(n,Jt.NW),this.x0=a+s*Jt.uX(n),this.y0=l+o*Jt.uY(n),n=Jt.add(n,2),this.x1=a+s*Jt.uX(n),this.y1=l+o*Jt.uY(n),n=Jt.add(n,2),this.x2=a+s*Jt.uX(n),this.y2=l+o*Jt.uY(n),n=Jt.add(n,2),this.x3=a+s*Jt.uX(n),this.y3=l+o*Jt.uY(n)}else this.x0=e.x/i,this.y0=e.y/r,this.x1=(e.x+e.width)/i,this.y1=e.y/r,this.x2=(e.x+e.width)/i,this.y2=(e.y+e.height)/r,this.x3=e.x/i,this.y3=(e.y+e.height)/r;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},e.prototype.toString=function(){return"[@pixi/core:TextureUvs x0="+this.x0+" y0="+this.y0+" x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" y2="+this.y2+" x3="+this.x3+" y3="+this.y3+"]"},e}(),Tn=new vn,En=function(e){function t(n,i,r,s,o,a){var l=e.call(this)||this;if(l.noFrame=!1,i||(l.noFrame=!0,i=new Dt(0,0,1,1)),n instanceof t&&(n=n.baseTexture),l.baseTexture=n,l._frame=i,l.trim=s,l.valid=!1,l._uvs=Tn,l.uvMatrix=null,l.orig=r||i,l._rotate=Number(o||0),!0===o)l._rotate=2;else if(l._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return l.defaultAnchor=a?new Vt(a.x,a.y):new Vt(0,0),l._updateID=0,l.textureCacheIds=[],n.valid?l.noFrame?n.valid&&l.onBaseTextureUpdated(n):l.frame=i:n.once("loaded",l.onBaseTextureUpdated,l),l.noFrame&&n.on("update",l.onBaseTextureUpdated,l),l}return nn(t,e),t.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},t.prototype.onBaseTextureUpdated=function(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},t.prototype.destroy=function(e){if(this.baseTexture){if(e){var n=this.baseTexture.resource;n&&n.url&&Tt[n.url]&&t.removeFromCache(n.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,t.removeFromCache(this),this.textureCacheIds=null},t.prototype.clone=function(){return new t(this.baseTexture,this.frame.clone(),this.orig.clone(),this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor)},t.prototype.updateUvs=function(){this._uvs===Tn&&(this._uvs=new vn),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},t.from=function(e,n,i){void 0===n&&(n={}),void 0===i&&(i=H.STRICT_TEXTURE_CACHE);var r="string"==typeof e,s=null;if(r)s=e;else{if(!e._pixiId){var o=n&&n.pixiIdPrefix||"pixiid";e._pixiId=o+"_"+gt()}s=e._pixiId}var a=Tt[s];if(r&&i&&!a)throw new Error('The cacheId "'+s+'" does not exist in TextureCache.');return a||(n.resolution||(n.resolution=It(e)),(a=new t(new an(e,n))).baseTexture.cacheId=s,an.addToCache(a.baseTexture,s),t.addToCache(a,s)),a},t.fromURL=function(e,n){var i=Object.assign({autoLoad:!1},null==n?void 0:n.resourceOptions),r=t.from(e,Object.assign({resourceOptions:i},n),!1),s=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):s.load().then((function(){return Promise.resolve(r)}))},t.fromBuffer=function(e,n,i,r){return new t(an.fromBuffer(e,n,i,r))},t.fromLoader=function(e,n,i,r){var s=new an(e,Object.assign({scaleMode:H.SCALE_MODE,resolution:It(n)},r)),o=s.resource;o instanceof dn&&(o.url=n);var a=new t(s);return i||(i=n),an.addToCache(a.baseTexture,i),t.addToCache(a,i),i!==n&&(an.addToCache(a.baseTexture,n),t.addToCache(a,n)),a.baseTexture.valid?Promise.resolve(a):new Promise((function(e){a.baseTexture.once("loaded",(function(){return e(a)}))}))},t.addToCache=function(e,t){t&&(-1===e.textureCacheIds.indexOf(t)&&e.textureCacheIds.push(t),Tt[t]&&console.warn("Texture added to the cache with an id ["+t+"] that already had an entry"),Tt[t]=e)},t.removeFromCache=function(e){if("string"==typeof e){var t=Tt[e];if(t){var n=t.textureCacheIds.indexOf(e);return n>-1&&t.textureCacheIds.splice(n,1),delete Tt[e],t}}else if(e&&e.textureCacheIds){for(var i=0;i<e.textureCacheIds.length;++i)Tt[e.textureCacheIds[i]]===e&&delete Tt[e.textureCacheIds[i]];return e.textureCacheIds.length=0,e}return null},Object.defineProperty(t.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frame",{get:function(){return this._frame},set:function(e){this._frame=e,this.noFrame=!1;var t=e.x,n=e.y,i=e.width,r=e.height,s=t+i>this.baseTexture.width,o=n+r>this.baseTexture.height;if(s||o){var a=s&&o?"and":"or",l="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,u="Y: "+n+" + "+r+" = "+(n+r)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+l+" "+a+" "+u)}this.valid=i&&r&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),t.prototype.castToBaseTexture=function(){return this.baseTexture},t}(st.d);function In(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}En.EMPTY=new En(new an),In(En.EMPTY),In(En.EMPTY.baseTexture),En.WHITE=function(){var e=document.createElement("canvas");e.width=16,e.height=16;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,16,16),new En(new an(new pn(e)))}(),In(En.WHITE),In(En.WHITE.baseTexture);var wn=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return nn(t,e),Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t,n){void 0===n&&(n=!0),e=Math.ceil(e),t=Math.ceil(t),this.valid=e>0&&t>0,this._frame.width=this.orig.width=e,this._frame.height=this.orig.height=t,n&&this.baseTexture.resize(e,t),this.updateUvs()},t.prototype.setResolution=function(e){var t=this.baseTexture;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))},t.create=function(e){for(var n=arguments,i=[],r=1;r<arguments.length;r++)i[r-1]=n[r];return"number"==typeof e&&(kt("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),e={width:e,height:i[0],scaleMode:i[1],resolution:i[2]}),new t(new yn(e))},t}(En),xn=function(){function e(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return e.prototype.createTexture=function(e,t){var n=new yn(Object.assign({width:e,height:t,resolution:1},this.textureOptions));return new wn(n)},e.prototype.getOptimalTexture=function(t,n,i){void 0===i&&(i=1);var r=e.SCREEN_KEY;t*=i,n*=i,this.enableFullScreen&&t===this._pixelsWidth&&n===this._pixelsHeight||(r=(65535&(t=dt(t)))<<16|65535&(n=dt(n))),this.texturePool[r]||(this.texturePool[r]=[]);var s=this.texturePool[r].pop();return s||(s=this.createTexture(t,n)),s.filterPoolKey=r,s.setResolution(i),s},e.prototype.getFilterTexture=function(e,t){var n=this.getOptimalTexture(e.width,e.height,t||e.resolution);return n.filterFrame=e.filterFrame,n},e.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},e.prototype.returnFilterTexture=function(e){this.returnTexture(e)},e.prototype.clear=function(e){if(e=!1!==e)for(var t in this.texturePool){var n=this.texturePool[t];if(n)for(var i=0;i<n.length;i++)n[i].destroy(!0)}this.texturePool={}},e.prototype.setScreenSize=function(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){var n=e.SCREEN_KEY,i=this.texturePool[n];if(this.enableFullScreen=t.width>0&&t.height>0,i)for(var r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[n]=[],this._pixelsWidth=t.width,this._pixelsHeight=t.height}},e.SCREEN_KEY="screen",e}(),An=function(){function e(e,t,n,i,r,s,o){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===i&&(i=5126),this.buffer=e,this.size=t,this.normalized=n,this.type=i,this.stride=r,this.start=s,this.instance=o}return e.prototype.destroy=function(){this.buffer=null},e.from=function(t,n,i,r,s){return new e(t,n,i,r,s)},e}(),$n=0,On=function(){function e(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!1),this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=n,this.static=t,this.id=$n++,this.disposeRunner=new At("disposeBuffer")}return e.prototype.update=function(e){this.data=e||this.data,this._updateID++},e.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},e.prototype.destroy=function(){this.dispose(),this.data=null},e.from=function(t){return t instanceof Array&&(t=new Float32Array(t)),new e(t)},e}();function Mn(e){if(4===e.BYTES_PER_ELEMENT)return e instanceof Float32Array?"Float32Array":e instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===e.BYTES_PER_ELEMENT){if(e instanceof Uint16Array)return"Uint16Array"}else if(1===e.BYTES_PER_ELEMENT&&e instanceof Uint8Array)return"Uint8Array";return null}var Cn={Float32Array,Uint32Array,Int32Array,Uint8Array};var Rn={5126:4,5123:2,5121:1},Nn=0,Ln={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Dn=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t={}),this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=Nn++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new At("disposeGeometry"),this.refCount=0}return e.prototype.addAttribute=function(e,t,n,i,r,s,o,a){if(void 0===n&&(n=0),void 0===i&&(i=!1),void 0===a&&(a=!1),!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof On||(t instanceof Array&&(t=new Float32Array(t)),t=new On(t));var l=e.split("|");if(l.length>1){for(var u=0;u<l.length;u++)this.addAttribute(l[u],t,n,i,r);return this}var c=this.buffers.indexOf(t);return-1===c&&(this.buffers.push(t),c=this.buffers.length-1),this.attributes[e]=new An(c,n,i,r,s,o,a),this.instanced=this.instanced||a,this},e.prototype.getAttribute=function(e){return this.attributes[e]},e.prototype.getBuffer=function(e){return this.buffers[this.getAttribute(e).buffer]},e.prototype.addIndex=function(e){return e instanceof On||(e instanceof Array&&(e=new Uint16Array(e)),e=new On(e)),e.index=!0,this.indexBuffer=e,-1===this.buffers.indexOf(e)&&this.buffers.push(e),this},e.prototype.getIndex=function(){return this.indexBuffer},e.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var e,t=[],n=[],i=new On;for(e in this.attributes){var r=this.attributes[e],s=this.buffers[r.buffer];t.push(s.data),n.push(r.size*Rn[r.type]/4),r.buffer=0}for(i.data=function(e,t){for(var n=0,i=0,r={},s=0;s<e.length;s++)i+=t[s],n+=e[s].length;var o=new ArrayBuffer(4*n),a=null,l=0;for(s=0;s<e.length;s++){var u=t[s],c=e[s],p=Mn(c);r[p]||(r[p]=new Cn[p](o)),a=r[p];for(var h=0;h<c.length;h++)a[(h/u|0)*i+l+h%u]=c[h];l+=u}return new Float32Array(o)}(t,n),e=0;e<this.buffers.length;e++)this.buffers[e]!==this.indexBuffer&&this.buffers[e].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},e.prototype.getSize=function(){for(var e in this.attributes){var t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0},e.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},e.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},e.prototype.clone=function(){for(var t=new e,n=0;n<this.buffers.length;n++)t.buffers[n]=new On(this.buffers[n].data.slice(0));for(var n in this.attributes){var i=this.attributes[n];t.attributes[n]=new An(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.index=!0),t},e.merge=function(t){for(var n,i=new e,r=[],s=[],o=[],a=0;a<t.length;a++){n=t[a];for(var l=0;l<n.buffers.length;l++)s[l]=s[l]||0,s[l]+=n.buffers[l].data.length,o[l]=0}for(a=0;a<n.buffers.length;a++)r[a]=new(Ln[Mn(n.buffers[a].data)])(s[a]),i.buffers[a]=new On(r[a]);for(a=0;a<t.length;a++)for(n=t[a],l=0;l<n.buffers.length;l++)r[l].set(n.buffers[l].data,o[l]),o[l]+=n.buffers[l].data.length;if(i.attributes=n.attributes,n.indexBuffer){i.indexBuffer=i.buffers[n.buffers.indexOf(n.indexBuffer)],i.indexBuffer.index=!0;var u=0,c=0,p=0,h=0;for(a=0;a<n.buffers.length;a++)if(n.buffers[a]!==n.indexBuffer){h=a;break}for(var a in n.attributes){var d=n.attributes[a];(0|d.buffer)===h&&(c+=d.size*Rn[d.type]/4)}for(a=0;a<t.length;a++){var f=t[a].indexBuffer.data;for(l=0;l<f.length;l++)i.indexBuffer.data[l+p]+=u;u+=n.buffers[h].data.length/c,p+=f.length}}return i},e}(),Pn=function(e){function t(){var t=e.call(this)||this;return t.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),t}return nn(t,e),t}(Dn),Fn=function(e){function t(){var t=e.call(this)||this;return t.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),t.uvs=new Float32Array([0,0,1,0,1,1,0,1]),t.vertexBuffer=new On(t.vertices),t.uvBuffer=new On(t.uvs),t.addAttribute("aVertexPosition",t.vertexBuffer).addAttribute("aTextureCoord",t.uvBuffer).addIndex([0,1,2,0,2,3]),t}return nn(t,e),t.prototype.map=function(e,t){var n=0,i=0;return this.uvs[0]=n,this.uvs[1]=i,this.uvs[2]=n+t.width/e.width,this.uvs[3]=i,this.uvs[4]=n+t.width/e.width,this.uvs[5]=i+t.height/e.height,this.uvs[6]=n,this.uvs[7]=i+t.height/e.height,n=t.x,i=t.y,this.vertices[0]=n,this.vertices[1]=i,this.vertices[2]=n+t.width,this.vertices[3]=i,this.vertices[4]=n+t.width,this.vertices[5]=i+t.height,this.vertices[6]=n,this.vertices[7]=i+t.height,this.invalidate(),this},t.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},t}(Dn),Bn=0,jn=function(){function e(e,t){this.uniforms=e,this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Bn++,this.static=!!t}return e.prototype.update=function(){this.dirtyId++},e.prototype.add=function(t,n,i){this.uniforms[t]=new e(n,i)},e.from=function(t,n){return new e(t,n)},e}(),Vn=function(){function e(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.sourceFrame=new Dt,this.destinationFrame=new Dt,this.bindingSourceFrame=new Dt,this.bindingDestinationFrame=new Dt,this.filters=[],this.transform=null}return e.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},e}(),Un=[new Vt,new Vt,new Vt,new Vt],Yn=new Yt,Gn=function(e){function t(t){var n=e.call(this,t)||this;return n.defaultFilterStack=[{}],n.texturePool=new xn,n.texturePool.setScreenSize(t.view),n.statePool=[],n.quad=new Pn,n.quadUv=new Fn,n.tempRect=new Dt,n.activeState={},n.globalUniforms=new jn({outputFrame:new Dt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),n.forceClear=!1,n.useMaxPadding=!1,n}return nn(t,e),t.prototype.push=function(e,t){for(var n=this.renderer,i=this.defaultFilterStack,r=this.statePool.pop()||new Vn,s=this.renderer.renderTexture,o=t[0].resolution,a=t[0].padding,l=t[0].autoFit,u=t[0].legacy,c=1;c<t.length;c++){var p=t[c];o=Math.min(o,p.resolution),a=this.useMaxPadding?Math.max(a,p.padding):a+p.padding,l=l&&p.autoFit,u=u||p.legacy}if(1===i.length&&(this.defaultFilterStack[0].renderTexture=s.current),i.push(r),r.resolution=o,r.legacy=u,r.target=e,r.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),r.sourceFrame.pad(a),l){var h=this.tempRect.copyFrom(s.sourceFrame);n.projection.transform&&this.transformAABB(Yn.copyFrom(n.projection.transform).invert(),h),r.sourceFrame.fit(h)}this.roundFrame(r.sourceFrame,s.current?s.current.resolution:n.resolution,s.sourceFrame,s.destinationFrame,n.projection.transform),r.renderTexture=this.getOptimalFilterTexture(r.sourceFrame.width,r.sourceFrame.height,o),r.filters=t,r.destinationFrame.width=r.renderTexture.width,r.destinationFrame.height=r.renderTexture.height;var d=this.tempRect;d.x=0,d.y=0,d.width=r.sourceFrame.width,d.height=r.sourceFrame.height,r.renderTexture.filterFrame=r.sourceFrame,r.bindingSourceFrame.copyFrom(s.sourceFrame),r.bindingDestinationFrame.copyFrom(s.destinationFrame),r.transform=n.projection.transform,n.projection.transform=null,s.bind(r.renderTexture,r.sourceFrame,d),n.framebuffer.clear(0,0,0,0)},t.prototype.pop=function(){var e=this.defaultFilterStack,t=e.pop(),n=t.filters;this.activeState=t;var i=this.globalUniforms.uniforms;i.outputFrame=t.sourceFrame,i.resolution=t.resolution;var r=i.inputSize,s=i.inputPixel,o=i.inputClamp;if(r[0]=t.destinationFrame.width,r[1]=t.destinationFrame.height,r[2]=1/r[0],r[3]=1/r[1],s[0]=r[0]*t.resolution,s[1]=r[1]*t.resolution,s[2]=1/s[0],s[3]=1/s[1],o[0]=.5*s[2],o[1]=.5*s[3],o[2]=t.sourceFrame.width*r[2]-.5*s[2],o[3]=t.sourceFrame.height*r[3]-.5*s[3],t.legacy){var a=i.filterArea;a[0]=t.destinationFrame.width,a[1]=t.destinationFrame.height,a[2]=t.sourceFrame.x,a[3]=t.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();var l=e[e.length-1];if(t.renderTexture.framebuffer.multisample>1&&this.renderer.framebuffer.blit(),1===n.length)n[0].apply(this,t.renderTexture,l.renderTexture,j.BLEND,t),this.returnFilterTexture(t.renderTexture);else{var u=t.renderTexture,c=this.getOptimalFilterTexture(u.width,u.height,t.resolution);c.filterFrame=u.filterFrame;var p=0;for(p=0;p<n.length-1;++p){n[p].apply(this,u,c,j.CLEAR,t);var h=u;u=c,c=h}n[p].apply(this,u,l.renderTexture,j.BLEND,t),this.returnFilterTexture(u),this.returnFilterTexture(c)}t.clear(),this.statePool.push(t)},t.prototype.bindAndClear=function(e,t){void 0===t&&(t=j.CLEAR);var n=this.renderer,i=n.renderTexture,r=n.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=e.filterFrame.width,s.height=e.filterFrame.height,i.bind(e,e.filterFrame,s)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=1&r.stateId||this.forceClear;(t===j.CLEAR||t===j.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},t.prototype.applyFilter=function(e,t,n,i){var r=this.renderer;r.state.set(e.state),this.bindAndClear(n,i),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,r.shader.bind(e),e.legacy?(this.quadUv.map(t._frame,t.filterFrame),r.geometry.bind(this.quadUv),r.geometry.draw(C.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(C.TRIANGLE_STRIP))},t.prototype.calculateSpriteMatrix=function(e,t){var n=this.activeState,i=n.sourceFrame,r=n.destinationFrame,s=t._texture.orig,o=e.set(r.width,0,0,r.height,i.x,i.y),a=t.worldTransform.copyTo(Yt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/s.width,1/s.height),o.translate(t.anchor.x,t.anchor.y),o},t.prototype.destroy=function(){this.texturePool.clear(!1)},t.prototype.getOptimalFilterTexture=function(e,t,n){return void 0===n&&(n=1),this.texturePool.getOptimalTexture(e,t,n)},t.prototype.getFilterTexture=function(e,t){if("number"==typeof e){var n=e;e=t,t=n}e=e||this.activeState.renderTexture;var i=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution);return i.filterFrame=e.filterFrame,i},t.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},t.prototype.emptyPool=function(){this.texturePool.clear(!0)},t.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},t.prototype.transformAABB=function(e,t){var n=Un[0],i=Un[1],r=Un[2],s=Un[3];n.set(t.left,t.top),i.set(t.left,t.bottom),r.set(t.right,t.top),s.set(t.right,t.bottom),e.apply(n,n),e.apply(i,i),e.apply(r,r),e.apply(s,s);var o=Math.min(n.x,i.x,r.x,s.x),a=Math.min(n.y,i.y,r.y,s.y),l=Math.max(n.x,i.x,r.x,s.x),u=Math.max(n.y,i.y,r.y,s.y);t.x=o,t.y=a,t.width=l-o,t.height=u-a},t.prototype.roundFrame=function(e,t,n,i,r){if(r){var s=r.a,o=r.b,a=r.c,l=r.d;if(!(0===o&&0===a||0===s&&0===l))return}(r=r?Yn.copyFrom(r):Yn.identity()).translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(r,e),e.ceil(t),this.transformAABB(r.invert(),e)},t}(gn),Xn=function(){function e(e){this.renderer=e}return e.prototype.flush=function(){},e.prototype.destroy=function(){this.renderer=null},e.prototype.start=function(){},e.prototype.stop=function(){this.flush()},e.prototype.render=function(e){},e}(),Hn=function(e){function t(t){var n=e.call(this,t)||this;return n.emptyRenderer=new Xn(t),n.currentRenderer=n.emptyRenderer,n}return nn(t,e),t.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},t.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.copyBoundTextures=function(e,t){for(var n=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=n[i]||null,e[i]&&(e[i]._batchLocation=i)},t.prototype.boundArray=function(e,t,n,i){for(var r=e.elements,s=e.ids,o=e.count,a=0,l=0;l<o;l++){var u=r[l],c=u._batchLocation;if(c>=0&&c<i&&t[c]===u)s[l]=c;else for(;a<i;){var p=t[a];if(!p||p._batchEnabled!==n||p._batchLocation!==a){s[l]=a,u._batchLocation=a,t[a]=u;break}a++}}},t}(gn),zn=0,qn=function(e){function t(t){var n=e.call(this,t)||this;return n.webGLVersion=1,n.extensions={},n.supports={uint32Indices:!1},n.handleContextLost=n.handleContextLost.bind(n),n.handleContextRestored=n.handleContextRestored.bind(n),t.view.addEventListener("webglcontextlost",n.handleContextLost,!1),t.view.addEventListener("webglcontextrestored",n.handleContextRestored,!1),n}return nn(t,e),Object.defineProperty(t.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),t.prototype.contextChange=function(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=zn++,e.isContextLost()&&e.getExtension("WEBGL_lose_context")&&e.getExtension("WEBGL_lose_context").restoreContext()},t.prototype.initFromContext=function(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=zn++,this.renderer.runners.contextChange.emit(e)},t.prototype.initFromOptions=function(e){var t=this.createContext(this.renderer.view,e);this.initFromContext(t)},t.prototype.createContext=function(e,t){var n;if(H.PREFER_ENV>=A.WEBGL2&&(n=e.getContext("webgl2",t)),n)this.webGLVersion=2;else if(this.webGLVersion=1,!(n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},t.prototype.getExtensions=function(){var e=this.gl,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},t.prototype.handleContextLost=function(e){e.preventDefault()},t.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},t.prototype.destroy=function(){var e=this.renderer.view;e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},t.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},t.prototype.validateContext=function(e){var t=e.getContextAttributes(),n="WebGL2RenderingContext"in self&&e instanceof self.WebGL2RenderingContext;n&&(this.webGLVersion=2),t.stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},t}(gn),Wn=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.multisample=G.NONE,this.msaaBuffer=null,this.blitFramebuffer=null},Kn=new Dt,Jn=function(e){function t(t){var n=e.call(this,t)||this;return n.managedFramebuffers=[],n.unknownFramebuffer=new kn(10,10),n.msaaSamples=null,n}return nn(t,e),t.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Dt,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var t=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;H.PREFER_ENV===A.WEBGL_LEGACY&&(t=null,n=null),t?e.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,e.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},t.prototype.bind=function(e,t){var n=this.gl;if(e){var i=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==e.dirtyId&&(i.dirtyId=e.dirtyId,i.dirtyFormat!==e.dirtyFormat?(i.dirtyFormat=e.dirtyFormat,this.updateFramebuffer(e)):i.dirtySize!==e.dirtySize&&(i.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var r=0;r<e.colorTextures.length;r++){var s=e.colorTextures[r];this.renderer.texture.unbind(s.parentTextureArray||s)}e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,e.width,e.height)}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},t.prototype.setViewport=function(e,t,n,i){var r=this.viewport;r.width===n&&r.height===i&&r.x===e&&r.y===t||(r.x=e,r.y=t,r.width=n,r.height=i,this.gl.viewport(e,t,n,i))},Object.defineProperty(t.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),t.prototype.clear=function(e,t,n,i,r){void 0===r&&(r=O.COLOR|O.DEPTH);var s=this.gl;s.clearColor(e,t,n,i),s.clear(r)},t.prototype.initFramebuffer=function(e){var t=this.gl,n=new Wn(t.createFramebuffer());return n.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(e),e.disposeRunner.add(this),n},t.prototype.resizeFramebuffer=function(e){var t=this.gl,n=e.glFramebuffers[this.CONTEXT_UID];n.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,n.stencil),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));for(var i=e.colorTextures,r=0;r<i.length;r++)this.renderer.texture.bind(i[r],0);e.depthTexture&&this.renderer.texture.bind(e.depthTexture,0)},t.prototype.updateFramebuffer=function(e){var t=this.gl,n=e.glFramebuffers[this.CONTEXT_UID],i=e.colorTextures.length;t.drawBuffers||(i=Math.min(i,1)),n.multisample>1&&(n.msaaBuffer=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,n.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.RGBA8,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,n.msaaBuffer));for(var r=[],s=0;s<i;s++)if(!(0===s&&n.multisample>1)){var o=e.colorTextures[s],a=o.parentTextureArray||o;this.renderer.texture.bind(a,0),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+s,o.target,a._glTextures[this.CONTEXT_UID].texture,0),r.push(t.COLOR_ATTACHMENT0+s)}if(r.length>1&&t.drawBuffers(r),e.depthTexture&&this.writeDepthTexture){var l=e.depthTexture;this.renderer.texture.bind(l,0),t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,0)}n.stencil||!e.stencil&&!e.depth||(n.stencil=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,n.stencil),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height),e.depthTexture||t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,n.stencil))},t.prototype.detectSamples=function(e){var t=this.msaaSamples,n=G.NONE;if(e<=1||null===t)return n;for(var i=0;i<t.length;i++)if(t[i]<=e){n=t[i];break}return 1===n&&(n=G.NONE),n},t.prototype.blit=function(e,t,n){var i=this.current,r=this.renderer,s=this.gl,o=this.CONTEXT_UID;if(2===r.context.webGLVersion&&i){var a=i.glFramebuffers[o];if(a){if(!e){if(a.multisample<=1)return;a.blitFramebuffer||(a.blitFramebuffer=new kn(i.width,i.height),a.blitFramebuffer.addColorTexture(0,i.colorTextures[0])),(e=a.blitFramebuffer).width=i.width,e.height=i.height}t||((t=Kn).width=i.width,t.height=i.height),n||(n=t);var l=t.width===n.width&&t.height===n.height;this.bind(e),s.bindFramebuffer(s.READ_FRAMEBUFFER,a.framebuffer),s.blitFramebuffer(t.x,t.y,t.width,t.height,n.x,n.y,n.width,n.height,s.COLOR_BUFFER_BIT,l?s.NEAREST:s.LINEAR)}}},t.prototype.disposeFramebuffer=function(e,t){var n=e.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(n){delete e.glFramebuffers[this.CONTEXT_UID];var r=this.managedFramebuffers.indexOf(e);r>=0&&this.managedFramebuffers.splice(r,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(n.framebuffer),n.stencil&&i.deleteRenderbuffer(n.stencil))}},t.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n<t.length;n++)this.disposeFramebuffer(t[n],e)},t.prototype.forceStencil=function(){var e=this.current;if(e){var t=e.glFramebuffers[this.CONTEXT_UID];if(t&&!t.stencil){e.enableStencil();var n=e.width,i=e.height,r=this.gl,s=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,s),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,n,i),t.stencil=s,r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,s)}}},t.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new Dt},t}(gn),Qn=function(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0},Zn={5126:4,5123:2,5121:1},ei=function(e){function t(t){var n=e.call(this,t)||this;return n._activeGeometry=null,n._activeVao=null,n.hasVao=!0,n.hasInstance=!0,n.canUseUInt32ElementIndex=!1,n.managedGeometries={},n.managedBuffers={},n}return nn(t,e),t.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==t.webGLVersion){var n=this.renderer.context.extensions.vertexArrayObject;H.PREFER_ENV===A.WEBGL_LEGACY&&(n=null),n?(e.createVertexArray=function(){return n.createVertexArrayOES()},e.bindVertexArray=function(e){return n.bindVertexArrayOES(e)},e.deleteVertexArray=function(e){return n.deleteVertexArrayOES(e)}):(this.hasVao=!1,e.createVertexArray=function(){return null},e.bindVertexArray=function(){return null},e.deleteVertexArray=function(){return null})}if(2!==t.webGLVersion){var i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=function(e,t){return i.vertexAttribDivisorANGLE(e,t)},e.drawElementsInstanced=function(e,t,n,r,s){return i.drawElementsInstancedANGLE(e,t,n,r,s)},e.drawArraysInstanced=function(e,t,n,r){return i.drawArraysInstancedANGLE(e,t,n,r)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===t.webGLVersion||!!t.extensions.uint32ElementIndex},t.prototype.bind=function(e,t){t=t||this.renderer.shader.shader;var n=this.gl,i=e.glVertexArrayObjects[this.CONTEXT_UID],r=!1;i||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=i={},r=!0);var s=i[t.program.id]||this.initGeometryVao(e,t.program,r);this._activeGeometry=e,this._activeVao!==s&&(this._activeVao=s,this.hasVao?n.bindVertexArray(s):this.activateVao(e,t.program)),this.updateBuffers()},t.prototype.reset=function(){this.unbind()},t.prototype.updateBuffers=function(){for(var e=this._activeGeometry,t=this.gl,n=0;n<e.buffers.length;n++){var i=e.buffers[n],r=i._glBuffers[this.CONTEXT_UID];if(i._updateID!==r.updateID){r.updateID=i._updateID;var s=i.index?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;if(t.bindBuffer(s,r.buffer),this._boundBuffer=r,r.byteLength>=i.data.byteLength)t.bufferSubData(s,0,i.data);else{var o=i.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;r.byteLength=i.data.byteLength,t.bufferData(s,i.data,o)}}}},t.prototype.checkCompatibility=function(e,t){var n=e.attributes,i=t.attributeData;for(var r in i)if(!n[r])throw new Error('shader and geometry incompatible, geometry missing the "'+r+'" attribute')},t.prototype.getSignature=function(e,t){var n=e.attributes,i=t.attributeData,r=["g",e.id];for(var s in n)i[s]&&r.push(s);return r.join("-")},t.prototype.initGeometryVao=function(e,t,n){void 0===n&&(n=!0),this.checkCompatibility(e,t);var i=this.gl,r=this.CONTEXT_UID,s=this.getSignature(e,t),o=e.glVertexArrayObjects[this.CONTEXT_UID],a=o[s];if(a)return o[t.id]=a,a;var l=e.buffers,u=e.attributes,c={},p={};for(var h in l)c[h]=0,p[h]=0;for(var h in u)!u[h].size&&t.attributeData[h]?u[h].size=t.attributeData[h].size:u[h].size||console.warn("PIXI Geometry attribute '"+h+"' size cannot be determined (likely the bound shader does not have the attribute)"),c[u[h].buffer]+=u[h].size*Zn[u[h].type];for(var h in u){var d=u[h],f=d.size;void 0===d.stride&&(c[d.buffer]===f*Zn[d.type]?d.stride=0:d.stride=c[d.buffer]),void 0===d.start&&(d.start=p[d.buffer],p[d.buffer]+=f*Zn[d.type])}a=i.createVertexArray(),i.bindVertexArray(a);for(var _=0;_<l.length;_++){var m=l[_];m._glBuffers[r]||(m._glBuffers[r]=new Qn(i.createBuffer()),this.managedBuffers[m.id]=m,m.disposeRunner.add(this)),n&&m._glBuffers[r].refCount++}return this.activateVao(e,t),this._activeVao=a,o[t.id]=a,o[s]=a,a},t.prototype.disposeBuffer=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var n=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),n&&(t||i.deleteBuffer(n.buffer),delete e._glBuffers[this.CONTEXT_UID])}},t.prototype.disposeGeometry=function(e,t){if(this.managedGeometries[e.id]){delete this.managedGeometries[e.id];var n=e.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,r=e.buffers;if(e.disposeRunner.remove(this),n){for(var s=0;s<r.length;s++){var o=r[s]._glBuffers[this.CONTEXT_UID];o.refCount--,0!==o.refCount||t||this.disposeBuffer(r[s],t)}if(!t)for(var a in n)if("g"===a[0]){var l=n[a];this._activeVao===l&&this.unbind(),i.deleteVertexArray(l)}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}},t.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedGeometries),n=0;n<t.length;n++)this.disposeGeometry(this.managedGeometries[t[n]],e);for(t=Object.keys(this.managedBuffers),n=0;n<t.length;n++)this.disposeBuffer(this.managedBuffers[t[n]],e)},t.prototype.activateVao=function(e,t){var n=this.gl,i=this.CONTEXT_UID,r=e.buffers,s=e.attributes;e.indexBuffer&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.indexBuffer._glBuffers[i].buffer);var o=null;for(var a in s){var l=s[a],u=r[l.buffer]._glBuffers[i];if(t.attributeData[a]){o!==u&&(n.bindBuffer(n.ARRAY_BUFFER,u.buffer),o=u);var c=t.attributeData[a].location;if(n.enableVertexAttribArray(c),n.vertexAttribPointer(c,l.size,l.type||n.FLOAT,l.normalized,l.stride,l.start),l.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");n.vertexAttribDivisor(c,1)}}}},t.prototype.draw=function(e,t,n,i){var r=this.gl,s=this._activeGeometry;if(s.indexBuffer){var o=s.indexBuffer.data.BYTES_PER_ELEMENT,a=2===o?r.UNSIGNED_SHORT:r.UNSIGNED_INT;2===o||4===o&&this.canUseUInt32ElementIndex?s.instanced?r.drawElementsInstanced(e,t||s.indexBuffer.data.length,a,(n||0)*o,i||1):r.drawElements(e,t||s.indexBuffer.data.length,a,(n||0)*o):console.warn("unsupported index buffer type: uint32")}else s.instanced?r.drawArraysInstanced(e,n,t||s.getSize(),i||1):r.drawArrays(e,n,t||s.getSize());return this},t.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},t}(gn),ti=function(){function e(e){void 0===e&&(e=null),this.type=Y.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._target=null}return e.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=Y.NONE,this.autoDetect=!0),this._target=null},e.prototype.copyCountersOrReset=function(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},e}();function ni(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}function ii(e,t,n,i){var r=ni(e,e.VERTEX_SHADER,t),s=ni(e,e.FRAGMENT_SHADER,n),o=e.createProgram();if(e.attachShader(o,r),e.attachShader(o,s),i)for(var a in i)e.bindAttribLocation(o,i[a],a);return e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||(console.warn(t),console.error(e.getShaderInfoLog(r))),e.getShaderParameter(s,e.COMPILE_STATUS)||(console.warn(n),console.error(e.getShaderInfoLog(s))),console.error("Pixi.js Error: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",e.getProgramParameter(o,e.VALIDATE_STATUS)),console.error("gl.getError()",e.getError()),""!==e.getProgramInfoLog(o)&&console.warn("Pixi.js Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(o)),e.deleteProgram(o),o=null),e.deleteShader(r),e.deleteShader(s),o}function ri(e){for(var t=new Array(e),n=0;n<t.length;n++)t[n]=!1;return t}function si(e,t){switch(e){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return ri(2*t);case"bvec3":return ri(3*t);case"bvec4":return ri(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var oi,ai={},li=ai;function ui(){if(li===ai||li&&li.isContextLost()){var e=document.createElement("canvas"),t=void 0;H.PREFER_ENV>=A.WEBGL2&&(t=e.getContext("webgl2",{})),t||((t=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?t.getExtension("WEBGL_draw_buffers"):t=null),li=t}return li}function ci(e,t,n){if("precision"!==e.substring(0,9)){var i=t;return t===U.HIGH&&n!==U.HIGH&&(i=U.MEDIUM),"precision "+i+" float;\n"+e}return n!==U.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var pi={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function hi(e){return pi[e]}var di=null,fi={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function _i(e,t){if(!di){var n=Object.keys(fi);di={};for(var i=0;i<n.length;++i){var r=n[i];di[e[r]]=fi[r]}}return di[t]}var mi=[{test:function(e){return"float"===e.type&&1===e.size},code:function(e){return'\n if(uv["'+e+'"] !== ud["'+e+'"].value)\n {\n ud["'+e+'"].value = uv["'+e+'"]\n gl.uniform1f(ud["'+e+'"].location, uv["'+e+'"])\n }\n '}},{test:function(e){return("sampler2D"===e.type||"samplerCube"===e.type||"sampler2DArray"===e.type)&&1===e.size&&!e.isArray},code:function(e){return't = syncData.textureCount++;\n\n renderer.texture.bind(uv["'+e+'"], t);\n\n if(ud["'+e+'"].value !== t)\n {\n ud["'+e+'"].value = t;\n gl.uniform1i(ud["'+e+'"].location, t);\n; // eslint-disable-line max-len\n }'}},{test:function(e,t){return"mat3"===e.type&&1===e.size&&void 0!==t.a},code:function(e){return'\n gl.uniformMatrix3fv(ud["'+e+'"].location, false, uv["'+e+'"].toArray(true));\n '}},{test:function(e,t){return"vec2"===e.type&&1===e.size&&void 0!==t.x},code:function(e){return'\n cv = ud["'+e+'"].value;\n v = uv["'+e+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["'+e+'"].location, v.x, v.y);\n }'}},{test:function(e){return"vec2"===e.type&&1===e.size},code:function(e){return'\n cv = ud["'+e+'"].value;\n v = uv["'+e+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["'+e+'"].location, v[0], v[1]);\n }\n '}},{test:function(e,t){return"vec4"===e.type&&1===e.size&&void 0!==t.width},code:function(e){return'\n cv = ud["'+e+'"].value;\n v = uv["'+e+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["'+e+'"].location, v.x, v.y, v.width, v.height)\n }'}},{test:function(e){return"vec4"===e.type&&1===e.size},code:function(e){return'\n cv = ud["'+e+'"].value;\n v = uv["'+e+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["'+e+'"].location, v[0], v[1], v[2], v[3])\n }'}}],bi={float:"\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }",vec2:"\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"gl.uniform4f(location, v[0], v[1], v[2], v[3])",int:"gl.uniform1i(location, v)",ivec2:"gl.uniform2i(location, v[0], v[1])",ivec3:"gl.uniform3i(location, v[0], v[1], v[2])",ivec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",uint:"gl.uniform1ui(location, v)",uvec2:"gl.uniform2ui(location, v[0], v[1])",uvec3:"gl.uniform3ui(location, v[0], v[1], v[2])",uvec4:"gl.uniform4ui(location, v[0], v[1], v[2], v[3])",bool:"gl.uniform1i(location, v)",bvec2:"gl.uniform2i(location, v[0], v[1])",bvec3:"gl.uniform3i(location, v[0], v[1], v[2])",bvec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"gl.uniform1i(location, v)",samplerCube:"gl.uniform1i(location, v)",sampler2DArray:"gl.uniform1i(location, v)"},gi={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};var Si,ki=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function yi(e){for(var t="",n=0;n<e;++n)n>0&&(t+="\nelse "),n<e-1&&(t+="if(test == "+n+".0){}");return t}var vi=0,Ti={},Ei=function(){function e(t,n,i){void 0===i&&(i="pixi-shader"),this.id=vi++,this.vertexSrc=t||e.defaultVertexSrc,this.fragmentSrc=n||e.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(i=i.replace(/\s+/g,"-"),Ti[i]?(Ti[i]++,i+="-"+Ti[i]):Ti[i]=1,this.vertexSrc="#define SHADER_NAME "+i+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+i+"\n"+this.fragmentSrc,this.vertexSrc=ci(this.vertexSrc,H.PRECISION_VERTEX,U.HIGH),this.fragmentSrc=ci(this.fragmentSrc,H.PRECISION_FRAGMENT,function(){if(!oi){oi=U.MEDIUM;var e=ui();if(e&&e.getShaderPrecisionFormat){var t=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);oi=t.precision?U.HIGH:U.MEDIUM}}return oi}())),this.extractData(this.vertexSrc,this.fragmentSrc),this.glPrograms={},this.syncUniforms=null}return e.prototype.extractData=function(e,t){var n=ui();if(n){var i=ii(n,e,t);this.attributeData=this.getAttributeData(i,n),this.uniformData=this.getUniformData(i,n),n.deleteProgram(i)}else this.uniformData={},this.attributeData={}},e.prototype.getAttributeData=function(e,t){for(var n={},i=[],r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),s=0;s<r;s++){var o=t.getActiveAttrib(e,s),a=_i(t,o.type),l={type:a,name:o.name,size:hi(a),location:0};n[o.name]=l,i.push(l)}for(i.sort((function(e,t){return e.name>t.name?1:-1})),s=0;s<i.length;s++)i[s].location=s;return n},e.prototype.getUniformData=function(e,t){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<i;r++){var s=t.getActiveUniform(e,r),o=s.name.replace(/\[.*?\]$/,""),a=s.name.match(/\[.*?\]$/),l=_i(t,s.type);n[o]={type:l,size:s.size,isArray:a,value:si(l,s.size)}}return n},Object.defineProperty(e,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),e.from=function(t,n,i){var r=t+n,s=vt[r];return s||(vt[r]=s=new e(t,n,i)),s},e}(),Ii=function(){function e(e,t){for(var n in this.program=e,this.uniformGroup=t?t instanceof jn?t:new jn(t):new jn({}),e.uniformData)this.uniformGroup.uniforms[n]instanceof Array&&(this.uniformGroup.uniforms[n]=new Float32Array(this.uniformGroup.uniforms[n]))}return e.prototype.checkUniformExists=function(e,t){if(t.uniforms[e])return!0;for(var n in t.uniforms){var i=t.uniforms[n];if(i.group&&this.checkUniformExists(e,i))return!0}return!1},e.prototype.destroy=function(){this.uniformGroup=null},Object.defineProperty(e.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),e.from=function(t,n,i){return new e(Ei.from(t,n),i)},e}(),wi=function(){function e(){this.data=0,this.blendMode=M.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(e.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(e){!!(1&this.data)!==e&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(e){!!(2&this.data)!==e&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(e){!!(4&this.data)!==e&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(e){!!(8&this.data)!==e&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{get:function(){return!!(32&this.data)},set:function(e){!!(32&this.data)!==e&&(this.data^=32)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(e){!!(16&this.data)!==e&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this._blendMode},set:function(e){this.blend=e!==M.NONE,this._blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(e){this.offsets=!!e,this._polygonOffset=e},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"[@pixi/core:State blendMode="+this.blendMode+" clockwiseFrontFace="+this.clockwiseFrontFace+" culling="+this.culling+" depthMask="+this.depthMask+" polygonOffset="+this.polygonOffset+"]"},e.for2d=function(){var t=new e;return t.depthTest=!1,t.blend=!0,t},e}(),xi=function(e){function t(n,i,r){var s=this,o=Ei.from(n||t.defaultVertexSrc,i||t.defaultFragmentSrc);return(s=e.call(this,o,r)||this).padding=0,s.resolution=H.FILTER_RESOLUTION,s.enabled=!0,s.autoFit=!0,s.legacy=!!s.program.attributeData.aTextureCoord,s.state=new wi,s}return nn(t,e),t.prototype.apply=function(e,t,n,i,r){e.applyFilter(this,t,n,i)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),t}(Ii),Ai=new Yt,$i=function(){function e(e,t){this._texture=e,this.mapCoord=new Yt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===t?.5:t,this.isSimple=!1}return Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),e.prototype.multiplyUvs=function(e,t){void 0===t&&(t=e);for(var n=this.mapCoord,i=0;i<e.length;i+=2){var r=e[i],s=e[i+1];t[i]=r*n.a+s*n.c+n.tx,t[i+1]=r*n.b+s*n.d+n.ty}return t},e.prototype.update=function(e){var t=this._texture;if(!t||!t.valid)return!1;if(!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;var n=t._uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);var i=t.orig,r=t.trim;r&&(Ai.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Ai));var s=t.baseTexture,o=this.uClampFrame,a=this.clampMargin/s.resolution,l=this.clampOffset;return o[0]=(t._frame.x+a+l)/s.width,o[1]=(t._frame.y+a+l)/s.height,o[2]=(t._frame.x+t._frame.width-a+l)/s.width,o[3]=(t._frame.y+t._frame.height-a+l)/s.height,this.uClampOffset[0]=l/s.realWidth,this.uClampOffset[1]=l/s.realHeight,this.isSimple=t._frame.width===s.width&&t._frame.height===s.height&&0===t.rotate,!0},e}(),Oi=function(e){function t(t){var n=this,i=new Yt;return n=e.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n")||this,t.renderable=!1,n.maskSprite=t,n.maskMatrix=i,n}return nn(t,e),t.prototype.apply=function(e,t,n,i){var r=this.maskSprite,s=r._texture;s.valid&&(s.uvMatrix||(s.uvMatrix=new $i(s,0)),s.uvMatrix.update(),this.uniforms.npmAlpha=s.baseTexture.alphaMode?0:1,this.uniforms.mask=s,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,r).prepend(s.uvMatrix.mapCoord),this.uniforms.alpha=r.worldAlpha,this.uniforms.maskClamp=s.uvMatrix.uClampFrame,e.applyFilter(this,t,n,i))},t}(xi),Mi=function(e){function t(t){var n=e.call(this,t)||this;return n.enableScissor=!0,n.alphaMaskPool=[],n.maskDataPool=[],n.maskStack=[],n.alphaMaskIndex=0,n}return nn(t,e),t.prototype.setMaskStack=function(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)},t.prototype.push=function(e,t){var n=t;if(!n.isMaskData){var i=this.maskDataPool.pop()||new ti;i.pooled=!0,i.maskObject=t,n=i}switch(n.autoDetect&&this.detect(n),n.copyCountersOrReset(this.maskStack[this.maskStack.length-1]),n._target=e,n.type){case Y.SCISSOR:this.maskStack.push(n),this.renderer.scissor.push(n);break;case Y.STENCIL:this.maskStack.push(n),this.renderer.stencil.push(n);break;case Y.SPRITE:n.copyCountersOrReset(null),this.pushSpriteMask(n),this.maskStack.push(n)}},t.prototype.pop=function(e){var t=this.maskStack.pop();if(t&&t._target===e){switch(t.type){case Y.SCISSOR:this.renderer.scissor.pop();break;case Y.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case Y.SPRITE:this.popSpriteMask()}t.reset(),t.pooled&&this.maskDataPool.push(t)}},t.prototype.detect=function(e){var t=e.maskObject;if(t.isSprite)e.type=Y.SPRITE;else if(e.type=Y.STENCIL,this.enableScissor&&t.isFastRect&&t.isFastRect()){var n=t.worldTransform,i=Math.atan2(n.b,n.a),r=Math.atan2(n.d,n.c);i=Math.round(i*(180/Math.PI)*100),r=((r=Math.round(r*(180/Math.PI)*100)-i)%18e3+18e3)%18e3,0==(i=(i%9e3+9e3)%9e3)&&9e3===r&&(e.type=Y.SCISSOR)}},t.prototype.pushSpriteMask=function(e){var t=e.maskObject,n=e._target,i=this.alphaMaskPool[this.alphaMaskIndex];i||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new Oi(t)]),i[0].resolution=this.renderer.resolution,i[0].maskSprite=t;var r=n.filterArea;n.filterArea=t.getBounds(!0),this.renderer.filter.push(n,i),n.filterArea=r,this.alphaMaskIndex++},t.prototype.popSpriteMask=function(){this.renderer.filter.pop(),this.alphaMaskIndex--},t}(gn),Ci=function(e){function t(t){var n=e.call(this,t)||this;return n.maskStack=[],n.glConst=0,n}return nn(t,e),t.prototype.getStackLength=function(){return this.maskStack.length},t.prototype.setMaskStack=function(e){var t=this.renderer.gl,n=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==n&&(0===i?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},t.prototype._useCurrent=function(){},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.maskStack=null},t}(gn),Ri=function(e){function t(t){var n=e.call(this,t)||this;return n.glConst=WebGLRenderingContext.SCISSOR_TEST,n}return nn(t,e),t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},t.prototype.push=function(e){var t=e.maskObject;t.renderable=!0;var n=e._scissorRect,i=t.getBounds(!0),r=this.renderer.gl;t.renderable=!1,n?i.fit(n):r.enable(r.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=i,this._useCurrent()},t.prototype.pop=function(){var e=this.renderer.gl;this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)},t.prototype._useCurrent=function(){var e=this.maskStack[this.maskStack.length-1]._scissorRect,t=this.renderer.renderTexture.current,n=this.renderer.projection,i=n.transform,r=n.sourceFrame,s=n.destinationFrame,o=t?t.resolution:this.renderer.resolution,a=s.width/r.width,l=s.height/r.height,u=((e.x-r.x)*a+s.x)*o,c=((e.y-r.y)*l+s.y)*o,p=e.width*a*o,h=e.height*l*o;i&&(u+=i.tx*o,c+=i.ty*o),t||(c=this.renderer.height-h-c),this.renderer.gl.scissor(u,c,p,h)},t}(Ci),Ni=function(e){function t(t){var n=e.call(this,t)||this;return n.glConst=WebGLRenderingContext.STENCIL_TEST,n}return nn(t,e),t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},t.prototype.push=function(e){var t=e.maskObject,n=this.renderer.gl,i=e._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),n.enable(n.STENCIL_TEST)),e._stencilCounter++,n.colorMask(!1,!1,!1,!1),n.stencilFunc(n.EQUAL,i,this._getBitwiseMask()),n.stencilOp(n.KEEP,n.KEEP,n.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),this.renderer.framebuffer.blit(),t.renderable=!1,this._useCurrent()},t.prototype.pop=function(e){var t=this.renderer.gl;0===this.getStackLength()?(t.disable(t.STENCIL_TEST),t.clear(t.STENCIL_BUFFER_BIT),t.clearStencil(0)):(t.colorMask(!1,!1,!1,!1),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent())},t.prototype._useCurrent=function(){var e=this.renderer.gl;e.colorMask(!0,!0,!0,!0),e.stencilFunc(e.EQUAL,this.getStackLength(),this._getBitwiseMask()),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},t.prototype._getBitwiseMask=function(){return(1<<this.getStackLength())-1},t}(Ci),Li=function(e){function t(t){var n=e.call(this,t)||this;return n.destinationFrame=null,n.sourceFrame=null,n.defaultFrame=null,n.projectionMatrix=new Yt,n.transform=null,n}return nn(t,e),t.prototype.update=function(e,t,n,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,n,i),this.transform&&this.projectionMatrix.append(this.transform);var r=this.renderer;r.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,r.globalUniforms.update(),r.shader.shader&&r.shader.syncUniformGroup(r.shader.shader.uniforms.globals)},t.prototype.calculateProjection=function(e,t,n,i){var r=this.projectionMatrix,s=i?-1:1;r.identity(),r.a=1/t.width*2,r.d=s*(1/t.height*2),r.tx=-1-t.x*r.a,r.ty=-s-t.y*r.d},t.prototype.setTransform=function(e){},t}(gn),Di=new Dt,Pi=new Dt,Fi=function(e){function t(t){var n=e.call(this,t)||this;return n.clearColor=t._backgroundColorRgba,n.defaultMaskStack=[],n.current=null,n.sourceFrame=new Dt,n.destinationFrame=new Dt,n.viewportFrame=new Dt,n}return nn(t,e),t.prototype.bind=function(e,t,n){void 0===e&&(e=null);var i,r,s,o=this.renderer;this.current=e,e?(s=(i=e.baseTexture).resolution,t||(Di.width=e.frame.width,Di.height=e.frame.height,t=Di),n||(Pi.x=e.frame.x,Pi.y=e.frame.y,Pi.width=t.width,Pi.height=t.height,n=Pi),r=i.framebuffer):(s=o.resolution,t||(Di.width=o.screen.width,Di.height=o.screen.height,t=Di),n||((n=Di).width=t.width,n.height=t.height));var a=this.viewportFrame;a.x=n.x*s,a.y=n.y*s,a.width=n.width*s,a.height=n.height*s,e||(a.y=o.view.height-(a.y+a.height)),this.renderer.framebuffer.bind(r,a),this.renderer.projection.update(n,t,s,!r),e?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(n)},t.prototype.clear=function(e,t){e=this.current?e||this.current.baseTexture.clearColor:e||this.clearColor;var n=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,r=n.width!==i.width||n.height!==i.height;if(r){var s=this.viewportFrame,o=s.x,a=s.y,l=s.width,u=s.height;this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,a,l,u)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),r&&this.renderer.scissor.pop()},t.prototype.resize=function(){this.bind(null)},t.prototype.reset=function(){this.bind(null)},t}(gn),Bi=function(){function e(e,t){this.program=e,this.uniformData=t,this.uniformGroups={}}return e.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.program=null},e}(),ji=0,Vi={textureCount:0},Ui=function(e){function t(t){var n=e.call(this,t)||this;return n.destroyed=!1,n.systemCheck(),n.gl=null,n.shader=null,n.program=null,n.cache={},n.id=ji++,n}return nn(t,e),t.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof Si)return Si;try{var e=new Function("param1","param2","param3","return param1[param2] === param3;");Si=!0===e({a:"b"},"a","b")}catch(e){Si=!1}return Si}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},t.prototype.contextChange=function(e){this.gl=e,this.reset()},t.prototype.bind=function(e,t){e.uniforms.globals=this.renderer.globalUniforms;var n=e.program,i=n.glPrograms[this.renderer.CONTEXT_UID]||this.generateShader(e);return this.shader=e,this.program!==n&&(this.program=n,this.gl.useProgram(i.program)),t||(Vi.textureCount=0,this.syncUniformGroup(e.uniformGroup,Vi)),i},t.prototype.setUniforms=function(e){var t=this.shader.program,n=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(n.uniformData,e,this.renderer)},t.prototype.syncUniformGroup=function(e,t){var n=this.getglProgram();e.static&&e.dirtyId===n.uniformGroups[e.id]||(n.uniformGroups[e.id]=e.dirtyId,this.syncUniforms(e,n,t))},t.prototype.syncUniforms=function(e,t,n){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,n)},t.prototype.createSyncGroups=function(e){var t=this.getSignature(e,this.shader.program.uniformData);return this.cache[t]||(this.cache[t]=function(e,t){var n=["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "];for(var i in e.uniforms){var r=t[i];if(r){for(var s=e.uniforms[i],o=!1,a=0;a<mi.length;a++)if(mi[a].test(r,s)){n.push(mi[a].code(i,s)),o=!0;break}if(!o){var l=(1===r.size?bi:gi)[r.type].replace("location",'ud["'+i+'"].location');n.push('\n cv = ud["'+i+'"].value;\n v = uv["'+i+'"];\n '+l+";")}}else e.uniforms[i].group&&n.push('\n renderer.shader.syncUniformGroup(uv["'+i+'"], syncData);\n ')}return new Function("ud","uv","renderer","syncData",n.join("\n"))}(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]},t.prototype.getSignature=function(e,t){var n=e.uniforms,i=[];for(var r in n)i.push(r),t[r]&&i.push(t[r].type);return i.join("-")},t.prototype.getglProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},t.prototype.generateShader=function(e){var t=this.gl,n=e.program,i={};for(var r in n.attributeData)i[r]=n.attributeData[r].location;var s=ii(t,n.vertexSrc,n.fragmentSrc,i),o={};for(var r in n.uniformData){var a=n.uniformData[r];o[r]={location:t.getUniformLocation(s,r),value:si(a.type,a.size)}}var l=new Bi(s,o);return n.glPrograms[this.renderer.CONTEXT_UID]=l,l},t.prototype.reset=function(){this.program=null,this.shader=null},t.prototype.destroy=function(){this.destroyed=!0},t}(gn);var Yi=function(e){function t(t){var n=e.call(this,t)||this;return n.gl=null,n.stateId=0,n.polygonOffset=0,n.blendMode=M.NONE,n._blendEq=!1,n.map=[],n.checks=[],n.defaultState=new wi,n.defaultState.blend=!0,n}return nn(t,e),t.prototype.contextChange=function(e){this.gl=e,this.blendModes=function(e,t){return void 0===t&&(t=[]),t[M.NORMAL]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.ADD]=[e.ONE,e.ONE],t[M.MULTIPLY]=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.SCREEN]=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.OVERLAY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.DARKEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.LIGHTEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.COLOR_DODGE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.COLOR_BURN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.HARD_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.SOFT_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.DIFFERENCE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.EXCLUSION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.HUE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.SATURATION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.COLOR]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.LUMINOSITY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.NONE]=[0,0],t[M.NORMAL_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.ADD_NPM]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t[M.SCREEN_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[M.SRC_IN]=[e.DST_ALPHA,e.ZERO],t[M.SRC_OUT]=[e.ONE_MINUS_DST_ALPHA,e.ZERO],t[M.SRC_ATOP]=[e.DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[M.DST_OVER]=[e.ONE_MINUS_DST_ALPHA,e.ONE],t[M.DST_IN]=[e.ZERO,e.SRC_ALPHA],t[M.DST_OUT]=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],t[M.DST_ATOP]=[e.ONE_MINUS_DST_ALPHA,e.SRC_ALPHA],t[M.XOR]=[e.ONE_MINUS_DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[M.SUBTRACT]=[e.ONE,e.ONE,e.ONE,e.ONE,e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD],t}(e),this.set(this.defaultState),this.reset()},t.prototype.set=function(e){if(e=e||this.defaultState,this.stateId!==e.data){for(var t=this.stateId^e.data,n=0;t;)1&t&&this.map[n].call(this,!!(e.data&1<<n)),t>>=1,n++;this.stateId=e.data}for(n=0;n<this.checks.length;n++)this.checks[n](this,e)},t.prototype.forceState=function(e){e=e||this.defaultState;for(var t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data},t.prototype.setBlend=function(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},t.prototype.setOffset=function(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},t.prototype.setDepthTest=function(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)},t.prototype.setDepthMask=function(e){this.gl.depthMask(e)},t.prototype.setCullFace=function(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)},t.prototype.setFrontFace=function(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])},t.prototype.setBlendMode=function(e){if(e!==this.blendMode){this.blendMode=e;var t=this.blendModes[e],n=this.gl;2===t.length?n.blendFunc(t[0],t[1]):n.blendFuncSeparate(t[0],t[1],t[2],t[3]),6===t.length?(this._blendEq=!0,n.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD))}},t.prototype.setPolygonOffset=function(e,t){this.gl.polygonOffset(e,t)},t.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},t.prototype.updateCheck=function(e,t){var n=this.checks.indexOf(e);t&&-1===n?this.checks.push(e):t||-1===n||this.checks.splice(n,1)},t.checkBlendMode=function(e,t){e.setBlendMode(t.blendMode)},t.checkPolygonOffset=function(e,t){e.setPolygonOffset(1,t.polygonOffset)},t}(gn),Gi=function(e){function t(t){var n=e.call(this,t)||this;return n.count=0,n.checkCount=0,n.maxIdle=H.GC_MAX_IDLE,n.checkCountMax=H.GC_MAX_CHECK_COUNT,n.mode=H.GC_MODE,n}return nn(t,e),t.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==V.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},t.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,n=!1,i=0;i<t.length;i++){var r=t[i];!r.framebuffer&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[i]=null,n=!0)}if(n){var s=0;for(i=0;i<t.length;i++)null!==t[i]&&(t[s++]=t[i]);t.length=s}},t.prototype.unload=function(e){var t=this.renderer.texture,n=e._texture;n&&!n.framebuffer&&t.destroyTexture(n);for(var i=e.children.length-1;i>=0;i--)this.unload(e.children[i])},t}(gn),Xi=function(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121},Hi=function(e){function t(t){var n=e.call(this,t)||this;return n.boundTextures=[],n.currentLocation=-1,n.managedTextures=[],n._unknownBoundTextures=!1,n.unknownTexture=new an,n}return nn(t,e),t.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var n=0;n<t;n++)this.boundTextures[n]=null;this.emptyTextures={};var i=new Xi(e.createTexture());for(e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new Xi(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture),n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);for(e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR),n=0;n<this.boundTextures.length;n++)this.bind(null,n)},t.prototype.bind=function(e,t){void 0===t&&(t=0);var n=this.gl;if(e){if((e=e.castToBaseTexture()).parentTextureArray)return;if(e.valid){e.touched=this.renderer.textureGC.count;var i=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,n.activeTexture(n.TEXTURE0+t)),n.bindTexture(e.target,i.texture)),i.dirtyId!==e.dirtyId&&(this.currentLocation!==t&&(this.currentLocation=t,n.activeTexture(n.TEXTURE0+t)),this.updateTexture(e)),this.boundTextures[t]=e}}else this.currentLocation!==t&&(this.currentLocation=t,n.activeTexture(n.TEXTURE0+t)),n.bindTexture(n.TEXTURE_2D,this.emptyTextures[n.TEXTURE_2D].texture),this.boundTextures[t]=null},t.prototype.reset=function(){this._unknownBoundTextures=!0,this.currentLocation=-1;for(var e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture},t.prototype.unbind=function(e){var t=this.gl,n=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var i=0;i<n.length;i++)n[i]===this.unknownTexture&&this.bind(null,i)}for(i=0;i<n.length;i++)n[i]===e&&(this.currentLocation!==i&&(t.activeTexture(t.TEXTURE0+i),this.currentLocation=i),t.bindTexture(e.target,this.emptyTextures[e.target].texture),n[i]=null)},t.prototype.initTexture=function(e){var t=new Xi(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},t.prototype.initTextureType=function(e,t){if(t.internalFormat=e.format,t.type=e.type,2===this.webGLVersion){var n=this.renderer.gl;e.type===n.FLOAT&&e.format===n.RGBA&&(t.internalFormat=n.RGBA32F),e.type===L.HALF_FLOAT&&(t.type=n.HALF_FLOAT),t.type===n.HALF_FLOAT&&e.format===n.RGBA&&(t.internalFormat=n.RGBA16F)}},t.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var n=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(n,e,t));else{var i=e.realWidth,r=e.realHeight,s=n.gl;(t.width!==i||t.height!==r||t.dirtyId<0)&&(t.width=i,t.height=r,s.texImage2D(e.target,0,t.internalFormat,i,r,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},t.prototype.destroyTexture=function(e,t){var n=this.gl;if((e=e.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(e),n.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var i=this.managedTextures.indexOf(e);-1!==i&&mt(this.managedTextures,i,1)}},t.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&(e.mipmap!==F.POW2&&2===this.webGLVersion||e.isPowerOfTwo?t.mipmap=e.mipmap>=1:t.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?t.wrapMode=e.wrapMode:t.wrapMode=P.CLAMP,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},t.prototype.setStyle=function(e,t){var n=this.gl;if(t.mipmap&&e.mipmap!==F.ON_MANUAL&&n.generateMipmap(e.target),n.texParameteri(e.target,n.TEXTURE_WRAP_S,t.wrapMode),n.texParameteri(e.target,n.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===D.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);var i=this.renderer.context.extensions.anisotropicFiltering;if(i&&e.anisotropicLevel>0&&e.scaleMode===D.LINEAR){var r=Math.min(e.anisotropicLevel,n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));n.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===D.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(e.target,n.TEXTURE_MAG_FILTER,e.scaleMode===D.LINEAR?n.LINEAR:n.NEAREST)},t}(gn),zi={__proto__:null,FilterSystem:Gn,BatchSystem:Hn,ContextSystem:qn,FramebufferSystem:Jn,GeometrySystem:ei,MaskSystem:Mi,ScissorSystem:Ri,StencilSystem:Ni,ProjectionSystem:Li,RenderTextureSystem:Fi,ShaderSystem:Ui,StateSystem:Yi,TextureGCSystem:Gi,TextureSystem:Hi},qi=new Yt,Wi=function(e){function t(t,n){void 0===t&&(t=$.UNKNOWN);var i=e.call(this)||this;return n=Object.assign({},H.RENDER_OPTIONS,n),i.options=n,i.type=t,i.screen=new Dt(0,0,n.width,n.height),i.view=n.view||document.createElement("canvas"),i.resolution=n.resolution||H.RESOLUTION,i.useContextAlpha=n.useContextAlpha,i.autoDensity=!!n.autoDensity,i.preserveDrawingBuffer=n.preserveDrawingBuffer,i.clearBeforeRender=n.clearBeforeRender,i._backgroundColor=0,i._backgroundColorRgba=[0,0,0,1],i._backgroundColorString="#000000",i.backgroundColor=n.backgroundColor||i._backgroundColor,i.backgroundAlpha=n.backgroundAlpha,void 0!==n.transparent&&(kt("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),i.useContextAlpha=n.transparent,i.backgroundAlpha=n.transparent?0:1),i._lastObjectRendered=null,i.plugins={},i}return nn(t,e),t.prototype.initPlugins=function(e){for(var t in e)this.plugins[t]=new e[t](this)},Object.defineProperty(t.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t){this.screen.width=e,this.screen.height=t,this.view.width=e*this.resolution,this.view.height=t*this.resolution,this.autoDensity&&(this.view.style.width=e+"px",this.view.style.height=t+"px"),this.emit("resize",e,t)},t.prototype.generateTexture=function(e,t,n,i){0===(i=i||e.getLocalBounds(null,!0)).width&&(i.width=1),0===i.height&&(i.height=1);var r=wn.create({width:0|i.width,height:0|i.height,scaleMode:t,resolution:n});return qi.tx=-i.x,qi.ty=-i.y,this.render(e,{renderTexture:r,clear:!1,transform:qi,skipUpdateTransform:!!e.parent}),r},t.prototype.destroy=function(e){for(var t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view),this.plugins=null,this.type=$.UNKNOWN,this.view=null,this.screen=null,this._tempDisplayObjectParent=null,this.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._backgroundColorString=function(e){var t=e.toString(16);return"#"+("000000".substr(0,6-t.length)+t)}(e),ct(e,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(e){this._backgroundColorRgba[3]=e},enumerable:!1,configurable:!0}),t}(st.d),Ki=(function(e){function t(n){var i=e.call(this,$.WEBGL,n)||this;return n=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new At("destroy"),contextChange:new At("contextChange"),reset:new At("reset"),update:new At("update"),postrender:new At("postrender"),prerender:new At("prerender"),resize:new At("resize")},i.globalUniforms=new jn({projectionMatrix:new Yt},!0),i.addSystem(Mi,"mask").addSystem(qn,"context").addSystem(Yi,"state").addSystem(Ui,"shader").addSystem(Hi,"texture").addSystem(ei,"geometry").addSystem(Jn,"framebuffer").addSystem(Ri,"scissor").addSystem(Ni,"stencil").addSystem(Li,"projection").addSystem(Gi,"textureGC").addSystem(Gn,"filter").addSystem(Fi,"renderTexture").addSystem(Hn,"batch"),i.initPlugins(t.__plugins),n.context?i.context.initFromContext(n.context):i.context.initFromOptions({alpha:!!i.useContextAlpha,antialias:n.antialias,premultipliedAlpha:i.useContextAlpha&&"notMultiplied"!==i.useContextAlpha,stencil:!0,preserveDrawingBuffer:n.preserveDrawingBuffer,powerPreference:i.options.powerPreference}),i.renderingToScreen=!0,function(e){var t;if(!ut){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var n=["\n %c %c %c PixiJS 6.0.1 - ✰ "+e+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(t=self.console).log.apply(t,n)}else self.console&&self.console.log("PixiJS 6.0.1 - "+e+" - http://www.pixijs.com/");ut=!0}}(2===i.context.webGLVersion?"WebGL 2":"WebGL 1"),i.resize(i.options.width,i.options.height),i}nn(t,e),t.create=function(e){if(void 0===lt&&(lt=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!self.WebGLRenderingContext)return!1;var t=document.createElement("canvas"),n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),i=!(!n||!n.getContextAttributes().stencil);if(n){var r=n.getExtension("WEBGL_lose_context");r&&r.loseContext()}return n=null,i}catch(e){return!1}}()),lt)return new t(e);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},t.prototype.addSystem=function(e,t){t||(t=e.name);var n=new e(this);if(this[t])throw new Error('Whoops! The name "'+t+'" is already in use');for(var i in this[t]=n,this.runners)this.runners[i].add(n);return this},t.prototype.render=function(e,t){var n,i,r,s;if(t&&(t instanceof wn?(kt("6.0.0","Renderer#render arguments changed, use options instead."),n=t,i=arguments[2],r=arguments[3],s=arguments[4]):(n=t.renderTexture,i=t.clear,r=t.transform,s=t.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=r,!this.context.isLost){if(n||(this._lastObjectRendered=e),!s){var o=e.enableTempParent();e.updateTransform(),e.disableTempParent(o)}this.renderTexture.bind(n),this.batch.currentRenderer.start(),(void 0!==i?i:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),n&&n.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},t.prototype.resize=function(t,n){e.prototype.resize.call(this,t,n),this.runners.resize.emit(t,n)},t.prototype.reset=function(){return this.runners.reset.emit(),this},t.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},t.prototype.destroy=function(t){for(var n in this.runners.destroy.emit(),this.runners)this.runners[n].destroy();e.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(t.prototype,"extract",{get:function(){return kt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),t.registerPlugin=function(e,n){t.__plugins=t.__plugins||{},t.__plugins[e]=n}}(Wi),function(){this.texArray=null,this.blend=0,this.type=C.TRIANGLES,this.start=0,this.size=0,this.data=null}),Ji=function(){function e(){this.elements=[],this.ids=[],this.count=0}return e.prototype.clear=function(){for(var e=0;e<this.count;e++)this.elements[e]=null;this.count=0},e}(),Qi=function(){function e(e){"number"==typeof e?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(e.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),e.prototype.view=function(e){return this[e+"View"]},e.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},e.sizeOf=function(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(e+" isn't a valid view type")}},e}(),Zi=function(e){function t(t){var n=e.call(this,t)||this;return n.shaderGenerator=null,n.geometryClass=null,n.vertexSize=null,n.state=wi.for2d(),n.size=4*H.SPRITE_BATCH_SIZE,n._vertexCount=0,n._indexCount=0,n._bufferedElements=[],n._bufferedTextures=[],n._bufferSize=0,n._shader=null,n._packedGeometries=[],n._packedGeometryPoolSize=2,n._flushId=0,n._aBuffers={},n._iBuffers={},n.MAX_TEXTURES=1,n.renderer.on("prerender",n.onPrerender,n),t.runners.contextChange.add(n),n._dcIndex=0,n._aIndex=0,n._iIndex=0,n._attributeBuffer=null,n._indexBuffer=null,n._tempBoundTextures=[],n}return nn(t,e),t.prototype.contextChange=function(){var e=this.renderer.gl;H.PREFER_ENV===A.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),H.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=function(e,t){if(0===e)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var n=t.createShader(t.FRAGMENT_SHADER);;){var i=ki.replace(/%forloop%/gi,yi(e));if(t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS))break;e=e/2|0}return e}(this.MAX_TEXTURES,e)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()},t.prototype.initFlushBuffers=function(){for(var e=t._drawCallPool,n=t._textureArrayPool,i=this.size/4,r=Math.floor(i/this.MAX_TEXTURES)+1;e.length<i;)e.push(new Ki);for(;n.length<r;)n.push(new Ji);for(var s=0;s<this.MAX_TEXTURES;s++)this._tempBoundTextures[s]=null},t.prototype.onPrerender=function(){this._flushId=0},t.prototype.render=function(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},t.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,n=this.MAX_TEXTURES,i=t._textureArrayPool,r=this.renderer.batch,s=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++an._globalBatch,l=0,u=i[0],c=0;r.copyBoundTextures(s,n);for(var p=0;p<this._bufferSize;++p){var h=e[p];e[p]=null,h._batchEnabled!==a&&(u.count>=n&&(r.boundArray(u,s,a,n),this.buildDrawCalls(u,c,p),c=p,u=i[++l],++a),h._batchEnabled=a,h.touched=o,u.elements[u.count++]=h)}for(u.count>0&&(r.boundArray(u,s,a,n),this.buildDrawCalls(u,c,this._bufferSize),++l,++a),p=0;p<s.length;p++)s[p]=null;an._globalBatch=a},t.prototype.buildDrawCalls=function(e,n,i){var r=this._bufferedElements,s=this._attributeBuffer,o=this._indexBuffer,a=this.vertexSize,l=t._drawCallPool,u=this._dcIndex,c=this._aIndex,p=this._iIndex,h=l[u];h.start=this._iIndex,h.texArray=e;for(var d=n;d<i;++d){var f=r[d],_=f._texture.baseTexture,m=pt[_.alphaMode?1:0][f.blendMode];r[d]=null,n<d&&h.blend!==m&&(h.size=p-h.start,n=d,(h=l[++u]).texArray=e,h.start=p),this.packInterleavedGeometry(f,s,o,c,p),c+=f.vertexData.length/2*a,p+=f.indices.length,h.blend=m}n<i&&(h.size=p-h.start,++u),this._dcIndex=u,this._aIndex=c,this._iIndex=p},t.prototype.bindAndClearTexArray=function(e){for(var t=this.renderer.texture,n=0;n<e.count;n++)t.bind(e.elements[n],e.ids[n]),e.elements[n]=null;e.count=0},t.prototype.updateGeometry=function(){var e=this._packedGeometries,t=this._attributeBuffer,n=this._indexBuffer;H.CAN_UPLOAD_SAME_BUFFER?(e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(n),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(n),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},t.prototype.drawBatches=function(){for(var e=this._dcIndex,n=this.renderer,i=n.gl,r=n.state,s=t._drawCallPool,o=null,a=0;a<e;a++){var l=s[a],u=l.texArray,c=l.type,p=l.size,h=l.start,d=l.blend;o!==u&&(o=u,this.bindAndClearTexArray(u)),this.state.blendMode=d,r.set(this.state),i.drawElements(c,p,i.UNSIGNED_SHORT,2*h)}},t.prototype.flush=function(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},t.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.shader.bind(this._shader),H.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},t.prototype.stop=function(){this.flush()},t.prototype.destroy=function(){for(var t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),e.prototype.destroy.call(this)},t.prototype.getAttributeBuffer=function(e){var t=dt(Math.ceil(e/8)),n=_t(t),i=8*t;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var r=this._aBuffers[i];return r||(this._aBuffers[i]=r=new Qi(i*this.vertexSize*4)),r},t.prototype.getIndexBuffer=function(e){var t=dt(Math.ceil(e/12)),n=_t(t),i=12*t;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var r=this._iBuffers[n];return r||(this._iBuffers[n]=r=new Uint16Array(i)),r},t.prototype.packInterleavedGeometry=function(e,t,n,i,r){for(var s=t.uint32View,o=t.float32View,a=i/this.vertexSize,l=e.uvs,u=e.indices,c=e.vertexData,p=e._texture.baseTexture._batchLocation,h=Math.min(e.worldAlpha,1),d=h<1&&e._texture.baseTexture.alphaMode?ht(e._tintRGB,h):e._tintRGB+(255*h<<24),f=0;f<c.length;f+=2)o[i++]=c[f],o[i++]=c[f+1],o[i++]=l[f],o[i++]=l[f+1],s[i++]=d,o[i++]=p;for(f=0;f<u.length;f++)n[r++]=a+u[f]},t._drawCallPool=[],t._textureArrayPool=[],t}(Xn),er=function(){function e(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},t.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(t.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return e.prototype.generateShader=function(e){if(!this.programCache[e]){for(var t=new Int32Array(e),n=0;n<e;n++)t[n]=n;this.defaultGroupCache[e]=jn.from({uSamplers:t},!0);var i=this.fragTemplate;i=(i=i.replace(/%count%/gi,""+e)).replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new Ei(this.vertexSrc,i)}var r={tint:new Float32Array([1,1,1,1]),translationMatrix:new Yt,default:this.defaultGroupCache[e]};return new Ii(this.programCache[e],r)},e.prototype.generateSampleSrc=function(e){var t="";t+="\n",t+="\n";for(var n=0;n<e;n++)n>0&&(t+="\nelse "),n<e-1&&(t+="if(vTextureId < "+n+".5)"),t+="\n{",t+="\n\tcolor = texture2D(uSamplers["+n+"], vTextureCoord);",t+="\n}";return(t+="\n")+"\n"},e}(),tr=function(e){function t(t){void 0===t&&(t=!1);var n=e.call(this)||this;return n._buffer=new On(null,t,!1),n._indexBuffer=new On(null,t,!0),n.addAttribute("aVertexPosition",n._buffer,2,!1,L.FLOAT).addAttribute("aTextureCoord",n._buffer,2,!1,L.FLOAT).addAttribute("aColor",n._buffer,4,!0,L.UNSIGNED_BYTE).addAttribute("aTextureId",n._buffer,1,!0,L.FLOAT).addIndex(n._indexBuffer),n}return nn(t,e),t}(Dn),nr="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n",ir="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n",rr=function(){function e(){}return e.create=function(e){var t=Object.assign({vertex:nr,fragment:ir,geometryClass:tr,vertexSize:6},e),n=t.vertex,i=t.fragment,r=t.vertexSize,s=t.geometryClass;return function(e){function t(t){var o=e.call(this,t)||this;return o.shaderGenerator=new er(n,i),o.geometryClass=s,o.vertexSize=r,o}return nn(t,e),t}(Zi)},Object.defineProperty(e,"defaultVertexSrc",{get:function(){return nr},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentTemplate",{get:function(){return ir},enumerable:!1,configurable:!0}),e}(),sr=(rr.create(),{}),or=function(e){Object.defineProperty(sr,e,{get:function(){return kt("6.0.0","PIXI.systems."+e+" has moved to PIXI."+e),bn[e]}})};for(var ar in bn)or(ar);var lr={},ur=function(e){Object.defineProperty(lr,e,{get:function(){return kt("6.0.0","PIXI.resources."+e+" has moved to PIXI."+e),zi[e]}})};for(var ar in zi)ur(ar);H.SORTABLE_CHILDREN=!1;var cr=function(){function e(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return e.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},e.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},e.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?Dt.EMPTY:((e=e||new Dt(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},e.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},e.prototype.addPointMatrix=function(e,t){var n=e.a,i=e.b,r=e.c,s=e.d,o=e.tx,a=e.ty,l=n*t.x+r*t.y+o,u=i*t.x+s*t.y+a;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)},e.prototype.addQuad=function(e){var t=this.minX,n=this.minY,i=this.maxX,r=this.maxY,s=e[0],o=e[1];t=s<t?s:t,n=o<n?o:n,i=s>i?s:i,r=o>r?o:r,t=(s=e[2])<t?s:t,n=(o=e[3])<n?o:n,i=s>i?s:i,r=o>r?o:r,t=(s=e[4])<t?s:t,n=(o=e[5])<n?o:n,i=s>i?s:i,r=o>r?o:r,t=(s=e[6])<t?s:t,n=(o=e[7])<n?o:n,i=s>i?s:i,r=o>r?o:r,this.minX=t,this.minY=n,this.maxX=i,this.maxY=r},e.prototype.addFrame=function(e,t,n,i,r){this.addFrameMatrix(e.worldTransform,t,n,i,r)},e.prototype.addFrameMatrix=function(e,t,n,i,r){var s=e.a,o=e.b,a=e.c,l=e.d,u=e.tx,c=e.ty,p=this.minX,h=this.minY,d=this.maxX,f=this.maxY,_=s*t+a*n+u,m=o*t+l*n+c;p=_<p?_:p,h=m<h?m:h,d=_>d?_:d,f=m>f?m:f,p=(_=s*i+a*n+u)<p?_:p,h=(m=o*i+l*n+c)<h?m:h,d=_>d?_:d,f=m>f?m:f,p=(_=s*t+a*r+u)<p?_:p,h=(m=o*t+l*r+c)<h?m:h,d=_>d?_:d,f=m>f?m:f,p=(_=s*i+a*r+u)<p?_:p,h=(m=o*i+l*r+c)<h?m:h,d=_>d?_:d,f=m>f?m:f,this.minX=p,this.minY=h,this.maxX=d,this.maxY=f},e.prototype.addVertexData=function(e,t,n){for(var i=this.minX,r=this.minY,s=this.maxX,o=this.maxY,a=t;a<n;a+=2){var l=e[a],u=e[a+1];i=l<i?l:i,r=u<r?u:r,s=l>s?l:s,o=u>o?u:o}this.minX=i,this.minY=r,this.maxX=s,this.maxY=o},e.prototype.addVertices=function(e,t,n,i){this.addVerticesMatrix(e.worldTransform,t,n,i)},e.prototype.addVerticesMatrix=function(e,t,n,i,r,s){void 0===r&&(r=0),void 0===s&&(s=r);for(var o=e.a,a=e.b,l=e.c,u=e.d,c=e.tx,p=e.ty,h=this.minX,d=this.minY,f=this.maxX,_=this.maxY,m=n;m<i;m+=2){var b=t[m],g=t[m+1],S=o*b+l*g+c,k=u*g+a*b+p;h=Math.min(h,S-r),f=Math.max(f,S+r),d=Math.min(d,k-s),_=Math.max(_,k+s)}this.minX=h,this.minY=d,this.maxX=f,this.maxY=_},e.prototype.addBounds=function(e){var t=this.minX,n=this.minY,i=this.maxX,r=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<n?e.minY:n,this.maxX=e.maxX>i?e.maxX:i,this.maxY=e.maxY>r?e.maxY:r},e.prototype.addBoundsMask=function(e,t){var n=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,r=e.maxX<t.maxX?e.maxX:t.maxX,s=e.maxY<t.maxY?e.maxY:t.maxY;if(n<=r&&i<=s){var o=this.minX,a=this.minY,l=this.maxX,u=this.maxY;this.minX=n<o?n:o,this.minY=i<a?i:a,this.maxX=r>l?r:l,this.maxY=s>u?s:u}},e.prototype.addBoundsMatrix=function(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)},e.prototype.addBoundsArea=function(e,t){var n=e.minX>t.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,r=e.maxX<t.x+t.width?e.maxX:t.x+t.width,s=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(n<=r&&i<=s){var o=this.minX,a=this.minY,l=this.maxX,u=this.maxY;this.minX=n<o?n:o,this.minY=i<a?i:a,this.maxX=r>l?r:l,this.maxY=s>u?s:u}},e.prototype.pad=function(e,t){void 0===e&&(e=0),void 0===t&&(t=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)},e.prototype.addFramePad=function(e,t,n,i,r,s){e-=r,t-=s,n+=r,i+=s,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>n?this.maxX:n,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>i?this.maxY:i},e}(),pr=function(e,t){return(pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function hr(e,t){function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var dr=function(e){function t(){var t=e.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Qt,t.alpha=1,t.visible=!0,t.renderable=!0,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new cr,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}return hr(t,e),t.mixin=function(e){for(var n=Object.keys(e),i=0;i<n.length;++i){var r=n[i];Object.defineProperty(t.prototype,r,Object.getOwnPropertyDescriptor(e,r))}},t.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},t.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},t.prototype.getBounds=function(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||(this._boundsRect||(this._boundsRect=new Dt),t=this._boundsRect),this._bounds.getRectangle(t)},t.prototype.getLocalBounds=function(e){e||(this._localBoundsRect||(this._localBoundsRect=new Dt),e=this._localBoundsRect),this._localBounds||(this._localBounds=new cr);var t=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var i=this._bounds,r=this._boundsID;this._bounds=this._localBounds;var s=this.getBounds(!1,e);return this.parent=n,this.transform=t,this._bounds=i,this._bounds.updateID+=this._boundsID-r,s},t.prototype.toGlobal=function(e,t,n){return void 0===n&&(n=!1),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)},t.prototype.toLocal=function(e,t,n,i){return t&&(e=t.toGlobal(e,n,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,n)},t.prototype.setParent=function(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e},t.prototype.setTransform=function(e,t,n,i,r,s,o,a,l){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===l&&(l=0),this.position.x=e,this.position.y=t,this.scale.x=n||1,this.scale.y=i||1,this.rotation=r,this.skew.x=s,this.skew.y=o,this.pivot.x=a,this.pivot.y=l,this},t.prototype.destroy=function(e){this.parent&&this.parent.removeChild(this),this.removeAllListeners(),this.transform=null,this.parent=null,this._bounds=null,this._mask=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this._destroyed=!0},Object.defineProperty(t.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new fr),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),t.prototype.enableTempParent=function(){var e=this.parent;return this.parent=this._tempDisplayObjectParent,e},t.prototype.disableTempParent=function(e){this.parent=e},Object.defineProperty(t.prototype,"x",{get:function(){return this.position.x},set:function(e){this.transform.position.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.position.y},set:function(e){this.transform.position.y=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.transform.position},set:function(e){this.transform.position.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this.transform.scale},set:function(e){this.transform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(e){this.transform.pivot.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skew",{get:function(){return this.transform.skew},set:function(e){this.transform.skew.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(e){this.transform.rotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this.transform.rotation*Nt},set:function(e){this.transform.rotation=e*Lt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(e){this._zIndex=e,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldVisible",{get:function(){var e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mask",{get:function(){return this._mask},set:function(e){var t;this._mask&&((t=this._mask.maskObject||this._mask).renderable=!0,t.isMask=!1),this._mask=e,this._mask&&((t=this._mask.maskObject||this._mask).renderable=!1,t.isMask=!0)},enumerable:!1,configurable:!0}),t}(st.d),fr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.sortDirty=null,t}return hr(t,e),t}(dr);function _r(e,t){return e.zIndex===t.zIndex?e._lastSortedIndex-t._lastSortedIndex:e.zIndex-t.zIndex}dr.prototype.displayObjectUpdateTransform=dr.prototype.updateTransform;var mr=function(e){function t(){var t=e.call(this)||this;return t.children=[],t.sortableChildren=H.SORTABLE_CHILDREN,t.sortDirty=!1,t}return hr(t,e),t.prototype.onChildrenChange=function(e){},t.prototype.addChild=function(){for(var e=arguments,t=[],n=0;n<arguments.length;n++)t[n]=e[n];if(t.length>1)for(var i=0;i<t.length;i++)this.addChild(t[i]);else{var r=t[0];r.parent&&r.parent.removeChild(r),r.parent=this,this.sortDirty=!0,r.transform._parentID=-1,this.children.push(r),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",r,this,this.children.length-1),r.emit("added",this)}return t[0]},t.prototype.addChildAt=function(e,t){if(t<0||t>this.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e},t.prototype.swapChildren=function(e,t){if(e!==t){var n=this.getChildIndex(e),i=this.getChildIndex(t);this.children[n]=t,this.children[i]=e,this.onChildrenChange(n<i?n:i)}},t.prototype.getChildIndex=function(e){var t=this.children.indexOf(e);if(-1===t)throw new Error("The supplied DisplayObject must be a child of the caller");return t},t.prototype.setChildIndex=function(e,t){if(t<0||t>=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var n=this.getChildIndex(e);mt(this.children,n,1),this.children.splice(t,0,e),this.onChildrenChange(t)},t.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},t.prototype.removeChild=function(){for(var e=arguments,t=[],n=0;n<arguments.length;n++)t[n]=e[n];if(t.length>1)for(var i=0;i<t.length;i++)this.removeChild(t[i]);else{var r=t[0],s=this.children.indexOf(r);if(-1===s)return null;r.parent=null,r.transform._parentID=-1,mt(this.children,s,1),this._boundsID++,this.onChildrenChange(s),r.emit("removed",this),this.emit("childRemoved",r,this,s)}return t[0]},t.prototype.removeChildAt=function(e){var t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,mt(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t},t.prototype.removeChildren=function(e,t){void 0===e&&(e=0),void 0===t&&(t=this.children.length);var n,i=e,r=t-i;if(r>0&&r<=t){n=this.children.splice(i,r);for(var s=0;s<n.length;++s)n[s].parent=null,n[s].transform&&(n[s].transform._parentID=-1);for(this._boundsID++,this.onChildrenChange(e),s=0;s<n.length;++s)n[s].emit("removed",this),this.emit("childRemoved",n[s],this,s);return n}if(0===r&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},t.prototype.sortChildren=function(){for(var e=!1,t=0,n=this.children.length;t<n;++t){var i=this.children[t];i._lastSortedIndex=t,e||0===i.zIndex||(e=!0)}e&&this.children.length>1&&this.children.sort(_r),this.sortDirty=!1},t.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var e=0,t=this.children.length;e<t;++e){var n=this.children[e];n.visible&&n.updateTransform()}},t.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var e=0;e<this.children.length;e++){var t=this.children[e];if(t.visible&&t.renderable)if(t.calculateBounds(),t._mask){var n=t._mask.maskObject||t._mask;n.calculateBounds(),this._bounds.addBoundsMask(t._bounds,n._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID},t.prototype.getLocalBounds=function(t,n){void 0===n&&(n=!1);var i=e.prototype.getLocalBounds.call(this,t);if(!n)for(var r=0,s=this.children.length;r<s;++r){var o=this.children[r];o.visible&&o.updateTransform()}return i},t.prototype._calculateBounds=function(){},t.prototype.render=function(e){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(e);else{this._render(e);for(var t=0,n=this.children.length;t<n;++t)this.children[t].render(e)}},t.prototype.renderAdvanced=function(e){e.batch.flush();var t=this.filters,n=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var i=0;i<t.length;i++)t[i].enabled&&this._enabledFilters.push(t[i]);this._enabledFilters.length&&e.filter.push(this,this._enabledFilters)}n&&e.mask.push(this,this._mask),this._render(e),i=0;for(var r=this.children.length;i<r;i++)this.children[i].render(e);e.batch.flush(),n&&e.mask.pop(this),t&&this._enabledFilters&&this._enabledFilters.length&&e.filter.pop()},t.prototype._render=function(e){},t.prototype.destroy=function(t){e.prototype.destroy.call(this),this.sortDirty=!1;var n="boolean"==typeof t?t:t&&t.children,i=this.removeChildren(0,this.children.length);if(n)for(var r=0;r<i.length;++r)i[r].destroy(t)},Object.defineProperty(t.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(e){var t=this.getLocalBounds().width;this.scale.x=0!==t?e/t:1,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(e){var t=this.getLocalBounds().height;this.scale.y=0!==t?e/t:1,this._height=e},enumerable:!1,configurable:!0}),t}(dr);mr.prototype.containerUpdateTransform=mr.prototype.updateTransform,function(e){e.MITER="miter",e.BEVEL="bevel",e.ROUND="round"}(l||(l={})),function(e){e.BUTT="butt",e.ROUND="round",e.SQUARE="square"}(u||(u={}));var br={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(e,t){if(void 0===t&&(t=20),!this.adaptive||!e||isNaN(e))return t;var n=Math.ceil(e/this.maxLength);return n<this.minSegments?n=this.minSegments:n>this.maxSegments&&(n=this.maxSegments),n}},gr=function(){function e(){this.color=16777215,this.alpha=1,this.texture=En.WHITE,this.matrix=null,this.visible=!1,this.reset()}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},e.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=En.WHITE,this.matrix=null,this.visible=!1},e.prototype.destroy=function(){this.texture=null,this.matrix=null},e}(),Sr=function(e,t){return(Sr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function kr(e,t){function n(){this.constructor=e}Sr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var yr={build:function(e){e.points=e.shape.points.slice()},triangulate:function(e,t){var n=e.points,i=e.holes,r=t.points,s=t.indices;if(n.length>=6){for(var o=[],a=0;a<i.length;a++){var l=i[a];o.push(n.length/2),n=n.concat(l.points)}var u=ot.d(n,o,2);if(!u)return;var c=r.length/2;for(a=0;a<u.length;a+=3)s.push(u[a]+c),s.push(u[a+1]+c),s.push(u[a+2]+c);for(a=0;a<n.length;a++)r.push(n[a])}}},vr={build:function(e){var t,n,i=e.shape,r=e.points,s=i.x,o=i.y;if(r.length=0,e.type===Ot.CIRC)t=i.radius,n=i.radius;else{var a=e.shape;t=a.width,n=a.height}if(0!==t&&0!==n){var l=Math.floor(30*Math.sqrt(i.radius))||Math.floor(15*Math.sqrt(t+n));l/=2.3;for(var u=2*Math.PI/l,c=0;c<l-.5;c++)r.push(s+Math.sin(-u*c)*t,o+Math.cos(-u*c)*n);r.push(r[0],r[1])}},triangulate:function(e,t){var n=e.points,i=t.points,r=t.indices,s=i.length/2,o=s,a=e.shape,l=e.matrix,u=a.x,c=a.y;i.push(e.matrix?l.a*u+l.c*c+l.tx:u,e.matrix?l.b*u+l.d*c+l.ty:c);for(var p=0;p<n.length;p+=2)i.push(n[p],n[p+1]),r.push(s++,o,s)}};function Tr(e,t,n){return e+(t-e)*n}function Er(e,t,n,i,r,s,o){void 0===o&&(o=[]);for(var a=o,l=0,u=0,c=0,p=0,h=0,d=0,f=0,_=0;f<=20;++f)l=Tr(e,n,_=f/20),u=Tr(t,i,_),c=Tr(n,r,_),p=Tr(i,s,_),h=Tr(l,c,_),d=Tr(u,p,_),a.push(h,d);return a}var Ir={build:function(e){var t=e.shape,n=e.points,i=t.x,r=t.y,s=t.width,o=t.height,a=Math.max(0,Math.min(t.radius,Math.min(s,o)/2));n.length=0,a?(Er(i,r+a,i,r,i+a,r,n),Er(i+s-a,r,i+s,r,i+s,r+a,n),Er(i+s,r+o-a,i+s,r+o,i+s-a,r+o,n),Er(i+a,r+o,i,r+o,i,r+o-a,n)):n.push(i,r,i+s,r,i+s,r+o,i,r+o)},triangulate:function(e,t){for(var n=e.points,i=t.points,r=t.indices,s=i.length/2,o=ot.d(n,null,2),a=0,l=o.length;a<l;a+=3)r.push(o[a]+s),r.push(o[a+1]+s),r.push(o[a+2]+s);for(a=0,l=n.length;a<l;a++)i.push(n[a],n[++a])}};function wr(e,t,n,i,r,s,o,a){var l,u;o?(l=i,u=-n):(l=-i,u=n);var c=e-n*r+l,p=t-i*r+u,h=e+n*s+l,d=t+i*s+u;return a.push(c,p),a.push(h,d),2}function xr(e,t,n,i,r,s,o,a){var l=n-e,u=i-t,c=Math.atan2(l,u),p=Math.atan2(r-e,s-t);a&&c<p?c+=2*Math.PI:!a&&c>p&&(p+=2*Math.PI);var h=c,d=p-c,f=Math.abs(d),_=Math.sqrt(l*l+u*u),m=1+(15*f*Math.sqrt(_)/Math.PI|0),b=d/m;if(h+=b,a){o.push(e,t),o.push(n,i);for(var g=1,S=h;g<m;g++,S+=b)o.push(e,t),o.push(e+Math.sin(S)*_,t+Math.cos(S)*_);o.push(e,t),o.push(r,s)}else{for(o.push(n,i),o.push(e,t),g=1,S=h;g<m;g++,S+=b)o.push(e+Math.sin(S)*_,t+Math.cos(S)*_),o.push(e,t);o.push(r,s),o.push(e,t)}return 2*m}function Ar(e,t){e.lineStyle.native?function(e,t){var n=0,i=e.shape,r=e.points||i.points,s=i.type!==Ot.POLY||i.closeStroke;if(0!==r.length){var o=t.points,a=t.indices,l=r.length/2,u=o.length/2,c=u;for(o.push(r[0],r[1]),n=1;n<l;n++)o.push(r[2*n],r[2*n+1]),a.push(c,c+1),c++;s&&a.push(c,u)}}(e,t):function(e,t){var n=e.shape,i=e.points||n.points.slice(),r=t.closePointEps;if(0!==i.length){var s=e.lineStyle,o=new Vt(i[0],i[1]),a=new Vt(i[i.length-2],i[i.length-1]),c=n.type!==Ot.POLY||n.closeStroke,p=Math.abs(o.x-a.x)<r&&Math.abs(o.y-a.y)<r;if(c){i=i.slice(),p&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));var h=.5*(o.x+a.x),d=.5*(a.y+o.y);i.unshift(h,d),i.push(h,d)}var f=t.points,_=i.length/2,m=i.length,b=f.length/2,g=s.width/2,S=g*g,k=s.miterLimit*s.miterLimit,y=i[0],v=i[1],T=i[2],E=i[3],I=0,w=0,x=-(v-E),A=y-T,$=0,O=0,M=Math.sqrt(x*x+A*A);x/=M,A/=M,x*=g,A*=g;var C=s.alignment,R=2*(1-C),N=2*C;c||(s.cap===u.ROUND?m+=xr(y-x*(R-N)*.5,v-A*(R-N)*.5,y-x*R,v-A*R,y+x*N,v+A*N,f,!0)+2:s.cap===u.SQUARE&&(m+=wr(y,v,x,A,R,N,!0,f))),f.push(y-x*R,v-A*R),f.push(y+x*N,v+A*N);for(var L=1;L<_-1;++L){y=i[2*(L-1)],v=i[2*(L-1)+1],T=i[2*L],E=i[2*L+1],I=i[2*(L+1)],w=i[2*(L+1)+1],x=-(v-E),A=y-T,x/=M=Math.sqrt(x*x+A*A),A/=M,x*=g,A*=g,$=-(E-w),O=T-I,$/=M=Math.sqrt($*$+O*O),O/=M,$*=g,O*=g;var D=T-y,P=v-E,F=T-I,B=w-E,j=P*F-B*D,V=j<0;if(Math.abs(j)<.1)f.push(T-x*R,E-A*R),f.push(T+x*N,E+A*N);else{var U=(-x+y)*(-A+E)-(-x+T)*(-A+v),Y=(-$+I)*(-O+E)-(-$+T)*(-O+w),G=(D*Y-F*U)/j,X=(B*U-P*Y)/j,H=(G-T)*(G-T)+(X-E)*(X-E),z=T+(G-T)*R,q=E+(X-E)*R,W=T-(G-T)*N,K=E-(X-E)*N,J=V?R:N;H<=Math.min(D*D+P*P,F*F+B*B)+J*J*S?s.join===l.BEVEL||H/S>k?(V?(f.push(z,q),f.push(T+x*N,E+A*N),f.push(z,q),f.push(T+$*N,E+O*N)):(f.push(T-x*R,E-A*R),f.push(W,K),f.push(T-$*R,E-O*R),f.push(W,K)),m+=2):s.join===l.ROUND?V?(f.push(z,q),f.push(T+x*N,E+A*N),m+=xr(T,E,T+x*N,E+A*N,T+$*N,E+O*N,f,!0)+4,f.push(z,q),f.push(T+$*N,E+O*N)):(f.push(T-x*R,E-A*R),f.push(W,K),m+=xr(T,E,T-x*R,E-A*R,T-$*R,E-O*R,f,!1)+4,f.push(T-$*R,E-O*R),f.push(W,K)):(f.push(z,q),f.push(W,K)):(f.push(T-x*R,E-A*R),f.push(T+x*N,E+A*N),s.join===l.BEVEL||H/S>k||(s.join===l.ROUND?m+=V?xr(T,E,T+x*N,E+A*N,T+$*N,E+O*N,f,!0)+2:xr(T,E,T-x*R,E-A*R,T-$*R,E-O*R,f,!1)+2:(V?(f.push(W,K),f.push(W,K)):(f.push(z,q),f.push(z,q)),m+=2)),f.push(T-$*R,E-O*R),f.push(T+$*N,E+O*N),m+=2)}}y=i[2*(_-2)],v=i[2*(_-2)+1],T=i[2*(_-1)],x=-(v-(E=i[2*(_-1)+1])),A=y-T,x/=M=Math.sqrt(x*x+A*A),A/=M,x*=g,A*=g,f.push(T-x*R,E-A*R),f.push(T+x*N,E+A*N),c||(s.cap===u.ROUND?m+=xr(T-x*(R-N)*.5,E-A*(R-N)*.5,T-x*R,E-A*R,T+x*N,E+A*N,f,!1)+2:s.cap===u.SQUARE&&(m+=wr(T,E,x,A,R,N,!1,f)));var Q=t.indices,Z=br.epsilon*br.epsilon;for(L=b;L<m+b-2;++L)y=f[2*L],v=f[2*L+1],T=f[2*(L+1)],E=f[2*(L+1)+1],I=f[2*(L+2)],w=f[2*(L+2)+1],Math.abs(y*(E-w)+T*(w-v)+I*(v-E))<Z||Q.push(L,L+1,L+2)}}(e,t)}var $r,Or=function(){function e(){}return e.curveTo=function(e,t,n,i,r,s){var o=s[s.length-2],a=s[s.length-1]-t,l=o-e,u=i-t,c=n-e,p=Math.abs(a*c-l*u);if(p<1e-8||0===r)return s[s.length-2]===e&&s[s.length-1]===t||s.push(e,t),null;var h=a*a+l*l,d=u*u+c*c,f=a*u+l*c,_=r*Math.sqrt(h)/p,m=r*Math.sqrt(d)/p,b=_*f/h,g=m*f/d,S=_*c+m*l,k=_*u+m*a,y=l*(m+b),v=a*(m+b),T=c*(_+g),E=u*(_+g);return{cx:S+e,cy:k+t,radius:r,startAngle:Math.atan2(v-k,y-S),endAngle:Math.atan2(E-k,T-S),anticlockwise:l*u>c*a}},e.arc=function(e,t,n,i,r,s,o,a,l){for(var u=o-s,c=br._segmentsCount(Math.abs(u)*r,40*Math.ceil(Math.abs(u)/Rt)),p=u/(2*c),h=2*p,d=Math.cos(p),f=Math.sin(p),_=c-1,m=_%1/_,b=0;b<=_;++b){var g=p+s+h*(b+m*b),S=Math.cos(g),k=-Math.sin(g);l.push((d*S+f*k)*r+n,(d*-k+f*S)*r+i)}},e}(),Mr=function(){function e(){}return e.curveLength=function(e,t,n,i,r,s,o,a){for(var l=0,u=0,c=0,p=0,h=0,d=0,f=0,_=0,m=0,b=0,g=0,S=e,k=t,y=1;y<=10;++y)b=S-(_=(f=(d=(h=1-(u=y/10))*h)*h)*e+3*d*u*n+3*h*(c=u*u)*r+(p=c*u)*o),g=k-(m=f*t+3*d*u*i+3*h*c*s+p*a),S=_,k=m,l+=Math.sqrt(b*b+g*g);return l},e.curveTo=function(t,n,i,r,s,o,a){var l=a[a.length-2],u=a[a.length-1];a.length-=2;var c=br._segmentsCount(e.curveLength(l,u,t,n,i,r,s,o)),p=0,h=0,d=0,f=0,_=0;a.push(l,u);for(var m=1,b=0;m<=c;++m)d=(h=(p=1-(b=m/c))*p)*p,_=(f=b*b)*b,a.push(d*l+3*h*b*t+3*p*f*i+_*s,d*u+3*h*b*n+3*p*f*r+_*o)},e}(),Cr=function(){function e(){}return e.curveLength=function(e,t,n,i,r,s){var o=e-2*n+r,a=t-2*i+s,l=2*n-2*e,u=2*i-2*t,c=4*(o*o+a*a),p=4*(o*l+a*u),h=l*l+u*u,d=2*Math.sqrt(c+p+h),f=Math.sqrt(c),_=2*c*f,m=2*Math.sqrt(h),b=p/f;return(_*d+f*p*(d-m)+(4*h*c-p*p)*Math.log((2*f+b+d)/(b+m)))/(4*_)},e.curveTo=function(t,n,i,r,s){for(var o=s[s.length-2],a=s[s.length-1],l=br._segmentsCount(e.curveLength(o,a,t,n,i,r)),u=0,c=0,p=1;p<=l;++p){var h=p/l;u=o+(t-o)*h,c=a+(n-a)*h,s.push(u+(t+(i-t)*h-u)*h,c+(n+(r-n)*h-c)*h)}},e}(),Rr=function(){function e(){this.reset()}return e.prototype.begin=function(e,t,n){this.reset(),this.style=e,this.start=t,this.attribStart=n},e.prototype.end=function(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start},e.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},e}(),Nr=(($r={})[Ot.POLY]=yr,$r[Ot.CIRC]=vr,$r[Ot.ELIP]=vr,$r[Ot.RECT]={build:function(e){var t=e.shape,n=t.x,i=t.y,r=t.width,s=t.height,o=e.points;o.length=0,o.push(n,i,n+r,i,n+r,i+s,n,i+s)},triangulate:function(e,t){var n=e.points,i=t.points,r=i.length/2;i.push(n[0],n[1],n[2],n[3],n[6],n[7],n[4],n[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},$r[Ot.RREC]=Ir,$r),Lr=[],Dr=[],Pr=function(){function e(e,t,n,i){void 0===t&&(t=null),void 0===n&&(n=null),void 0===i&&(i=null),this.shape=e,this.lineStyle=n,this.fillStyle=t,this.matrix=i,this.type=e.type,this.points=[],this.holes=[]}return e.prototype.clone=function(){return new e(this.shape,this.fillStyle,this.lineStyle,this.matrix)},e.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},e}(),Fr=new Vt,Br=new cr,jr=function(e){function t(){var t=e.call(this)||this;return t.uvsFloat32=null,t.indicesUint16=null,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.dirty=0,t.batchDirty=-1,t.cacheDirty=-1,t.clearDirty=0,t.drawCalls=[],t.batches=[],t.shapeIndex=0,t._bounds=new cr,t.boundsDirty=-1,t.boundsPadding=0,t.batchable=!1,t.indicesUint16=null,t.uvsFloat32=null,t.closePointEps=1e-4,t}return kr(t,e),Object.defineProperty(t.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),t.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),Dr.push(this.drawCalls[e]);for(this.drawCalls.length=0,e=0;e<this.batches.length;e++){var t=this.batches[e];t.reset(),Lr.push(t)}this.batches.length=0},t.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},t.prototype.drawShape=function(e,t,n,i){void 0===t&&(t=null),void 0===n&&(n=null),void 0===i&&(i=null);var r=new Pr(e,t,n,i);return this.graphicsData.push(r),this.dirty++,this},t.prototype.drawHole=function(e,t){if(void 0===t&&(t=null),!this.graphicsData.length)return null;var n=new Pr(e,null,null,t),i=this.graphicsData[this.graphicsData.length-1];return n.lineStyle=i.lineStyle,i.holes.push(n),this.dirty++,this},t.prototype.destroy=function(){e.prototype.destroy.call(this);for(var t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},t.prototype.containsPoint=function(e){for(var t=this.graphicsData,n=0;n<t.length;++n){var i=t[n];if(i.fillStyle.visible&&i.shape&&(i.matrix?i.matrix.applyInverse(e,Fr):Fr.copyFrom(e),i.shape.contains(Fr.x,Fr.y))){var r=!1;if(i.holes)for(var s=0;s<i.holes.length;s++)if(i.holes[s].shape.contains(Fr.x,Fr.y)){r=!0;break}if(!r)return!0}}return!1},t.prototype.updateBatches=function(e){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,n=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<n.length;s++){this.shapeIndex++;var o=n[s],a=o.fillStyle,l=o.lineStyle;Nr[o.type].build(o),o.matrix&&this.transformPoints(o.points,o.matrix);for(var u=0;u<2;u++){var c=0===u?a:l;if(c.visible){var p=c.texture.baseTexture,h=this.indices.length,d=this.points.length/2;p.wrapMode=P.REPEAT,0===u?this.processFill(o):this.processLine(o);var f=this.points.length/2-d;0!==f&&(i&&!this._compareStyles(r,c)&&(i.end(h,d),i=null),i||((i=Lr.pop()||new Rr).begin(c,h,d),this.batches.push(i),r=c),this.addUvs(this.points,t,c.texture,d,f,c.matrix))}}}var _=this.indices.length,m=this.points.length/2;if(i&&i.end(_,m),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=m>65535&&e;this.indicesUint16=b?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},t.prototype._compareStyles=function(e,t){return!(!e||!t)&&e.texture.baseTexture===t.texture.baseTexture&&e.color+e.alpha===t.color+t.alpha&&!!e.native==!!t.native},t.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var e=0,t=this.graphicsData.length;e<t;e++){var n=this.graphicsData[e],i=n.fillStyle,r=n.lineStyle;if(i&&!i.texture.baseTexture.valid)return!1;if(r&&!r.texture.baseTexture.valid)return!1}return!0},t.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var e=this.batches,t=0,n=e.length;t<n;t++)for(var i=e[t],r=0;r<i.size;r++){var s=i.start+r;this.indicesUint16[s]=this.indicesUint16[s]-i.attribStart}},t.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var e=this.batches,n=0;n<e.length;n++)if(e[n].style.native)return!1;return this.points.length<2*t.BATCHABLE_SIZE},t.prototype.buildDrawCalls=function(){for(var e=++an._globalBatch,t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Dr.push(this.drawCalls[t]);this.drawCalls.length=0;var n=this.colors,i=this.textureIds,r=Dr.pop();r||((r=new Ki).texArray=new Ji),r.texArray.count=0,r.start=0,r.size=0,r.type=C.TRIANGLES;var s=0,o=null,a=0,l=!1,u=C.TRIANGLES,c=0;for(this.drawCalls.push(r),t=0;t<this.batches.length;t++){var p=this.batches[t],h=p.style,d=h.texture.baseTexture;l!==!!h.native&&(u=(l=!!h.native)?C.LINES:C.TRIANGLES,o=null,s=8,e++),o!==d&&(o=d,d._batchEnabled!==e&&(8===s&&(e++,s=0,r.size>0&&((r=Dr.pop())||((r=new Ki).texArray=new Ji),this.drawCalls.push(r)),r.start=c,r.size=0,r.texArray.count=0,r.type=u),d.touched=1,d._batchEnabled=e,d._batchLocation=s,d.wrapMode=10497,r.texArray.elements[r.texArray.count++]=d,s++)),r.size+=p.size,c+=p.size,a=d._batchLocation,this.addColors(n,h.color,h.alpha,p.attribSize),this.addTextureIds(i,a,p.attribSize)}an._globalBatch=e,this.packAttributes()},t.prototype.packAttributes=function(){for(var e=this.points,t=this.uvs,n=this.colors,i=this.textureIds,r=new ArrayBuffer(3*e.length*4),s=new Float32Array(r),o=new Uint32Array(r),a=0,l=0;l<e.length/2;l++)s[a++]=e[2*l],s[a++]=e[2*l+1],s[a++]=t[2*l],s[a++]=t[2*l+1],o[a++]=n[l],s[a++]=i[l];this._buffer.update(r),this._indexBuffer.update(this.indicesUint16)},t.prototype.processFill=function(e){e.holes.length?(this.processHoles(e.holes),yr.triangulate(e,this)):Nr[e.type].triangulate(e,this)},t.prototype.processLine=function(e){Ar(e,this);for(var t=0;t<e.holes.length;t++)Ar(e.holes[t],this)},t.prototype.processHoles=function(e){for(var t=0;t<e.length;t++){var n=e[t];Nr[n.type].build(n),n.matrix&&this.transformPoints(n.points,n.matrix)}},t.prototype.calculateBounds=function(){var e=this._bounds,t=Br,n=Yt.IDENTITY;this._bounds.clear(),t.clear();for(var i=0;i<this.graphicsData.length;i++){var r=this.graphicsData[i],s=r.shape,o=r.type,a=r.lineStyle,l=r.matrix||Yt.IDENTITY,u=0;if(a&&a.visible){var c=a.alignment;u=a.width,o===Ot.POLY?u*=.5+Math.abs(.5-c):u*=Math.max(0,c)}if(n!==l&&(t.isEmpty()||(e.addBoundsMatrix(t,n),t.clear()),n=l),o===Ot.RECT||o===Ot.RREC){var p=s;t.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(o===Ot.CIRC){var h=s;t.addFramePad(h.x,h.y,h.x,h.y,h.radius+u,h.radius+u)}else if(o===Ot.ELIP){var d=s;t.addFramePad(d.x,d.y,d.x,d.y,d.width+u,d.height+u)}else{var f=s;e.addVerticesMatrix(n,f.points,0,f.points.length,u,u)}}t.isEmpty()||e.addBoundsMatrix(t,n),e.pad(this.boundsPadding,this.boundsPadding)},t.prototype.transformPoints=function(e,t){for(var n=0;n<e.length/2;n++){var i=e[2*n],r=e[2*n+1];e[2*n]=t.a*i+t.c*r+t.tx,e[2*n+1]=t.b*i+t.d*r+t.ty}},t.prototype.addColors=function(e,t,n,i){for(var r=ht((t>>16)+(65280&t)+((255&t)<<16),n);i-- >0;)e.push(r)},t.prototype.addTextureIds=function(e,t,n){for(;n-- >0;)e.push(t)},t.prototype.addUvs=function(e,t,n,i,r,s){void 0===s&&(s=null);for(var o=0,a=t.length,l=n.frame;o<r;){var u=e[2*(i+o)],c=e[2*(i+o)+1];if(s){var p=s.a*u+s.c*c+s.tx;c=s.b*u+s.d*c+s.ty,u=p}o++,t.push(u/l.width,c/l.height)}var h=n.baseTexture;(l.width<h.width||l.height<h.height)&&this.adjustUvs(t,n,a,r)},t.prototype.adjustUvs=function(e,t,n,i){for(var r=t.baseTexture,s=n+2*i,o=t.frame,a=o.width/r.width,l=o.height/r.height,u=o.x/o.width,c=o.y/o.height,p=Math.floor(e[n]+1e-6),h=Math.floor(e[n+1]+1e-6),d=n+2;d<s;d+=2)p=Math.min(p,Math.floor(e[d]+1e-6)),h=Math.min(h,Math.floor(e[d+1]+1e-6));for(u-=p,c-=h,d=n;d<s;d+=2)e[d]=(e[d]+u)*a,e[d+1]=(e[d+1]+c)*l},t.BATCHABLE_SIZE=100,t}(tr),Vr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.width=0,t.alignment=.5,t.native=!1,t.cap=u.BUTT,t.join=l.MITER,t.miterLimit=10,t}return kr(t,e),t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e},t.prototype.reset=function(){e.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},t}(gr),Ur=new Float32Array(3),Yr={},Gr=function(e){function t(t){void 0===t&&(t=null);var n=e.call(this)||this;return n._geometry=t||new jr,n._geometry.refCount++,n.shader=null,n.state=wi.for2d(),n._fillStyle=new gr,n._lineStyle=new Vr,n._matrix=null,n._holeMode=!1,n.currentPath=null,n.batches=[],n.batchTint=-1,n.batchDirty=-1,n.vertexData=null,n.pluginName="batch",n._transformID=-1,n.tint=16777215,n.blendMode=M.NORMAL,n}return kr(t,e),Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return this.finishPoly(),new t(this._geometry)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),t.prototype.lineStyle=function(e,t,n,i,r){return void 0===e&&(e=null),void 0===t&&(t=0),void 0===n&&(n=1),void 0===i&&(i=.5),void 0===r&&(r=!1),"number"==typeof e&&(e={width:e,color:t,alpha:n,alignment:i,native:r}),this.lineTextureStyle(e)},t.prototype.lineTextureStyle=function(e){e=Object.assign({width:0,texture:En.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:u.BUTT,join:l.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var t=e.width>0&&e.alpha>0;return t?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:t},e)):this._lineStyle.reset(),this},t.prototype.startPoly=function(){if(this.currentPath){var e=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new Bt,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new Bt,this.currentPath.closeStroke=!1},t.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},t.prototype.moveTo=function(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this},t.prototype.lineTo=function(e,t){this.currentPath||this.moveTo(0,0);var n=this.currentPath.points,i=n[n.length-2],r=n[n.length-1];return i===e&&r===t||n.push(e,t),this},t.prototype._initCurve=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[e,t]):this.moveTo(e,t)},t.prototype.quadraticCurveTo=function(e,t,n,i){this._initCurve();var r=this.currentPath.points;return 0===r.length&&this.moveTo(0,0),Cr.curveTo(e,t,n,i,r),this},t.prototype.bezierCurveTo=function(e,t,n,i,r,s){return this._initCurve(),Mr.curveTo(e,t,n,i,r,s,this.currentPath.points),this},t.prototype.arcTo=function(e,t,n,i,r){this._initCurve(e,t);var s=this.currentPath.points,o=Or.curveTo(e,t,n,i,r,s);if(o){var a=o.cx,l=o.cy,u=o.radius,c=o.startAngle,p=o.endAngle,h=o.anticlockwise;this.arc(a,l,u,c,p,h)}return this},t.prototype.arc=function(e,t,n,i,r,s){if(void 0===s&&(s=!1),i===r)return this;if(!s&&r<=i?r+=Rt:s&&i<=r&&(i+=Rt),0==r-i)return this;var o=e+Math.cos(i)*n,a=t+Math.sin(i)*n,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var c=Math.abs(u[u.length-2]-o),p=Math.abs(u[u.length-1]-a);c<l&&p<l||u.push(o,a)}else this.moveTo(o,a),u=this.currentPath.points;return Or.arc(o,a,e,t,n,i,r,s,u),this},t.prototype.beginFill=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=1),this.beginTextureFill({texture:En.WHITE,color:e,alpha:t})},t.prototype.beginTextureFill=function(e){e=Object.assign({texture:En.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var t=e.alpha>0;return t?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:t},e)):this._fillStyle.reset(),this},t.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},t.prototype.drawRect=function(e,t,n,i){return this.drawShape(new Dt(e,t,n,i))},t.prototype.drawRoundedRect=function(e,t,n,i,r){return this.drawShape(new jt(e,t,n,i,r))},t.prototype.drawCircle=function(e,t,n){return this.drawShape(new Pt(e,t,n))},t.prototype.drawEllipse=function(e,t,n,i){return this.drawShape(new Ft(e,t,n,i))},t.prototype.drawPolygon=function(){for(var e,t=arguments,n=[],i=0;i<arguments.length;i++)n[i]=t[i];var r=!0,s=n[0];s.points?(r=s.closeStroke,e=s.points):e=Array.isArray(n[0])?n[0]:n;var o=new Bt(e);return o.closeStroke=r,this.drawShape(o),this},t.prototype.drawShape=function(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},t.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},t.prototype.isFastRect=function(){var e=this._geometry.graphicsData;return 1===e.length&&e[0].shape.type===Ot.RECT&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)},t.prototype._render=function(e){this.finishPoly();var t=this._geometry,n=e.context.supports.uint32Indices;t.updateBatches(n),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))},t.prototype._populateBatches=function(){var e=this._geometry,t=this.blendMode,n=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=n,this.vertexData=new Float32Array(e.points);for(var i=0;i<n;i++){var r=e.batches[i],s=r.style.color,o=new Float32Array(this.vertexData.buffer,4*r.attribStart*2,2*r.attribSize),a=new Float32Array(e.uvsFloat32.buffer,4*r.attribStart*2,2*r.attribSize),l={vertexData:o,blendMode:t,indices:new Uint16Array(e.indicesUint16.buffer,2*r.start,r.size),uvs:a,_batchRGB:ct(s),_tintRGB:s,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[i]=l}},t.prototype._renderBatched=function(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var t=0,n=this.batches.length;t<n;t++){var i=this.batches[t];i.worldAlpha=this.worldAlpha*i.alpha,e.plugins[this.pluginName].render(i)}}},t.prototype._renderDirect=function(e){var t=this._resolveDirectShader(e),n=this._geometry,i=this.tint,r=this.worldAlpha,s=t.uniforms,o=n.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(i>>16&255)/255*r,s.tint[1]=(i>>8&255)/255*r,s.tint[2]=(255&i)/255*r,s.tint[3]=r,e.shader.bind(t),e.geometry.bind(n,t),e.state.set(this.state);for(var a=0,l=o.length;a<l;a++)this._renderDrawCallDirect(e,n.drawCalls[a])},t.prototype._renderDrawCallDirect=function(e,t){for(var n=t.texArray,i=t.type,r=t.size,s=t.start,o=n.count,a=0;a<o;a++)e.texture.bind(n.elements[a],a);e.geometry.draw(i,r,s)},t.prototype._resolveDirectShader=function(e){var t=this.shader,n=this.pluginName;if(!t){if(!Yr[n]){for(var i=e.plugins.batch.MAX_TEXTURES,r=new Int32Array(i),s=0;s<i;s++)r[s]=s;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Yt,default:jn.from({uSamplers:r},!0)},a=e.plugins[n]._shader.program;Yr[n]=new Ii(a,o)}t=Yr[n]}return t},t.prototype._calculateBounds=function(){this.finishPoly();var e=this._geometry;if(e.graphicsData.length){var t=e.bounds,n=t.minX,i=t.minY,r=t.maxX,s=t.maxY;this._bounds.addFrame(this.transform,n,i,r,s)}},t.prototype.containsPoint=function(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)},t.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var e=ct(this.tint,Ur),t=0;t<this.batches.length;t++){var n=this.batches[t],i=n._batchRGB,r=(e[0]*i[0]*255<<16)+(e[1]*i[1]*255<<8)+(0|e[2]*i[2]*255);n._tintRGB=(r>>16)+(65280&r)+((255&r)<<16)}}},t.prototype.calculateVertices=function(){var e=this.transform._worldID;if(this._transformID!==e){this._transformID=e;for(var t=this.transform.worldTransform,n=t.a,i=t.b,r=t.c,s=t.d,o=t.tx,a=t.ty,l=this._geometry.points,u=this.vertexData,c=0,p=0;p<l.length;p+=2){var h=l[p],d=l[p+1];u[c++]=n*h+r*d+o,u[c++]=s*d+i*h+a}}},t.prototype.closePath=function(){var e=this.currentPath;return e&&(e.closeStroke=!0),this},t.prototype.setMatrix=function(e){return this._matrix=e,this},t.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},t.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},t.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,e.prototype.destroy.call(this,t)},t._TEMP_POINT=new Vt,t}(mr),Xr=c&&c.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Hr=function(e){function t(t,n,i){void 0===n&&(n={});var r=e.call(this)||this;r.graphicsOptions={x:0,y:0,width:100,height:100,fill:0,lineWidth:1,lineColor:16777215},r.graphicsOptions=Object.assign(r.graphicsOptions,t),r.physicsOptions=n;var s=r.graphicsOptions.width/2,o=r.graphicsOptions.height/2;return r.pivot.x=s,r.pivot.y=o,r._update=i,r.graphicsOptions.radius?r._body=a.Bodies.circle(r.graphicsOptions.x,r.graphicsOptions.y,r.graphicsOptions.radius,r.physicsOptions):r._body=a.Bodies.rectangle(r.graphicsOptions.x+s,r.graphicsOptions.y+o,r.graphicsOptions.width,r.graphicsOptions.height,r.physicsOptions),r}return Xr(t,e),Object.defineProperty(t.prototype,"body",{get:function(){return this._body},enumerable:!1,configurable:!0}),t.prototype.update=function(){this._update({position:this._body.position,rotation:this._body.angle})},t}(window.PIXI?window.PIXI.Graphics:Gr);c.PhysicsGraphics=Hr;var zr=o&&o.__assign||function(){return(zr=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},qr=o&&o.__spreadArray||function(e,t){for(var n=0,i=t.length,r=e.length;n<i;n++,r++)e[r]=t[n];return e};function Wr(e,t){return window[t]?Promise.resolve(window[t]):new Promise((function(n,i){var r=document.createElement("script");r.onload=function(){n(t&&window[t])},r.onerror=function(e){r.onload=null,r.onerror=null,document.body.removeChild(r),i(e)},r.src=e,r.async=!0,document.body.appendChild(r)}))}o.loadScript=Wr;o.resetPygameZero=function(e){e.App&&(e.App.destroy({removeView:!0}),window.PIXI.loader.destroy(),e.App=null,e.timerMap.forEach((function(e,t){window.clearInterval(e),window.clearTimeout(e)})),e.timerMap.clear(),e.soundMap={},e.music.pause(),e.music=null,e.music=new Audio,Object.keys(e.windowListener).map((function(t){var n=t.replace("Listener","");window.removeEventListener(n,e.windowListener[t])})))};var Kr={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#FF00FF",gray:"#808080",green:"#008000",lime:"#00FF00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#FFA500",purple:"#800080",red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"};o.ColorNameMap=Kr;o.translateTools=function(e){Math.round(e.view.width/2),Math.round(e.view.height/2);var t={transX:function(e,t){return void 0===t&&(t=!1),e},transY:function(e,t){return void 0===t&&(t=!1),e},transPos:function(e,n){return void 0===n&&(n=!1),e?[t.transX(e[0],n),t.transY(e[1],n)]:e},transColor:function(e){return Array.isArray(e)?window.PIXI.utils.rgb2hex(e):e.match("#")?window.PIXI.utils.string2hex(e):Kr[e]?window.PIXI.utils.string2hex(Kr[e]):16777215}};return t},o.hitTestRectangle=function(e,t){Array.isArray(t)&&(t.x=t[0],t.y=t[1],t.width=0,t.height=0),e.centerX=e.x+e.width/2,e.centerY=e.y+e.height/2,t.centerX=t.x+t.width/2,t.centerY=t.y+t.height/2,e.halfWidth=e.width/2,e.halfHeight=e.height/2,t.halfWidth=t.width/2,t.halfHeight=t.height/2;var n=e.centerX-t.centerX,i=e.centerY-t.centerY,r=e.halfWidth+t.halfWidth,s=e.halfHeight+t.halfHeight;return Math.abs(n)<r&&Math.abs(i)<s};var Jr={};o.textureRecources=function(e){function t(e){var t;return Array.isArray(e)&&(t=qr([],e),e=t[0]),new Promise((function(n,i){window.PIXI.utils.TextureCache[e]?n(window.PIXI.utils.TextureCache[e]):window.PIXI.loader.add(t||e).load((function(){var t=window.PIXI.loader.resources[e].texture;n(t)}))}))}return/\.json$/.test(e)?Jr[e]?t(Jr[e]):fetch(e).then((function(e){return e.json()})).then((function(n){var i=e.replace("index.json",""),r=n.map((function(e){return i+e}));return Jr[e]=r,t(r)})):t(e)};var Qr=window.Sk;function Zr(e,t){var n=function(n){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];t||(i=new Qr.builtins.tuple(i));var s=new Qr.builtin.dict(n);return e(i,s)};return n.co_kwargs=!0,n}o.defineGetter=function(e){return Qr.misceval.callsimOrSuspend(Qr.builtins.property,new Qr.builtin.func(e),new Qr.builtin.func((function(){})))},o.genkwaFunc=Zr;var es=function(e,t){return Qr.misceval.callsimOrSuspend(Qr.builtins.property,new Qr.builtin.func((function(n){return"function"==typeof e?e(n):Qr.ffi.remapToPy(n[e][t])})),new Qr.builtin.func((function(n,i){"function"==typeof t?t(n,i):n[e][t]=i.v})))};o.defineProperty=es;o.upgradeGraphics=function(e,t,n,i){return new Qr.builtin.func((function(t){for(var r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];return Qr.misceval.callsimOrSuspend(Qr.misceval.buildClass(e,(function(e,s){s.__init__=new Qr.builtin.func((function(e){e.graph=new window.PIXI.Graphics;var n=e.graph;i.apply(void 0,qr([t,n],r));var s=e.graph.width/2,o=e.graph.height/2,a=e.graph.graphicsData[0].shape.x,l=e.graph.graphicsData[0].shape.y;e.graph.isCircle?(e.graph.pivot.set(2*s,2*o),e.graph.position.set(2*s,2*s)):(e.graph.pivot.set(a+s,l+o),e.graph.position.set(a+s,l+o))})),s.rotation=es((function(e){return Qr.ffi.remapToPy(e.rotation)}),(function(e,t){e.physicGraphics?a.Body.setAngle(e.physicGraphics._body,t.v):e.graph.rotation=t.v})),s.physicsImpostor=new Qr.builtin.func(Zr((function(e,t){t=Qr.ffi.remapToJs(t);var i=e[0],r=e[1],s=e[2];r=Qr.ffi.remapToJs(r||t.is_static)||!1;var o=!1;s=Qr.ffi.remapToJs(s||t.physicsOptions)||{};var l=i.graph,u=l.graphicsData,c=l.width,p=l.height,h=l.line,d=l.rotation,f={};i.graph.isCircle&&(o=!0,f.radius=u[0].shape.radius),i.graph.isFilled&&(f.fill=u[0].fillStyle.color),i.physicGraphics=new Hr(zr({x:u[0].shape.x,y:u[0].shape.y,width:c,height:p,lineWidth:h.width,lineColor:h.color},f),zr({isCircle:o,isStatic:r},s),(function(e){var t=e.position,n=e.rotation;i.graph.position=t,i.graph.rotation=n})),a.Body.setAngle(i.physicGraphics._body,d),n.addToWorld(i.physicGraphics)}),!0))})))}))};t({scripts:{start:"parcel build src/main.ts && parcel src/pygame-zero.ts -d ./dist",server:"node server.js",build:"parcel build src/main.ts --experimental-scope-hoisting --no-source-maps && parcel build src/pygame-zero.ts --no-source-maps"},name:"skulpt-pygame-zero",description:"This module provides most of the functions of pygame-zero for skulpt",version:"0.3.4-alpha2",main:"dist/main.js",files:["lib","dist","*.d.ts","README.md","README-zh.md"],devDependencies:{"alphanum-sort":"^1.0.2","ansi-styles":"^3.2.1",argparse:"^1.0.10",boolbase:"^1.0.0",browserslist:"^4.16.3","call-bind":"^1.0.2","caller-callsite":"^2.0.0","caller-path":"^2.0.0",callsites:"^2.0.0","caniuse-api":"^3.0.0","caniuse-lite":"^1.0.30001194",chalk:"^2.4.2",coa:"^2.0.2",color:"^3.1.3","color-convert":"^1.9.3","color-name":"^1.1.3","color-string":"^1.5.4",colorette:"^1.2.2",cosmiconfig:"^5.2.1","css-color-names":"^0.0.4","css-declaration-sorter":"^4.0.1","css-select":"^2.1.0","css-select-base-adapter":"^0.1.1","css-tree":"^1.0.0-alpha.37","css-what":"^3.4.2",cssesc:"^3.0.0","cssnano-preset-default":"^4.0.7","cssnano-util-get-arguments":"^4.0.0","cssnano-util-get-match":"^4.0.0","cssnano-util-raw-cache":"^4.0.1","cssnano-util-same-parent":"^4.0.1",csso:"^4.2.0","define-properties":"^1.1.3","dom-serializer":"^0.2.2",domelementtype:"^1.3.1",domutils:"^1.7.0","dot-prop":"^5.3.0","electron-to-chromium":"^1.3.678",entities:"^2.2.0","error-ex":"^1.3.2","es-abstract":"^1.18.0-next.3","es-to-primitive":"^1.2.1",escalade:"^3.1.1","escape-string-regexp":"^1.0.5",esprima:"^4.0.1","function-bind":"^1.1.1","get-intrinsic":"^1.1.1",has:"^1.0.3","has-bigints":"^1.0.1","has-flag":"^3.0.0","has-symbols":"^1.0.2","hex-color-regex":"^1.1.0","hsl-regex":"^1.0.0","hsla-regex":"^1.0.0","html-comment-regex":"^1.1.2","import-fresh":"^2.0.0","indexes-of":"^1.0.1","is-absolute-url":"^2.1.0","is-arrayish":"^0.2.1","is-bigint":"^1.0.1","is-boolean-object":"^1.1.0","is-callable":"^1.2.3","is-color-stop":"^1.1.0","is-date-object":"^1.0.2","is-directory":"^0.3.1","is-negative-zero":"^2.0.1","is-number-object":"^1.0.4","is-obj":"^2.0.0","is-regex":"^1.1.2","is-resolvable":"^1.1.0","is-string":"^1.0.5","is-svg":"^3.0.0","is-symbol":"^1.0.3","js-yaml":"^3.14.1","json-parse-better-errors":"^1.0.2","lodash.memoize":"^4.1.2","lodash.uniq":"^4.5.0","matter-js":"^0.16.1","mdn-data":"^2.0.4",minimist:"^1.2.5",mkdirp:"^0.5.5","node-releases":"^1.1.71","normalize-url":"^3.3.0","nth-check":"^1.0.2","object-inspect":"^1.9.0","object-keys":"^1.1.1","object.assign":"^4.1.2","object.getownpropertydescriptors":"^2.1.2","object.values":"^1.1.3","parse-json":"^4.0.0",postcss:"^7.0.35","postcss-calc":"^7.0.5","postcss-colormin":"^4.0.3","postcss-convert-values":"^4.0.1","postcss-discard-comments":"^4.0.2","postcss-discard-duplicates":"^4.0.2","postcss-discard-empty":"^4.0.1","postcss-discard-overridden":"^4.0.1","postcss-merge-longhand":"^4.0.11","postcss-merge-rules":"^4.0.3","postcss-minify-font-values":"^4.0.2","postcss-minify-gradients":"^4.0.2","postcss-minify-params":"^4.0.2","postcss-minify-selectors":"^4.0.2","postcss-normalize-charset":"^4.0.1","postcss-normalize-display-values":"^4.0.2","postcss-normalize-positions":"^4.0.2","postcss-normalize-repeat-style":"^4.0.2","postcss-normalize-string":"^4.0.2","postcss-normalize-timing-functions":"^4.0.2","postcss-normalize-unicode":"^4.0.1","postcss-normalize-url":"^4.0.1","postcss-normalize-whitespace":"^4.0.2","postcss-ordered-values":"^4.1.2","postcss-reduce-initial":"^4.0.3","postcss-reduce-transforms":"^4.0.2","postcss-selector-parser":"^3.1.2","postcss-svgo":"^4.0.2","postcss-unique-selectors":"^4.0.1","postcss-value-parser":"^3.3.1",q:"^1.5.1","resolve-from":"^3.0.0","rgb-regex":"^1.0.1","rgba-regex":"^1.0.0",sax:"^1.2.4","simple-swizzle":"^0.2.2","source-map":"^0.6.1","sprintf-js":"^1.0.3",stable:"^0.1.8","string.prototype.trimend":"^1.0.4","string.prototype.trimstart":"^1.0.4",stylehacks:"^4.0.3","supports-color":"^6.1.0",svgo:"^1.3.2",timsort:"^0.3.0",typescript:"^4.2.3","unbox-primitive":"^1.0.0",uniq:"^1.0.1",uniqs:"^2.0.0",unquote:"^1.1.1","util-deprecate":"^1.0.2","util.promisify":"^1.0.1",vendors:"^1.0.4","which-boxed-primitive":"^1.0.2"},repository:{type:"git",url:"git+https://github.com/lipten/skulpt-pygame-zero.git"},keywords:[],author:"",license:"ISC",bugs:{url:"https://github.com/lipten/skulpt-pygame-zero/issues"},homepage:"https://github.com/lipten/skulpt-pygame-zero#readme",_id:"skulpt-pygame-zero@0.2.3-alpha3",dependencies:{"@pixi/graphics":"^6.0.1"}});var ts=window.Sk,ns={"./pgzrun/__init__.js":"https://cdn.jsdelivr.net/gh/LIAO-wanting/skulpt_pj@main/src/pgzhelper/pygamezero.js"},is={usePyGameZero:function(e){var t=this;return function(n){return t.matchModelName(n)?t.load(n):e.call(this,n)}},load:function(e){return ts.misceval.promiseToSuspension(new Promise((function(t,n){Wr("https://cdn.bootcdn.net/ajax/libs/pixi.js/5.3.4/pixi.min.js","PIXI").then((function(){fetch(ns[e]).then((function(e){window.PIXI.utils.skipHello();var n=e.text();t(n)}))}))})))},matchModelName:function(e){return Object.keys(ns).includes(e)},setContainer:function(e){this.container=e},reset:function(){this._handleReset()},_handleReset:function(){},_onRunning:function(e){this.app=e},_moduleCache:{App:null,timerMap:new Map,soundMap:{},music:new Audio,windowListener:{}}};s.PyGameZero=is,window.PyGameZero=is,e.exports=s}()},23:()=>{Sk.builtinFiles={files:{"src/builtin/sys.js":'var $builtinmodule=function(){var b,a=Math.pow,c={},d=[],e=Sk.getSysArgv();for(b=0;b<e.length;++b)d.push(new Sk.builtin.str(e[b]));return c.argv=new Sk.builtins.list(d),c.copyright=new Sk.builtin.str("Copyright 2009-2010 Scott Graham.\\nAll Rights Reserved.\\n"),Sk.__future__.python3?(c.version="3.7(ish) [Skulpt]",c.version_info=new Sk.builtin.tuple([new Sk.builtin.int_(3),new Sk.builtin.int_(7)])):(c.version="2.7(ish) [Skulpt]",c.version_info=new Sk.builtin.tuple([new Sk.builtin.int_(2),new Sk.builtin.int_(7)])),c.maxint=new Sk.builtin.int_(a(2,53)-1),c.maxsize=new Sk.builtin.int_(a(2,53)-1),c.modules=Sk.sysmodules,c.path=Sk.realsyspath,c.getExecutionLimit=new Sk.builtin.func(function(){return null===Sk.execLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.execLimit)}),c.setExecutionLimit=new Sk.builtin.func(function(a){if(null===Sk.execLimit)throw new Sk.builtin.NotImplementedError("Execution limiting is not enabled");void 0!==a&&(Sk.execLimit=Sk.builtin.asnum$(a))}),c.resetTimeout=new Sk.builtin.func(function(){Sk.execStart=new Date}),c.getYieldLimit=new Sk.builtin.func(function(){return null===Sk.yieldLimit?Sk.builtin.none.none$:new Sk.builtin.int_(Sk.yieldLimit)}),c.setYieldLimit=new Sk.builtin.func(function(a){if(null===Sk.yieldLimit)throw new Sk.builtin.NotImplementedError("Yielding is not enabled");void 0!==a&&(Sk.yieldLimit=Sk.builtin.asnum$(a))}),c.debug=new Sk.builtin.func(function(){return Sk.builtin.none.none$}),c.__stdout__=new Sk.builtin.file(new Sk.builtin.str("/dev/stdout"),new Sk.builtin.str("w")),c.__stdin__=new Sk.builtin.file(new Sk.builtin.str("/dev/stdin"),new Sk.builtin.str("r")),c.stdout=c.__stdout__,c.stdin=c.__stdin__,c};',"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":'raise NotImplementedError("BaseHTTPServer is not yet implemented in Skulpt")\n',"src/lib/Bastion.py":'raise NotImplementedError("Bastion is not yet implemented in Skulpt")\n',"src/lib/CGIHTTPServer.py":'raise NotImplementedError("CGIHTTPServer is not yet implemented in Skulpt")\n',"src/lib/ConfigParser.py":'raise NotImplementedError("ConfigParser is not yet implemented in Skulpt")\n',"src/lib/Cookie.py":'raise NotImplementedError("Cookie is not yet implemented in Skulpt")\n',"src/lib/DocXMLRPCServer.py":'raise NotImplementedError("DocXMLRPCServer is not yet implemented in Skulpt")\n',"src/lib/HTMLParser.py":'raise NotImplementedError("HTMLParser is not yet implemented in Skulpt")\n',"src/lib/MimeWriter.py":'raise NotImplementedError("MimeWriter is not yet implemented in Skulpt")\n',"src/lib/Queue.py":'raise NotImplementedError("Queue is not yet implemented in Skulpt")\n',"src/lib/SimpleHTTPServer.py":'raise NotImplementedError("SimpleHTTPServer is not yet implemented in Skulpt")\n',"src/lib/SimpleXMLRPCServer.py":'raise NotImplementedError("SimpleXMLRPCServer is not yet implemented in Skulpt")\n',"src/lib/SocketServer.py":'raise NotImplementedError("SocketServer is not yet implemented in Skulpt")\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":'raise NotImplementedError("UserDict is not yet implemented in Skulpt")\n',"src/lib/UserList.py":'raise NotImplementedError("UserList is not yet implemented in Skulpt")\n',"src/lib/UserString.py":'raise NotImplementedError("UserString is not yet implemented in Skulpt")\n',"src/lib/_LWPCookieJar.py":'raise NotImplementedError("_LWPCookieJar is not yet implemented in Skulpt")\n',"src/lib/_MozillaCookieJar.py":'raise NotImplementedError("_MozillaCookieJar is not yet implemented in Skulpt")\n',"src/lib/__future__.py":'raise NotImplementedError("__future__ is not yet implemented in Skulpt")\n',"src/lib/__phello__.foo.py":'raise NotImplementedError("__phello__.foo is not yet implemented in Skulpt")\n',"src/lib/_abcoll.py":'raise NotImplementedError("_abcoll is not yet implemented in Skulpt")\n',"src/lib/_strptime.py":'raise NotImplementedError("_strptime is not yet implemented in Skulpt")\n',"src/lib/_threading_local.py":'raise NotImplementedError("_threading_local is not yet implemented in Skulpt")\n',"src/lib/abc.py":'raise NotImplementedError("abc is not yet implemented in Skulpt")\n',"src/lib/aifc.py":'raise NotImplementedError("aifc is not yet implemented in Skulpt")\n',"src/lib/antigravity.py":'import webbrowser\n\nwebbrowser.open("https://xkcd.com/353/")\n',"src/lib/anydbm.py":'raise NotImplementedError("anydbm is not yet implemented in Skulpt")\n',"src/lib/array.js":'$builtinmodule=function(){var a={},b=["c","b","B","u","h","H","i","I","l","L","f","d"];return a.__name__=new Sk.builtin.str("array"),a.array=Sk.misceval.buildClass(a,function(a,c){c.__init__=new Sk.builtin.func(function(a,c,d){if(Sk.builtin.pyCheckArgsLen("__init__",arguments.length,2,3),-1==b.indexOf(Sk.ffi.remapToJs(c)))throw new Sk.builtin.ValueError("bad typecode (must be c, b, B, u, h, H, i, I, l, L, f or d)");if(d&&!Sk.builtin.checkIterable(d))throw new Sk.builtin.TypeError("iteration over non-sequence");if(a.$d.mp$ass_subscript(new Sk.builtin.str("typecode"),c),a.$d.mp$ass_subscript(new Sk.builtin.str("__module__"),new Sk.builtin.str("array")),a.typecode=c,void 0===d)a.internalIterable=new Sk.builtin.list;else if(d instanceof Sk.builtin.list)a.internalIterable=d;else for(a.internalIterable=new Sk.builtin.list,iter=Sk.abstr.iter(d),item=iter.tp$iternext();void 0!==item;item=iter.tp$iternext())Sk.misceval.callsimArray(a.internalIterable.append,[a.internalIterable,item])}),c.__repr__=new Sk.builtin.func(function(a){var b=Sk.ffi.remapToJs(a.typecode),c="";return Sk.ffi.remapToJs(a.internalIterable).length&&("c"==Sk.ffi.remapToJs(a.typecode)?c=", \'"+Sk.ffi.remapToJs(a.internalIterable).join("")+"\'":c=", "+Sk.ffi.remapToJs(Sk.misceval.callsimArray(a.internalIterable.__repr__,[a.internalIterable]))),new Sk.builtin.str("array(\'"+b+"\'"+c+")")}),c.__str__=c.__repr__,c.__getattribute__=new Sk.builtin.func(function(a,b){return a.tp$getattr(b)}),c.append=new Sk.builtin.func(function(a,b){return Sk.misceval.callsimArray(a.internalIterable.append,[a.internalIterable,b]),Sk.builtin.none.none$}),c.extend=new Sk.builtin.func(function(a,b){if(Sk.builtin.pyCheckArgsLen("__init__",arguments.length,2,2),!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("iteration over non-sequence");for(iter=Sk.abstr.iter(b),item=iter.tp$iternext();void 0!==item;item=iter.tp$iternext())Sk.misceval.callsimArray(a.internalIterable.append,[a.internalIterable,item])})},"array",[]),a};',"src/lib/ast.py":'raise NotImplementedError("ast is not yet implemented in Skulpt")\n',"src/lib/asynchat.py":'raise NotImplementedError("asynchat is not yet implemented in Skulpt")\n',"src/lib/asyncore.py":'raise NotImplementedError("asyncore is not yet implemented in Skulpt")\n',"src/lib/atexit.py":'raise NotImplementedError("atexit is not yet implemented in Skulpt")\n',"src/lib/audiodev.py":'raise NotImplementedError("audiodev is not yet implemented in Skulpt")\n',"src/lib/base64.py":'raise NotImplementedError("base64 is not yet implemented in Skulpt")\n',"src/lib/bdb.py":'raise NotImplementedError("bdb is not yet implemented in Skulpt")\n',"src/lib/binhex.py":'raise NotImplementedError("binhex is not yet implemented in Skulpt")\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":'raise NotImplementedError("bsddb is not yet implemented in Skulpt")\n',"src/lib/cProfile.py":'raise NotImplementedError("cProfile is not yet implemented in Skulpt")\n',"src/lib/calendar.py":'raise NotImplementedError("calendar is not yet implemented in Skulpt")\n',"src/lib/cgi.py":'raise NotImplementedError("cgi is not yet implemented in Skulpt")\n',"src/lib/cgitb.py":'raise NotImplementedError("cgitb is not yet implemented in Skulpt")\n',"src/lib/chunk.py":'raise NotImplementedError("chunk is not yet implemented in Skulpt")\n',"src/lib/cmd.py":'raise NotImplementedError("cmd is not yet implemented in Skulpt")\n',"src/lib/code.py":'raise NotImplementedError("code is not yet implemented in Skulpt")\n',"src/lib/codecs.py":'raise NotImplementedError("codecs is not yet implemented in Skulpt")\n',"src/lib/codeop.py":'raise NotImplementedError("codeop is not yet implemented in Skulpt")\n',"src/lib/collections.js":'function $builtinmodule(){const a={};return Sk.misceval.chain(Sk.importModule("keyword",!1,!0),b=>(a._iskeyword=b.$d.iskeyword,Sk.importModule("itertools",!1,!0)),b=>(a._chain=b.$d.chain,a._starmap=b.$d.starmap,a._repeat=b.$d.repeat,Sk.importModule("operator",!1,!0)),b=>{a._itemgetter=b.$d.itemgetter},()=>collections_mod(a))}function collections_mod(a){function counterNumberSlot(b){return function(c){if(void 0!==c&&!(c instanceof a.Counter))return Sk.builtin.NotImplemented.NotImplemented$;const d=new a.Counter;return b.call(this,d,c),d}}function counterInplaceSlot(a,b){return function(c){if(!(c instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError("Counter "+a+"= "+Sk.abstr.typeName(c)+" is not supported");return b.call(this,c),this.keep$positive()}}function namedtuple(b,c,d,l,m){function _make(a,b){return a.prototype.tp$new(Sk.misceval.arrayFromIterable(b))}function _asdict(a){const b=[];for(let c=0;c<a._fields.v.length;c++)b.push(a._fields.v[c]),b.push(a.v[c]);return new Sk.builtin.dict(b)}function _replace(a,b){a=new Sk.builtin.dict(a);const c=a.tp$getattr(new Sk.builtin.str("pop")),d=Sk.abstr.gattr(b,new Sk.builtin.str("_make")),e=Sk.misceval.callsimArray,f=e(d,[e(Sk.builtin.map_,[c,r,b])]);if(a.sq$length()){const b=a.sk$asarray();throw new Sk.builtin.ValueError("Got unexpectd field names: ["+b.map(a=>"\'"+a.$jsstr()+"\'")+"]")}return f}if(b=b.tp$str(),Sk.misceval.isTrue(Sk.misceval.callsimArray(a._iskeyword,[b])))throw new Sk.builtin.ValueError("Type names and field names cannot be a keyword: \'"+Sk.misceval.objectRepr(b)+"\'");const n=b.$jsstr();if(e.test(n)||!g.test(n)||!n)throw new Sk.builtin.ValueError("Type names and field names must be valid identifiers: \'"+n+"\'");let o,p;if(Sk.builtin.checkString(c))o=c.$jsstr().replace(h," ").split(j),1==o.length&&""===o[0]&&(o=[]),p=o.map(a=>new Sk.builtin.str(a));else{o=[],p=[];for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext())b=b.tp$str(),p.push(b),o.push(b.$jsstr())}let q=new Set;if(Sk.misceval.isTrue(d))for(i=0;i<o.length;i++)(Sk.misceval.isTrue(Sk.misceval.callsimArray(a._iskeyword,[p[i]]))||f.test(o[i])||!g.test(o[i])||!o[i]||q.has(o[i]))&&(o[i]="_"+i,p[i]=new Sk.builtin.str("_"+i)),q.add(o[i]);else for(i=0;i<o.length;i++){if(Sk.misceval.isTrue(Sk.misceval.callsimArray(a._iskeyword,[p[i]])))throw new Sk.builtin.ValueError("Type names and field names cannot be a keyword: \'"+o[i]+"\'");else if(f.test(o[i]))throw new Sk.builtin.ValueError("Field names cannot start with an underscore: \'"+o[i]+"\'");else if(!g.test(o[i])||!o[i])throw new Sk.builtin.ValueError("Type names and field names must be valid identifiers: \'"+o[i]+"\'");else if(q.has(o[i]))throw new Sk.builtin.ValueError("Encountered duplicate field name: \'"+o[i]+"\'");q.add(o[i])}const r=new Sk.builtin.tuple(p),s=[];let t=[];if(!Sk.builtin.checkNone(l)){if(t=Sk.misceval.arrayFromIterable(l),t.length>o.length)throw new Sk.builtin.TypeError("Got more default values than field names");for(let a=0,b=p.length-t.length;b<p.length;a++,b++)s.push(p[b]),s.push(t[a])}const u=new Sk.builtin.dict(s);_make.co_varnames=["_cls","iterable"],_asdict.co_varnames=["self"],_replace.co_kwargs=1,_replace.co_varnames=["_self"];const v={};for(let e=0;e<o.length;e++)v[p[e].$mangled]=new Sk.builtin.property(new a._itemgetter([new Sk.builtin.int_(e)]),void 0,void 0,new Sk.builtin.str("Alias for field number "+e));return Sk.abstr.buildNativeClass(n,{constructor:function NamedTuple(){},base:Sk.builtin.tuple,slots:{tp$doc:n+"("+o.join(", ")+")",tp$new(a,b){a=Sk.abstr.copyKeywordsToNamedArgs("__new__",o,a,b,t);const c=new this.constructor;return Sk.builtin.tuple.call(c,a),c},$r(){const a=this.v.map((a,b)=>o[b]+"="+Sk.misceval.objectRepr(a));return new Sk.builtin.str(Sk.abstr.typeName(this)+"("+a.join(", ")+")")}},proto:Object.assign({__module__:Sk.builtin.checkNone(m)?Sk.globals.__name__:m,__slots__:new Sk.builtin.tuple,_fields:r,_field_defaults:u,_make:new Sk.builtin.classmethod(new Sk.builtin.func(_make)),_asdict:new Sk.builtin.func(_asdict),_replace:new Sk.builtin.func(_replace)},v)})}a.__all__=new Sk.builtin.list(["deque","defaultdict","namedtuple","Counter","OrderedDict"].map(a=>new Sk.builtin.str(a))),a.defaultdict=Sk.abstr.buildNativeClass("collections.defaultdict",{constructor:function defaultdict(a,b){this.default_factory=a,Sk.builtin.dict.call(this,b)},base:Sk.builtin.dict,methods:{copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0}},__missing__:{$meth(a){if(Sk.builtin.checkNone(this.default_factory))throw new Sk.builtin.KeyError(Sk.misceval.objectRepr(a));else{const b=Sk.misceval.callsimArray(this.default_factory,[]);return this.mp$ass_subscript(a,b),b}},$flags:{OneArg:!0}}},getsets:{default_factory:{$get(){return this.default_factory},$set(a){a=a||Sk.builtin.none.none$,this.default_factory=a}}},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(a,b){const c=a.shift();if(void 0===c)this.default_factory=Sk.builtin.none.none$;else if(!Sk.builtin.checkCallable(c)&&!Sk.builtin.checkNone(c))throw new Sk.builtin.TypeError("first argument must be callable");else this.default_factory=c;return Sk.builtin.dict.prototype.tp$init.call(this,a,b)},$r(){const a=Sk.misceval.objectRepr(this.default_factory),b=Sk.builtin.dict.prototype.$r.call(this).v;return new Sk.builtin.str("defaultdict("+a+", "+b+")")}},proto:{$copy(){const b=[];return Sk.misceval.iterFor(Sk.abstr.iter(this),a=>{b.push(a),b.push(this.mp$subscript(a))}),new a.defaultdict(this.default_factory,b)}}}),a.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 b=a._chain.tp$getattr(new Sk.builtin.str("from_iterable")),c=a._starmap,d=a._repeat,e=Sk.misceval.callsimArray;return e(b,[e(c,[d,e(this.tp$getattr(this.str$items))])])}},most_common:{$flags:{NamedArgs:["n"],Defaults:[Sk.builtin.none.none$]},$meth(a){length=this.sq$length(),Sk.builtin.checkNone(a)?a=length:(a=Sk.misceval.asIndexOrThrow(a),a=a>length?length:0>a?0:a);const b=this.$items().sort((c,a)=>Sk.misceval.richCompareBool(c[1],a[1],"Lt")?1:Sk.misceval.richCompareBool(c[1],a[1],"Gt")?-1:0);return new Sk.builtin.list(b.slice(0,a).map(a=>new Sk.builtin.tuple(a)))}},update:{$flags:{FastCall:!0},$meth(a,b){return Sk.abstr.checkArgsLen("update",a,0,1),this.counter$update(a,b)}},subtract:{$flags:{FastCall:!0},$meth(a,b){Sk.abstr.checkArgsLen("subtract",a,0,1);const c=a[0];if(void 0!==c)if(c instanceof Sk.builtin.dict)for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){const a=this.mp$subscript(b);this.mp$ass_subscript(b,Sk.abstr.numberBinOp(a,c.mp$subscript(b),"Sub"))}else for(iter=Sk.abstr.iter(c),k=iter.tp$iternext();void 0!==k;k=iter.tp$iternext()){const a=this.mp$subscript(k);this.mp$ass_subscript(k,Sk.abstr.numberBinOp(a,this.$one,"Sub"))}b=b||[];for(let c=0;c<b.length;c+=2){const a=new Sk.builtin.str(b[c]),d=this.mp$subscript(a);this.mp$ass_subscript(a,Sk.abstr.numberBinOp(d,b[c+1],"Sub"))}return Sk.builtin.none.none$}},__missing__:{$meth(){return this.$zero},$flags:{OneArg:!0}},copy:{$meth(){return Sk.misceval.callsimArray(a.Counter,[this])},$flags:{NoArgs:!0}}},getsets:{__dict__:Sk.generic.getSetDict},slots:{tp$doc:"Dict subclass for counting hashable items. Sometimes called a bag\\n or multiset. Elements are stored as dictionary keys and their counts\\n are stored as dictionary values.\\n\\n >>> 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(a,b){return Sk.abstr.checkArgsLen(this.tpjs_name,a,0,1),this.counter$update(a,b)},$r(){const a=0<this.size?Sk.builtin.dict.prototype.$r.call(this).v:"";return new Sk.builtin.str(Sk.abstr.typeName(this)+"("+a+")")},tp$as_sequence_or_mapping:!0,mp$ass_subscript(a,b){return void 0===b?this.mp$lookup(a)&&Sk.builtin.dict.prototype.mp$ass_subscript.call(this,a,b):Sk.builtin.dict.prototype.mp$ass_subscript.call(this,a,b)},tp$as_number:!0,nb$positive:counterNumberSlot(function(a){this.$items().forEach(([b,c])=>{Sk.misceval.richCompareBool(c,this.$zero,"Gt")&&a.mp$ass_subscript(b,c)})}),nb$negative:counterNumberSlot(function(a){this.$items().forEach(([b,c])=>{Sk.misceval.richCompareBool(c,this.$zero,"Lt")&&a.mp$ass_subscript(b,Sk.abstr.numberBinOp(this.$zero,c,"Sub"))})}),nb$subtract:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=Sk.abstr.numberBinOp(d,b.mp$subscript(c),"Sub");Sk.misceval.richCompareBool(e,this.$zero,"Gt")&&a.mp$ass_subscript(c,e)}),b.$items().forEach(([b,c])=>{void 0===this.mp$lookup(b)&&Sk.misceval.richCompareBool(c,this.$zero,"Lt")&&a.mp$ass_subscript(b,Sk.abstr.numberBinOp(this.$zero,c,"Sub"))})}),nb$add:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=Sk.abstr.numberBinOp(d,b.mp$subscript(c),"Add");Sk.misceval.richCompareBool(e,this.$zero,"Gt")&&a.mp$ass_subscript(c,e)}),b.$items().forEach(([b,c])=>{void 0===this.mp$lookup(b)&&Sk.misceval.richCompareBool(c,this.$zero,"Gt")&&a.mp$ass_subscript(b,c)})}),nb$inplace_add:counterInplaceSlot("+",function(a){a.$items().forEach(([a,b])=>{const c=Sk.abstr.numberInplaceBinOp(this.mp$subscript(a),b,"Add");this.mp$ass_subscript(a,c)})}),nb$inplace_subtract:counterInplaceSlot("-",function(a){a.$items().forEach(([a,b])=>{const c=Sk.abstr.numberInplaceBinOp(this.mp$subscript(a),b,"Sub");this.mp$ass_subscript(a,c)})}),nb$or:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=b.mp$subscript(c),f=Sk.misceval.richCompareBool(d,e,"Lt")?e:d;Sk.misceval.richCompareBool(f,this.$zero,"Gt")&&a.mp$ass_subscript(c,f)}),b.$items().forEach(([b,c])=>{void 0===this.mp$lookup(b)&&Sk.misceval.richCompareBool(c,this.$zero,"Gt")&&a.mp$ass_subscript(b,c)})}),nb$and:counterNumberSlot(function(a,b){this.$items().forEach(([c,d])=>{const e=b.mp$subscript(c),f=Sk.misceval.richCompareBool(d,e,"Lt")?d:e;Sk.misceval.richCompareBool(f,this.$zero,"Gt")&&a.mp$ass_subscript(c,f)})}),nb$inplace_and:counterInplaceSlot("&",function(a){this.$items().forEach(([b,c])=>{const d=a.mp$subscript(b);Sk.misceval.richCompareBool(d,c,"Lt")&&this.mp$ass_subscript(b,d)})}),nb$inplace_or:counterInplaceSlot("|",function(a){a.$items().forEach(([a,b])=>{Sk.misceval.richCompareBool(b,this.mp$subscript(a),"Gt")&&this.mp$ass_subscript(a,b)})}),nb$reflected_and:null,nb$reflected_or:null,nb$reflected_add:null,nb$reflected_subtract:null},proto:{keep$positive(){return this.$items().forEach(([a,b])=>{Sk.misceval.richCompareBool(b,this.$zero,"LtE")&&this.mp$ass_subscript(a)}),this},$zero:new Sk.builtin.int_(0),$one:new Sk.builtin.int_(1),str$items:new Sk.builtin.str("items"),counter$update(a,b){const c=a[0];if(void 0!==c)if(!Sk.builtin.checkMapping(c))for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){const a=this.mp$subscript(b);this.mp$ass_subscript(b,Sk.abstr.numberBinOp(a,this.$one,"Add"))}else if(!this.sq$length())this.update$common(a,void 0,"update");else for(let a=Sk.abstr.iter(c),b=a.tp$iternext();void 0!==b;b=a.tp$iternext()){const a=this.mp$subscript(b);this.mp$ass_subscript(b,Sk.abstr.numberBinOp(a,c.mp$subscript(b),"Add"))}if(b&&b.length)if(!this.sq$length())this.update$common([],b,"update");else for(let a=0;a<b.length;a+=2){const c=new Sk.builtin.str(b[a]),d=this.mp$subscript(c);this.mp$ass_subscript(c,Sk.abstr.numberBinOp(d,b[a+1],"Add"))}return Sk.builtin.none.none$}},classmethods:{fromkeys:{$meth:function fromkeys(){throw new Sk.builtin.NotImplementedError("Counter.fromkeys() is undefined. Use Counter(iterable) instead.")},$flags:{MinArgs:1,MaxArgs:2}}}});const b=Sk.abstr.buildIteratorClass("odict_iterator",{constructor:function odict_iter_(a){this.$index=0,this.$seq=a.sk$asarray(),this.$orig=a},iternext:Sk.generic.iterNextWithArrayCheckSize,flags:{sk$acceptable_as_base_class:!1}});a.OrderedDict=Sk.abstr.buildNativeClass("OrderedDict",{constructor:function OrderedDict(){return this.orderedkeys=[],Sk.builtin.dict.call(this),this},base:Sk.builtin.dict,slots:{tp$as_sequence_or_mapping:!0,tp$init(a,b){Sk.abstr.checkArgsLen("OrderedDict",a,0,1),a.unshift(this),res=Sk.misceval.callsimArray(this.update,a,b)},tp$doc:"Dictionary that remembers insertion order",$r(){let a,b;const c=[];for(let b=this.tp$iter(),d=b.tp$iternext();void 0!==d;d=b.tp$iternext())a=this.mp$subscript(d),void 0===a&&(a=null),c.push("("+Sk.misceval.objectRepr(d)+", "+Sk.misceval.objectRepr(a)+")");return b=c.join(", "),0<c.length&&(b="["+b+"]"),new Sk.builtin.str("OrderedDict("+b+")")},tp$richcompare(b,c){if("Eq"!=c&&"Ne"!=c)return Sk.builtin.NotImplemented.NotImplemented$;const d="Eq"==c;if(!(b instanceof a.OrderedDict))return Sk.builtin.dict.prototype.tp$richcompare.call(this,b,c);const e=this.size,f=b.size;if(e!==f)return!d;for(let a=this.tp$iter(),e=b.tp$iter(),f=a.tp$iternext(),g=e.tp$iternext();void 0!==f;f=a.tp$iternext(),g=e.tp$iternext()){if(!Sk.misceval.isTrue(Sk.misceval.richCompareBool(f,g,"Eq")))return!d;const a=this.mp$subscript(f),c=b.mp$subscript(g);if(!Sk.misceval.isTrue(Sk.misceval.richCompareBool(a,c,"Eq")))return!d}return d},mp$ass_subscript(a,b){if(void 0===b){const b=this.pop$item(a);if(void 0===b)throw new Sk.builtin.KeyError(a)}else this.set$item(a,b)},tp$iter(){return new b(this)}},methods:{pop:{$flags:{NamedArgs:["key","default"],Defaults:[null]},$meth(a,b){return null===b?Sk.misceval.callsimArray(Sk.builtin.dict.prototype.pop,[this,a]):Sk.misceval.callsimArray(Sk.builtin.dict.prototype.pop,[this,a,b])}},popitem:{$flags:{NamedArgs:["last"],Defaults:[Sk.builtin.bool.true$]},$meth(a){let b,c;if(!this.orderedkeys.length)throw new Sk.builtin.KeyError("dictionary is empty");return b=this.orderedkeys[0],Sk.misceval.isTrue(a)&&(b=this.orderedkeys[this.orderedkeys.length-1]),c=Sk.misceval.callsimArray(this.pop,[this,b]),new Sk.builtin.tuple([b,c])}},move_to_end:{$flags:{NamedArgs:["key","last"],Defaults:[Sk.builtin.bool.true$]},$meth(a,b){let c,d=-1;for(let e=0;e<this.orderedkeys.length;e++)if(c=this.orderedkeys[e],c===a||Sk.misceval.richCompareBool(c,a,"Eq")){d=e;break}if(-1!==d)this.orderedkeys.splice(d,1);else throw new Sk.builtin.KeyError(a);return Sk.misceval.isTrue(b)?this.orderedkeys.push(a):this.orderedkeys.unshift(a),Sk.builtin.none.none$}}},proto:{sk$asarray(){return this.orderedkeys.slice(0)},set$item(a,b){const c=this.orderedkeys.indexOf(a);-1==c&&this.orderedkeys.push(a),Sk.builtin.dict.prototype.set$item.call(this,a,b)},pop$item(a){var b=this.orderedkeys.indexOf(a);if(-1!=b)return this.orderedkeys.splice(b,1),Sk.builtin.dict.prototype.pop$item.call(this,a)}}}),a.deque=Sk.abstr.buildNativeClass("collections.deque",{constructor:function deque(a,b,c,d,e){this.head=c||0,this.tail=d||0,this.mask=e||1,this.maxlen=b,this.v=a||[,,]},slots:{tp$doc:"deque([iterable[, maxlen]]) --\x3e deque object\\n\\nA list-like sequence optimized for data accesses near its endpoints.",tp$hash:Sk.builtin.none.none$,tp$new:Sk.generic.new,tp$init(a,b){if([iterable,maxlen]=Sk.abstr.copyKeywordsToNamedArgs("deque",["iterable","maxlen"],a,b),void 0!==maxlen&&!Sk.builtin.checkNone(maxlen))if(maxlen=Sk.misceval.asIndexSized(maxlen,Sk.builtin.OverflowError,"an integer is required"),0>maxlen)throw new Sk.builtin.ValueError("maxlen must be non-negative");else this.maxlen=maxlen;this.$clear(),void 0!==iterable&&this.$extend(iterable)},tp$getattr:Sk.generic.getAttr,tp$richcompare(b,c){var d=Math.max;if(this===b&&Sk.misceval.opAllowsEquality(c))return!0;if(!(b instanceof a.deque))return Sk.builtin.NotImplemented.NotImplemented$;const e=b,f=this.v;b=b.v;const g=this.tail-this.head&this.mask,h=e.tail-e.head&e.mask;let j,l=d(g,h);if(g===h)for(l=0;l<g&&l<h&&(j=Sk.misceval.richCompareBool(f[this.head+l&this.mask],b[e.head+l&e.mask],"Eq"),!!j);++l);if(l>=g||l>=h)switch(c){case"Lt":return g<h;case"LtE":return g<=h;case"Eq":return g===h;case"NotEq":return g!==h;case"Gt":return g>h;case"GtE":return g>=h;}return"Eq"!==c&&("NotEq"===c||Sk.misceval.richCompareBool(f[this.head+l&this.mask],b[e.head+l&e.mask],c))},tp$iter(){return new c(this)},$r(){const a=[],b=this.tail-this.head&this.mask;if(this.$entered_repr)return new Sk.builtin.str("[...]");this.$entered_repr=!0;for(let c=0;c<b;c++)a.push(Sk.misceval.objectRepr(this.v[this.head+c&this.mask]));const c=Sk.abstr.typeName(this);return void 0===this.maxlen?(this.$entered_repr=void 0,new Sk.builtin.str(c+"(["+a.filter(Boolean).join(", ")+"])")):new Sk.builtin.str(c+"(["+a.filter(Boolean).join(", ")+"], maxlen="+this.maxlen+")")},tp$as_number:!0,nb$bool(){return 0!=(this.tail-this.head&this.mask)},tp$as_sequence_or_mapping:!0,sq$contains(a){for(let b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(Sk.misceval.richCompareBool(c,a,"Eq"))return!0;return!1},sq$concat(b){if(!(b instanceof a.deque))throw new Sk.builtin.TypeError("can only concatenate deque (not \'"+Sk.abstr.typeName(b)+"\') to deque");const c=this.$copy();for(let a=b.tp$iter(),d=a.tp$iternext();void 0!==d;d=a.tp$iternext())c.$push(d);return c},sq$length(){return this.tail-this.head&this.mask},sq$repeat(a){a=Sk.misceval.asIndexOrThrow(a,"can\'t multiply sequence by non-int of type \'{tp$name}\'");const b=this.tail-this.head&this.mask,c=this.$copy();let d;0>=a&&c.$clear();for(let e=1;e<a;e++)for(let a=0;a<b;a++)d=this.head+a&this.mask,c.$push(this.v[d]);return c},mp$subscript(a){a=Sk.misceval.asIndexOrThrow(a);const b=this.tail-this.head&this.mask;if(a>=b||a<-b)throw new Sk.builtin.IndexError("deque index out of range");const c=(0<=a?this.head:this.tail)+a&this.mask;return this.v[c]},mp$ass_subscript(a,b){a=Sk.misceval.asIndexOrThrow(a);const c=this.tail-this.head&this.mask;if(a>=c||a<-c)throw new Sk.builtin.IndexError("deque index out of range");void 0===b?this.del$item(a):this.set$item(a,b)},nb$inplace_add(a){for(this.maxlen=void 0,it=Sk.abstr.iter(a),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())this.$push(i);return this},nb$inplace_multiply(a){a=Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError,"can\'t multiply sequence by non-int of type \'{tp$name}\'"),0>=a&&this.$clear();const b=this.$copy(),c=this.tail-this.head&this.mask;for(let d=1;d<a;d++)for(let a=0;a<c;a++){const c=this.head+a&this.mask;b.$push(this.v[c])}return this.v=b.v,this.head=b.head,this.tail=b.tail,this.mask=b.mask,this}},methods:{append:{$meth(a){return this.$push(a),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to the right side of the deque."},appendleft:{$meth(a){return this.$pushLeft(a),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to the left side of the deque."},clear:{$meth(){return this.$clear(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove all elements from the deque."},__copy__:{$meth(){return this.$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a deque."},copy:{$meth(){return this.$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a deque."},count:{$meth(a){const b=this.tail-this.head&this.mask;let c=0;for(let d=0;d<b;d++)Sk.misceval.richCompareBool(this.v[this.head+d&this.mask],a,"Eq")&&c++;return new Sk.builtin.int_(c)},$flags:{OneArg:!0},$textsig:null,$doc:"D.count(value) -> integer -- return number of occurrences of value"},extend:{$meth(a){return this.$extend(a),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Extend the right side of the deque with elements from the iterable"},extendleft:{$meth(a){for(it=Sk.abstr.iter(a),i=it.tp$iternext();void 0!==i;i=it.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(a,b,c){const d=this.$index(a,b,c);if(void 0!==d)return new Sk.builtin.int_(d);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(a)+" 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(a,b){a=Sk.misceval.asIndexOrThrow(a,"integer argument expected, got {tp$name}");const c=this.tail-this.head&this.mask;if(void 0!==this.maxlen&&c>=this.maxlen)throw new Sk.builtin.IndexError("deque already at its maximum size");a>c&&(a=c),a<=-c&&(a=0);const d=(0<=a?this.head:this.tail)+a&this.mask;let e=this.tail;for(this.tail=this.tail+1&this.mask;e!==d;){const a=e-1&this.mask;this.v[e]=this.v[a],e=a}return this.v[d]=b,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(a){const b=this.$index(a);if(void 0===b)throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(a)+" is not in deque");const c=this.head+b&this.mask;for(let b=c;b!==this.tail;){const a=b+1&this.mask;this.v[b]=this.v[a],b=a}this.tail=this.tail-1&this.mask;var d=this.tail-this.head&this.mask;d<this.mask>>>1&&this.$resize(d,this.v.length>>>1)},$flags:{OneArg:!0},$textsig:null,$doc:"D.remove(value) -- remove first occurrence of value."},__reversed__:{$meth(){return new d(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.__reversed__() -- return a reverse iterator over the deque"},reverse:{$meth(){const c=this.head,d=this.tail,e=this.mask,f=this.tail-this.head&this.mask;for(let g=0;g<~~(f/2);g++){const f=d-g-1&e,a=c+g&e,b=this.v[f];this.v[f]=this.v[a],this.v[a]=b}return Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"D.reverse() -- reverse *IN PLACE*"},rotate:{$meth(a){a=void 0===a?1:Sk.misceval.asIndexSized(a,Sk.builtin.OverflowError);const c=this.head,d=this.tail;if(0===a||c===d)return this;if(this.head=c-a&this.mask,this.tail=d-a&this.mask,0<a)for(let e=1;e<=a;e++){const f=c-e&this.mask,a=d-e&this.mask;this.v[f]=this.v[a],this.v[a]=void 0}else for(let e=0;e>a;e--){const f=d-e&this.mask,a=c-e&this.mask;this.v[f]=this.v[a],this.v[a]=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."}},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=[,,]},$copy(){return new a.deque(this.v.slice(0),this.maxlen,this.head,this.tail,this.mask)},$extend(a){for(it=Sk.abstr.iter(a),i=it.tp$iternext();void 0!==i;i=it.tp$iternext())this.$push(i)},set$item(a,b){const c=(0<=a?this.head:this.tail)+a&this.mask;this.v[c]=b},del$item(a){const b=(0<=a?this.head:this.tail)+a&this.mask;for(let c=b;c!==this.tail;){const a=c+1&this.mask;this.v[c]=this.v[a],c=a}const c=this.tail-this.head&this.mask;this.tail=this.tail-1&this.mask,c<this.mask>>>1&&this.$resize(c,this.v.length>>>1)},$push(a){this.v[this.tail]=a,this.tail=this.tail+1&this.mask,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);const b=this.tail-this.head&this.mask;return void 0!==this.maxlen&&b>this.maxlen&&this.$popLeft(),this},$pushLeft(a){this.head=this.head-1&this.mask,this.v[this.head]=a,this.head===this.tail&&this.$resize(this.v.length,this.v.length<<1);const b=this.tail-this.head&this.mask;return void 0!==this.maxlen&&b>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 a=this.v[this.tail];this.v[this.tail]=void 0;const b=this.tail-this.head&this.mask;return b<this.mask>>>1&&this.$resize(b,this.v.length>>>1),a},$popLeft(){if(this.head===this.tail)throw new Sk.builtin.IndexError("pop from an empty deque");const a=this.v[this.head];this.v[this.head]=void 0,this.head=this.head+1&this.mask;const b=this.tail-this.head&this.mask;return b<this.mask>>>1&&this.$resize(b,this.v.length>>>1),a},$resize(a,b){const c=this.head,d=this.mask;if(this.head=0,this.tail=a,this.mask=b-1,0===c)return void(this.v.length=b);const e=Array(b);for(let f=0;f<a;f++)e[f]=this.v[c+f&d];this.v=e},$index(a,b,c){const d=this.tail-this.head&this.mask;b=void 0===b?0:Sk.misceval.asIndexOrThrow(b),c=c===void 0?d:Sk.misceval.asIndexOrThrow(c);const e=this.head,f=this.mask,g=this.v,h=0<=b?b:b<-d?0:d+b;c=0<=c?c:c<-d?0:d+c;for(let d=h;d<c;d++)if(g[e+d&f]===a)return d},sk$asarray(){const a=[],b=this.tail-this.head&this.mask;for(let c=0;c<b;++c){const b=this.head+c&this.mask;a.push(this.v[b])}return a}}});const c=Sk.abstr.buildIteratorClass("_collections._deque_iterator",{constructor:function _deque_iterator(a){this.$index=0,this.dq=a.v,this.$length=a.tail-a.head&a.mask,this.$head=a.head,this.$tail=a.tail,this.$mask=a.mask},iternext(){if(!(this.$index>=this.$length)){const a=(0<=this.$index?this.$head:this.$tail)+this.$index&this.$mask;return this.$index++,this.dq[a]}},methods:{__length_hint__:{$meth:function __length_hint__(){return new Sk.builtin.int_(this.$length-this.$index)},$flags:{NoArgs:!0}}}}),d=Sk.abstr.buildIteratorClass("_collections._deque_reverse_iterator",{constructor:function _deque_reverse_iterator(a){this.$index=(a.tail-a.head&a.mask)-1,this.dq=a.v,this.$head=a.head,this.$mask=a.mask},iternext(){if(!(0>this.$index)){const a=this.$head+this.$index&this.$mask;return this.$index--,this.dq[a]}},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef}}),e=new RegExp(/^[0-9].*/),f=new RegExp(/^[0-9_].*/),g=new RegExp(/^\\w*$/),h=/,/g,j=/\\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"],a.namedtuple=new Sk.builtin.func(namedtuple),a}',"src/lib/colorsys.py":'raise NotImplementedError("colorsys is not yet implemented in Skulpt")\n',"src/lib/commands.py":'raise NotImplementedError("commands is not yet implemented in Skulpt")\n',"src/lib/compileall.py":'raise NotImplementedError("compileall is not yet implemented in Skulpt")\n',"src/lib/compiler/__init__.py":'raise NotImplementedError("compiler is not yet implemented in Skulpt")\n',"src/lib/config/__init__.py":'raise NotImplementedError("config is not yet implemented in Skulpt")\n',"src/lib/contextlib.py":'raise NotImplementedError("contextlib is not yet implemented in Skulpt")\n',"src/lib/cookielib.py":'raise NotImplementedError("cookielib is not yet implemented in Skulpt")\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\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, 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 try:\n getstate = getattr(x, "__getstate__", None)\n setstate = getattr(x, "__setstate__", None)\n initargs = getattr(x, "__getinitargs__", None)\n except:\n reductor = False\n if getstate or setstate or initargs:\n raise NotImplementedError("Skulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()")\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 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 try:\n getstate = getattr(x, "__getstate__", None)\n setstate = getattr(x, "__setstate__", None)\n initargs = getattr(x, "__getinitargs__", None)\n except:\n reductor = False\n if getstate or setstate or initargs:\n raise NotImplementedError("Skulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()")\n copier = _deepcopy_dispatch.get(cls)\n if copier:\n y = copier(x, memo)\n elif str(cls)[1:6] == "class":\n copier = _deepcopy_dispatch["InstanceType"]\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 reductor = getattr(x, "__reduce__", None)\n if reductor:\n rv = reductor()\n else:\n raise Error(\n "un(deep)copyable object of type %s" % cls)\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\n# d[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":'raise NotImplementedError("copy_reg is not yet implemented in Skulpt")\n',"src/lib/csv.py":'raise NotImplementedError("csv is not yet implemented in Skulpt")\n',"src/lib/ctypes/__init__.py":'raise NotImplementedError("ctypes is not yet implemented in Skulpt")\n',"src/lib/ctypes/macholib/__init__.py":'raise NotImplementedError("macholib is not yet implemented in Skulpt")\n',"src/lib/curses/__init__.py":'raise NotImplementedError("curses is not yet implemented in Skulpt")\n',"src/lib/datetime.py":'"""Concrete date/time and related types -- prototype implemented in Python.\n\nSee http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage\n\nSee also http://dir.yahoo.com/Reference/calendars/\n\nFor a primer on DST, including many current DST rules, see\nhttp://webexhibits.org/daylightsaving/\n\nFor more about DST than you ever wanted to know, see\nftp://elsie.nci.nih.gov/pub/\n\nSources for time zone and DST data: http://www.twinsun.com/tz/tz-link.htm\n\nThis was originally copied from the sandbox of the CPython CVS repository.\nThanks to Tim Peters for suggesting using it.\n\nThis was then copied from PyPy v5.1.0 into Skulpt by Meredydd Luff, removing\n\'from __future__ import division\' (and replacing division operators accordingly)\nand pickle support (which requires \'struct\', which Skulpt does not currently\n[as of 31/8/2016] have)\n"""\n\nimport time as _time\nimport math as _math\n\n# Python 2-vs-3 compat hack\nimport sys\nunicode = unicode if sys.version_info < (3,) else str\n\n_SENTINEL = object()\n\ndef _cmp(x, y):\n return 0 if x == y else 1 if x > y else -1\n\ndef _round(x):\n return int(_math.floor(x + 0.5) if x >= 0.0 else _math.ceil(x - 0.5))\n\nMINYEAR = 1\nMAXYEAR = 9999\n_MINYEARFMT = 1900\n\n_MAX_DELTA_DAYS = 999999999\n\n# Utility functions, adapted from Python\'s Demo/classes/Dates.py, which\n# also assumes the current Gregorian calendar indefinitely extended in\n# both directions. Difference: Dates.py calls January 1 of year 0 day\n# number 1. The code here calls January 1 of year 1 day number 1. This is\n# to match the definition of the "proleptic Gregorian" calendar in Dershowitz\n# and Reingold\'s "Calendrical Calculations", where it\'s the base calendar\n# for all computations. See the book for algorithms for converting between\n# proleptic Gregorian ordinals and many other calendar systems.\n\n_DAYS_IN_MONTH = [-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n_DAYS_BEFORE_MONTH = [-1]\ndbm = 0\nfor dim in _DAYS_IN_MONTH[1:]:\n _DAYS_BEFORE_MONTH.append(dbm)\n dbm += dim\ndel dbm, dim\n\ndef _is_leap(year):\n "year -> 1 if leap year, else 0."\n return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)\n\ndef _days_before_year(year):\n "year -> number of days before January 1st of year."\n y = year - 1\n return y*365 + y//4 - y//100 + y//400\n\ndef _days_in_month(year, month):\n "year, month -> number of days in that month in that year."\n assert 1 <= month <= 12, month\n if month == 2 and _is_leap(year):\n return 29\n return _DAYS_IN_MONTH[month]\n\ndef _days_before_month(year, month):\n "year, month -> number of days in year preceding first day of month."\n assert 1 <= month <= 12, \'month must be in 1..12\'\n return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year))\n\ndef _ymd2ord(year, month, day):\n "year, month, day -> ordinal, considering 01-Jan-0001 as day 1."\n assert 1 <= month <= 12, \'month must be in 1..12\'\n dim = _days_in_month(year, month)\n assert 1 <= day <= dim, (\'day must be in 1..%d\' % dim)\n return (_days_before_year(year) +\n _days_before_month(year, month) +\n day)\n\n_DI400Y = _days_before_year(401) # number of days in 400 years\n_DI100Y = _days_before_year(101) # " " " " 100 "\n_DI4Y = _days_before_year(5) # " " " " 4 "\n\n# A 4-year cycle has an extra leap day over what we\'d get from pasting\n# together 4 single years.\nassert _DI4Y == 4 * 365 + 1\n\n# Similarly, a 400-year cycle has an extra leap day over what we\'d get from\n# pasting together 4 100-year cycles.\nassert _DI400Y == 4 * _DI100Y + 1\n\n# OTOH, a 100-year cycle has one fewer leap day than we\'d get from\n# pasting together 25 4-year cycles.\nassert _DI100Y == 25 * _DI4Y - 1\n\n_US_PER_US = 1\n_US_PER_MS = 1000\n_US_PER_SECOND = 1000000\n_US_PER_MINUTE = 60000000\n_SECONDS_PER_DAY = 24 * 3600\n_US_PER_HOUR = 3600000000\n_US_PER_DAY = 86400000000\n_US_PER_WEEK = 604800000000\n\ndef _ord2ymd(n):\n "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1."\n\n # n is a 1-based index, starting at 1-Jan-1. The pattern of leap years\n # repeats exactly every 400 years. The basic strategy is to find the\n # closest 400-year boundary at or before n, then work with the offset\n # from that boundary to n. Life is much clearer if we subtract 1 from\n # n first -- then the values of n at 400-year boundaries are exactly\n # those divisible by _DI400Y:\n #\n # D M Y n n-1\n # -- --- ---- ---------- ----------------\n # 31 Dec -400 -_DI400Y -_DI400Y -1\n # 1 Jan -399 -_DI400Y +1 -_DI400Y 400-year boundary\n # ...\n # 30 Dec 000 -1 -2\n # 31 Dec 000 0 -1\n # 1 Jan 001 1 0 400-year boundary\n # 2 Jan 001 2 1\n # 3 Jan 001 3 2\n # ...\n # 31 Dec 400 _DI400Y _DI400Y -1\n # 1 Jan 401 _DI400Y +1 _DI400Y 400-year boundary\n n -= 1\n n400, n = divmod(n, _DI400Y)\n year = n400 * 400 + 1 # ..., -399, 1, 401, ...\n\n # Now n is the (non-negative) offset, in days, from January 1 of year, to\n # the desired date. Now compute how many 100-year cycles precede n.\n # Note that it\'s possible for n100 to equal 4! In that case 4 full\n # 100-year cycles precede the desired day, which implies the desired\n # day is December 31 at the end of a 400-year cycle.\n n100, n = divmod(n, _DI100Y)\n\n # Now compute how many 4-year cycles precede it.\n n4, n = divmod(n, _DI4Y)\n\n # And now how many single years. Again n1 can be 4, and again meaning\n # that the desired day is December 31 at the end of the 4-year cycle.\n n1, n = divmod(n, 365)\n\n year += n100 * 100 + n4 * 4 + n1\n if n1 == 4 or n100 == 4:\n assert n == 0\n return year-1, 12, 31\n\n # Now the year is correct, and n is the offset from January 1. We find\n # the month via an estimate that\'s either exact or one too large.\n leapyear = n1 == 3 and (n4 != 24 or n100 == 3)\n assert leapyear == _is_leap(year)\n month = (n + 50) >> 5\n preceding = _DAYS_BEFORE_MONTH[month] + (month > 2 and leapyear)\n if preceding > n: # estimate is too large\n month -= 1\n preceding -= _DAYS_IN_MONTH[month] + (month == 2 and leapyear)\n n -= preceding\n assert 0 <= n < _days_in_month(year, month)\n\n # Now the year and month are correct, and n is the offset from the\n # start of that month: we\'re done!\n return year, month, n+1\n\n# Month and day names. For localized versions, see the calendar module.\n_MONTHNAMES = [None, "Jan", "Feb", "Mar", "Apr", "May", "Jun",\n "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]\n_DAYNAMES = [None, "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]\n\n\ndef _build_struct_time(y, m, d, hh, mm, ss, dstflag):\n wday = (_ymd2ord(y, m, d) + 6) % 7\n dnum = _days_before_month(y, m) + d\n return _time.struct_time((y, m, d, hh, mm, ss, wday, dnum, dstflag))\n\ndef _format_time(hh, mm, ss, us):\n # Skip trailing microseconds when us==0.\n result = "%02d:%02d:%02d" % (hh, mm, ss)\n if us:\n result += ".%06d" % us\n return result\n\n# Correctly substitute for %z and %Z escapes in strftime formats.\ndef _wrap_strftime(object, format, timetuple):\n year = timetuple[0]\n if year < _MINYEARFMT:\n raise ValueError("year=%d is before %d; the datetime strftime() "\n "methods require year >= %d" %\n (year, _MINYEARFMT, _MINYEARFMT))\n # Don\'t call utcoffset() or tzname() unless actually needed.\n freplace = None # the string to use for %f\n zreplace = None # the string to use for %z\n Zreplace = None # the string to use for %Z\n\n # Scan format for %z and %Z escapes, replacing as needed.\n newformat = []\n push = newformat.append\n i, n = 0, len(format)\n while i < n:\n ch = format[i]\n i += 1\n if ch == \'%\':\n if i < n:\n ch = format[i]\n i += 1\n if ch == \'f\':\n if freplace is None:\n freplace = \'%06d\' % getattr(object,\n \'microsecond\', 0)\n newformat.append(freplace)\n elif ch == \'z\':\n if zreplace is None:\n zreplace = ""\n if hasattr(object, "_utcoffset"):\n offset = object._utcoffset()\n if offset is not None:\n sign = \'+\'\n if offset < 0:\n offset = -offset\n sign = \'-\'\n h, m = divmod(offset, 60)\n zreplace = \'%c%02d%02d\' % (sign, h, m)\n assert \'%\' not in zreplace\n newformat.append(zreplace)\n elif ch == \'Z\':\n if Zreplace is None:\n Zreplace = ""\n if hasattr(object, "tzname"):\n s = object.tzname()\n if s is not None:\n # strftime is going to have at this: escape %\n Zreplace = s.replace(\'%\', \'%%\')\n newformat.append(Zreplace)\n else:\n push(\'%\')\n push(ch)\n else:\n push(\'%\')\n else:\n push(ch)\n newformat = "".join(newformat)\n return _time.strftime(newformat, timetuple)\n\n# Just raise TypeError if the arg isn\'t None or a string.\ndef _check_tzname(name):\n if name is not None and not isinstance(name, str):\n raise TypeError("tzinfo.tzname() must return None or string, "\n "not \'%s\'" % type(name))\n\n# name is the offset-producing method, "utcoffset" or "dst".\n# offset is what it returned.\n# If offset isn\'t None or timedelta, raises TypeError.\n# If offset is None, returns None.\n# Else offset is checked for being in range, and a whole # of minutes.\n# If it is, its integer value is returned. Else ValueError is raised.\ndef _check_utc_offset(name, offset):\n assert name in ("utcoffset", "dst")\n if offset is None:\n return\n if not isinstance(offset, timedelta):\n raise TypeError("tzinfo.%s() must return None "\n "or timedelta, not \'%s\'" % (name, type(offset)))\n days = offset.days\n if days < -1 or days > 0:\n offset = 1440 # trigger out-of-range\n else:\n seconds = days * 86400 + offset.seconds\n minutes, seconds = divmod(seconds, 60)\n if seconds or offset.microseconds:\n raise ValueError("tzinfo.%s() must return a whole number "\n "of minutes" % name)\n offset = minutes\n if not -1440 < offset < 1440:\n raise ValueError("%s()=%d, must be in -1439..1439" % (name, offset))\n return offset\n\ndef _check_int_field(value):\n if isinstance(value, int):\n return int(value)\n if not isinstance(value, float):\n try:\n value = value.__int__()\n except AttributeError:\n pass\n else:\n if isinstance(value, int):\n return int(value)\n raise TypeError(\'__int__ method should return an integer\')\n raise TypeError(\'an integer is required\')\n raise TypeError(\'integer argument expected, got float\')\n\ndef _check_date_fields(year, month, day):\n year = _check_int_field(year)\n month = _check_int_field(month)\n day = _check_int_field(day)\n if not MINYEAR <= year <= MAXYEAR:\n raise ValueError(\'year must be in %d..%d\' % (MINYEAR, MAXYEAR), year)\n if not 1 <= month <= 12:\n raise ValueError(\'month must be in 1..12\', month)\n dim = _days_in_month(year, month)\n if not 1 <= day <= dim:\n raise ValueError(\'day must be in 1..%d\' % dim, day)\n return year, month, day\n\ndef _check_time_fields(hour, minute, second, microsecond):\n hour = _check_int_field(hour)\n minute = _check_int_field(minute)\n second = _check_int_field(second)\n microsecond = _check_int_field(microsecond)\n if not 0 <= hour <= 23:\n raise ValueError(\'hour must be in 0..23\', hour)\n if not 0 <= minute <= 59:\n raise ValueError(\'minute must be in 0..59\', minute)\n if not 0 <= second <= 59:\n raise ValueError(\'second must be in 0..59\', second)\n if not 0 <= microsecond <= 999999:\n raise ValueError(\'microsecond must be in 0..999999\', microsecond)\n return hour, minute, second, microsecond\n\ndef _check_tzinfo_arg(tz):\n if tz is not None and not isinstance(tz, tzinfo):\n raise TypeError("tzinfo argument must be None or of a tzinfo subclass")\n\n\n# Notes on comparison: In general, datetime module comparison operators raise\n# TypeError when they don\'t know how to do a comparison themself. If they\n# returned NotImplemented instead, comparison could (silently) fall back to\n# the default compare-objects-by-comparing-their-memory-addresses strategy,\n# and that\'s not helpful. There are two exceptions:\n#\n# 1. For date and datetime, if the other object has a "timetuple" attr,\n# NotImplemented is returned. This is a hook to allow other kinds of\n# datetime-like objects a chance to intercept the comparison.\n#\n# 2. Else __eq__ and __ne__ return False and True, respectively. This is\n# so opertaions like\n#\n# x == y\n# x != y\n# x in sequence\n# x not in sequence\n# dict[x] = y\n#\n# don\'t raise annoying TypeErrors just because a datetime object\n# is part of a heterogeneous collection. If there\'s no known way to\n# compare X to a datetime, saying they\'re not equal is reasonable.\n\ndef _cmperror(x, y):\n raise TypeError("can\'t compare \'%s\' to \'%s\'" % (\n type(x).__name__, type(y).__name__))\n\ndef _normalize_pair(hi, lo, factor):\n if not 0 <= lo <= factor-1:\n inc, lo = divmod(lo, factor)\n hi += inc\n return hi, lo\n\ndef _normalize_datetime(y, m, d, hh, mm, ss, us, ignore_overflow=False):\n # Normalize all the inputs, and store the normalized values.\n ss, us = _normalize_pair(ss, us, 1000000)\n mm, ss = _normalize_pair(mm, ss, 60)\n hh, mm = _normalize_pair(hh, mm, 60)\n d, hh = _normalize_pair(d, hh, 24)\n y, m, d = _normalize_date(y, m, d, ignore_overflow)\n return y, m, d, hh, mm, ss, us\n\ndef _normalize_date(year, month, day, ignore_overflow=False):\n # That was easy. Now it gets muddy: the proper range for day\n # can\'t be determined without knowing the correct month and year,\n # but if day is, e.g., plus or minus a million, the current month\n # and year values make no sense (and may also be out of bounds\n # themselves).\n # Saying 12 months == 1 year should be non-controversial.\n if not 1 <= month <= 12:\n year, month = _normalize_pair(year, month-1, 12)\n month += 1\n assert 1 <= month <= 12\n\n # Now only day can be out of bounds (year may also be out of bounds\n # for a datetime object, but we don\'t care about that here).\n # If day is out of bounds, what to do is arguable, but at least the\n # method here is principled and explainable.\n dim = _days_in_month(year, month)\n if not 1 <= day <= dim:\n # Move day-1 days from the first of the month. First try to\n # get off cheap if we\'re only one day out of range (adjustments\n # for timezone alone can\'t be worse than that).\n if day == 0: # move back a day\n month -= 1\n if month > 0:\n day = _days_in_month(year, month)\n else:\n year, month, day = year-1, 12, 31\n elif day == dim + 1: # move forward a day\n month += 1\n day = 1\n if month > 12:\n month = 1\n year += 1\n else:\n ordinal = _ymd2ord(year, month, 1) + (day - 1)\n year, month, day = _ord2ymd(ordinal)\n\n if not ignore_overflow and not MINYEAR <= year <= MAXYEAR:\n raise OverflowError("date value out of range")\n return year, month, day\n\ndef _accum(tag, sofar, num, factor, leftover):\n if isinstance(num, int):\n prod = num * factor\n rsum = sofar + prod\n return rsum, leftover\n if isinstance(num, float):\n fracpart, intpart = _math.modf(num)\n prod = int(intpart) * factor\n rsum = sofar + prod\n if fracpart == 0.0:\n return rsum, leftover\n assert isinstance(factor, int)\n fracpart, intpart = _math.modf(factor * fracpart)\n rsum += int(intpart)\n return rsum, leftover + fracpart\n raise TypeError("unsupported type for timedelta %s component: %s" %\n (tag, type(num)))\n\nclass timedelta(object):\n """Represent the difference between two datetime objects.\n\n Supported operators:\n\n - add, subtract timedelta\n - unary plus, minus, abs\n - compare to timedelta\n - multiply, divide by int/long\n\n In addition, datetime supports subtraction of two datetime objects\n returning a timedelta, and addition or subtraction of a datetime\n and a timedelta giving a datetime.\n\n Representation: (days, seconds, microseconds). Why? Because I\n felt like it.\n """\n __slots__ = \'_days\', \'_seconds\', \'_microseconds\', \'_hashcode\'\n\n def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL,\n milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL):\n x = 0\n leftover = 0.0\n if microseconds is not _SENTINEL:\n x, leftover = _accum("microseconds", x, microseconds, _US_PER_US, leftover)\n if milliseconds is not _SENTINEL:\n x, leftover = _accum("milliseconds", x, milliseconds, _US_PER_MS, leftover)\n if seconds is not _SENTINEL:\n x, leftover = _accum("seconds", x, seconds, _US_PER_SECOND, leftover)\n if minutes is not _SENTINEL:\n x, leftover = _accum("minutes", x, minutes, _US_PER_MINUTE, leftover)\n if hours is not _SENTINEL:\n x, leftover = _accum("hours", x, hours, _US_PER_HOUR, leftover)\n if days is not _SENTINEL:\n x, leftover = _accum("days", x, days, _US_PER_DAY, leftover)\n if weeks is not _SENTINEL:\n x, leftover = _accum("weeks", x, weeks, _US_PER_WEEK, leftover)\n if leftover != 0.0:\n x += _round(leftover)\n return cls._from_microseconds(x)\n\n @classmethod\n def _from_microseconds(cls, us):\n s, us = divmod(us, _US_PER_SECOND)\n d, s = divmod(s, _SECONDS_PER_DAY)\n return cls._create(d, s, us, False)\n\n @classmethod\n def _create(cls, d, s, us, normalize):\n if normalize:\n s, us = _normalize_pair(s, us, 1000000)\n d, s = _normalize_pair(d, s, 24*3600)\n\n if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS:\n raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS))\n\n self = object.__new__(cls)\n self._days = d\n self._seconds = s\n self._microseconds = us\n self._hashcode = -1\n return self\n\n def _to_microseconds(self):\n return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND +\n self._microseconds)\n\n def __repr__(self):\n module = "datetime." if self.__class__ is timedelta else ""\n if self._microseconds:\n return "%s(%d, %d, %d)" % (module + self.__class__.__name__,\n self._days,\n self._seconds,\n self._microseconds)\n if self._seconds:\n return "%s(%d, %d)" % (module + self.__class__.__name__,\n self._days,\n self._seconds)\n return "%s(%d)" % (module + self.__class__.__name__, self._days)\n\n def __str__(self):\n mm, ss = divmod(self._seconds, 60)\n hh, mm = divmod(mm, 60)\n s = "%d:%02d:%02d" % (hh, mm, ss)\n if self._days:\n def plural(n):\n return n, abs(n) != 1 and "s" or ""\n s = ("%d day%s, " % plural(self._days)) + s\n if self._microseconds:\n s = s + ".%06d" % self._microseconds\n return s\n\n def total_seconds(self):\n """Total seconds in the duration."""\n return self._to_microseconds() / 10.0**6\n\n # Read-only field accessors\n @property\n def days(self):\n """days"""\n return self._days\n\n @property\n def seconds(self):\n """seconds"""\n return self._seconds\n\n @property\n def microseconds(self):\n """microseconds"""\n return self._microseconds\n\n def __add__(self, other):\n if isinstance(other, timedelta):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(self._days + other._days,\n self._seconds + other._seconds,\n self._microseconds + other._microseconds,\n True)\n return NotImplemented\n\n def __sub__(self, other):\n if isinstance(other, timedelta):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(self._days - other._days,\n self._seconds - other._seconds,\n self._microseconds - other._microseconds,\n True)\n return NotImplemented\n\n def __neg__(self):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(-self._days,\n -self._seconds,\n -self._microseconds,\n True)\n\n def __pos__(self):\n # for CPython compatibility, we cannot use\n # our __class__ here, but need a real timedelta\n return timedelta._create(self._days,\n self._seconds,\n self._microseconds,\n False)\n\n def __abs__(self):\n if self._days < 0:\n return -self\n else:\n return self\n\n def __mul__(self, other):\n if not isinstance(other, int):\n return NotImplemented\n usec = self._to_microseconds()\n return timedelta._from_microseconds(usec * other)\n\n __rmul__ = __mul__\n\n def __div__(self, other):\n if not isinstance(other, int):\n return NotImplemented\n usec = self._to_microseconds()\n return timedelta._from_microseconds(usec // other)\n\n __floordiv__ = __div__\n\n # Comparisons of timedelta objects with other.\n\n def __eq__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) == 0\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) != 0\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) <= 0\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) < 0\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) >= 0\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, timedelta):\n return self._cmp(other) > 0\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, timedelta)\n return _cmp(self._getstate(), other._getstate())\n\n def __hash__(self):\n if self._hashcode == -1:\n self._hashcode = hash(self._getstate())\n return self._hashcode\n\n def __nonzero__(self):\n return (self._days != 0 or\n self._seconds != 0 or\n self._microseconds != 0)\n\ntimedelta.min = timedelta(-_MAX_DELTA_DAYS)\ntimedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1)\ntimedelta.resolution = timedelta(microseconds=1)\n\nclass date(object):\n """Concrete date type.\n\n Constructors:\n\n __new__()\n fromtimestamp()\n today()\n fromordinal()\n\n Operators:\n\n __repr__, __str__\n __cmp__, __hash__\n __add__, __radd__, __sub__ (add/radd only with timedelta arg)\n\n Methods:\n\n timetuple()\n toordinal()\n weekday()\n isoweekday(), isocalendar(), isoformat()\n ctime()\n strftime()\n\n Properties (readonly):\n year, month, day\n """\n __slots__ = \'_year\', \'_month\', \'_day\', \'_hashcode\'\n\n def __new__(cls, year, month=None, day=None):\n """Constructor.\n\n Arguments:\n\n year, month, day (required, base 1)\n """\n year, month, day = _check_date_fields(year, month, day)\n self = object.__new__(cls)\n self._year = year\n self._month = month\n self._day = day\n self._hashcode = -1\n return self\n\n # Additional constructors\n\n @classmethod\n def fromtimestamp(cls, t):\n "Construct a date from a POSIX timestamp (like time.time())."\n y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t)\n return cls(y, m, d)\n\n @classmethod\n def today(cls):\n "Construct a date from time.time()."\n t = _time.time()\n return cls.fromtimestamp(t)\n\n @classmethod\n def fromordinal(cls, n):\n """Contruct a date from a proleptic Gregorian ordinal.\n\n January 1 of year 1 is day 1. Only the year, month and day are\n non-zero in the result.\n """\n y, m, d = _ord2ymd(n)\n return cls(y, m, d)\n\n # Conversions to string\n\n def __repr__(self):\n """Convert to formal string, for repr().\n\n >>> dt = datetime(2010, 1, 1)\n >>> repr(dt)\n \'datetime.datetime(2010, 1, 1, 0, 0)\'\n\n >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)\n >>> repr(dt)\n \'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)\'\n """\n module = "datetime." if self.__class__ is date else ""\n return "%s(%d, %d, %d)" % (module + self.__class__.__name__,\n self._year,\n self._month,\n self._day)\n\n # XXX These shouldn\'t depend on time.localtime(), because that\n # clips the usable dates to [1970 .. 2038). At least ctime() is\n # easily done without using strftime() -- that\'s better too because\n # strftime("%c", ...) is locale specific.\n\n def ctime(self):\n "Return ctime() style string."\n weekday = self.toordinal() % 7 or 7\n return "%s %s %2d 00:00:00 %04d" % (\n _DAYNAMES[weekday],\n _MONTHNAMES[self._month],\n self._day, self._year)\n\n def strftime(self, format):\n "Format using strftime()."\n return _wrap_strftime(self, format, self.timetuple())\n\n def __format__(self, fmt):\n if not isinstance(fmt, (str, unicode)):\n raise ValueError("__format__ expects str or unicode, not %s" %\n fmt.__class__.__name__)\n if len(fmt) != 0:\n return self.strftime(fmt)\n return str(self)\n\n def isoformat(self):\n """Return the date formatted according to ISO.\n\n This is \'YYYY-MM-DD\'.\n\n References:\n - http://www.w3.org/TR/NOTE-datetime\n - http://www.cl.cam.ac.uk/~mgk25/iso-time.html\n """\n return "%04d-%02d-%02d" % (self._year, self._month, self._day)\n\n __str__ = isoformat\n\n # Read-only field accessors\n @property\n def year(self):\n """year (1-9999)"""\n return self._year\n\n @property\n def month(self):\n """month (1-12)"""\n return self._month\n\n @property\n def day(self):\n """day (1-31)"""\n return self._day\n\n # Standard conversions, __cmp__, __hash__ (and helpers)\n\n def timetuple(self):\n "Return local time tuple compatible with time.localtime()."\n return _build_struct_time(self._year, self._month, self._day,\n 0, 0, 0, -1)\n\n def toordinal(self):\n """Return proleptic Gregorian ordinal for the year, month and day.\n\n January 1 of year 1 is day 1. Only the year, month and day values\n contribute to the result.\n """\n return _ymd2ord(self._year, self._month, self._day)\n\n def replace(self, year=None, month=None, day=None):\n """Return a new date with new values for the specified fields."""\n if year is None:\n year = self._year\n if month is None:\n month = self._month\n if day is None:\n day = self._day\n return date(year, month, day)\n\n # Comparisons of date objects with other.\n\n def __eq__(self, other):\n if isinstance(other, date):\n return self._cmp(other) == 0\n elif hasattr(other, "timetuple"):\n return NotImplemented\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, date):\n return self._cmp(other) != 0\n elif hasattr(other, "timetuple"):\n return NotImplemented\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, date):\n return self._cmp(other) <= 0\n elif hasattr(other, "timetuple"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, date):\n return self._cmp(other) < 0\n elif hasattr(other, "timetuple"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, date):\n return self._cmp(other) >= 0\n elif hasattr(other, "timetuple"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, date):\n return self._cmp(other) > 0\n elif hasattr(other, "timetuple"):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, date)\n y, m, d = self._year, self._month, self._day\n y2, m2, d2 = other._year, other._month, other._day\n return _cmp((y, m, d), (y2, m2, d2))\n\n def __hash__(self):\n "Hash."\n if self._hashcode == -1:\n self._hashcode = hash(self._getstate())\n return self._hashcode\n\n # Computations\n\n def _add_timedelta(self, other, factor):\n y, m, d = _normalize_date(\n self._year,\n self._month,\n self._day + other.days * factor)\n return date(y, m, d)\n\n def __add__(self, other):\n "Add a date to a timedelta."\n if isinstance(other, timedelta):\n return self._add_timedelta(other, 1)\n return NotImplemented\n\n __radd__ = __add__\n\n def __sub__(self, other):\n """Subtract two dates, or a date and a timedelta."""\n if isinstance(other, date):\n days1 = self.toordinal()\n days2 = other.toordinal()\n return timedelta._create(days1 - days2, 0, 0, False)\n if isinstance(other, timedelta):\n return self._add_timedelta(other, -1)\n return NotImplemented\n\n def weekday(self):\n "Return day of the week, where Monday == 0 ... Sunday == 6."\n return (self.toordinal() + 6) % 7\n\n # Day-of-the-week and week-of-the-year, according to ISO\n\n def isoweekday(self):\n "Return day of the week, where Monday == 1 ... Sunday == 7."\n # 1-Jan-0001 is a Monday\n return self.toordinal() % 7 or 7\n\n def isocalendar(self):\n """Return a 3-tuple containing ISO year, week number, and weekday.\n\n The first ISO week of the year is the (Mon-Sun) week\n containing the year\'s first Thursday; everything else derives\n from that.\n\n The first week is 1; Monday is 1 ... Sunday is 7.\n\n ISO calendar algorithm taken from\n http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm\n """\n year = self._year\n week1monday = _isoweek1monday(year)\n today = _ymd2ord(self._year, self._month, self._day)\n # Internally, week and day have origin 0\n week, day = divmod(today - week1monday, 7)\n if week < 0:\n year -= 1\n week1monday = _isoweek1monday(year)\n week, day = divmod(today - week1monday, 7)\n elif week >= 52:\n if today >= _isoweek1monday(year+1):\n year += 1\n week = 0\n return year, week+1, day+1\n\n_date_class = date # so functions w/ args named "date" can get at the class\n\ndate.min = date(1, 1, 1)\ndate.max = date(9999, 12, 31)\ndate.resolution = timedelta(days=1)\n\nclass tzinfo(object):\n """Abstract base class for time zone info classes.\n\n Subclasses must override the name(), utcoffset() and dst() methods.\n """\n __slots__ = ()\n\n def tzname(self, dt):\n "datetime -> string name of time zone."\n raise NotImplementedError("tzinfo subclass must override tzname()")\n\n def utcoffset(self, dt):\n "datetime -> minutes east of UTC (negative for west of UTC)"\n raise NotImplementedError("tzinfo subclass must override utcoffset()")\n\n def dst(self, dt):\n """datetime -> DST offset in minutes east of UTC.\n\n Return 0 if DST not in effect. utcoffset() must include the DST\n offset.\n """\n raise NotImplementedError("tzinfo subclass must override dst()")\n\n def fromutc(self, dt):\n "datetime in UTC -> datetime in local time."\n\n if not isinstance(dt, datetime):\n raise TypeError("fromutc() requires a datetime argument")\n if dt.tzinfo is not self:\n raise ValueError("dt.tzinfo is not self")\n\n dtoff = dt.utcoffset()\n if dtoff is None:\n raise ValueError("fromutc() requires a non-None utcoffset() "\n "result")\n\n # See the long comment block at the end of this file for an\n # explanation of this algorithm.\n dtdst = dt.dst()\n if dtdst is None:\n raise ValueError("fromutc() requires a non-None dst() result")\n delta = dtoff - dtdst\n if delta:\n dt = dt + delta\n dtdst = dt.dst()\n if dtdst is None:\n raise ValueError("fromutc(): dt.dst gave inconsistent "\n "results; cannot convert")\n if dtdst:\n return dt + dtdst\n else:\n return dt\n\n_tzinfo_class = tzinfo\n\nclass time(object):\n """Time with time zone.\n\n Constructors:\n\n __new__()\n\n Operators:\n\n __repr__, __str__\n __cmp__, __hash__\n\n Methods:\n\n strftime()\n isoformat()\n utcoffset()\n tzname()\n dst()\n\n Properties (readonly):\n hour, minute, second, microsecond, tzinfo\n """\n __slots__ = \'_hour\', \'_minute\', \'_second\', \'_microsecond\', \'_tzinfo\', \'_hashcode\'\n\n def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None):\n """Constructor.\n\n Arguments:\n\n hour, minute (required)\n second, microsecond (default to zero)\n tzinfo (default to None)\n """\n hour, minute, second, microsecond = _check_time_fields(\n hour, minute, second, microsecond)\n _check_tzinfo_arg(tzinfo)\n self = object.__new__(cls)\n self._hour = hour\n self._minute = minute\n self._second = second\n self._microsecond = microsecond\n self._tzinfo = tzinfo\n self._hashcode = -1\n return self\n\n # Read-only field accessors\n @property\n def hour(self):\n """hour (0-23)"""\n return self._hour\n\n @property\n def minute(self):\n """minute (0-59)"""\n return self._minute\n\n @property\n def second(self):\n """second (0-59)"""\n return self._second\n\n @property\n def microsecond(self):\n """microsecond (0-999999)"""\n return self._microsecond\n\n @property\n def tzinfo(self):\n """timezone info object"""\n return self._tzinfo\n\n # Standard conversions, __hash__ (and helpers)\n\n # Comparisons of time objects with other.\n\n def __eq__(self, other):\n if isinstance(other, time):\n return self._cmp(other) == 0\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, time):\n return self._cmp(other) != 0\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, time):\n return self._cmp(other) <= 0\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, time):\n return self._cmp(other) < 0\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, time):\n return self._cmp(other) >= 0\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, time):\n return self._cmp(other) > 0\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, time)\n mytz = self._tzinfo\n ottz = other._tzinfo\n myoff = otoff = None\n\n if mytz is ottz:\n base_compare = True\n else:\n myoff = self._utcoffset()\n otoff = other._utcoffset()\n base_compare = myoff == otoff\n\n if base_compare:\n return _cmp((self._hour, self._minute, self._second,\n self._microsecond),\n (other._hour, other._minute, other._second,\n other._microsecond))\n if myoff is None or otoff is None:\n raise TypeError("can\'t compare offset-naive and offset-aware times")\n myhhmm = self._hour * 60 + self._minute - myoff\n othhmm = other._hour * 60 + other._minute - otoff\n return _cmp((myhhmm, self._second, self._microsecond),\n (othhmm, other._second, other._microsecond))\n\n def __hash__(self):\n """Hash."""\n if self._hashcode == -1:\n tzoff = self._utcoffset()\n if not tzoff: # zero or None\n self._hashcode = hash(self._getstate()[0])\n else:\n h, m = divmod(self.hour * 60 + self.minute - tzoff, 60)\n if 0 <= h < 24:\n self._hashcode = hash(time(h, m, self.second, self.microsecond))\n else:\n self._hashcode = hash((h, m, self.second, self.microsecond))\n return self._hashcode\n\n # Conversion to string\n\n def _tzstr(self, sep=":"):\n """Return formatted timezone offset (+xx:xx) or None."""\n off = self._utcoffset()\n if off is not None:\n if off < 0:\n sign = "-"\n off = -off\n else:\n sign = "+"\n hh, mm = divmod(off, 60)\n assert 0 <= hh < 24\n off = "%s%02d%s%02d" % (sign, hh, sep, mm)\n return off\n\n def __repr__(self):\n """Convert to formal string, for repr()."""\n if self._microsecond != 0:\n s = ", %d, %d" % (self._second, self._microsecond)\n elif self._second != 0:\n s = ", %d" % self._second\n else:\n s = ""\n module = "datetime." if self.__class__ is time else ""\n s= "%s(%d, %d%s)" % (module + self.__class__.__name__,\n self._hour, self._minute, s)\n if self._tzinfo is not None:\n assert s[-1:] == ")"\n s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"\n return s\n\n def isoformat(self):\n """Return the time formatted according to ISO.\n\n This is \'HH:MM:SS.mmmmmm+zz:zz\', or \'HH:MM:SS+zz:zz\' if\n self.microsecond == 0.\n """\n s = _format_time(self._hour, self._minute, self._second,\n self._microsecond)\n tz = self._tzstr()\n if tz:\n s += tz\n return s\n\n __str__ = isoformat\n\n def strftime(self, format):\n """Format using strftime(). The date part of the timestamp passed\n to underlying strftime should not be used.\n """\n # The year must be >= _MINYEARFMT else Python\'s strftime implementation\n # can raise a bogus exception.\n timetuple = (1900, 1, 1,\n self._hour, self._minute, self._second,\n 0, 1, -1)\n return _wrap_strftime(self, format, timetuple)\n\n def __format__(self, fmt):\n if not isinstance(fmt, (str, unicode)):\n raise ValueError("__format__ expects str or unicode, not %s" %\n fmt.__class__.__name__)\n if len(fmt) != 0:\n return self.strftime(fmt)\n return str(self)\n\n # Timezone functions\n\n def utcoffset(self):\n """Return the timezone offset in minutes east of UTC (negative west of\n UTC)."""\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(None)\n offset = _check_utc_offset("utcoffset", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _utcoffset(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(None)\n offset = _check_utc_offset("utcoffset", offset)\n return offset\n\n def tzname(self):\n """Return the timezone name.\n\n Note that the name is 100% informational -- there\'s no requirement that\n it mean anything in particular. For example, "GMT", "UTC", "-500",\n "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.\n """\n if self._tzinfo is None:\n return None\n name = self._tzinfo.tzname(None)\n _check_tzname(name)\n return name\n\n def dst(self):\n """Return 0 if DST is not in effect, or the DST offset (in minutes\n eastward) if DST is in effect.\n\n This is purely informational; the DST offset has already been added to\n the UTC offset returned by utcoffset() if applicable, so there\'s no\n need to consult dst() unless you\'re interested in displaying the DST\n info.\n """\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(None)\n offset = _check_utc_offset("dst", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _dst(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(None)\n offset = _check_utc_offset("dst", offset)\n return offset\n\n def replace(self, hour=None, minute=None, second=None, microsecond=None,\n tzinfo=True):\n """Return a new time with new values for the specified fields."""\n if hour is None:\n hour = self.hour\n if minute is None:\n minute = self.minute\n if second is None:\n second = self.second\n if microsecond is None:\n microsecond = self.microsecond\n if tzinfo is True:\n tzinfo = self.tzinfo\n return time(hour, minute, second, microsecond, tzinfo)\n\n def __nonzero__(self):\n if self.second or self.microsecond:\n return True\n offset = self._utcoffset() or 0\n return self.hour * 60 + self.minute != offset\n\n_time_class = time # so functions w/ args named "time" can get at the class\n\ntime.min = time(0, 0, 0)\ntime.max = time(23, 59, 59, 999999)\ntime.resolution = timedelta(microseconds=1)\n\nclass datetime(date):\n """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n\n The year, month and day arguments are required. tzinfo may be None, or an\n instance of a tzinfo subclass. The remaining arguments may be ints or longs.\n """\n __slots__ = date.__slots__ + time.__slots__\n\n def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,\n microsecond=0, tzinfo=None):\n year, month, day = _check_date_fields(year, month, day)\n hour, minute, second, microsecond = _check_time_fields(\n hour, minute, second, microsecond)\n _check_tzinfo_arg(tzinfo)\n self = object.__new__(cls)\n self._year = year\n self._month = month\n self._day = day\n self._hour = hour\n self._minute = minute\n self._second = second\n self._microsecond = microsecond\n self._tzinfo = tzinfo\n self._hashcode = -1\n return self\n\n # Read-only field accessors\n @property\n def hour(self):\n """hour (0-23)"""\n return self._hour\n\n @property\n def minute(self):\n """minute (0-59)"""\n return self._minute\n\n @property\n def second(self):\n """second (0-59)"""\n return self._second\n\n @property\n def microsecond(self):\n """microsecond (0-999999)"""\n return self._microsecond\n\n @property\n def tzinfo(self):\n """timezone info object"""\n return self._tzinfo\n\n @classmethod\n def fromtimestamp(cls, timestamp, tz=None):\n """Construct a datetime from a POSIX timestamp (like time.time()).\n\n A timezone info object may be passed in as well.\n """\n _check_tzinfo_arg(tz)\n converter = _time.localtime if tz is None else _time.gmtime\n self = cls._from_timestamp(converter, timestamp, tz)\n if tz is not None:\n self = tz.fromutc(self)\n return self\n\n @classmethod\n def utcfromtimestamp(cls, t):\n "Construct a UTC datetime from a POSIX timestamp (like time.time())."\n return cls._from_timestamp(_time.gmtime, t, None)\n\n @classmethod\n def _from_timestamp(cls, converter, timestamp, tzinfo):\n t_full = timestamp\n timestamp = int(_math.floor(timestamp))\n frac = t_full - timestamp\n us = _round(frac * 1e6)\n\n # If timestamp is less than one microsecond smaller than a\n # full second, us can be rounded up to 1000000. In this case,\n # roll over to seconds, otherwise, ValueError is raised\n # by the constructor.\n if us == 1000000:\n timestamp += 1\n us = 0\n y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp)\n ss = min(ss, 59) # clamp out leap seconds if the platform has them\n return cls(y, m, d, hh, mm, ss, us, tzinfo)\n\n @classmethod\n def now(cls, tz=None):\n "Construct a datetime from time.time() and optional time zone info."\n t = _time.time()\n return cls.fromtimestamp(t, tz)\n\n @classmethod\n def utcnow(cls):\n "Construct a UTC datetime from time.time()."\n t = _time.time()\n return cls.utcfromtimestamp(t)\n\n @classmethod\n def combine(cls, date, time):\n "Construct a datetime from a given date and a given time."\n if not isinstance(date, _date_class):\n raise TypeError("date argument must be a date instance")\n if not isinstance(time, _time_class):\n raise TypeError("time argument must be a time instance")\n return cls(date.year, date.month, date.day,\n time.hour, time.minute, time.second, time.microsecond,\n time.tzinfo)\n\n def timetuple(self):\n "Return local time tuple compatible with time.localtime()."\n dst = self._dst()\n if dst is None:\n dst = -1\n elif dst:\n dst = 1\n return _build_struct_time(self.year, self.month, self.day,\n self.hour, self.minute, self.second,\n dst)\n\n def utctimetuple(self):\n "Return UTC time tuple compatible with time.gmtime()."\n y, m, d = self.year, self.month, self.day\n hh, mm, ss = self.hour, self.minute, self.second\n offset = self._utcoffset()\n if offset: # neither None nor 0\n mm -= offset\n y, m, d, hh, mm, ss, _ = _normalize_datetime(\n y, m, d, hh, mm, ss, 0, ignore_overflow=True)\n return _build_struct_time(y, m, d, hh, mm, ss, 0)\n\n def date(self):\n "Return the date part."\n return date(self._year, self._month, self._day)\n\n def time(self):\n "Return the time part, with tzinfo None."\n return time(self.hour, self.minute, self.second, self.microsecond)\n\n def timetz(self):\n "Return the time part, with same tzinfo."\n return time(self.hour, self.minute, self.second, self.microsecond,\n self._tzinfo)\n\n def replace(self, year=None, month=None, day=None, hour=None,\n minute=None, second=None, microsecond=None, tzinfo=True):\n """Return a new datetime with new values for the specified fields."""\n if year is None:\n year = self.year\n if month is None:\n month = self.month\n if day is None:\n day = self.day\n if hour is None:\n hour = self.hour\n if minute is None:\n minute = self.minute\n if second is None:\n second = self.second\n if microsecond is None:\n microsecond = self.microsecond\n if tzinfo is True:\n tzinfo = self.tzinfo\n return datetime(year, month, day, hour, minute, second, microsecond,\n tzinfo)\n\n def astimezone(self, tz):\n if not isinstance(tz, tzinfo):\n raise TypeError("tz argument must be an instance of tzinfo")\n\n mytz = self.tzinfo\n if mytz is None:\n raise ValueError("astimezone() requires an aware datetime")\n\n if tz is mytz:\n return self\n\n # Convert self to UTC, and attach the new time zone object.\n myoffset = self.utcoffset()\n if myoffset is None:\n raise ValueError("astimezone() requires an aware datetime")\n utc = (self - myoffset).replace(tzinfo=tz)\n\n # Convert from UTC to tz\'s local time.\n return tz.fromutc(utc)\n\n # Ways to produce a string.\n\n def ctime(self):\n "Return ctime() style string."\n weekday = self.toordinal() % 7 or 7\n return "%s %s %2d %02d:%02d:%02d %04d" % (\n _DAYNAMES[weekday],\n _MONTHNAMES[self._month],\n self._day,\n self._hour, self._minute, self._second,\n self._year)\n\n def isoformat(self, sep=\'T\'):\n """Return the time formatted according to ISO.\n\n This is \'YYYY-MM-DD HH:MM:SS.mmmmmm\', or \'YYYY-MM-DD HH:MM:SS\' if\n self.microsecond == 0.\n\n If self.tzinfo is not None, the UTC offset is also attached, giving\n \'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM\' or \'YYYY-MM-DD HH:MM:SS+HH:MM\'.\n\n Optional argument sep specifies the separator between date and\n time, default \'T\'.\n """\n s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) +\n _format_time(self._hour, self._minute, self._second,\n self._microsecond))\n off = self._utcoffset()\n if off is not None:\n if off < 0:\n sign = "-"\n off = -off\n else:\n sign = "+"\n hh, mm = divmod(off, 60)\n s += "%s%02d:%02d" % (sign, hh, mm)\n return s\n\n def __repr__(self):\n """Convert to formal string, for repr()."""\n L = [self._year, self._month, self._day, # These are never zero\n self._hour, self._minute, self._second, self._microsecond]\n if L[-1] == 0:\n del L[-1]\n if L[-1] == 0:\n del L[-1]\n s = ", ".join(map(str, L))\n module = "datetime." if self.__class__ is datetime else ""\n s = "%s(%s)" % (module + self.__class__.__name__, s)\n if self._tzinfo is not None:\n assert s[-1:] == ")"\n s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"\n return s\n\n def __str__(self):\n "Convert to string, for str()."\n return self.isoformat(sep=\' \')\n\n @classmethod\n def strptime(cls, date_string, format):\n \'string, format -> new datetime parsed from a string (like time.strptime()).\'\n from _strptime import _strptime\n # _strptime._strptime returns a two-element tuple. The first\n # element is a time.struct_time object. The second is the\n # microseconds (which are not defined for time.struct_time).\n struct, micros = _strptime(date_string, format)\n return cls(*(struct[0:6] + (micros,)))\n\n def utcoffset(self):\n """Return the timezone offset in minutes east of UTC (negative west of\n UTC)."""\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(self)\n offset = _check_utc_offset("utcoffset", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _utcoffset(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.utcoffset(self)\n offset = _check_utc_offset("utcoffset", offset)\n return offset\n\n def tzname(self):\n """Return the timezone name.\n\n Note that the name is 100% informational -- there\'s no requirement that\n it mean anything in particular. For example, "GMT", "UTC", "-500",\n "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.\n """\n if self._tzinfo is None:\n return None\n name = self._tzinfo.tzname(self)\n _check_tzname(name)\n return name\n\n def dst(self):\n """Return 0 if DST is not in effect, or the DST offset (in minutes\n eastward) if DST is in effect.\n\n This is purely informational; the DST offset has already been added to\n the UTC offset returned by utcoffset() if applicable, so there\'s no\n need to consult dst() unless you\'re interested in displaying the DST\n info.\n """\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(self)\n offset = _check_utc_offset("dst", offset)\n if offset is not None:\n offset = timedelta._create(0, offset * 60, 0, True)\n return offset\n\n # Return an integer (or None) instead of a timedelta (or None).\n def _dst(self):\n if self._tzinfo is None:\n return None\n offset = self._tzinfo.dst(self)\n offset = _check_utc_offset("dst", offset)\n return offset\n\n # Comparisons of datetime objects with other.\n\n def __eq__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) == 0\n elif hasattr(other, "timetuple") and not isinstance(other, date):\n return NotImplemented\n else:\n return False\n\n def __ne__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) != 0\n elif hasattr(other, "timetuple") and not isinstance(other, date):\n return NotImplemented\n else:\n return True\n\n def __le__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) <= 0\n elif hasattr(other, "timetuple") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __lt__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) < 0\n elif hasattr(other, "timetuple") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __ge__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) >= 0\n elif hasattr(other, "timetuple") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def __gt__(self, other):\n if isinstance(other, datetime):\n return self._cmp(other) > 0\n elif hasattr(other, "timetuple") and not isinstance(other, date):\n return NotImplemented\n else:\n _cmperror(self, other)\n\n def _cmp(self, other):\n assert isinstance(other, datetime)\n mytz = self._tzinfo\n ottz = other._tzinfo\n myoff = otoff = None\n\n if mytz is ottz:\n base_compare = True\n else:\n if mytz is not None:\n myoff = self._utcoffset()\n if ottz is not None:\n otoff = other._utcoffset()\n base_compare = myoff == otoff\n\n if base_compare:\n return _cmp((self._year, self._month, self._day,\n self._hour, self._minute, self._second,\n self._microsecond),\n (other._year, other._month, other._day,\n other._hour, other._minute, other._second,\n other._microsecond))\n if myoff is None or otoff is None:\n raise TypeError("can\'t compare offset-naive and offset-aware datetimes")\n # XXX What follows could be done more efficiently...\n diff = self - other # this will take offsets into account\n if diff.days < 0:\n return -1\n return diff and 1 or 0\n\n def _add_timedelta(self, other, factor):\n y, m, d, hh, mm, ss, us = _normalize_datetime(\n self._year,\n self._month,\n self._day + other.days * factor,\n self._hour,\n self._minute,\n self._second + other.seconds * factor,\n self._microsecond + other.microseconds * factor)\n return datetime(y, m, d, hh, mm, ss, us, tzinfo=self._tzinfo)\n\n def __add__(self, other):\n "Add a datetime and a timedelta."\n if not isinstance(other, timedelta):\n return NotImplemented\n return self._add_timedelta(other, 1)\n\n __radd__ = __add__\n\n def __sub__(self, other):\n "Subtract two datetimes, or a datetime and a timedelta."\n if not isinstance(other, datetime):\n if isinstance(other, timedelta):\n return self._add_timedelta(other, -1)\n return NotImplemented\n\n delta_d = self.toordinal() - other.toordinal()\n delta_s = (self._hour - other._hour) * 3600 + \\\n (self._minute - other._minute) * 60 + \\\n (self._second - other._second)\n delta_us = self._microsecond - other._microsecond\n base = timedelta._create(delta_d, delta_s, delta_us, True)\n if self._tzinfo is other._tzinfo:\n return base\n myoff = self._utcoffset()\n otoff = other._utcoffset()\n if myoff == otoff:\n return base\n if myoff is None or otoff is None:\n raise TypeError("can\'t subtract offset-naive and offset-aware datetimes")\n return base + timedelta(minutes = otoff-myoff)\n\n def __hash__(self):\n if self._hashcode == -1:\n tzoff = self._utcoffset()\n if tzoff is None:\n self._hashcode = hash(self._getstate()[0])\n else:\n days = _ymd2ord(self.year, self.month, self.day)\n seconds = self.hour * 3600 + (self.minute - tzoff) * 60 + self.second\n self._hashcode = hash(timedelta(days, seconds, self.microsecond))\n return self._hashcode\n\n\n\ndatetime.min = datetime(1, 1, 1)\ndatetime.max = datetime(9999, 12, 31, 23, 59, 59, 999999)\ndatetime.resolution = timedelta(microseconds=1)\n\n\ndef _isoweek1monday(year):\n # Helper to calculate the day number of the Monday starting week 1\n # XXX This could be done more efficiently\n THURSDAY = 3\n firstday = _ymd2ord(year, 1, 1)\n firstweekday = (firstday + 6) % 7 # See weekday() above\n week1monday = firstday - firstweekday\n if firstweekday > THURSDAY:\n week1monday += 7\n return week1monday\n\n"""\nSome time zone algebra. For a datetime x, let\n x.n = x stripped of its timezone -- its naive time.\n x.o = x.utcoffset(), and assuming that doesn\'t raise an exception or\n return None\n x.d = x.dst(), and assuming that doesn\'t raise an exception or\n return None\n x.s = x\'s standard offset, x.o - x.d\n\nNow some derived rules, where k is a duration (timedelta).\n\n1. x.o = x.s + x.d\n This follows from the definition of x.s.\n\n2. If x and y have the same tzinfo member, x.s = y.s.\n This is actually a requirement, an assumption we need to make about\n sane tzinfo classes.\n\n3. The naive UTC time corresponding to x is x.n - x.o.\n This is again a requirement for a sane tzinfo class.\n\n4. (x+k).s = x.s\n This follows from #2, and that datimetimetz+timedelta preserves tzinfo.\n\n5. (x+k).n = x.n + k\n Again follows from how arithmetic is defined.\n\nNow we can explain tz.fromutc(x). Let\'s assume it\'s an interesting case\n(meaning that the various tzinfo methods exist, and don\'t blow up or return\nNone when called).\n\nThe function wants to return a datetime y with timezone tz, equivalent to x.\nx is already in UTC.\n\nBy #3, we want\n\n y.n - y.o = x.n [1]\n\nThe algorithm starts by attaching tz to x.n, and calling that y. So\nx.n = y.n at the start. Then it wants to add a duration k to y, so that [1]\nbecomes true; in effect, we want to solve [2] for k:\n\n (y+k).n - (y+k).o = x.n [2]\n\nBy #1, this is the same as\n\n (y+k).n - ((y+k).s + (y+k).d) = x.n [3]\n\nBy #5, (y+k).n = y.n + k, which equals x.n + k because x.n=y.n at the start.\nSubstituting that into [3],\n\n x.n + k - (y+k).s - (y+k).d = x.n; the x.n terms cancel, leaving\n k - (y+k).s - (y+k).d = 0; rearranging,\n k = (y+k).s - (y+k).d; by #4, (y+k).s == y.s, so\n k = y.s - (y+k).d\n\nOn the RHS, (y+k).d can\'t be computed directly, but y.s can be, and we\napproximate k by ignoring the (y+k).d term at first. Note that k can\'t be\nvery large, since all offset-returning methods return a duration of magnitude\nless than 24 hours. For that reason, if y is firmly in std time, (y+k).d must\nbe 0, so ignoring it has no consequence then.\n\nIn any case, the new value is\n\n z = y + y.s [4]\n\nIt\'s helpful to step back at look at [4] from a higher level: it\'s simply\nmapping from UTC to tz\'s standard time.\n\nAt this point, if\n\n z.n - z.o = x.n [5]\n\nwe have an equivalent time, and are almost done. The insecurity here is\nat the start of daylight time. Picture US Eastern for concreteness. The wall\ntime jumps from 1:59 to 3:00, and wall hours of the form 2:MM don\'t make good\nsense then. The docs ask that an Eastern tzinfo class consider such a time to\nbe EDT (because it\'s "after 2"), which is a redundant spelling of 1:MM EST\non the day DST starts. We want to return the 1:MM EST spelling because that\'s\nthe only spelling that makes sense on the local wall clock.\n\nIn fact, if [5] holds at this point, we do have the standard-time spelling,\nbut that takes a bit of proof. We first prove a stronger result. What\'s the\ndifference between the LHS and RHS of [5]? Let\n\n diff = x.n - (z.n - z.o) [6]\n\nNow\n z.n = by [4]\n (y + y.s).n = by #5\n y.n + y.s = since y.n = x.n\n x.n + y.s = since z and y are have the same tzinfo member,\n y.s = z.s by #2\n x.n + z.s\n\nPlugging that back into [6] gives\n\n diff =\n x.n - ((x.n + z.s) - z.o) = expanding\n x.n - x.n - z.s + z.o = cancelling\n - z.s + z.o = by #2\n z.d\n\nSo diff = z.d.\n\nIf [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time\nspelling we wanted in the endcase described above. We\'re done. Contrarily,\nif z.d = 0, then we have a UTC equivalent, and are also done.\n\nIf [5] is not true now, diff = z.d != 0, and z.d is the offset we need to\nadd to z (in effect, z is in tz\'s standard time, and we need to shift the\nlocal clock into tz\'s daylight time).\n\nLet\n\n z\' = z + z.d = z + diff [7]\n\nand we can again ask whether\n\n z\'.n - z\'.o = x.n [8]\n\nIf so, we\'re done. If not, the tzinfo class is insane, according to the\nassumptions we\'ve made. This also requires a bit of proof. As before, let\'s\ncompute the difference between the LHS and RHS of [8] (and skipping some of\nthe justifications for the kinds of substitutions we\'ve done several times\nalready):\n\n diff\' = x.n - (z\'.n - z\'.o) = replacing z\'.n via [7]\n x.n - (z.n + diff - z\'.o) = replacing diff via [6]\n x.n - (z.n + x.n - (z.n - z.o) - z\'.o) =\n x.n - z.n - x.n + z.n - z.o + z\'.o = cancel x.n\n - z.n + z.n - z.o + z\'.o = cancel z.n\n - z.o + z\'.o = #1 twice\n -z.s - z.d + z\'.s + z\'.d = z and z\' have same tzinfo\n z\'.d - z.d\n\nSo z\' is UTC-equivalent to x iff z\'.d = z.d at this point. If they are equal,\nwe\'ve found the UTC-equivalent so are done. In fact, we stop with [7] and\nreturn z\', not bothering to compute z\'.d.\n\nHow could z.d and z\'d differ? z\' = z + z.d [7], so merely moving z\' by\na dst() offset, and starting *from* a time already in DST (we know z.d != 0),\nwould have to change the result dst() returns: we start in DST, and moving\na little further into it takes us out of DST.\n\nThere isn\'t a sane case where this can happen. The closest it gets is at\nthe end of DST, where there\'s an hour in UTC with no spelling in a hybrid\ntzinfo class. In US Eastern, that\'s 5:MM UTC = 0:MM EST = 1:MM EDT. During\nthat hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM\nUTC) because the docs insist on that, but 0:MM is taken as being in daylight\ntime (4:MM UTC). There is no local time mapping to 5:MM UTC. The local\nclock jumps from 1:59 back to 1:00 again, and repeats the 1:MM hour in\nstandard time. Since that\'s what the local clock *does*, we want to map both\nUTC hours 5:MM and 6:MM to 1:MM Eastern. The result is ambiguous\nin local time, but so it goes -- it\'s the way the local clock works.\n\nWhen x = 5:MM UTC is the input to this algorithm, x.o=0, y.o=-5 and y.d=0,\nso z=0:MM. z.d=60 (minutes) then, so [5] doesn\'t hold and we keep going.\nz\' = z + z.d = 1:MM then, and z\'.d=0, and z\'.d - z.d = -60 != 0 so [8]\n(correctly) concludes that z\' is not UTC-equivalent to x.\n\nBecause we know z.d said z was in daylight time (else [5] would have held and\nwe would have stopped then), and we know z.d != z\'.d (else [8] would have held\nand we have stopped then), and there are only 2 possible values dst() can\nreturn in Eastern, it follows that z\'.d must be 0 (which it is in the example,\nbut the reasoning doesn\'t depend on the example -- it depends on there being\ntwo possible dst() outcomes, one zero and the other non-zero). Therefore\nz\' must be in standard time, and is the spelling we want in this case.\n\nNote again that z\' is not UTC-equivalent as far as the hybrid tzinfo class is\nconcerned (because it takes z\' as being in standard time rather than the\ndaylight time we intend here), but returning it gives the real-life "local\nclock repeats an hour" behavior when mapping the "unspellable" UTC hour into\ntz.\n\nWhen the input is 6:MM, z=1:MM and z.d=0, and we stop at once, again with\nthe 1:MM standard time spelling we want.\n\nSo how can this break? One of the assumptions must be violated. Two\npossibilities:\n\n1) [2] effectively says that y.s is invariant across all y belong to a given\n time zone. This isn\'t true if, for political reasons or continental drift,\n a region decides to change its base offset from UTC.\n\n2) There may be versions of "double daylight" time where the tail end of\n the analysis gives up a step too early. I haven\'t thought about that\n enough to say.\n\nIn any case, it\'s clear that the default fromutc() is strong enough to handle\n"almost all" time zones: so long as the standard offset is invariant, it\ndoesn\'t matter if daylight time transition points change from year to year, or\nif daylight time is skipped in some years; it doesn\'t matter how large or\nsmall dst() may get within its bounds; and it doesn\'t even matter if some\nperverse time zone returns a negative dst()). So a breaking case must be\npretty bizarre, and a tzinfo subclass can override fromutc() if it is.\n"""\n',"src/lib/dbhash.py":'raise NotImplementedError("dbhash is not yet implemented in Skulpt")\n',"src/lib/decimal.py":'raise NotImplementedError("decimal is not yet implemented in Skulpt")\n',"src/lib/difflib.py":'raise NotImplementedError("difflib is not yet implemented in Skulpt")\n',"src/lib/dircache.py":'raise NotImplementedError("dircache is not yet implemented in Skulpt")\n',"src/lib/dis.py":'raise NotImplementedError("dis is not yet implemented in Skulpt")\n',"src/lib/distutils/__init__.py":'raise NotImplementedError("distutils is not yet implemented in Skulpt")\n',"src/lib/distutils/command/__init__.py":'raise NotImplementedError("command is not yet implemented in Skulpt")\n',"src/lib/distutils/tests/__init__.py":'raise NotImplementedError("tests is not yet implemented in Skulpt")\n',"src/lib/doctest.py":'raise NotImplementedError("doctest is not yet implemented in Skulpt")\n',"src/lib/document.js":'var $builtinmodule=function(){var a,b={__name__:new Sk.builtin.str("document")};return b.getElementById=new Sk.builtin.func(function(a){var c=document.getElementById(a.v);return c?Sk.misceval.callsimArray(b.Element,[c]):Sk.builtin.none.none$}),b.createElement=new Sk.builtin.func(function(a){var c=document.createElement(a.v);if(c)return Sk.misceval.callsimArray(b.Element,[c])}),b.getElementsByTagName=new Sk.builtin.func(function(a){for(var c=document.getElementsByTagName(a.v),d=[],e=c.length-1;0<=e;e--)d.push(Sk.misceval.callsimArray(b.Element,[c[e]]));return new Sk.builtin.list(d)}),b.getElementsByClassName=new Sk.builtin.func(function(a){for(var c=document.getElementsByClassName(a.v),d=[],e=0;e<c.length;e++)d.push(Sk.misceval.callsimArray(b.Element,[c[e]]));return new Sk.builtin.list(d)}),b.getElementsByName=new Sk.builtin.func(function(a){for(var c=document.getElementsByName(a.v),d=[],e=0;e<c.length;e++)d.push(Sk.misceval.callsimArray(b.Element,[c[e]]));return new Sk.builtin.list(d)}),b.currentDiv=new Sk.builtin.func(function(){if(void 0!==Sk.divid)return new Sk.builtin.str(Sk.divid);throw new Sk.builtin.AttributeError("There is no value set for divid")}),a=function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v=b,a.innerHTML=b.innerHTML,a.innerText=b.innerText,void 0!==b.value&&(a.value=b.value,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str("value"),new Sk.builtin.str(a.value))),void 0!==b.checked&&(a.checked=b.checked,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str("checked"),new Sk.builtin.str(a.checked))),Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str("innerHTML"),new Sk.builtin.str(a.innerHTML)),Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str("innerText"),new Sk.builtin.str(a.innerText))}),b.tp$getattr=Sk.generic.getAttr,b.__setattr__=new Sk.builtin.func(function(a,b,c){b=Sk.ffi.remapToJs(b),"innerHTML"===b&&(a.innerHTML=c,a.v.innerHTML=c.v,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str("innerHTML"),c)),"innerText"===b&&(a.innerText=c,a.v.innerText=c.v,Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str("innerText"),c))}),b.appendChild=new Sk.builtin.func(function(a,b){a.v.appendChild(b.v)}),b.removeChild=new Sk.builtin.func(function(a,b){a.v.removeChild(b.v)}),b.getCSS=new Sk.builtin.func(function(a,b){return new Sk.builtin.str(a.v.style[b.v])}),b.setCSS=new Sk.builtin.func(function(a,b,c){a.v.style[b.v]=c.v}),b.getAttribute=new Sk.builtin.func(function(a,b){var c=a.v.getAttribute(b.v);return c?new Sk.builtin.str(c):Sk.builtin.none.none$}),b.setAttribute=new Sk.builtin.func(function(a,b,c){a.v.setAttribute(b.v,c.v)}),b.getProperty=new Sk.builtin.func(function(a,b){var c=a.v[b.v];return c?new Sk.builtin.str(c):Sk.builtin.none.none$}),b.__str__=new Sk.builtin.func(function(a){return console.log(a.v.tagName),new Sk.builtin.str(a.v.tagName)}),b.__repr__=new Sk.builtin.func(function(){return new Sk.builtin.str("[DOM Element]")})},b.Element=Sk.misceval.buildClass(b,a,"Element",[]),b};',"src/lib/dumbdbm.py":'raise NotImplementedError("dumbdbm is not yet implemented in Skulpt")\n',"src/lib/dummy_thread.py":'raise NotImplementedError("dummy_thread is not yet implemented in Skulpt")\n',"src/lib/dummy_threading.py":'raise NotImplementedError("dummy_threading is not yet implemented in Skulpt")\n',"src/lib/email/__init__.py":'raise NotImplementedError("email is not yet implemented in Skulpt")\n',"src/lib/email/mime/__init__.py":'raise NotImplementedError("mime is not yet implemented in Skulpt")\n',"src/lib/email/test/data/__init__.py":'raise NotImplementedError("data is not yet implemented in Skulpt")\n',"src/lib/encodings/__init__.py":'raise NotImplementedError("encodings is not yet implemented in Skulpt")\n',"src/lib/filecmp.py":'raise NotImplementedError("filecmp is not yet implemented in Skulpt")\n',"src/lib/fileinput.py":'raise NotImplementedError("fileinput is not yet implemented in Skulpt")\n',"src/lib/fnmatch.py":'raise NotImplementedError("fnmatch is not yet implemented in Skulpt")\n',"src/lib/formatter.py":'raise NotImplementedError("formatter is not yet implemented in Skulpt")\n',"src/lib/fpformat.py":'raise NotImplementedError("fpformat is not yet implemented in Skulpt")\n',"src/lib/fractions.py":'raise NotImplementedError("fractions is not yet implemented in Skulpt")\n',"src/lib/ftplib.py":'raise NotImplementedError("ftplib is not yet implemented in Skulpt")\n',"src/lib/functools.py":'raise NotImplementedError("functools is not yet implemented in Skulpt")\n',"src/lib/genericpath.py":'raise NotImplementedError("genericpath is not yet implemented in Skulpt")\n',"src/lib/getopt.py":'raise NotImplementedError("getopt is not yet implemented in Skulpt")\n',"src/lib/getpass.py":'raise NotImplementedError("getpass is not yet implemented in Skulpt")\n',"src/lib/gettext.py":'raise NotImplementedError("gettext is not yet implemented in Skulpt")\n',"src/lib/glob.py":'raise NotImplementedError("glob is not yet implemented in Skulpt")\n',"src/lib/gzip.py":'raise NotImplementedError("gzip is not yet implemented in Skulpt")\n',"src/lib/hashlib.py":'raise NotImplementedError("hashlib is not yet implemented in Skulpt")\n',"src/lib/heapq.py":'raise NotImplementedError("heapq is not yet implemented in Skulpt")\n',"src/lib/hmac.py":'raise NotImplementedError("hmac is not yet implemented in Skulpt")\n',"src/lib/hotshot/__init__.py":'raise NotImplementedError("hotshot is not yet implemented in Skulpt")\n',"src/lib/htmlentitydefs.py":'raise NotImplementedError("htmlentitydefs is not yet implemented in Skulpt")\n',"src/lib/htmllib.py":'raise NotImplementedError("htmllib is not yet implemented in Skulpt")\n',"src/lib/httplib.py":'raise NotImplementedError("httplib is not yet implemented in Skulpt")\n',"src/lib/idlelib/Icons/__init__.py":'raise NotImplementedError("Icons is not yet implemented in Skulpt")\n',"src/lib/idlelib/__init__.py":'raise NotImplementedError("idlelib is not yet implemented in Skulpt")\n',"src/lib/ihooks.py":'raise NotImplementedError("ihooks is not yet implemented in Skulpt")\n',"src/lib/image.js":'var ImageMod,$builtinmodule;ImageMod||(ImageMod={},ImageMod.canvasLib=[]),$builtinmodule=function(){var a,b,c,d,e,f,g,h={__name__:new Sk.builtin.str("image")};return h.Image=Sk.misceval.buildClass(h,function(a,b){var c=Math.floor;e=function(a){a.width=a.image.width,a.height=a.image.height,a.delay=0,a.updateCount=0,a.updateInterval=1,a.lastx=0,a.lasty=0,a.canvas=document.createElement("canvas"),a.canvas.height=a.height,a.canvas.width=a.width,a.ctx=a.canvas.getContext("2d"),a.ctx.drawImage(a.image,0,0),a.imagedata=a.ctx.getImageData(0,0,a.width,a.height)},b.__init__=new Sk.builtin.func(function(a,b){var c;Sk.builtin.pyCheckArgsLen("__init__",arguments.length,2,2);try{a.image=document.getElementById(Sk.ffi.remapToJs(b)),e(a)}catch(b){a.image=null}if(null==a.image)return c=new Sk.misceval.Suspension,c.resume=function(){if(c.data.error)throw new Sk.builtin.IOError(c.data.error.message)},c.data={type:"Sk.promise",promise:new Promise(function(c,d){var f=new Image;f.crossOrigin="",f.onerror=function(){d(Error("Failed to load URL: "+f.src))},f.onload=function(){a.image=this,e(a),c()},f.src=g(b)})},c}),g=function(a){var b,c,d="function"==typeof Sk.imageProxy?Sk.imageProxy:function(a){return b=document.createElement("a"),b.href=c,window.location.host===b.host?a:Sk.imageProxy+"/"+a};return c=Sk.ffi.remapToJs(a),c=d(c),c},f=function(a,b,c){if(0>b||0>c||b>=a.width||c>=a.height)throw new Sk.builtin.ValueError("Pixel index out of range.")};var i=function(a,b,c){var d;Sk.builtin.pyCheckArgsLen("setdelay",arguments.length,2,3),a.delay=Sk.ffi.remapToJs(b),d=Sk.builtin.asnum$(c),a.updateInterval=d?d:1};b.set_delay=new Sk.builtin.func(i),b.setDelay=new Sk.builtin.func(i);var j=function(a){var b,d=[];for(Sk.builtin.pyCheckArgsLen("getpixels",arguments.length,1,1),b=0;b<a.image.height*a.image.width;b++)d[b]=Sk.misceval.callsimArray(a.getPixel,[a,b%a.image.width,c(b/a.image.width)]);return new Sk.builtin.tuple(d)};b.get_pixels=new Sk.builtin.func(j),b.getPixels=new Sk.builtin.func(j),b.getData=new Sk.builtin.func(function(a){var b,d,e,g,h,j,k,l=[];for(Sk.builtin.pyCheckArgsLen("getData",arguments.length,1,1),b=0;b<a.image.height*a.image.width;b++)d=b%a.image.width,e=c(b/a.image.width),f(a,d,e),k=4*e*a.width+4*d,g=a.imagedata.data[k],h=a.imagedata.data[k+1],j=a.imagedata.data[k+2],l[b]=new Sk.builtin.tuple([new Sk.builtin.int_(g),new Sk.builtin.int_(h),new Sk.builtin.int_(j)]);return new Sk.builtin.list(l)});var k=function(a,b,c){var d,e,g,i;return Sk.builtin.pyCheckArgsLen("getpixel",arguments.length,3,3),b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),f(a,b,c),i=4*c*a.width+4*b,d=a.imagedata.data[i],g=a.imagedata.data[i+1],e=a.imagedata.data[i+2],Sk.misceval.callsimArray(h.Pixel,[d,g,e,b,c])};b.get_pixel=new Sk.builtin.func(k),b.getPixel=new Sk.builtin.func(k),d=function(a,b,c){var d=new Sk.misceval.Suspension;return d.resume=function(){return Sk.builtin.none.none$},d.data={type:"Sk.promise",promise:new Promise(function(d){var e=Math.max,f=Math.abs,g=Math.min;a.updateCount++,0==a.updateCount%a.updateInterval?(a.lastx+a.updateInterval>=a.width?a.lastCtx.putImageData(a.imagedata,a.lastUlx,a.lastUly,0,a.lasty,a.width,2):a.lasty+a.updateInterval>=a.height?a.lastCtx.putImageData(a.imagedata,a.lastUlx,a.lastUly,a.lastx,0,2,a.height):a.lastCtx.putImageData(a.imagedata,a.lastUlx,a.lastUly,g(b,a.lastx),g(c,a.lasty),e(f(b-a.lastx),1),e(f(c-a.lasty),1)),a.lastx=b,a.lasty=c,0<a.delay?window.setTimeout(d,a.delay):d()):d()})},d};var l=function(a,b,c,e){var g;return Sk.builtin.pyCheckArgsLen("setpixel",arguments.length,4,4),b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),f(a,b,c),g=4*c*a.width+4*b,a.imagedata.data[g]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getRed,[e])),a.imagedata.data[g+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getGreen,[e])),a.imagedata.data[g+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getBlue,[e])),a.imagedata.data[g+3]=255,d(a,b,c)};b.set_pixel=new Sk.builtin.func(l),b.setPixel=new Sk.builtin.func(l);var m=function(a,b,e){var g,h,i;return Sk.builtin.pyCheckArgsLen("setpixelat",arguments.length,3,3),b=Sk.builtin.asnum$(b),g=b%a.image.width,h=c(b/a.image.width),f(a,g,h),i=4*h*a.width+4*g,a.imagedata.data[i]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getRed,[e])),a.imagedata.data[i+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getGreen,[e])),a.imagedata.data[i+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(e.getBlue,[e])),a.imagedata.data[i+3]=255,d(a,g,h)};b.set_pixel_at=new Sk.builtin.func(m),b.setPixelAt=new Sk.builtin.func(m);var n=function(a,b){var c,e,g;return Sk.builtin.pyCheckArgsLen("updatepixel",arguments.length,2,2),c=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getX,[b])),e=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getY,[b])),f(a,c,e),g=4*e*a.width+4*c,a.imagedata.data[g]=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getRed,[b])),a.imagedata.data[g+1]=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getGreen,[b])),a.imagedata.data[g+2]=Sk.builtin.asnum$(Sk.misceval.callsimArray(b.getBlue,[b])),a.imagedata.data[g+3]=255,d(a,c,e)};b.update_pixel=new Sk.builtin.func(n),b.updatePixel=new Sk.builtin.func(n);var o=function(a){return Sk.builtin.pyCheckArgsLen("getheight",arguments.length,1,1),new Sk.builtin.int_(a.height)};b.get_height=new Sk.builtin.func(o),b.getHeight=new Sk.builtin.func(o);var p=function(a){return Sk.builtin.pyCheckArgsLen("getwidth",arguments.length,1,1),new Sk.builtin.int_(a.width)};b.get_width=new Sk.builtin.func(p),b.getWidth=new Sk.builtin.func(p),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"height"===b)?Sk.builtin.assk$(a.height):"width"===b?Sk.builtin.assk$(a.width):void 0}),b.__setattr__=new Sk.builtin.func(function(a,b){if(b=Sk.ffi.remapToJs(b),"height"===b||"width"===b)throw new Sk.builtin.Exception("Cannot change height or width they can only be set on creation");else throw new Sk.builtin.Exception("Unknown attribute: "+b)}),b.draw=new Sk.builtin.func(function(a,b,c,d){var e;return Sk.builtin.pyCheckArgsLen("draw",arguments.length,2,4),e=new Sk.misceval.Suspension,e.resume=function(){return Sk.builtin.none.none$},e.data={type:"Sk.promise",promise:new Promise(function(e){var f,g;b=Sk.builtin.asnum$(b),c=Sk.builtin.asnum$(c),d=Sk.builtin.asnum$(d),f=Sk.misceval.callsimArray(b.getWin,[b]),g=f.getContext("2d"),void 0===c&&(c=0,d=0),a.lastUlx=c,a.lastUly=d,a.lastCtx=g,g.putImageData(a.imagedata,c,d),0<a.delay?window.setTimeout(e,a.delay):window.setTimeout(e,200)})},e})},"Image",[]),c=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgsLen("__init__",arguments.length,3,3),a.width=Sk.builtin.asnum$(b),a.height=Sk.builtin.asnum$(c),a.canvas=document.createElement("canvas"),a.ctx=a.canvas.getContext("2d"),a.canvas.height=a.height,a.canvas.width=a.width,a.imagedata=a.ctx.getImageData(0,0,a.width,a.height)})},h.EmptyImage=Sk.misceval.buildClass(h,c,"EmptyImage",[h.Image]),b=function(a,b){b.__init__=new Sk.builtin.func(function(a,c,d,e,b,f){Sk.builtin.pyCheckArgsLen("__init__",arguments.length,4,6),a.red=Sk.builtin.asnum$(c),a.green=Sk.builtin.asnum$(d),a.blue=Sk.builtin.asnum$(e),a.x=Sk.builtin.asnum$(b),a.y=Sk.builtin.asnum$(f)});var c=function(a){return Sk.builtin.pyCheckArgsLen("getred",arguments.length,1,1),Sk.builtin.assk$(a.red)};b.get_red=new Sk.builtin.func(c),b.getRed=new Sk.builtin.func(c);var d=function(a){return Sk.builtin.pyCheckArgsLen("getgreen",arguments.length,1,1),Sk.builtin.assk$(a.green)};b.get_green=new Sk.builtin.func(d),b.getGreen=new Sk.builtin.func(d);var e=function(a){return Sk.builtin.pyCheckArgsLen("getblue",arguments.length,1,1),Sk.builtin.assk$(a.blue)};b.get_blue=new Sk.builtin.func(e),b.getBlue=new Sk.builtin.func(e);var f=function(a){return Sk.builtin.pyCheckArgsLen("getx",arguments.length,1,1),Sk.builtin.assk$(a.x)};b.get_x=new Sk.builtin.func(f),b.getX=new Sk.builtin.func(f);var g=function(a){return Sk.builtin.pyCheckArgsLen("gety",arguments.length,1,1),Sk.builtin.assk$(a.y)};b.get_y=new Sk.builtin.func(g),b.getY=new Sk.builtin.func(g);var h=function(a,b){Sk.builtin.pyCheckArgsLen("setred",arguments.length,2,2),a.red=Sk.builtin.asnum$(b)};b.set_red=new Sk.builtin.func(h),b.setRed=new Sk.builtin.func(h);var i=function(a,b){Sk.builtin.pyCheckArgsLen("setgreen",arguments.length,2,2),a.green=Sk.builtin.asnum$(b)};b.set_green=new Sk.builtin.func(i),b.setGreen=new Sk.builtin.func(i);var j=function(a,c){Sk.builtin.pyCheckArgsLen("setblue",arguments.length,2,2),a.blue=Sk.builtin.asnum$(c)};b.set_blue=new Sk.builtin.func(j),b.setBlue=new Sk.builtin.func(j),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"red"===b)?Sk.builtin.assk$(a.red):"green"===b?Sk.builtin.assk$(a.green):"blue"===b?Sk.builtin.assk$(a.blue):void 0}),b.__setattr__=new Sk.builtin.func(function(a,b,c){b=Sk.ffi.remapToJs(b),("red"===b||"green"===b||"blue"===b)&&(a[b]=Sk.builtin.asnum$(c))});var k=function(a,b){Sk.builtin.pyCheckArgsLen("setx",arguments.length,2,2),a.x=Sk.builtin.asnum$(b)};b.set_x=new Sk.builtin.func(k),b.setX=new Sk.builtin.func(k);var l=function(a,b){Sk.builtin.pyCheckArgsLen("sety",arguments.length,2,2),a.y=Sk.builtin.asnum$(b)};b.set_y=new Sk.builtin.func(l),b.setY=new Sk.builtin.func(l),b.__getitem__=new Sk.builtin.func(function(a,b){return(b=Sk.builtin.asnum$(b),0===b)?a.red:1==b?a.green:2==b?a.blue:void 0}),b.__str__=new Sk.builtin.func(function(a){return Sk.ffi.remapToPy("["+a.red+","+a.green+","+a.blue+"]")}),b.getColorTuple=new Sk.builtin.func(function(){}),b.setRange=new Sk.builtin.func(function(a,b){a.max=Sk.builtin.asnum$(b)})},h.Pixel=Sk.misceval.buildClass(h,b,"Pixel",[]),a=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c){var d,e,f;Sk.builtin.pyCheckArgsLen("__init__",arguments.length,1,3),d=ImageMod.canvasLib[Sk.canvas],void 0===d?(e=document.createElement("canvas"),f=document.getElementById(Sk.canvas),a.theScreen=e,f.appendChild(e),ImageMod.canvasLib[Sk.canvas]=e,ImageMod.canvasLib[Sk.canvas]=a.theScreen):(a.theScreen=d,a.theScreen.height=a.theScreen.height),void 0===b?(Sk.availableHeight&&(a.theScreen.height=Sk.availableHeight),Sk.availableWidth&&(a.theScreen.width=Sk.availableWidth)):(a.theScreen.height=c.v,a.theScreen.width=b.v),a.theScreen.style.display="block"}),b.getWin=new Sk.builtin.func(function(a){return a.theScreen}),b.exitonclick=new Sk.builtin.func(function(a){var b=a.theScreen.id;a.theScreen.onclick=function(){document.getElementById(b).style.display="none",document.getElementById(b).onclick=null,delete ImageMod.canvasLib[b]}})},h.ImageWin=Sk.misceval.buildClass(h,a,"ImageWin",[]),h};',"src/lib/imaplib.py":'raise NotImplementedError("imaplib is not yet implemented in Skulpt")\n',"src/lib/imghdr.py":'raise NotImplementedError("imghdr is not yet implemented in Skulpt")\n',"src/lib/imputil.py":'raise NotImplementedError("imputil is not yet implemented in Skulpt")\n',"src/lib/io.py":'raise NotImplementedError("io is not yet implemented in Skulpt")\n',"src/lib/itertools.js":'var $builtinmodule=function(){function combinationsNew(a,b,c){let d,e;[d,e]=Sk.abstr.copyKeywordsToNamedArgs(a.tp$name,["iterable","r"],b,c,[]);const f=Sk.misceval.arrayFromIterable(d);if(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverFlowError),0>e)throw new Sk.builtin.ValueError("r must be non-negative");if(this===a)return new a.constructor(f,e);else{const b=new this.constructor;return a.constructor.call(b,f,e),b}}var a={};return a.accumulate=Sk.abstr.buildIteratorClass("itertools.accumulate",{constructor:function accumulate(a,b,c){this.iter=a,this.func=b,this.total=c,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(){let a=this.iter.tp$iternext();if(void 0!==a)return this.total=Sk.misceval.callsimArray(this.func,[this.total,a]),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(b,c){Sk.abstr.checkArgsLen("accumulate",b,0,2);let[d,e,f]=Sk.abstr.copyKeywordsToNamedArgs("accumulate",["iterable","func","initial"],b,c,[Sk.builtin.none.none$,Sk.builtin.none.none$]);if(d=Sk.abstr.iter(d),e=Sk.builtin.checkNone(e)?new Sk.builtin.func((c,a)=>Sk.abstr.numberBinOp(c,a,"Add")):e,this===a.accumulate.prototype)return new a.accumulate(d,e,f);else{const b=new this.constructor;return a.accumulate.call(b,d,e,f),b}}}}),a.chain=Sk.abstr.buildIteratorClass("itertools.chain",{constructor:function chain(a){this.iterables=a,this.current_it=null,this.tp$iternext=()=>(this.tp$iternext=this.constructor.prototype.tp$iternext,this.current_it=this.iterables.tp$iternext(),void 0===this.current_it)?void(this.tp$iternext=()=>void 0):(this.current_it=Sk.abstr.iter(this.current_it),this.tp$iternext())},iternext(){for(let a;void 0===a;)if(a=this.current_it.tp$iternext(),void 0===a){if(this.current_it=this.iterables.tp$iternext(),void 0===this.current_it)return void(this.tp$iternext=()=>void 0);this.current_it=Sk.abstr.iter(this.current_it)}else return a},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(b,c){if(Sk.abstr.checkNoKwargs("chain",c),b=new Sk.builtin.tuple(b.slice(0)).tp$iter(),this===a.chain.prototype)return new a.chain(b);else{const c=new this.constructor;return a.chain.call(c,b),c}}},classmethods:{from_iterable:{$meth(b){const c=Sk.abstr.iter(b);return new a.chain(c)},$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}}}),a.combinations=Sk.abstr.buildIteratorClass("itertools.combinations",{constructor:function combinations(a,b){this.pool=a,this.r=b,this.indices=Array(b).fill().map((a,b)=>b),this.n=a.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(){let a,b=!1;for(a=this.r-1;0<=a;a--)if(this.indices[a]!=a+this.n-this.r){b=!0;break}if(!b)return void(this.r=0);this.indices[a]++;for(let b=a+1;b<this.r;b++)this.indices[b]=this.indices[b-1]+1;const c=this.indices.map(a=>this.pool[a]);return new Sk.builtin.tuple(c)},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(b,c){return combinationsNew.call(this,a.combinations.prototype,b,c)}}}),a.combinations_with_replacement=Sk.abstr.buildIteratorClass("itertools.combinations_with_replacement",{constructor:function combinations_with_replacement(a,b){this.pool=a,this.r=b,this.indices=Array(b).fill(0),this.n=a.length,this.tp$iternext=()=>{if(!this.r||this.n){this.tp$iternext=this.constructor.prototype.tp$iternext;const a=this.indices.map(a=>this.pool[a]);return new Sk.builtin.tuple(a)}}},iternext(){let a,b=!1;for(a=this.r-1;0<=a;a--)if(this.indices[a]!=this.n-1){b=!0;break}if(!b)return void(this.r=0);const c=this.indices[a]+1;for(let b=a;b<this.r;b++)this.indices[b]=c;const d=this.indices.map(a=>this.pool[a]);return new Sk.builtin.tuple(d)},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(b,c){return combinationsNew.call(this,a.combinations_with_replacement.prototype,b,c)}}}),a.compress=Sk.abstr.buildIteratorClass("itertools.compress",{constructor:function compress(a,b){this.data=a,this.selectors=b},iternext(){let a=this.data.tp$iternext(),b=this.selectors.tp$iternext();for(;void 0!==a&&void 0!==b;){if(Sk.misceval.isTrue(b))return a;a=this.data.tp$iternext(),b=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(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs("compress",["data","selectors"],b,c,[]),d=Sk.abstr.iter(d),e=Sk.abstr.iter(e),this===a.count.prototype)return new a.compress(d,e);else{const b=new this.constructor;return a.compress.call(b,d,e),b}}}}),a.count=Sk.abstr.buildIteratorClass("itertools.count",{constructor:function count(a,b){this.start=a,this.step=b},iternext(){const a=this.start;return this.start=Sk.abstr.numberBinOp(this.start,this.step,"Add"),a},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(b,c){const[d,e]=Sk.abstr.copyKeywordsToNamedArgs("count",["start","step"],b,c,[new Sk.builtin.int_(0),new Sk.builtin.int_(1)]);if(!Sk.builtin.checkNumber(d)&&!Sk.builtin.checkComplex(d))throw new Sk.builtin.TypeError("a number is required");if(!Sk.builtin.checkNumber(e)&&!Sk.builtin.checkComplex(e))throw new Sk.builtin.TypeError("a number is required");if(this===a.count.prototype)return new a.count(d,e);else{const b=new this.constructor;return a.count.call(b,d,e),b}},$r(){const a=Sk.misceval.objectRepr(this.start);let b=Sk.misceval.objectRepr(this.step);return b="1"===b?"":", "+b,new Sk.builtin.str(Sk.abstr.typeName(this)+"("+a+b+")")}}}),a.cycle=Sk.abstr.buildIteratorClass("itertools.cycle",{constructor:function cycle(a){this.iter=a,this.saved=[],this.consumed=!1,this.i=0,this.length},iternext(){let a;if(!this.consumed){if(a=this.iter.tp$iternext(),void 0!==a)return this.saved.push(a),a;if(this.consumed=!0,this.length=this.saved.length,!this.length)return}return a=this.saved[this.i],this.i=(this.i+1)%this.length,a},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(b,c){Sk.abstr.checkOneArg("cycle",b,c);const d=Sk.abstr.iter(b[0]);if(this===a.cycle.prototype)return new a.cycle(d);else{const b=new this.constructor;return a.cycle.call(b,d),b}}}}),a.dropwhile=Sk.abstr.buildIteratorClass("itertools.dropwhile",{constructor:function dropwhile(a,b){this.predicate=a,this.iter=b,this.passed},iternext(){let a=this.iter.tp$iternext();for(;void 0===this.passed&&void 0!==a;){const b=Sk.misceval.callsimArray(this.predicate,[a]);if(!Sk.misceval.isTrue(b))return this.passed=!0,a;a=this.iter.tp$iternext()}return a},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(b,c){Sk.abstr.checkNoKwargs("dropwhile",c),Sk.abstr.checkArgsLen("dropwhile",b,2,2);const d=b[0],e=Sk.abstr.iter(b[1]);if(this===a.dropwhile.prototype)return new a.dropwhile(d,e);else{const b=new this.constructor;return a.dropwhile.call(b,d,e),b}}}}),a.filterfalse=Sk.abstr.buildIteratorClass("itertools.filterfalse",{constructor:function filterfalse(a,b){this.predicate=a,this.iter=b},iternext(){let a=this.iter.tp$iternext();if(void 0!==a){for(let b=Sk.misceval.callsimArray(this.predicate,[a]);Sk.misceval.isTrue(b);){if(a=this.iter.tp$iternext(),void 0===a)return;b=Sk.misceval.callsimArray(this.predicate,[a])}return a}},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(b,c){Sk.abstr.checkNoKwargs("filterfalse",c),Sk.abstr.checkArgsLen("filterfalse",b,2,2);const d=Sk.builtin.checkNone(b[0])?Sk.builtin.bool:b[0],e=Sk.abstr.iter(b[1]);if(this===a.filterfalse.prototype)return new a.filterfalse(d,e);else{const b=new this.constructor;return a.filterfalse.call(b,d,e),b}}}}),a._grouper=Sk.abstr.buildIteratorClass("itertools._grouper",{constructor:function _grouper(a){this.groupby=a,this.tgtkey=a.tgtkey,this.id=a.id},iternext(){const a=Sk.misceval.richCompareBool(this.groupby.currkey,this.tgtkey,"Eq");if(this.groupby.id===this.id&&a){let a=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])),a}}}),a.groupby=Sk.abstr.buildIteratorClass("itertools.groupby",{constructor:function groupby(a,b){this.iter=a,this.keyf=b,this.currval,this.currkey=this.tgtkey=new Sk.builtin.object,this.id},iternext(){this.id={};for(let a=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,"Eq");a;){if(this.currval=this.iter.tp$iternext(),void 0===this.currval)return;this.currkey=Sk.misceval.callsimArray(this.keyf,[this.currval]),a=Sk.misceval.richCompareBool(this.currkey,this.tgtkey,"Eq")}this.tgtkey=this.currkey;const b=new a._grouper(this);return new Sk.builtin.tuple([this.currkey,b])},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(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs("groupby",["iterable","key"],b,c,[Sk.builtin.none.none$]),d=Sk.abstr.iter(d),e=Sk.builtin.checkNone(e)?new Sk.builtin.func(a=>a):e,this===a.groupby.prototype)return new a.groupby(d,e);else{const b=new this.constructor;return a.groupby.call(b,d,e),b}}}}),a.islice=Sk.abstr.buildIteratorClass("itertools.islice",{constructor:function islice(a,b,c,d){this.iter=a,this.previt=b,this.stop=c,this.step=d,this.tp$iternext=()=>{if(this.tp$iternext=this.constructor.prototype.tp$iternext,this.previt>=this.stop){for(let a=0;a<this.stop;a++)this.iter.tp$iternext();return}for(let a=0;a<this.previt;a++)this.iter.tp$iternext();return this.iter.tp$iternext()}},iternext(){if(this.previt+this.step>=this.stop){for(let a=this.previt+1;a<this.stop;a++)this.previt+=this.step,this.iter.tp$iternext();return}for(let a=this.previt+1;a<this.previt+this.step;a++)this.iter.tp$iternext();return this.previt+=this.step,this.iter.tp$iternext()},slots:{tp$doc:"islice(iterable, stop) --\x3e islice object\\nislice(iterable, start, stop[, step]) --\x3e islice object\\n\\nReturn an iterator whose next() method returns selected values from an\\niterable. If start is specified, will skip all preceding elements;\\notherwise, start defaults to zero. Step defaults to one. If\\nspecified as another value, step determines how many values are \\nskipped between successive calls. Works like a slice() on a list\\nbut returns an iterator.",tp$new(b,c){var d=Number.MAX_SAFE_INTEGER;Sk.abstr.checkNoKwargs("islice",c),Sk.abstr.checkArgsLen("islice",b,2,4);const e=Sk.abstr.iter(b[0]);let f=b[1],g=b[2],h=b[3];if(void 0===g?(g=f,f=Sk.builtin.none.none$,h=Sk.builtin.none.none$):void 0===h&&(h=Sk.builtin.none.none$),!(Sk.builtin.checkNone(g)||Sk.misceval.isIndex(g)))throw new Sk.builtin.ValueError("Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.");else if(g=Sk.builtin.checkNone(g)?d:Sk.misceval.asIndexSized(g),0>g||g>d)throw new Sk.builtin.ValueError("Stop for islice() must be None or an integer: 0 <= x <= sys.maxsize.");if(!(Sk.builtin.checkNone(f)||Sk.misceval.isIndex(f)))throw new Sk.builtin.ValueError("Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.");else if(f=Sk.builtin.checkNone(f)?0:Sk.misceval.asIndexSized(f),0>f||f>d)throw new Sk.builtin.ValueError("Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.");if(!(Sk.builtin.checkNone(h)||Sk.misceval.isIndex(h)))throw new Sk.builtin.ValueError("Step for islice() must be a positive integer or None");else if(h=Sk.builtin.checkNone(h)?1:Sk.misceval.asIndexSized(h),0>=h||h>d)throw new Sk.builtin.ValueError("Step for islice() must be a positive integer or None.");if(this===a.islice.prototype)return new a.islice(e,f,g,h);else{const b=new this.constructor;return a.islice.call(b,e,f,g,h),b}}}}),a.permutations=Sk.abstr.buildIteratorClass("itertools.permutations",{constructor:function permutations(a,b){this.pool=a,this.r=b;const c=a.length;this.indices=Array(c).fill().map((a,b)=>b),this.cycles=Array(b).fill().map((a,b)=>c-b),this.n=c,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(){for(let a=this.r-1;0<=a;a--)if(this.cycles[a]--,0==this.cycles[a])this.indices.push(this.indices.splice(a,1)[0]),this.cycles[a]=this.n-a;else{j=this.cycles[a],[this.indices[a],this.indices[this.n-j]]=[this.indices[this.n-j],this.indices[a]];const b=this.indices.map(a=>this.pool[a]).slice(0,this.r);return new Sk.builtin.tuple(b)}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(b,c){let d,e;[d,e]=Sk.abstr.copyKeywordsToNamedArgs("permutations",["iterable","r"],b,c,[Sk.builtin.none.none$]);const f=Sk.misceval.arrayFromIterable(d);if(e=Sk.builtin.checkNone(e)?f.length:Sk.misceval.asIndexSized(e,Sk.builtin.OverFlowError),0>e)throw new Sk.builtin.ValueError("r must be non-negative");if(this===a.permutations.prototype)return new a.permutations(f,e);else{const b=new this.constructor;return a.permutations.call(b,f,e),b}}}}),a.product=Sk.abstr.buildIteratorClass("itertools.product",{constructor:function product(a){this.pools=a,this.n=a.length,this.indices=Array(a.length).fill(0),this.pool_sizes=a.map(a=>a.length),this.tp$iternext=()=>{this.tp$iternext=this.constructor.prototype.tp$iternext;const a=this.indices.map((a,b)=>this.pools[b][this.indices[b]]);return a.some(a=>void 0===a)?void(this.n=0):new Sk.builtin.tuple(a)}},iternext(){for(let a=this.n-1;0<=a&&a<this.n;)this.indices[a]++,this.indices[a]>=this.pool_sizes[a]?(this.indices[a]=-1,a--):a++;if(!this.n||this.indices.every(a=>-1===a))return void(this.n=0);else{const a=this.indices.map((a,b)=>this.pools[b][this.indices[b]]);return new Sk.builtin.tuple(a)}},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(b,c){let[d]=Sk.abstr.copyKeywordsToNamedArgs("product",["repeat"],[],c,[new Sk.builtin.int_(1)]);if(d=Sk.misceval.asIndexSized(d,Sk.builtin.OverFlowError),0>d)throw new Sk.builtin.ValueError("repeat argument cannot be negative");const e=[];for(let a=0;a<b.length;a++)e.push(Sk.misceval.arrayFromIterable(b[a]));const f=[].concat(...Array(d).fill(e));if(this===a.product.prototype)return new a.product(f);else{const b=new this.constructor;return a.product.call(b,f),b}}}}),a.repeat=Sk.abstr.buildIteratorClass("itertools.repeat",{constructor:function repeat(a,b){this.object=a,this.times=b,void 0===b&&(this.tp$iternext=()=>this.object)},iternext(){return 0<this.times--?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(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs("repeat",["object","times"],b,c,[null]),e=null===e?void 0:Sk.misceval.asIndexSized(e,Sk.builtin.OverFlowError),this===a.repeat.prototype)return new a.repeat(d,e);else{const b=new this.constructor;return a.repeat.call(b,d,e),b}},$r(){return object_repr=Sk.misceval.objectRepr(this.object),times_repr=void 0===this.times?"":", "+(0<=this.times?this.times:0),new Sk.builtin.str(Sk.abstr.typeName(this)+"("+object_repr+times_repr+")")}},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}}}),a.starmap=Sk.abstr.buildIteratorClass("itertools.starmap",{constructor:function starmap(a,b){this.func=a,this.iter=b},iternext(){const a=this.iter.tp$iternext();if(void 0===a)return;const b=Sk.misceval.arrayFromIterable(a),c=Sk.misceval.callsimArray(this.func,b);return c},slots:{tp$new(b,c){let d,e;if([d,e]=Sk.abstr.copyKeywordsToNamedArgs("starmap",["func","iterable"],b,c,[]),e=Sk.abstr.iter(e),d=Sk.builtin.checkNone(d)?Sk.builtin.bool:d,this===a.starmap.prototype)return new a.starmap(d,e);else{const b=new this.constructor;return a.starmap.call(b,d,e),b}}}}),a.takewhile=Sk.abstr.buildIteratorClass("itertools.takewhile",{constructor:function takewhile(a,b){this.predicate=a,this.iter=b},iternext(){const a=this.iter.tp$iternext();if(void 0!==a){const b=Sk.misceval.callsimArray(this.predicate,[a]);if(Sk.misceval.isTrue(b))return a;this.tp$iternext=()=>void 0}},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(b,c){Sk.abstr.checkNoKwargs("takewhile",c),Sk.abstr.checkArgsLen("takewhile",b,2,2);const d=b[0],e=Sk.abstr.iter(b[1]);if(this===a.takewhile.prototype)return new a.takewhile(d,e);else{const b=new this.constructor;return a.takewhile.call(b,d,e),b}}}}),a.tee=new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError("tee is not yet implemented in Skulpt")}),a.zip_longest=Sk.abstr.buildIteratorClass("itertools.zip_longest",{constructor:function zip_longest(a,b){this.iters=a,this.fillvalue=b,this.active=this.iters.length},iternext(){if(!this.active)return;let b;const c=[];for(let d=0;d<this.iters.length;d++){if(b=this.iters[d].tp$iternext(),void 0===b){if(this.active--,!this.active)return;this.iters[d]=new a.repeat(this.fillvalue),b=this.fillvalue}c.push(b)}return new Sk.builtin.tuple(c)},slots:{tp$doc:"zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --\x3e zip_longest object\\n\\nReturn a zip_longest object whose .__next__() method returns a tuple where\\nthe i-th element comes from the i-th iterable argument. The .__next__()\\nmethod continues until the longest iterable in the argument sequence\\nis exhausted and then it raises StopIteration. When the shorter iterables\\nare exhausted, the fillvalue is substituted in their place. The fillvalue\\ndefaults to None or can be specified by a keyword argument.\\n",tp$new(b,c){const[d]=Sk.abstr.copyKeywordsToNamedArgs("zip_longest",["fillvalue"],[],c,[Sk.builtin.none.none$]),e=[];for(let a=0;a<b.length;a++)e.push(Sk.abstr.iter(b[a]));if(this===a.zip_longest.prototype)return new a.zip_longest(e,d);else{const b=new this.constructor;return a.zip_longest.call(b,e,d),b}}}}),a.__doc__=new Sk.builtin.str("An implementation of the python itertools module in Skulpt"),a.__package__=new Sk.builtin.str(""),a};',"src/lib/json/__init__.py":'raise NotImplementedError("json is not yet implemented in Skulpt")\n',"src/lib/json/tests/__init__.py":'raise NotImplementedError("tests is not yet implemented in Skulpt")\n',"src/lib/keyword.py":"\n__all__ = [\"iskeyword\", \"kwlist\"]\n\nkwlist = [\n#--start keywords--\n 'and',\n 'as',\n 'assert',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'exec',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'not',\n 'or',\n 'pass',\n 'print',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield',\n#--end keywords--\n ]\n\niskeyword = frozenset(kwlist).__contains__\n\n","src/lib/lib-dynload/__init__.py":'raise NotImplementedError("lib-dynload is not yet implemented in Skulpt")\n',"src/lib/lib-tk/__init__.py":'raise NotImplementedError("lib-tk is not yet implemented in Skulpt")\n',"src/lib/lib2to3/__init__.py":'raise NotImplementedError("lib2to3 is not yet implemented in Skulpt")\n',"src/lib/lib2to3/fixes/__init__.py":'raise NotImplementedError("fixes is not yet implemented in Skulpt")\n',"src/lib/lib2to3/pgen2/__init__.py":'raise NotImplementedError("pgen2 is not yet implemented in Skulpt")\n',"src/lib/lib2to3/tests/__init__.py":'raise NotImplementedError("tests is not yet implemented in Skulpt")\n',"src/lib/linecache.py":'raise NotImplementedError("linecache is not yet implemented in Skulpt")\n',"src/lib/locale.py":'raise NotImplementedError("locale is not yet implemented in Skulpt")\n',"src/lib/logging/__init__.py":'raise NotImplementedError("logging is not yet implemented in Skulpt")\n',"src/lib/macpath.py":'raise NotImplementedError("macpath is not yet implemented in Skulpt")\n',"src/lib/macurl2path.py":'raise NotImplementedError("macurl2path is not yet implemented in Skulpt")\n',"src/lib/mailbox.py":'raise NotImplementedError("mailbox is not yet implemented in Skulpt")\n',"src/lib/mailcap.py":'raise NotImplementedError("mailcap is not yet implemented in Skulpt")\n',"src/lib/markupbase.py":'raise NotImplementedError("markupbase is not yet implemented in Skulpt")\n',"src/lib/math.js":'const $builtinmodule=function(){var a=Math.PI,b=Math.sqrt,c=Number.MAX_SAFE_INTEGER,d=Math.E,e=Math.log,f=Math.exp,g=Math.pow,h=Math.log2,i=Number.isFinite,j=Math.floor,k=Math.abs;const l={pi:new Sk.builtin.float_(a),e:new Sk.builtin.float_(d),tau:new Sk.builtin.float_(2*a),nan:new Sk.builtin.float_(NaN),inf:new Sk.builtin.float_(1/0)},n=function(a){return a=a?0>a?-1:1:0>1/a?-1:1,a},o=18;return Sk.abstr.setUpModuleMethods("math",l,{acos:{$meth:function acos(a){var b=Math.acos;return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the arc cosine (measured in radians) of x."},acosh:{$meth:function acosh(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const c=a+b(a*a-1);return new Sk.builtin.float_(e(c))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the inverse hyperbolic cosine of x."},asin:{$meth:function asin(a){var b=Math.asin;return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the arc sine (measured in radians) of x."},asinh:{$meth:function asinh(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const c=a+b(a*a+1);return new Sk.builtin.float_(e(c))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the inverse hyperbolic sine of x."},atan:{$meth:function atan(a){var b=Math.atan;return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the arc tangent (measured in radians) of x."},atan2:{$meth:function atan2(a,b){var c=Math.atan2;return Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(b)),new Sk.builtin.float_(c(Sk.builtin.asnum$(a),Sk.builtin.asnum$(b)))},$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(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=(1+a)/(1-a);return new Sk.builtin.float_(e(b)/2)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the inverse hyperbolic tangent of x."},ceil:{$meth:function ceil(a){var b=Math.ceil;Sk.builtin.pyCheckType("","real number",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a);return Sk.__future__.ceil_floor_int?new Sk.builtin.int_(b(c)):new Sk.builtin.float_(b(c))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the ceiling of x as an Integral.\\n\\nThis is the smallest integer >= x."},copysign:{$meth:function copysign(a,b){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(b));const c=Sk.builtin.asnum$(b),d=Sk.builtin.asnum$(a),e=n(d),f=n(c);return new Sk.builtin.float_(d*(e*f))},$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(a){var b=Math.cos;return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the cosine of x (measured in radians)."},cosh:{$meth:function cosh(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=g(d,a);return new Sk.builtin.float_((b+1/b)/2)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the hyperbolic cosine of x."},degrees:{$meth:function degrees(b){Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(b));const c=180/a*Sk.builtin.asnum$(b);return new Sk.builtin.float_(c)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Convert angle x from radians to degrees."},erf:{$meth:function erf(){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(){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(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let b=a.v;if("number"!=typeof b&&(b=a.nb$float().v),b==1/0||b==-Infinity||isNaN(b))return new Sk.builtin.float_(f(b));const c=f(b);if(!isFinite(c))throw new Sk.builtin.OverflowError("math range error");return new Sk.builtin.float_(c)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return e raised to the power of x."},expm1:{$meth:function expm1(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);if(.7>k(b)){const a=f(b);if(1==a)return new Sk.builtin.float_(b);else{const c=(a-1)*b/e(a);return new Sk.builtin.float_(c)}}else{const a=f(b)-1;return new Sk.builtin.float_(a)}},$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(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let b=a.v;return JSBI.__isBigInt(b)&&(b=a.nb$float().v),b=k(b),new Sk.builtin.float_(b)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the absolute value of the float x."},factorial:{$meth:function factorial(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let b=Sk.builtin.asnum$(a);if(a=j(b),a!=b)throw new Sk.builtin.ValueError("factorial() only accepts integral values");if(0>a)throw new Sk.builtin.ValueError("factorial() not defined for negative numbers");let c=1;for(let b=2;b<=a&&b<=o;b++)c*=b;if(a<=o)return new Sk.builtin.int_(c);c=JSBI.BigInt(c);for(let b=19;b<=a;b++)c=JSBI.multiply(c,JSBI.BigInt(b));return new Sk.builtin.int_(c)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Find x!.\\n\\nRaise a ValueError if x is negative or non-integral."},floor:{$meth:function floor(a){return Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.__future__.ceil_floor_int?new Sk.builtin.int_(j(Sk.builtin.asnum$(a))):new Sk.builtin.float_(j(Sk.builtin.asnum$(a)))},$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(a,b){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(b));let c=a.v,d=b.v;if("number"!=typeof c&&(c=a.nb$float().v),"number"!=typeof d&&(d=b.nb$float().v),(d==1/0||d==-Infinity)&&isFinite(c))return new Sk.builtin.float_(c);const e=c%d;if(isNaN(e)&&!isNaN(c)&&!isNaN(d))throw new Sk.builtin.ValueError("math domain error");return new Sk.builtin.float_(e)},$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(a){var b=Math.max;Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a),d=[c,0];if(0!==c&&i(c)){const a=k(c);let e=b(-1023,j(h(a))+1),f=a*g(2,-e);for(;.5>f;)f*=2,e--;for(;1<=f;)f*=.5,e++;0>c&&(f=-f),d[0]=f,d[1]=e}return d[0]=new Sk.builtin.float_(d[0]),d[1]=new Sk.builtin.int_(d[1]),new Sk.builtin.tuple(d)},$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(a){if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("\'"+Sk.abstr.typeName(a)+"\' object is not iterable");let b=[];a=Sk.abstr.iter(a);let c,d,e;for(let f=a.tp$iternext();void 0!==f;f=a.tp$iternext()){Sk.builtin.pyCheckType("","real number",Sk.builtin.checkNumber(f)),c=0;let a=f.v;"number"!=typeof a&&(a=f.nb$float().v),f=a;for(let a,g=0,h=b.length;g<h;g++){if(a=b[g],k(f)<k(a)){let b=f;f=a,a=b}d=f+a,e=a-(d-f),e&&(b[c]=e,c++),f=d}b=b.slice(0,c).concat([f])}const f=b.reduce(function(c,a){return c+a},0);return new Sk.builtin.float_(f)},$flags:{OneArg:!0},$textsig:"($module, seq, /)",$doc:"Return an accurate floating point sum of values in the iterable seq.\\n\\nAssumes IEEE-754 floating point arithmetic."},gamma:{$meth:function gamma(){throw new Sk.builtin.NotImplementedError("math.gamma() is not yet implemented in Skulpt")},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Gamma function at x."},gcd:{$meth:function gcd(c,a){function _gcd(c,a){return 0==a?c:_gcd(a,c%a)}function _biggcd(c,a){return JSBI.equal(a,JSBI.__ZERO)?c:_biggcd(a,JSBI.remainder(c,a))}Sk.builtin.pyCheckType("a","integer",Sk.builtin.checkInt(c)),Sk.builtin.pyCheckType("b","integer",Sk.builtin.checkInt(a));let b,d=Sk.builtin.asnum$(c),e=Sk.builtin.asnum$(a);return"number"==typeof d&&"number"==typeof e?(d=k(d),e=k(e),b=_gcd(d,e),b=0>b?-b:b,new Sk.builtin.int_(b)):(d=JSBI.BigInt(d),e=JSBI.BigInt(e),b=_biggcd(d,e),JSBI.lessThan(b,JSBI.__ZERO)&&(b=JSBI.multiply(b,JSBI.BigInt(-1))),new Sk.builtin.int_(b.toString()))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"greatest common divisor of x and y"},hypot:{$meth:function hypot(a,c){return Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(c)),a=Sk.builtin.asnum$(a),c=Sk.builtin.asnum$(c),new Sk.builtin.float_(b(a*a+c*c))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return the Euclidean distance, sqrt(x*x + y*y)."},isclose:{$meth:function isclose(c,d){Sk.abstr.checkArgsLen("isclose",c,2,2),rel_abs_vals=Sk.abstr.copyKeywordsToNamedArgs("isclose",["rel_tol","abs_tol"],[],d,[new Sk.builtin.float_(1e-9),new Sk.builtin.float_(0)]);const e=c[0],a=c[1],b=rel_abs_vals[0],f=rel_abs_vals[1];Sk.builtin.pyCheckType("a","number",Sk.builtin.checkNumber(e)),Sk.builtin.pyCheckType("b","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("rel_tol","number",Sk.builtin.checkNumber(b)),Sk.builtin.pyCheckType("abs_tol","number",Sk.builtin.checkNumber(f));const g=Sk.builtin.asnum$(e),h=Sk.builtin.asnum$(a),i=Sk.builtin.asnum$(b),j=Sk.builtin.asnum$(f);if(0>i||0>j)throw new Sk.builtin.ValueError("tolerances must be non-negative");if(g==h)return Sk.builtin.bool.true$;if(g==1/0||g==-Infinity||h==1/0||h==-Infinity)return Sk.builtin.bool.false$;const l=k(h-g),m=l<=k(i*h)||l<=k(i*g)||l<=j;return new Sk.builtin.bool(m)},$flags:{FastCall:!0},$textsig:"($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)",$doc:"Determine whether two floating point numbers are close in value.\\n\\n rel_tol\\n maximum difference for being considered \\"close\\", relative to the\\n magnitude of the input values\\n abs_tol\\n maximum difference for being considered \\"close\\", regardless of the\\n magnitude of the input values\\n\\nReturn True if a is close in value to b, and False otherwise.\\n\\nFor the values to be considered close, the difference between them\\nmust be smaller than at least one of the tolerances.\\n\\n-inf, inf and NaN behave similarly to the IEEE 754 Standard. That\\nis, NaN is not close to anything, even itself. inf and -inf are\\nonly close to themselves."},isfinite:{$meth:function isfinite(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);return Sk.builtin.checkInt(a)?Sk.builtin.bool.true$:isFinite(b)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return True if x is neither an infinity nor a NaN, and False otherwise."},isinf:{$meth:function isinf(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);return Sk.builtin.checkInt(a)?Sk.builtin.bool.false$:isFinite(b)||isNaN(b)?Sk.builtin.bool.false$:Sk.builtin.bool.true$},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return True if x is a positive or negative infinity, and False otherwise."},isnan:{$meth:function isnan(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);return isNaN(b)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return True if x is a NaN (not a number), and False otherwise."},ldexp:{$meth:function ldexp(a,b){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("i","integer",Sk.builtin.checkInt(b));let c=a.v;"number"!=typeof c&&(c=a.nb$float().v);const d=Sk.builtin.asnum$(b);if(c==1/0||c==-Infinity||0==c||isNaN(c))return a;const e=c*g(2,d);if(!isFinite(e))throw new Sk.builtin.OverflowError("math range error");return new Sk.builtin.float_(e)},$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(){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(a,b){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let f,g,h=Sk.builtin.asnum$(a);if(0>=h)throw new Sk.builtin.ValueError("math domain error");if(void 0===b?f=d:(Sk.builtin.pyCheckType("base","number",Sk.builtin.checkNumber(b)),f=Sk.builtin.asnum$(b)),0>=f)throw new Sk.builtin.ValueError("math domain error");else if(Sk.builtin.checkFloat(a)||h<c)g=e(h)/e(f);else{h=new Sk.builtin.str(a).$jsstr();const b=h.length,c=parseFloat("0."+h);g=(b*e(10)+e(c))/e(f)}return new Sk.builtin.float_(g)},$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"log(x, [base=e])\\nReturn the logarithm of x to the given base.\\n\\nIf the base not specified, returns the natural logarithm (base e) of x."},log10:{$meth:function log10(a){var b=Math.log10;Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let d,e=Sk.builtin.asnum$(a);if(0>e)throw new Sk.builtin.ValueError("math domain error");else if(Sk.builtin.checkFloat(a)||e<c)d=b(e);else{e=new Sk.builtin.str(a).$jsstr();const c=e.length,f=parseFloat("0."+e);d=c+b(f)}return new Sk.builtin.float_(d)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the base 10 logarithm of x."},log1p:{$meth:function log1p(a){var b=Number.EPSILON;Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let c=a.v;if("number"!=typeof c&&(c=a.nb$float().v),-1>=c)throw new Sk.builtin.ValueError("math domain error");else{if(0==c)return new Sk.builtin.float_(c);if(k(c)<b/2)return new Sk.builtin.float_(c);if(-.5<=c&&1>=c){const a=1+c,b=e(a)-(a-1-c)/a;return new Sk.builtin.float_(b)}else{const a=e(1+c);return new Sk.builtin.float_(a)}}},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the natural logarithm of 1+x (base e).\\n\\nThe result is computed in a way which is accurate for x near zero."},log2:{$meth:function log2(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let b,d=Sk.builtin.asnum$(a);if(0>d)throw new Sk.builtin.ValueError("math domain error");else if(Sk.builtin.checkFloat(a)||d<c)b=h(d);else{d=new Sk.builtin.str(a).$jsstr();const c=d.length,e=parseFloat("0."+d);b=c*h(10)+h(e)}return new Sk.builtin.float_(b)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the base 2 logarithm of x."},modf:{$meth:function modf(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));let b=Sk.builtin.asnum$(a);if(!isFinite(b)){if(b==1/0)return new Sk.builtin.tuple([new Sk.builtin.float_(0),new Sk.builtin.float_(b)]);if(b==-Infinity)return new Sk.builtin.tuple([new Sk.builtin.float_(-0),new Sk.builtin.float_(b)]);if(isNaN(b))return new Sk.builtin.tuple([new Sk.builtin.float_(b),new Sk.builtin.float_(b)])}const c=n(b);b=k(b);const e=c*j(b),f=c*(b-j(b));return new Sk.builtin.tuple([new Sk.builtin.float_(f),new Sk.builtin.float_(e)])},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the fractional and integer parts of x.\\n\\nBoth results carry the sign of x and are floats."},pow:{$meth:function pow(a,b){var c=Number.isInteger;Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(b));let d=a.v,e=b.v;if("number"!=typeof d&&(d=a.nb$float().v),"number"!=typeof e&&(e=b.nb$float().v),0==d&&0>e)throw new Sk.builtin.ValueError("math domain error");else{if(1==d)return new Sk.builtin.float_(1);if(i(d)&&i(e)&&0>d&&!c(e))throw new Sk.builtin.ValueError("math domain error");else if(-1==d&&(e==-Infinity||e==1/0))return new Sk.builtin.float_(1)}const f=g(d,e);if(!i(d)||!i(e))return new Sk.builtin.float_(f);if(f==1/0||f==-Infinity)throw new Sk.builtin.OverflowError("math range error");return new Sk.builtin.float_(f)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return x**y (x to the power of y)."},radians:{$meth:function radians(b){Sk.builtin.pyCheckType("deg","number",Sk.builtin.checkNumber(b));const c=a/180*Sk.builtin.asnum$(b);return new Sk.builtin.float_(c)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Convert angle x from degrees to radians."},remainder:{$meth:function remainder(a,b){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("y","number",Sk.builtin.checkNumber(b));let d=a.v,e=b.v;if("number"!=typeof d&&(d=a.nb$float().v),"number"!=typeof e&&(e=b.nb$float().v),isFinite(d)&&isFinite(e)){let a,b,f,c,g;if(0==e)throw new Sk.builtin.ValueError("math domain error");if(a=k(d),b=k(e),c=a%b,f=b-c,c<f)g=c;else if(c>f)g=-f;else{if(c!=f)throw new Sk.builtin.AssertionError;g=c-2*(.5*(a-c)%b)}return new Sk.builtin.float_(n(d)*g)}if(isNaN(d))return a;if(isNaN(e))return b;if(d==1/0||d==-Infinity)throw new Sk.builtin.ValueError("math domain error");if(e!=1/0&&e!=-Infinity)throw new Sk.builtin.AssertionError;return new Sk.builtin.float_(d)},$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(a){var b=Math.sin;return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the sine of x (measured in radians)."},sinh:{$meth:function sinh(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),a=Sk.builtin.asnum$(a);const b=g(d,a);return new Sk.builtin.float_((b-1/b)/2)},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the hyperbolic sine of x."},sqrt:{$meth:function sqrt(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const c=Sk.builtin.asnum$(a);if(0>c)throw new Sk.builtin.ValueError("math domain error");return new Sk.builtin.float_(b(c))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the square root of x."},tan:{$meth:function tan(a){var b=Math.tan;return Sk.builtin.pyCheckType("rad","number",Sk.builtin.checkNumber(a)),new Sk.builtin.float_(b(Sk.builtin.asnum$(a)))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the tangent of x (measured in radians)."},tanh:{$meth:function tanh(a){Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));const b=Sk.builtin.asnum$(a);if(0===b)return new Sk.builtin.float_(b);const c=g(d,b),e=1/c;return new Sk.builtin.float_((c-e)/2/((c+e)/2))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the hyperbolic tangent of x."},trunc:{$meth:function trunc(a){return Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a)),Sk.builtin.checkInt(a)?a:new Sk.builtin.int_(0|Sk.builtin.asnum$(a))},$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Truncates the Real x to the nearest Integral toward 0.\\n\\nUses the __trunc__ magic method."}}),l};',"src/lib/md5.py":'raise NotImplementedError("md5 is not yet implemented in Skulpt")\n',"src/lib/mhlib.py":'raise NotImplementedError("mhlib is not yet implemented in Skulpt")\n',"src/lib/mimetools.py":'raise NotImplementedError("mimetools is not yet implemented in Skulpt")\n',"src/lib/mimetypes.py":'raise NotImplementedError("mimetypes is not yet implemented in Skulpt")\n',"src/lib/mimify.py":'raise NotImplementedError("mimify is not yet implemented in Skulpt")\n',"src/lib/modulefinder.py":'raise NotImplementedError("modulefinder is not yet implemented in Skulpt")\n',"src/lib/multifile.py":'raise NotImplementedError("multifile is not yet implemented in Skulpt")\n',"src/lib/multiprocessing/__init__.py":'raise NotImplementedError("multiprocessing is not yet implemented in Skulpt")\n',"src/lib/multiprocessing/dummy/__init__.py":'raise NotImplementedError("dummy is not yet implemented in Skulpt")\n',"src/lib/mutex.py":'raise NotImplementedError("mutex is not yet implemented in Skulpt")\n',"src/lib/netrc.py":'raise NotImplementedError("netrc is not yet implemented in Skulpt")\n',"src/lib/new.py":'raise NotImplementedError("new is not yet implemented in Skulpt")\n',"src/lib/nntplib.py":'raise NotImplementedError("nntplib is not yet implemented in Skulpt")\n',"src/lib/ntpath.py":'raise NotImplementedError("ntpath is not yet implemented in Skulpt")\n',"src/lib/nturl2path.py":'raise NotImplementedError("nturl2path is not yet implemented in Skulpt")\n',"src/lib/numbers.py":"Number = (int, float, complex)\nIntegral = int\nComplex = complex\n","src/lib/opcode.py":'raise NotImplementedError("opcode is not yet implemented in Skulpt")\n',"src/lib/operator.js":'function $builtinmodule(){return operator={__name__:new Sk.builtin.str("operator"),__doc__:new Sk.builtin.str("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 Sk.builtin.list(["abs","add","and_","attrgetter","concat","contains","countOf","delitem","eq","floordiv","ge","getitem","gt","iadd","iand","iconcat","ifloordiv","ilshift","imatmul","imod","imul","index","indexOf","inv","invert","ior","ipow","irshift","is_","is_not","isub","itemgetter","itruediv","ixor","le","length_hint","lshift","lt","matmul","methodcaller","mod","mul","ne","neg","not_","or_","pos","pow","rshift","setitem","sub","truediv","truth","xor"].map(a=>new Sk.builtin.str(a)))},operator.itemgetter=Sk.abstr.buildNativeClass("operator.itemgetter",{constructor:function itemgetter(a){this.items=a,this.oneitem=1===a.length,this.item=a[0],this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$new(a,b){return Sk.abstr.checkNoKwargs("itemgetter",b),Sk.abstr.checkArgsLen("itemgetter",a,1),new operator.itemgetter(a)},tp$call(a,b){Sk.abstr.checkNoKwargs("itemgetter",b),Sk.abstr.checkArgsLen("itemgetter",a,1,1);const c=a[0];return this.oneitem?Sk.abstr.objectGetItem(c,this.item,!0):new Sk.builtin.tuple(this.items.map(a=>Sk.abstr.objectGetItem(c,a)))},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 Sk.builtin.str(this.tp$name+"(...)");this.in$repr=!0;const a=this.tp$name+"("+this.items.map(a=>Sk.misceval.objectRepr(a)).join(", ")+")";return this.in$repr=!1,a}}}),operator.attrgetter=Sk.abstr.buildNativeClass("operator.attrgetter",{constructor:function attrgetter(a){this.attrs=a,this.oneattr=1===a.length,this.attr=a[0],this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$new(a,b){Sk.abstr.checkNoKwargs("attrgetter",b),Sk.abstr.checkArgsLen("attrgetter",a,1);const c=[];for(let d=0;d<a.length;d++){const b=a[d];if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be a string");b.v.includes(".")?c.push(b.$jsstr().split(".").map(a=>new Sk.builtin.str(a))):c.push([b])}return new operator.attrgetter(c)},tp$call(a,b){Sk.abstr.checkNoKwargs("attrgetter",b),Sk.abstr.checkArgsLen("attrgetter",a,1,1);const c=a[0];if(this.oneattr)return this.attr.reduce((a,b)=>Sk.abstr.gattr(a,b),c);const d=this.attrs.map(a=>a.reduce((a,b)=>Sk.abstr.gattr(a,b),c));return new Sk.builtin.tuple(d)},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 Sk.builtin.str(this.tp$name+"(...)");this.in$repr=!0;const a=this.tp$name+"("+this.items.map(a=>Sk.misceval.objectRepr(a)).join(", ")+")";return this.in$repr=!1,a}}}),operator.methodcaller=Sk.abstr.buildNativeClass("operator.methodcaller",{constructor:function methodcaller(a,b,c){this.$name=a,this.args=b,this.kwargs=c||[],this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$new(a,b){Sk.abstr.checkArgsLen("methodcaller",a,1);const c=a[0];if(!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("method name must be a string");return new operator.methodcaller(c,a.slice(1),b)},tp$call(a,b){Sk.abstr.checkNoKwargs("methodcaller",b),Sk.abstr.checkArgsLen("methodcaller",a,1,1);const c=a[0];return Sk.misceval.chain(Sk.abstr.gattr(c,this.$name,!0),a=>Sk.misceval.callsimOrSuspendArray(a,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 Sk.builtin.str(this.tp$name+"(...)");this.in$repr=!0;let a=[Sk.misceval.objectRepr(this.$name),...this.args.map(a=>Sk.misceval.objectRepr(a))];for(let b=0;b<this.kwargs.length;b+=2)a.push(this.kwargs[b]+"="+Sk.misceval.objectRepr(this.kwargs[b+1]));return a=this.tp$name+"("+a.join(", ")+")",this.in$repr=!1,a}}}),Sk.abstr.setUpModuleMethods("operator",operator,{lt:{$meth:function lt(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"Lt"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a < b."},le:{$meth:function le(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"LtE"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a <= b."},eq:{$meth:function eq(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"Eq"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a == b."},ne:{$meth:function ne(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"NotEq"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a != b."},ge:{$meth:function ge(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"GtE"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a >= b."},gt:{$meth:function gt(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"Gt"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a > b."},not_:{$meth:function not_(a){return Sk.abstr.numberUnaryOp(a,"Not")},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Same as not a."},truth:{$meth:function truth(a){return Sk.builtin.bool(a)},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Return True if a is true, False otherwise."},is_:{$meth:function is_(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"Is"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a is b."},is_not:{$meth:function is_not(c,a){return Sk.builtin.bool(Sk.misceval.richCompareBool(c,a,"IsNot"))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a is not b."},abs:{$meth:function abs(a){return Sk.builtin.abs(a)},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Same as abs(a)."},add:{$meth:function add(c,a){return Sk.abstr.numberBinOp(c,a,"Add")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a + b."},and_:{$meth:function and_(c,a){return Sk.abstr.numberBinOp(c,a,"BitAnd")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a & b."},floordiv:{$meth:function floordiv(c,a){return Sk.abstr.numberBinOp(c,a,"FloorDiv")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a // b."},index:{$meth:function index(b){return new Sk.builtin.int_(Sk.misceval.asIndexOrThrow(b))},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Same as a.__index__()"},inv:{$meth:function inv(a){return Sk.abstr.numberUnaryOp(a,"Invert")},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Same as ~a."},invert:{$meth:function invert(a){return Sk.abstr.numberUnaryOp(a,"Invert")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, /)",$doc:"Same as ~a."},lshift:{$meth:function lshift(c,a){return Sk.abstr.numberBinOp(c,a,"LShift")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a << b."},mod:{$meth:function mod(c,a){return Sk.abstr.numberBinOp(c,a,"Mod")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a % b."},mul:{$meth:function mul(c,a){return Sk.abstr.numberBinOp(c,a,"Mult")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a * b."},matmul:{$meth:function matmul(c,a){return Sk.abstr.numberBinOp(c,a,"MatMult")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a @ b."},neg:{$meth:function neg(a){return Sk.abstr.numberUnaryOp(a,"USub")},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Same as -a."},or_:{$meth:function or_(c,a){return Sk.abstr.numberBinOp(c,a,"BitOr")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a | b."},pos:{$meth:function pos(a){return Sk.abstr.numberUnaryOp(a,"UAdd")},$flags:{OneArg:!0},$textsig:"($module, a, /)",$doc:"Same as +a."},pow:{$meth:function pow(c,a){return Sk.abstr.numberBinOp(c,a,"Pow")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a ** b."},rshift:{$meth:function rshift(c,a){return Sk.abstr.numberBinOp(c,a,"RShift")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a >> b."},sub:{$meth:function sub(c,a){return Sk.abstr.numberBinOp(c,a,"Sub")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a - b."},truediv:{$meth:function div(c,a){return Sk.abstr.numberBinOp(c,a,"Div")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a / b."},xor:{$meth:function xor(c,a){return Sk.abstr.numberBinOp(c,a,"BitXor")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a ^ b."},concat:{$meth:function concat(c,a){return Sk.abstr.sequenceConcat(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a + b, for a and b sequences."},contains:{$meth:function contains(c,a){return Sk.builtin.bool(Sk.abstr.sequenceContains(c,a))},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as b in a (note reversed operands)."},countOf:{$meth:function countOf(c,a){return Sk.abstr.sequenceGetCountOf(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Return the number of times b occurs in a."},delitem:{$meth:function delitem(c,a){return Sk.misceval.chain(Sk.abstr.objectDelItem(c,a,!0),()=>Sk.builtin.none.none$)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as del a[b]."},getitem:{$meth:function getitem(c,a){return Sk.abstr.objectGetItem(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a[b]."},indexOf:{$meth:function indexOf(c,a){return Sk.abstr.sequenceGetIndexOf(c,a)},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Return the first index of b in a."},setitem:{$meth:function setitem(d,a,b){return Sk.misceval.chain(Sk.abstr.objectSetItem(d,a,b,!0),()=>Sk.builtin.none.none$)},$flags:{MinArgs:3,MaxArgs:3},$textsig:"($module, a, b, c, /)",$doc:"Same as a[b] = c."},length_hint:{$meth:function length_hint(a,b){if(void 0===b)b=new Sk.builtin.int_(0);else if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("\'"+Sk.abstr.typeName(b)+"\' object cannot be interpreted as an integer");try{return Sk.builtin.len(a)}catch(a){if(!(a instanceof Sk.builtin.TypeError))throw a}const c=Sk.abstr.lookupSpecial(a,Sk.builtin.str.$length_hint);if(void 0!==c){const a=Sk.misceval.callsimArray(c,[]);if(a===Sk.builtin.NotImplemented.NotImplemented$)return b;if(!Sk.builtin.checkInteger(a))throw new Sk.builtin.TypeError("__length_hint__ must be an integer, not "+Sk.abstr.typeName(a));else if(a.nb$isnegative())throw new Sk.builtin.TypeError("__length_hint__() should return >= 0");return a}return b},$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:{$meth:function iadd(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"Add")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a += b."},iand:{$meth:function iand(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"BitAnd")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a &= b."},iconcat:{$meth:function iconcat(c,a){if(void 0!==c.sq$inplace_concat)return c.sq$inplace_concat(a);if(void 0!==c.sq$concat)return c.sq$concat(a);if(!Sk.builtin.checkSequence(c)||!Sk.builtin.checkSequence(a))throw new Sk.builtin.TypeError(Sk.abstr.typeName(c)+" object can\'t be concatenated");return Sk.abstr.numberInplaceBinOp(c,a,"Add")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a += b, for a and b sequences."},ifloordiv:{$meth:function ifloordiv(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"FloorDiv")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a //= b."},ilshift:{$meth:function ilshift(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"LShift")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a <<= b."},imod:{$meth:function imod(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"Mod")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a %= b."},imul:{$meth:function imul(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"Mult")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a *= b."},imatmul:{$meth:function imatmul(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"MatMult")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a @= b."},ior:{$meth:function ior(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"BitOr")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a |= b."},ipow:{$meth:function ipow(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"Pow")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a **= b."},irshift:{$meth:function irshift(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"LRhift")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a >>= b."},isub:{$meth:function isub(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"Sub")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a -= b."},itruediv:{$meth:function idiv(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"Div")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a /= b."},ixor:{$meth:function ixor(c,a){return Sk.abstr.numberInplaceBinOp(c,a,"BitXor")},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, a, b, /)",$doc:"Same as a ^= b."}}),Object.assign(operator,{__abs__:operator.abs,__add__:operator.add,__and__:operator.and,__concat__:operator.concat,__contains__:operator.contains,__delitem__:operator.delitem,__eq__:operator.eq,__floordiv__:operator.floordiv,__ge__:operator.ge,__getitem__:operator.getitem,__gt__:operator.gt,__iadd__:operator.iadd,__iand__:operator.iand,__iconcat__:operator.iconcat,__ifloordiv__:operator.ifloordiv,__ilshift__:operator.ilshift,__imatmul__:operator.imatmul,__imod__:operator.imod,__imul__:operator.imul,__index__:operator.index,__inv__:operator.inv,__invert__:operator.invert,__ior__:operator.ior,__ipow__:operator.ipow,__irshift__:operator.irshift,__isub__:operator.isub,__itruediv__:operator.itruediv,__ixor__:operator.ixor,__le__:operator.le,__lshift__:operator.lshift,__lt__:operator.lt,__matmul__:operator.matmul,__mod__:operator.mod,__mul__:operator.mul,__ne__:operator.ne,__neg__:operator.neg,__not__:operator.not,__or__:operator.or,__pos__:operator.pos,__pow__:operator.pow,__rshift__:operator.rshift,__setitem__:operator.setitem,__sub__:operator.sub,__truediv__:operator.truediv,__xor__:operator.xor,_abs:Sk.builtins.abs,div:operator.truediv,__div__:operator.truediv}),operator}',"src/lib/optparse.py":'raise NotImplementedError("optparse is not yet implemented in Skulpt")\n',"src/lib/os.py":'raise NotImplementedError("os is not yet implemented in Skulpt")\n',"src/lib/os2emxpath.py":'raise NotImplementedError("os2emxpath is not yet implemented in Skulpt")\n',"src/lib/pdb.py":'raise NotImplementedError("pdb is not yet implemented in Skulpt")\n',"src/lib/pickle.py":'raise NotImplementedError("pickle is not yet implemented in Skulpt")\n',"src/lib/pickletools.py":'raise NotImplementedError("pickletools is not yet implemented in Skulpt")\n',"src/lib/pipes.py":'raise NotImplementedError("pipes is not yet implemented in Skulpt")\n',"src/lib/pkgutil.py":'raise NotImplementedError("pkgutil is not yet implemented in Skulpt")\n',"src/lib/platform.js":'var $builtinmodule=function(){var a={},b="undefined"!=typeof window&&"undefined"!=typeof window.navigator;return a.python_implementation=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen("python_implementation",arguments.length,0,0),new Sk.builtin.str("Skulpt")}),a.node=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen("node",arguments.length,0,0),new Sk.builtin.str("")}),a.version=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen("version",arguments.length,0,0),new Sk.builtin.str("")}),a.python_version=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen("python_version",arguments.length,0,0),a=Sk.__future__.python_version?"3.2.0":"2.7.0",new Sk.builtin.str(a)}),a.system=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen("system",arguments.length,0,0),a=b?window.navigator.appCodeName:"",new Sk.builtin.str(a)}),a.machine=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen("machine",arguments.length,0,0),a=b?window.navigator.platform:"",new Sk.builtin.str(a)}),a.release=new Sk.builtin.func(function(){var a;return Sk.builtin.pyCheckArgsLen("release",arguments.length,0,0),a=b?window.navigator.appVersion:"",new Sk.builtin.str(a)}),a.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("")])}),a.processor=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen("processor",arguments.length,0,0),new Sk.builtin.str("")}),a};',"src/lib/platform.py":'raise NotImplementedError("platform is not yet implemented in Skulpt")\n',"src/lib/plistlib.py":'raise NotImplementedError("plistlib is not yet implemented in Skulpt")\n',"src/lib/popen2.py":'raise NotImplementedError("popen2 is not yet implemented in Skulpt")\n',"src/lib/poplib.py":'raise NotImplementedError("poplib is not yet implemented in Skulpt")\n',"src/lib/posixfile.py":'raise NotImplementedError("posixfile is not yet implemented in Skulpt")\n',"src/lib/posixpath.py":'raise NotImplementedError("posixpath is not yet implemented in Skulpt")\n',"src/lib/pprint.py":'raise NotImplementedError("pprint is not yet implemented in Skulpt")\n',"src/lib/processing.js":'var $builtinmodule=function(){var b,c,d,e,f,g,h,a=Math.PI,j={__name__:new Sk.builtin.str("processing")},k=[],l=!0,m=null;return j.processing=null,j.p=null,j.X=new Sk.builtin.int_(0),j.Y=new Sk.builtin.int_(1),j.Z=new Sk.builtin.int_(2),j.R=new Sk.builtin.int_(3),j.G=new Sk.builtin.int_(4),j.B=new Sk.builtin.int_(5),j.A=new Sk.builtin.int_(6),j.U=new Sk.builtin.int_(7),j.V=new Sk.builtin.int_(8),j.NX=new Sk.builtin.int_(9),j.NY=new Sk.builtin.int_(10),j.NZ=new Sk.builtin.int_(11),j.EDGE=new Sk.builtin.int_(12),j.SR=new Sk.builtin.int_(13),j.SG=new Sk.builtin.int_(14),j.SB=new Sk.builtin.int_(15),j.SA=new Sk.builtin.int_(16),j.SW=new Sk.builtin.int_(17),j.TX=new Sk.builtin.int_(18),j.TY=new Sk.builtin.int_(19),j.TZ=new Sk.builtin.int_(20),j.VX=new Sk.builtin.int_(21),j.VY=new Sk.builtin.int_(22),j.VZ=new Sk.builtin.int_(23),j.VW=new Sk.builtin.int_(24),j.AR=new Sk.builtin.int_(25),j.AG=new Sk.builtin.int_(26),j.AB=new Sk.builtin.int_(27),j.DR=new Sk.builtin.int_(3),j.DG=new Sk.builtin.int_(4),j.DB=new Sk.builtin.int_(5),j.DA=new Sk.builtin.int_(6),j.SPR=new Sk.builtin.int_(28),j.SPG=new Sk.builtin.int_(29),j.SPB=new Sk.builtin.int_(30),j.SHINE=new Sk.builtin.int_(31),j.ER=new Sk.builtin.int_(32),j.EG=new Sk.builtin.int_(33),j.EB=new Sk.builtin.int_(34),j.BEEN_LIT=new Sk.builtin.int_(35),j.VERTEX_FIELD_COUNT=new Sk.builtin.int_(36),j.CENTER=new Sk.builtin.int_(3),j.RADIUS=new Sk.builtin.int_(2),j.CORNERS=new Sk.builtin.int_(1),j.CORNER=new Sk.builtin.int_(0),j.DIAMETER=new Sk.builtin.int_(3),j.BASELINE=new Sk.builtin.int_(0),j.TOP=new Sk.builtin.int_(101),j.BOTTOM=new Sk.builtin.int_(102),j.NORMAL=new Sk.builtin.int_(1),j.NORMALIZED=new Sk.builtin.int_(1),j.IMAGE=new Sk.builtin.int_(2),j.MODEL=new Sk.builtin.int_(4),j.SHAPE=new Sk.builtin.int_(5),j.AMBIENT=new Sk.builtin.int_(0),j.DIRECTIONAL=new Sk.builtin.int_(1),j.SPOT=new Sk.builtin.int_(3),j.RGB=new Sk.builtin.int_(1),j.ARGB=new Sk.builtin.int_(2),j.HSB=new Sk.builtin.int_(3),j.ALPHA=new Sk.builtin.int_(4),j.CMYK=new Sk.builtin.int_(5),j.TIFF=new Sk.builtin.int_(0),j.TARGA=new Sk.builtin.int_(1),j.JPEG=new Sk.builtin.int_(2),j.GIF=new Sk.builtin.int_(3),j.MITER=new Sk.builtin.str("miter"),j.BEVEL=new Sk.builtin.str("bevel"),j.ROUND=new Sk.builtin.str("round"),j.SQUARE=new Sk.builtin.str("butt"),j.PROJECT=new Sk.builtin.str("square"),j.P2D=new Sk.builtin.int_(1),j.JAVA2D=new Sk.builtin.int_(1),j.WEBGL=new Sk.builtin.int_(2),j.P3D=new Sk.builtin.int_(2),j.OPENGL=new Sk.builtin.int_(2),j.PDF=new Sk.builtin.int_(0),j.DXF=new Sk.builtin.int_(0),j.OTHER=new Sk.builtin.int_(0),j.WINDOWS=new Sk.builtin.int_(1),j.MAXOSX=new Sk.builtin.int_(2),j.LINUX=new Sk.builtin.int_(3),j.EPSILON=new Sk.builtin.float_(1e-4),j.MAX_FLOAT=new Sk.builtin.float_(34028235e31),j.MIN_FLOAT=new Sk.builtin.float_(-34028235e31),j.MAX_INT=new Sk.builtin.int_(2147483647),j.MIN_INT=new Sk.builtin.int_(-2147483648),j.HALF_PI=new Sk.builtin.float_(a/2),j.THIRD_PI=new Sk.builtin.float_(a/3),j.PI=new Sk.builtin.float_(a),j.TWO_PI=new Sk.builtin.float_(2*a),j.TAU=new Sk.builtin.float_(2*a),j.QUARTER_PI=new Sk.builtin.float_(a/4),j.DEG_TO_RAD=new Sk.builtin.float_(a/180),j.RAD_TO_DEG=new Sk.builtin.float_(180/a),j.WHITESPACE=new Sk.builtin.str(" \\t\\n\\r\\f\\xA0"),j.POINT=new Sk.builtin.int_(2),j.POINTS=new Sk.builtin.int_(2),j.LINE=new Sk.builtin.int_(4),j.LINES=new Sk.builtin.int_(4),j.TRIANGLE=new Sk.builtin.int_(8),j.TRIANGLES=new Sk.builtin.int_(9),j.TRIANGLE_FAN=new Sk.builtin.int_(11),j.TRIANGLE_STRIP=new Sk.builtin.int_(10),j.QUAD=new Sk.builtin.int_(16),j.QUADS=new Sk.builtin.int_(16),j.QUAD_STRIP=new Sk.builtin.int_(17),j.POLYGON=new Sk.builtin.int_(20),j.PATH=new Sk.builtin.int_(21),j.RECT=new Sk.builtin.int_(30),j.ELLIPSE=new Sk.builtin.int_(31),j.ARC=new Sk.builtin.int_(32),j.SPHERE=new Sk.builtin.int_(40),j.BOX=new Sk.builtin.int_(41),j.GROUP=new Sk.builtin.int_(0),j.PRIMITIVE=new Sk.builtin.int_(1),j.GEOMETRY=new Sk.builtin.int_(3),j.VERTEX=new Sk.builtin.int_(0),j.BEZIER_VERTEX=new Sk.builtin.int_(1),j.CURVE_VERTEX=new Sk.builtin.int_(2),j.BREAK=new Sk.builtin.int_(3),j.CLOSESHAPE=new Sk.builtin.int_(4),j.REPLACE=new Sk.builtin.int_(0),j.BLEND=new Sk.builtin.int_(1),j.ADD=new Sk.builtin.int_(2),j.SUBTRACT=new Sk.builtin.int_(4),j.LIGHTEST=new Sk.builtin.int_(8),j.DARKEST=new Sk.builtin.int_(16),j.DIFFERENCE=new Sk.builtin.int_(32),j.EXCLUSION=new Sk.builtin.int_(64),j.MULTIPLY=new Sk.builtin.int_(128),j.SCREEN=new Sk.builtin.int_(256),j.OVERLAY=new Sk.builtin.int_(512),j.HARD_LIGHT=new Sk.builtin.int_(1024),j.SOFT_LIGHT=new Sk.builtin.int_(2048),j.DODGE=new Sk.builtin.int_(4096),j.BURN=new Sk.builtin.int_(8192),j.ALPHA_MASK=new Sk.builtin.int_(4278190080),j.RED_MASK=new Sk.builtin.int_(16711680),j.GREEN_MASK=new Sk.builtin.int_(65280),j.BLUE_MASK=new Sk.builtin.int_(255),j.CUSTOM=new Sk.builtin.int_(0),j.ORTHOGRAPHIC=new Sk.builtin.int_(2),j.PERSPECTIVE=new Sk.builtin.int_(3),j.ARROW=new Sk.builtin.str("default"),j.CROSS=new Sk.builtin.str("crosshair"),j.HAND=new Sk.builtin.str("pointer"),j.MOVE=new Sk.builtin.str("move"),j.TEXT=new Sk.builtin.str("text"),j.WAIT=new Sk.builtin.str("wait"),j.NOCURSOR=Sk.builtin.assk$("url(\'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\'), auto"),j.DISABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(1),j.ENABLE_OPENGL_2X_SMOOTH=new Sk.builtin.int_(-1),j.ENABLE_OPENGL_4X_SMOOTH=new Sk.builtin.int_(2),j.ENABLE_NATIVE_FONTS=new Sk.builtin.int_(3),j.DISABLE_DEPTH_TEST=new Sk.builtin.int_(4),j.ENABLE_DEPTH_TEST=new Sk.builtin.int_(-4),j.ENABLE_DEPTH_SORT=new Sk.builtin.int_(5),j.DISABLE_DEPTH_SORT=new Sk.builtin.int_(-5),j.DISABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(6),j.ENABLE_OPENGL_ERROR_REPORT=new Sk.builtin.int_(-6),j.ENABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(7),j.DISABLE_ACCURATE_TEXTURES=new Sk.builtin.int_(-7),j.HINT_COUNT=new Sk.builtin.int_(10),j.OPEN=new Sk.builtin.int_(1),j.CLOSE=new Sk.builtin.int_(2),j.BLUR=new Sk.builtin.int_(11),j.GRAY=new Sk.builtin.int_(12),j.INVERT=new Sk.builtin.int_(13),j.OPAQUE=new Sk.builtin.int_(14),j.POSTERIZE=new Sk.builtin.int_(15),j.THRESHOLD=new Sk.builtin.int_(16),j.ERODE=new Sk.builtin.int_(17),j.DILATE=new Sk.builtin.int_(18),j.BACKSPACE=new Sk.builtin.int_(8),j.TAB=new Sk.builtin.int_(9),j.ENTER=new Sk.builtin.int_(10),j.RETURN=new Sk.builtin.int_(13),j.ESC=new Sk.builtin.int_(27),j.DELETE=new Sk.builtin.int_(127),j.CODED=new Sk.builtin.int_(65535),j.SHIFT=new Sk.builtin.int_(16),j.CONTROL=new Sk.builtin.int_(17),j.ALT=new Sk.builtin.int_(18),j.CAPSLK=new Sk.builtin.int_(20),j.PGUP=new Sk.builtin.int_(33),j.PGDN=new Sk.builtin.int_(34),j.END=new Sk.builtin.int_(35),j.HOME=new Sk.builtin.int_(36),j.LEFT=new Sk.builtin.int_(37),j.UP=new Sk.builtin.int_(38),j.RIGHT=new Sk.builtin.int_(39),j.DOWN=new Sk.builtin.int_(40),j.F1=new Sk.builtin.int_(112),j.F2=new Sk.builtin.int_(113),j.F3=new Sk.builtin.int_(114),j.F4=new Sk.builtin.int_(115),j.F5=new Sk.builtin.int_(116),j.F6=new Sk.builtin.int_(117),j.F7=new Sk.builtin.int_(118),j.F8=new Sk.builtin.int_(119),j.F9=new Sk.builtin.int_(120),j.F10=new Sk.builtin.int_(121),j.F11=new Sk.builtin.int_(122),j.F12=new Sk.builtin.int_(123),j.NUMLK=new Sk.builtin.int_(144),j.META=new Sk.builtin.int_(157),j.INSERT=new Sk.builtin.int_(155),j.SINCOS_LENGTH=new Sk.builtin.int_(720),j.PRECISIONB=new Sk.builtin.int_(15),j.PRECISIONF=new Sk.builtin.int_(32768),j.PREC_MAXVAL=new Sk.builtin.int_(32767),j.PREC_ALPHA_SHIFT=new Sk.builtin.int_(9),j.PREC_RED_SHIFT=new Sk.builtin.int_(1),j.NORMAL_MODE_AUTO=new Sk.builtin.int_(0),j.NORMAL_MODE_SHAPE=new Sk.builtin.int_(1),j.NORMAL_MODE_VERTEX=new Sk.builtin.int_(2),j.MAX_LIGHTS=new Sk.builtin.int_(8),j.line=new Sk.builtin.func(function(a,b,c,d){j.processing.line(a.v,b.v,c.v,d.v)}),j.ellipse=new Sk.builtin.func(function(a,b,c,d){j.processing.ellipse(a.v,b.v,c.v,d.v)}),j.text=new Sk.builtin.func(function(a,b,c){j.processing.text(a.v,b.v,c.v)}),j.point=new Sk.builtin.func(function(a,b){j.processing.point(a.v,b.v)}),j.arc=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.arc(a.v,b.v,c.v,d.v,e.v,f.v)}),j.quad=new Sk.builtin.func(function(a,b,c,d,e,f,g,h){j.processing.quad(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v)}),j.rect=new Sk.builtin.func(function(a,b,c,d,e){"undefined"==typeof e?j.processing.rect(a.v,b.v,c.v,d.v):j.processing.rect(a.v,b.v,c.v,d.v,e.v)}),j.triangle=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.triangle(a.v,b.v,c.v,d.v,e.v,f.v)}),j.bezier=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i,k,l,m){"undefined"==typeof i?j.processing.bezier(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):j.processing.bezier(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v,l.v,m.v)}),j.alpha=new Sk.builtin.func(function(a,c,d){return"undefined"==typeof c?new Sk.builtin.float_(j.processing.alpha(a.v)):"undefined"==typeof d?new Sk.builtin.float_(j.processing.alpha(a.v,c.v)):new Sk.builtin.float_(j.processing.alpha(a.v,c.v,d.v))}),j.ambient=new Sk.builtin.func(function(a,c,d){"undefined"==typeof c?j.processing.ambient(a.v):"undefined"==typeof d?j.processing.ambient(a.v,c.v):j.processing.ambient(a.v,c.v,d.v)}),j.ambientLight=new Sk.builtin.func(function(a,b,c,d,e,f){"undefined"==typeof d?j.processing.ambientLight(a.v,b.v,c.v):"undefined"==typeof e?j.processing.ambientLight(a.v,b.v,c.v,d.v):"undefined"==typeof f?j.processing.ambientLight(a.v,b.v,c.v,d.v,e.v):j.processing.ambientLight(a.v,b.v,c.v,d.v,e.v,f.v)}),j.beginCamera=new Sk.builtin.func(function(){j.processing.beginCamera()}),j.beginShape=new Sk.builtin.func(function(a){"undefined"==typeof a&&(a=j.POLYGON),j.processing.beginShape(a.v)}),j.bezierDetail=new Sk.builtin.func(function(a){a="undefined"==typeof a?20:a.v,j.processing.bezierDetail(a)}),j.bezierPoint=new Sk.builtin.func(function(e,a,b,c,d){j.processing.bezierPoint(e.v,a.v,b.v,c.v,d.v)}),j.bezierTangent=new Sk.builtin.func(function(e,a,b,c,d){j.processing.bezierTangent(e.v,a.v,b.v,c.v,d.v)}),j.bezierVertex=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i){"undefined"==typeof g?j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v):"undefined"==typeof h?j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v,g.v):"undefined"==typeof i?j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):j.processing.bezierVertex(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v)}),j.blend=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i,k){other instanceof Sk.builtin.int_||other instanceof Sk.builtin.float_?j.processing.blend(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v):j.processing.blend(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v)}),j.blendColor=new Sk.builtin.func(function(a,b,d){var e=Sk.misceval.callsimArray(j.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return e.v=j.processing.blendColor(a.v,b.v,d.v),e}),j.brightness=new Sk.builtin.func(function(a,c,d){return"undefined"==typeof c?new Sk.builtin.float_(j.processing.brightness(a.v)):"undefined"==typeof d?new Sk.builtin.float_(j.processing.brightness(a.v,c.v)):new Sk.builtin.float_(j.processing.brightness(a.v,c.v,d.v))}),j.camera=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i){"undefined"==typeof a?j.processing.camera():j.processing.camera(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v)}),j.constrain=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.constrain(a.v,b.v,c.v))}),j.copy=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i){other instanceof Sk.builtin.int_||other instanceof Sk.builtin.float_?j.processing.copy(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):j.processing.copy(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v)}),j.createFont=new Sk.builtin.func(function(a,b,c,d){var e=Sk.misceval.callsimArray(j.PFont);return e.v="undefined"==typeof c?j.processing.createFont(a.v,b.v):"undefined"==typeof d?j.processing.createFont(a.v,b.v,c.v):j.processing.createFont(a.v,b.v,c.v,d.v),e}),j.createGraphics=new Sk.builtin.func(function(a,b,c,d){var e=Sk.misceval.callsimArray(j.PGraphics);return e.v="undefined"==typeof d?j.processing.createGraphics(a.v,b.v,c.v):j.processing.createGraphics(a.v,b.v,c.v,d.v),e}),j.createImage=new Sk.builtin.func(function(a,b,c){var d=Sk.misceval.callsimArray(j.PImage);return d.v=j.processing.createImage(a.v,b.v,c.v),d}),j.cursor=new Sk.builtin.func(function(a,b,c){"undefined"==typeof a?j.processing.cursor():"undefined"==typeof b?j.processing.cursor(a.v):"undefined"==typeof c?j.processing.cursor(a.v,b.v):j.processing.cursor(a.v,b.v,c.v)}),j.curve=new Sk.builtin.func(function(a,b,c,d,e,f,g,h,i,k,l,m){"undefined"==typeof i?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v):"undefined"==typeof k?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v):"undefined"==typeof l?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v):"undefined"==typeof m?j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v,l.v):j.processing.curve(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v,i.v,k.v,l.v,m.v)}),j.curveDetail=new Sk.builtin.func(function(a){j.processing.curveDetail(a.v)}),j.curvePoint=new Sk.builtin.func(function(e,a,b,c,d){j.processing.curvePoint(e.v,a.v,b.v,c.v,d.v)}),j.curveTangent=new Sk.builtin.func(function(e,a,b,c,d){j.processing.curveTangent(e.v,a.v,b.v,c.v,d.v)}),j.curveTightness=new Sk.builtin.func(function(a){j.processing.curveTightness(a.v)}),j.curveVertex=new Sk.builtin.func(function(a,b,c){"undefined"==typeof c?j.processing.curveVertex(a.v,b.v):j.processing.curveVertex(a.v,b.v,c.v)}),j.day=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.day())}),j.degrees=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.degrees(a.v))}),j.directionalLight=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.directionalLight(a.v,b.v,c.v,d.v,e.v,f.v)}),j.dist=new Sk.builtin.func(function(a,b,c,d,e,f){return"undefined"==typeof e?new Sk.builtin.float_(j.processing.dist(a.v,b.v,c.v,d.v)):"undefined"==typeof f?new Sk.builtin.float_(j.processing.dist(a.v,b.v,c.v,d.v,e.v)):new Sk.builtin.float_(j.processing.dist(a.v,b.v,c.v,d.v,e.v,f.v))}),j.emissive=new Sk.builtin.func(function(a,b,c){"undefined"==typeof b?j.processing.emissive(a.v):"undefined"==typeof c?j.processing.emissive(a.v,b.v):j.processing.emissive(a.v,b.v,c.v)}),j.endCamera=new Sk.builtin.func(function(){j.processing.endCamera()}),j.endShape=new Sk.builtin.func(function(a){"undefined"==typeof a?j.processing.endShape():j.processing.endShape(a.v)}),j.filter=new Sk.builtin.func(function(a,b){"undefined"==typeof b?j.processing.filter(a.v):j.processing.filter(a.v,b.v)}),j.frustum=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.frustum(a,b,c,d,e,f)}),j.hint=new Sk.builtin.func(function(a){j.processing.hint(a)}),j.hour=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.hour())}),j.hue=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.hue(a.v))}),j.imageMode=new Sk.builtin.func(function(a){j.processing.imageMode(a.v)}),j.lerp=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.lerp(a.v,b.v,c.v))}),j.lerpColor=new Sk.builtin.func(function(a,b,d){var e=Sk.misceval.callsimArray(j.color,[new Sk.builtin.int_(0),new Sk.builtin.int_(0),new Sk.builtin.int_(0)]);return e.v=j.processing.lerpColor(a.v,b.v,d.v),e}),j.lightFalloff=new Sk.builtin.func(function(a,b,c){j.processing.lightFalloff(a.v,b.v,c.v)}),j.lights=new Sk.builtin.func(function(){j.processing.lights()}),j.lightSpecular=new Sk.builtin.func(function(a,b,c){j.processing.lightSpecular(a.v,b.v,c.v)}),j.loadBytes=new Sk.builtin.func(function(a){return new Sk.builtin.list(j.processing.loadBytes(a.v))}),j.loadFont=new Sk.builtin.func(function(a){var b=Sk.misceval.callsimArray(j.PFont);return b.v=j.processing.loadFont(a.v),b}),j.loadShape=new Sk.builtin.func(function(a){var b=Sk.misceval.callsimArray(j.PShapeSVG,[new Sk.builtin.str("string"),a]);return b}),j.loadStrings=new Sk.builtin.func(function(a){return new Sk.builtin.list(j.processing.loadStrings(a.v))}),j.mag=new Sk.builtin.func(function(d,a,b){return"undefined"==typeof b?new Sk.builtin.float_(j.processing.mag(d.v,a.v)):new Sk.builtin.float_(j.processing.mag(d.v,a.v,b.v))}),j.map=new Sk.builtin.func(function(a,b,c,d,e){return new Sk.builtin.float_(j.processing.map(a.v,b.v,c.v,d.v,e.v))}),j.millis=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.millis())}),j.minute=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.minute())}),j.modelX=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.modelX(a.v,b.v,c.v))}),j.modelY=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.modelY(a.v,b.v,c.v))}),j.modelZ=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.modelZ(a.v,b.v,c.v))}),j.month=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.month())}),j.noCursor=new Sk.builtin.func(function(){j.processing.noCursor()}),j.noise=new Sk.builtin.func(function(a,b,c){return"undefined"==typeof b?new Sk.builtin.float_(j.processing.noise(a.v)):"undefined"==typeof c?new Sk.builtin.float_(j.processing.noise(a.v,b.v)):new Sk.builtin.float_(j.processing.noise(a.v,b.v,c.v))}),j.noiseDetail=new Sk.builtin.func(function(a,b){j.processing.noiseDetail(a.v,b.v)}),j.noiseSeed=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.noiseSeed(a.v))}),j.noLights=new Sk.builtin.func(function(){j.processing.noLights()}),j.norm=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.norm(a.v,b.v,c.v))}),j.normal=new Sk.builtin.func(function(a,b,c){j.processing.normal(a.v,b.v,c.v)}),j.noTint=new Sk.builtin.func(function(){j.processing.noTint()}),j.ortho=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.ortho(a.v,b.v,c.v,d.v,e.v,f.v)}),j.perspective=new Sk.builtin.func(function(a,b,c,d){"undefined"==typeof a?j.processing.perspective():"undefined"==typeof b?j.processing.perspective(a.v):"undefined"==typeof c?j.processing.perspective(a.v,b.v):"undefined"==typeof d?j.processing.perspective(a.v,b.v,c.v):j.processing.perspective(a.v,b.v,c.v,d.v)}),j.pointLight=new Sk.builtin.func(function(a,b,c,d,e,f){j.processing.pointLight(a.v,b.v,c.v,d.v,e.v,f.v)}),j.printCamera=new Sk.builtin.func(function(){j.processing.printCamera()}),j.println=new Sk.builtin.func(function(a){j.processing.println(a.v)}),j.printProjection=new Sk.builtin.func(function(){j.processing.printProjection()}),j.radians=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.radians(a.v))}),j.randomSeed=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.randomSeed(a.v))}),j.random=new Sk.builtin.func(function(a,b){return"undefined"==typeof a?new Sk.builtin.float_(j.processing.random()):"undefined"==typeof b?new Sk.builtin.float_(j.processing.random(a.v)):new Sk.builtin.float_(j.processing.random(a.v,b.v))}),j.requestImage=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PImage);return c.v="undefined"==typeof b?j.processing.requestImage(a.v):j.processing.requestImage(a.v,b.v),c}),j.saturation=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.saturation(a.v))}),j.save=new Sk.builtin.func(function(a){j.processing.save(a.v)}),j.saveFrame=new Sk.builtin.func(function(a){"undefined"==typeof a?j.processing.saveFrame():j.processing.saveFrame(a.v)}),j.saveStrings=new Sk.builtin.func(function(a,b){j.processing.saveStrings(a.v,b.v)}),j.screenX=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.screenX(a.v,b.v,c.v))}),j.screenY=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.screenY(a.v,b.v,c.v))}),j.screenZ=new Sk.builtin.func(function(a,b,c){return new Sk.builtin.float_(j.processing.screenZ(a.v,b.v,c.v))}),j.second=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.second())}),j.shape=new Sk.builtin.func(function(a,b,c,d,e){"undefined"==typeof b?j.processing.shape(a.v):"undefined"==typeof c?j.processing.shape(a.v,b.v):"undefined"==typeof d?j.processing.shape(a.v,b.v,c.v):"undefined"==typeof e?j.processing.shape(a.v,b.v,c.v,d.v):j.processing.shape(a.v,b.v,c.v,d.v,e.v)}),j.shapeMode=new Sk.builtin.func(function(a){j.processing.shapeMode(a.v)}),j.shininess=new Sk.builtin.func(function(a){j.processing.shininess(a.v)}),j.specular=new Sk.builtin.func(function(a,b,c){"undefined"==typeof b?j.processing.specular(a.v):"undefined"==typeof c?j.processing.specular(a.v,b.v):j.processing.specular(a.v,b.v,c.v)}),j.spotLight=new Sk.builtin.func(function(a,b,c,d,e,f,g,h){j.processing.spotLight(a.v,b.v,c.v,d.v,e.v,f.v,g.v,h.v)}),j.sq=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.sq(a))}),j.status=new Sk.builtin.func(function(a){j.processing.status(a.v)}),j.textAlign=new Sk.builtin.func(function(a,b){"undefined"==typeof b?j.processing.textAlign(a.v):j.processing.textAlign(a.v,b.v)}),j.textAscent=new Sk.builtin.func(function(){return new Sk.builtin.float_(j.processing.textAscent())}),j.textDescent=new Sk.builtin.func(function(){return new Sk.builtin.float_(j.processing.textDescent())}),j.textFont=new Sk.builtin.func(function(a,b){"undefined"==typeof b?j.processing.textFont(a.v):j.processing.textFont(a.v,b.v)}),j.textLeading=new Sk.builtin.func(function(a){j.processing.textLeading(a.v)}),j.textMode=new Sk.builtin.func(function(a){j.processing.textMode(a.v)}),j.textSize=new Sk.builtin.func(function(a){j.processing.textSize(a.v)}),j.texture=new Sk.builtin.func(function(a){j.processing.texture(a.v)}),j.textureMode=new Sk.builtin.func(function(a){j.processing.textureMode(a.v)}),j.textWidth=new Sk.builtin.func(function(a){return new Sk.builtin.float_(j.processing.textWidth(a.v))}),j.tint=new Sk.builtin.func(function(a,b,c,d){"undefined"==typeof b?j.processing.tint(a.v):"undefined"==typeof c?j.processing.tint(a.v,b.v):"undefined"==typeof d?j.processing.tint(a.v,b.v,c.v):j.processing.tint(a.v,b.v,c.v,d.v)}),j.updatePixels=new Sk.builtin.func(function(){j.processing.updatePixels()}),j.vertex=new Sk.builtin.func(function(a,b,c,d,e){"undefined"==typeof c?j.processing.vertex(a.v,b.v):"undefined"==typeof d?j.processing.vertex(a.v,b.v,c.v):"undefined"==typeof e?j.processing.vertex(a.v,b.v,c.v,d.v):j.processing.vertex(a.v,b.v,c.v,d.v,e.v)}),j.year=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.year())}),j.box=new Sk.builtin.func(function(a){j.processing.box(a.v)}),j.sphere=new Sk.builtin.func(function(a){j.processing.sphere(a.v)}),j.sphereDetail=new Sk.builtin.func(function(a,b){"undefined"==typeof b?j.processing.sphereDetail(a.v):j.processing.sphereDetail(a.v,b.v)}),j.background=new Sk.builtin.func(function(a,c,d){"undefined"!=typeof c&&(c=c.v),"undefined"!=typeof d&&(d=d.v),j.processing.background(a.v,c,d)}),j.fill=new Sk.builtin.func(function(a,c,d,e){"undefined"!=typeof c&&(c=c.v),"undefined"!=typeof d&&(d=d.v),"undefined"!=typeof e&&(e=e.v),j.processing.fill(a.v,c,d,e)}),j.stroke=new Sk.builtin.func(function(a,c,d,e){"undefined"!=typeof c&&(c=c.v),"undefined"!=typeof d&&(d=d.v),"undefined"!=typeof e&&(e=e.v),j.processing.stroke(a.v,c,d,e)}),j.noStroke=new Sk.builtin.func(function(){j.processing.noStroke()}),j.colorMode=new Sk.builtin.func(function(a,b,c,d,e){b="undefined"==typeof b?255:b.v,"undefined"!=typeof c&&(c=c.v),"undefined"!=typeof d&&(d=d.v),"undefined"!=typeof e&&(e=e.v),j.processing.colorMode(a.v,b,c,d,e)}),j.noFill=new Sk.builtin.func(function(){j.processing.noFill()}),j.loop=new Sk.builtin.func(function(){if(null===j.processing)throw new Sk.builtin.Exception("loop() should be called after run()");l=!0,j.processing.loop()}),j.noLoop=new Sk.builtin.func(function(){if(null===j.processing)throw new Sk.builtin.Exception("noLoop() should be called after run()");l=!1,j.processing.noLoop()}),j.frameRate=new Sk.builtin.func(function(a){j.processing.frameRate(a.v)}),j.width=new Sk.builtin.int_(0),j.height=new Sk.builtin.int_(0),j.renderMode=j.P2D,j.size=new Sk.builtin.func(function(a,b,c){"undefined"==typeof c&&(c=j.P2D),j.processing.size(a.v,b.v,c.v),j.width=new Sk.builtin.int_(j.processing.width),j.height=new Sk.builtin.int_(j.processing.height),j.renderMode=c}),j.exitp=new Sk.builtin.func(function(){j.processing.exit()}),j.mouseX=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.mouseX)}),j.mouseY=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.mouseY)}),j.pmouseX=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.pmouseX)}),j.pmouseY=new Sk.builtin.func(function(){return new Sk.builtin.int_(j.processing.pmouseY)}),j.rectMode=new Sk.builtin.func(function(a){j.processing.rectMode(a.v)}),j.strokeWeight=new Sk.builtin.func(function(a){j.processing.strokeWeight(a.v)}),j.smooth=new Sk.builtin.func(function(){j.processing.smooth()}),j.noSmooth=new Sk.builtin.func(function(){j.processing.noSmooth()}),j.ellipseMode=new Sk.builtin.func(function(a){j.processing.ellipseMode(a.v)}),j.strokeCap=new Sk.builtin.func(function(a){j.processing.strokeCap(a.v)}),j.strokeJoin=new Sk.builtin.func(function(a){j.processing.strokeJoin(a.v)}),j.rotate=new Sk.builtin.func(function(a){j.processing.rotate(a.v)}),j.rotateX=new Sk.builtin.func(function(a){j.processing.rotateX(a.v)}),j.rotateY=new Sk.builtin.func(function(a){j.processing.rotateY(a.v)}),j.rotateZ=new Sk.builtin.func(function(a){j.processing.rotateZ(a.v)}),j.scale=new Sk.builtin.func(function(a,b,c){b="undefined"==typeof b?1:b.v,c="undefined"==typeof c?1:c.v,j.processing.scale(a.v,b,c)}),j.translate=new Sk.builtin.func(function(a,b,c){b="undefined"==typeof b?1:b.v,c="undefined"==typeof c?1:c.v,j.processing.translate(a.v,b,c)}),j.popMatrix=new Sk.builtin.func(function(){j.processing.popMatrix()}),j.pushMatrix=new Sk.builtin.func(function(){j.processing.pushMatrix()}),j.applyMatrix=new Sk.builtin.func(function(){var a,b=Array.prototype.slice.call(arguments,0,16);for(a=0;a<b.length;a++)b[a]="undefined"==typeof b[a]?0:b[a].v;j.processing.applyMatrix.apply(j.processing,b)}),j.resetMatrix=new Sk.builtin.func(function(){j.processing.resetMatrix()}),j.printMatrix=new Sk.builtin.func(function(){return Sk.ffi.remapToPy(j.processing.printMatrix())}),j.run=new Sk.builtin.func(function(){var a=document.getElementById(Sk.canvas);if(!a)throw new Error("Processing module: Canvas element not specified");if(window.Processing.logger={log:function(a){Sk.misceval.print_(a)}},m=window.Processing.getInstanceById(Sk.canvas),m&&m.exit(),j.p=new window.Processing(a,function sketchProc(a){j.processing=a,a.draw=function(){var b=!1;for(var c in k)0===k[c].width&&(b=!0);if(!0==b)return!0===l?void 0:void a.loop();if(!1===l&&a.noLoop(),j.frameCount=a.frameCount,Sk.globals.draw)try{Sk.misceval.callsimArray(Sk.globals.draw)}catch(a){Sk.uncaughtException(a)}};var b=["setup","mouseMoved","mouseClicked","mouseDragged","mouseMoved","mouseOut","mouseOver","mousePressed","mouseReleased","keyPressed","keyReleased","keyTyped"];for(var c in b)Sk.globals[b[c]]&&(a[b[c]]=new Function("try {Sk.misceval.callsimArray(Sk.globals[\'"+b[c]+"\']);} catch(e) {Sk.uncaughtException(e);}"))}),0===j.width.v&&0===j.height.v){var b=a.offsetWidth,c=a.offsetHeight;Sk.misceval.callsimArray(j.size,[new Sk.builtin.int_(b),new Sk.builtin.int_(c),j.renderMode])}}),g=function(a,b){b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"x"===b)?Sk.builtin.assk$(j.processing.mouseX):"y"===b?Sk.builtin.assk$(j.processing.mouseY):"px"===b?Sk.builtin.assk$(j.processing.pmouseX):"py"===b?Sk.builtin.assk$(j.processing.pmouseY):"pressed"===b?new Sk.builtin.bool(j.processing.__mousePressed):"button"===b?Sk.builtin.assk$(j.processing.mouseButton):void 0})},j.Mouse=Sk.misceval.buildClass(j,g,"Mouse",[]),j.mouse=Sk.misceval.callsimArray(j.Mouse),f=function(a,b){b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"key"===b)?new Sk.builtin.str(j.processing.key.toString()):"keyCode"===b?Sk.builtin.assk$(j.processing.keyCode):"keyPressed"===b?new Sk.builtin.str(j.processing.keyPressed):void 0})},j.Keyboard=Sk.misceval.buildClass(j,f,"Keyboard",[]),j.keyboard=Sk.misceval.callsimArray(j.Keyboard),e=function(a,b){b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"frameCount"===b)?Sk.builtin.assk$(j.processing.frameCount):"frameRate"===b?Sk.builtin.assk$(j.processing.frameRate):"height"===b?Sk.builtin.assk$(j.processing.height):"width"===b?Sk.builtin.assk$(j.processing.width):"online"===b?new Sk.builtin.bool(j.processing.online):"focused"===b?new Sk.builtin.bool(j.processing.focused):void 0})},j.Environment=Sk.misceval.buildClass(j,e,"Environment",[]),j.environment=Sk.misceval.callsimArray(j.Environment),d=function(a,b){b.__init__=new Sk.builtin.func(function(a){a.pixels=null}),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"height"===b)?Sk.builtin.assk$(j.processing.height):"width"===b?Sk.builtin.assk$(j.processing.width):("pixels"===b&&null==a.pixels&&(a.pixels=new Sk.builtin.list(j.processing.pixels.toArray())),a.pixels)})},j.Screen=Sk.misceval.buildClass(j,d,"Screen",[]),j.screen=Sk.misceval.callsimArray(j.Screen),j.loadPixels=new Sk.builtin.func(function(){j.processing.loadPixels()}),c=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d,e){"undefined"!=typeof c&&(c=c.v),"undefined"!=typeof d&&(d=d.v),"undefined"!=typeof e&&(e=e.v),a.v=j.processing.color(b.v,c,d,e)})},j.color=Sk.misceval.buildClass(j,c,"color",[]),j.red=new Sk.builtin.func(function(a){return new Sk.builtin.int_(j.processing.red(a.v))}),j.green=new Sk.builtin.func(function(a){return new Sk.builtin.int_(j.processing.green(a.v))}),j.blue=new Sk.builtin.func(function(a){return new Sk.builtin.int_(j.processing.blue(a.v))}),b=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v="undefined"==typeof b?new j.processing.PImage:"undefined"==typeof c?new j.processing.PImage(b.v):"undefined"==typeof d?new j.processing.PImage(b.v,c.v):new j.processing.PImage(b.v,c.v,d.v)}),b.__getattr__=new Sk.builtin.func(function(a,b){return b=Sk.ffi.remapToJs(b),"width"===b?Sk.builtin.assk$(a.v.width):"height"===b?Sk.builtin.assk$(a.v.height):void 0})},j.loadImage=new Sk.builtin.func(function(a){var b=j.processing.loadImage(a.v);k.push(b);var c=Sk.misceval.callsimArray(j.PImage);return c.v=b,c}),j.image=new Sk.builtin.func(function(a,b,c,d,e){"undefined"==typeof d?j.processing.image(a.v,b.v,c.v):j.processing.image(a.v,b.v,c.v,d.v,e.v)}),j.get=new Sk.builtin.func(function(a,b){var c=j.processing.get(a.v,b.v);return Sk.misceval.callsimArray(j.color,[new Sk.builtin.int_(j.processing.red(c)),new Sk.builtin.int_(j.processing.green(c)),new Sk.builtin.int_(j.processing.blue(c))])}),j.set=new Sk.builtin.func(function(a,b,c){j.processing.set(a.v,b.v,c.v)}),h=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v="undefined"==typeof b?new j.processing.PVector:"undefined"==typeof d?new j.processing.PVector(b.v,c.v):new j.processing.PVector(b.v,c.v,d.v)}),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"x"===b)?Sk.builtin.assk$(a.v.x):"y"===b?Sk.builtin.assk$(a.v.y):"z"===b?Sk.builtin.assk$(a.v.z):void 0}),b.get=new Sk.builtin.func(function(a){var b=Sk.misceval.callsimArray(j.PVector);return b.v=a.v.get(),b}),b.set=new Sk.builtin.func(function(a,b,c,d){"undefined"==typeof d?a.v.set(b.v,c.v):a.v.set(b.v,c.v,d.v)}),b.mag=new Sk.builtin.func(function(a){return Sk.builtin.assk$(a.v.mag())}),b.add=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.add(b.v),c}),b.sub=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.sub(b.v),c}),b.mult=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.mult(b.v),c}),b.div=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.div(b.v),c}),b.dist=new Sk.builtin.func(function(a,b){return Sk.builtin.assk$(a.v.dist(b.v))}),b.dot=new Sk.builtin.func(function(a,b,c,d){return"undefined"==typeof c?Sk.builtin.assk$(a.v.dot(b.v)):Sk.builtin.assk$(a.v.dot(b.v,c.v,d.v))}),b.cross=new Sk.builtin.func(function(a,b){var c=Sk.misceval.callsimArray(j.PVector);return c.v=a.v.cross(b.v),c}),b.normalize=new Sk.builtin.func(function(a){a.v.normalize()}),b.limit=new Sk.builtin.func(function(a,b){a.v.limit(b.v)}),b.angleBetween=new Sk.builtin.func(function(a,b){return Sk.builtin.assk$(a.v.angleBetween(b.v))}),b.array=new Sk.builtin.func(function(a){return new Sk.builtin.list(a.v.array())})},fontClass=function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v="undefined"==typeof b?new j.processing.PFont:new j.processing.PVector(b.v)}),b.list=new Sk.builtin.func(function(a){return new Sk.builtin.list(a.v.list())})},graphicsClass=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v="undefined"==typeof b?new j.processing.PVector:"undefined"==typeof d?new j.processing.PVector(b.v,c.v):new j.processing.PVector(b.v,c.v,d.v)}),b.beginDraw=new Sk.builtin.func(function(a){a.v.beginDraw()}),b.endDraw=new Sk.builtin.func(function(a){a.v.endDraw()})},shapeClass=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){a.v="undefined"==typeof b?null:"undefined"==typeof c?new j.processing.PShapeSVG(b.v):"undefined"==typeof d?new j.processing.PShapeSVG(b.v,c.v):new j.processing.PShapeSVG(b.v,c.v,d.v)}),b.__getattr__=new Sk.builtin.func(function(a,b){return(b=Sk.ffi.remapToJs(b),"width"===b)?Sk.builtin.assk$(a.v.width):"height"===b?Sk.builtin.assk$(a.v.height):void 0}),b.isVisible=new Sk.builtin.func(function(a){return new Sk.builtin.bool(a.v.isVisible())}),b.setVisible=new Sk.builtin.func(function(a,b){a.v.setVisible(b.v)}),b.disableStyle=new Sk.builtin.func(function(a){a.v.disableStyle()}),b.enableStyle=new Sk.builtin.func(function(a){a.v.enableStyle()}),b.getChild=new Sk.builtin.func(function(a,b){var c=a.v.getChild(b.v);if(null!=c){var d=Sk.misceval.callsimArray(j.PShapeSVG);return d.v=c,d}return null}),b.translate=new Sk.builtin.func(function(a,b,c,d){"undefined"==typeof d?a.v.translate(b.v,c.v):a.v.translate(b.v,c.v,d.v)}),b.rotate=new Sk.builtin.func(function(a,b){a.v.rotate(b.v)}),b.rotateX=new Sk.builtin.func(function(a,b){a.v.rotateX(b.v)}),b.rotateY=new Sk.builtin.func(function(a){a.v.rotateY(angle.v)}),b.rotateZ=new Sk.builtin.func(function(a){a.v.rotateZ(angle.v)}),b.scale=new Sk.builtin.func(function(a,b,c,d){"undefined"==typeof c?a.v.scale(b.v):"undefined"==typeof d?a.v.scale(b.v,c.v):a.v.scale(b.v,c.v,d.v)})},j.PFont=Sk.misceval.buildClass(j,fontClass,"PFont",[]),j.PGraphics=Sk.misceval.buildClass(j,graphicsClass,"PGraphics",[]),j.PShapeSVG=Sk.misceval.buildClass(j,shapeClass,"PShapeSVG",[]),j.PVector=Sk.misceval.buildClass(j,h,"PVector",[]),j.PImage=Sk.misceval.buildClass(j,b,"PImage",[]),j};',"src/lib/profile.py":'raise NotImplementedError("profile is not yet implemented in Skulpt")\n',"src/lib/pstats.py":'raise NotImplementedError("pstats is not yet implemented in Skulpt")\n',"src/lib/pty.py":'raise NotImplementedError("pty is not yet implemented in Skulpt")\n',"src/lib/py_compile.py":'raise NotImplementedError("py_compile is not yet implemented in Skulpt")\n',"src/lib/pyclbr.py":'raise NotImplementedError("pyclbr is not yet implemented in Skulpt")\n',"src/lib/pydoc.py":'raise NotImplementedError("pydoc is not yet implemented in Skulpt")\n',"src/lib/pydoc_topics.py":'raise NotImplementedError("pydoc_topics is not yet implemented in Skulpt")\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":'raise NotImplementedError("quopri is not yet implemented in Skulpt")\n',"src/lib/random.js":'var MersenneTwister=function(a){a==null&&(a=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=Array(this.N),this.mti=this.N+1,this.init_genrand(a)};MersenneTwister.prototype.init_genrand=function(a){for(this.mt[0]=a>>>0,this.mti=1;this.mti<this.N;this.mti++){var a=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&a)>>>16)<<16)+1812433253*(65535&a)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.init_by_array=function(a,b){var d,e,f;for(this.init_genrand(19650218),d=1,e=0,f=this.N>b?this.N:b;f;f--){var g=this.mt[d-1]^this.mt[d-1]>>>30;this.mt[d]=(this.mt[d]^(1664525*((4294901760&g)>>>16)<<16)+1664525*(65535&g))+a[e]+e,this.mt[d]>>>=0,d++,e++,d>=this.N&&(this.mt[0]=this.mt[this.N-1],d=1),e>=b&&(e=0)}for(f=this.N-1;f;f--){var g=this.mt[d-1]^this.mt[d-1]>>>30;this.mt[d]=(this.mt[d]^(1566083941*((4294901760&g)>>>16)<<16)+1566083941*(65535&g))-d,this.mt[d]>>>=0,d++,d>=this.N&&(this.mt[0]=this.mt[this.N-1],d=1)}this.mt[0]=2147483648},MersenneTwister.prototype.genrand_int32=function(){var a,b=[0,this.MATRIX_A];if(this.mti>=this.N){var d;for(this.mti==this.N+1&&this.init_genrand(5489),d=0;d<this.N-this.M;d++)a=this.mt[d]&this.UPPER_MASK|this.mt[d+1]&this.LOWER_MASK,this.mt[d]=this.mt[d+this.M]^a>>>1^b[1&a];for(;d<this.N-1;d++)a=this.mt[d]&this.UPPER_MASK|this.mt[d+1]&this.LOWER_MASK,this.mt[d]=this.mt[d+(this.M-this.N)]^a>>>1^b[1&a];a=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^a>>>1^b[1&a],this.mti=0}return a=this.mt[this.mti++],a^=a>>>11,a^=2636928640&a<<7,a^=4022730752&a<<15,a^=a>>>18,a>>>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(){var d=this.genrand_int32()>>>5,a=this.genrand_int32()>>>6;return(67108864*d+a)*(1/9007199254740992)};var $builtinmodule=function(){var a=Math.log,b=Math.sqrt,d={},e=new MersenneTwister,f=void 0;d.seed=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("seed",arguments.length,0,1),a=Sk.builtin.asnum$(a),e=0<arguments.length?new MersenneTwister(a):new MersenneTwister,Sk.builtin.none.none$}),d.random=new Sk.builtin.func(function(){return Sk.builtin.pyCheckArgsLen("random",arguments.length,0,0),new Sk.builtin.float_(e.genrand_res53())});var g=function(a){return 0|a},h=function(a,b,d){var f,h,i;if(!Sk.builtin.checkInt(a))throw new Sk.builtin.ValueError("non-integer first argument for randrange()");if(void 0===b)return i=g(e.genrand_res53()*a),new Sk.builtin.int_(i);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.ValueError("non-integer stop for randrange()");if(void 0===d&&(d=1),f=b-a,1==d&&0<f)return i=a+g(e.genrand_res53()*f),new Sk.builtin.int_(i);if(1==d)throw new Sk.builtin.ValueError("empty range for randrange() ("+a+", "+b+", "+f+")");if(!Sk.builtin.checkInt(d))throw new Sk.builtin.ValueError("non-integer step for randrange()");if(0<d)h=g((f+d-1)/d);else if(0>d)h=g((f+d+1)/d);else throw new Sk.builtin.ValueError("zero step for randrange()");if(0>=h)throw new Sk.builtin.ValueError("empty range for randrange()");return i=a+d*g(e.genrand_res53()*h),new Sk.builtin.int_(i)};d.randint=new Sk.builtin.func(function(d,e){return Sk.builtin.pyCheckArgsLen("randint",arguments.length,2,2),d=Sk.builtin.asnum$(d),e=Sk.builtin.asnum$(e),h(d,e+1)}),d.randrange=new Sk.builtin.func(function(a,b,d){return Sk.builtin.pyCheckArgsLen("randrange",arguments.length,1,3),a=Sk.builtin.asnum$(a),b=Sk.builtin.asnum$(b),d=Sk.builtin.asnum$(d),h(a,b,d)}),d.uniform=new Sk.builtin.func(function(d,f){Sk.builtin.pyCheckArgsLen("uniform",arguments.length,2,2),d=Sk.builtin.asnum$(d),f=Sk.builtin.asnum$(f);var g=e.genrand_res53();return c=d+g*(f-d),new Sk.builtin.float_(c)}),d.triangular=new Sk.builtin.func(function(a,d,f){Sk.builtin.pyCheckArgsLen("triangular",arguments.length,2,3),Sk.builtin.pyCheckType("low","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("high","number",Sk.builtin.checkNumber(d));var g,h,i;return a=Sk.builtin.asnum$(a),d=Sk.builtin.asnum$(d),a>d&&(i=a,a=d,d=i),void 0===f||f===Sk.builtin.none.none$?f=(d-a)/2:(Sk.builtin.pyCheckType("mode","number",Sk.builtin.checkNumber(f)),f=Sk.builtin.asnum$(f)),g=e.genrand_res53(),h=g<(f-a)/(d-a)?a+b(g*(d-a)*(f-a)):d-b((1-g)*(d-a)*(d-f)),new Sk.builtin.float_(h)});var i=function(d,g){var k,l,m,n,o,h=Math.sin,i=Math.cos,j=Math.PI;return void 0===f?(k=e.genrand_res53(),l=e.genrand_res53(),m=b(-2*a(k)),n=2*j*l,o=m*i(n),f=m*h(n)):(o=f,f=void 0),d+g*o};return d.gauss=new Sk.builtin.func(function(a,b){return Sk.builtin.pyCheckArgsLen("gauss",arguments.length,2,2),Sk.builtin.pyCheckType("mu","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("sigma","number",Sk.builtin.checkNumber(b)),a=Sk.builtin.asnum$(a),b=Sk.builtin.asnum$(b),new Sk.builtin.float_(i(a,b))}),d.normalvariate=d.gauss,d.lognormvariate=new Sk.builtin.func(function(a,b){var d=Math.exp;return Sk.builtin.pyCheckArgsLen("lognormvariate",arguments.length,2,2),Sk.builtin.pyCheckType("mu","number",Sk.builtin.checkNumber(a)),Sk.builtin.pyCheckType("sigma","number",Sk.builtin.checkNumber(b)),a=Sk.builtin.asnum$(a),b=Sk.builtin.asnum$(b),new Sk.builtin.float_(d(i(a,b)))}),d.expovariate=new Sk.builtin.func(function(b){Sk.builtin.pyCheckArgsLen("expovariate",arguments.length,1,1),Sk.builtin.pyCheckType("lambd","number",Sk.builtin.checkNumber(b)),b=Sk.builtin.asnum$(b);var d=e.genrand_res53();return new Sk.builtin.float_(-a(d)/b)}),d.choice=new Sk.builtin.func(function(a){if(Sk.builtin.pyCheckArgsLen("choice",arguments.length,1,1),Sk.builtin.pyCheckType("seq","sequence",Sk.builtin.checkSequence(a)),void 0!==a.sq$length){var b=new Sk.builtin.int_(g(e.genrand_res53()*a.sq$length()));return a.mp$subscript(b)}throw new Sk.builtin.TypeError("object has no length")}),d.shuffle=new Sk.builtin.func(function(a){if(Sk.builtin.pyCheckArgsLen("shuffle",arguments.length,1,1),Sk.builtin.pyCheckType("x","sequence",Sk.builtin.checkSequence(a)),a.constructor===Sk.builtin.list){const h=a.v;for(var b=h.length-1;0<b;b-=1){var d=g(e.genrand_res53()*(b+1)),f=h[d];h[d]=h[b],h[b]=f}}else if(void 0===a.sq$length)throw new Sk.builtin.TypeError("object has no length");else if(void 0!==a.mp$ass_subscript)for(var d,b=a.sq$length()-1;0<b;b-=1){d=new Sk.builtin.int_(g(e.genrand_res53()*(b+1))),b=new Sk.builtin.int_(b);var f=a.mp$subscript(d);a.mp$ass_subscript(d,a.mp$subscript(b)),a.mp$ass_subscript(b,f)}else throw new Sk.builtin.TypeError("object is immutable");return Sk.builtin.none.none$}),d.sample=new Sk.builtin.func(function(a,b){var f,g,h,l,m,d=Math.floor;for(Sk.builtin.pyCheckArgsLen("sample",arguments.length,2,2),Sk.builtin.pyCheckType("population","iterable",Sk.builtin.checkIterable(a)),Sk.builtin.pyCheckType("k","integer",Sk.builtin.checkInt(b)),b=Sk.builtin.asnum$(b),m=[],h=Sk.abstr.iter(a),(f=0,l=h.tp$iternext());void 0!==l;f++,l=h.tp$iternext())g=d(e.genrand_res53()*(f+1)),f<b?(g<f&&(m[f]=m[g]),m[g]=l):g<b&&(m[g]=l);if(f<b)throw new Sk.builtin.ValueError("sample larger than population");return new Sk.builtin.list(m)}),d};',"src/lib/re.js":'var $builtinmodule=function(name){var validGroups,convert,getFlags,_split,_findall,matchobj,_search,_match,regexobj,mod={__name__:new Sk.builtin.str("re")};return mod.I=2,mod.IGNORECASE=2,mod.M=8,mod.MULTILINE=8,validGroups=["(?:","(?=","(?!"],convert=function(a){var b,c,d;if(c=a.match(/\\(\\?./g),c)for(d=0;d<c.length;d++)if(-1==validGroups.indexOf(c[d]))throw new Sk.builtin.ValueError("Disallowed group in pattern: \'"+c[d]+"\'");return b=a.replace("/\\\\/g","\\\\\\\\"),b=a.replace(/([^\\\\]){,(?![^\\[]*\\])/g,"$1{0,"),b},getFlags=function(a){var b="g";return(a&mod.IGNORECASE)==mod.IGNORECASE&&(b+="i"),(a&mod.MULTILINE)==mod.MULTILINE&&(b+="m"),b},_split=function(a,b,c,d){var e,f,g,h,i,j,k,l,m;if(Sk.builtin.pyCheckArgsLen("split",arguments.length,2,4),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("pattern must be a string");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("string must be a string");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError("maxsplit must be a number");if(void 0===d&&(d=0),!Sk.builtin.checkNumber(d))throw new Sk.builtin.TypeError("flags must be a number");for(c=Sk.builtin.asnum$(c),e=Sk.ffi.unwrapo(a),f=Sk.ffi.unwrapo(b),e=convert(e),g=null!==e.match(/^\\(.*\\)$/),h=getFlags(d),i=new RegExp(e,h),j=[],k,l=0,m=0;null!=(k=i.exec(f))&&k.index!==i.lastIndex&&(j.push(new Sk.builtin.str(f.substring(l,k.index))),g&&j.push(new Sk.builtin.str(k[0])),l=i.lastIndex,m+=1,!(c&&m>=c)););return j.push(new Sk.builtin.str(f.substring(l))),new Sk.builtin.list(j)},_split.co_varnames=["pattern","string","maxsplit","flags"],_split.$defaults=[new Sk.builtin.int_(0),new Sk.builtin.int_(0)],mod.split=new Sk.builtin.func(_split),_findall=function(a,b,c){var d,e,f,g,h,j;if(Sk.builtin.pyCheckArgsLen("findall",arguments.length,2,3),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("pattern must be a string");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("string must be a string");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError("flags must be a number");if(d=Sk.ffi.unwrapo(a),e=Sk.ffi.unwrapo(b),d=convert(d),f=getFlags(c),g=new RegExp(d,f),d.match(/\\$/)){var k=new RegExp(/\\n$/);e.match(k)&&(e=e.slice(0,-1))}for(h=[],j;null!=(j=g.exec(e));){if(2>j.length)h.push(new Sk.builtin.str(j[0]));else if(2==j.length)h.push(new Sk.builtin.str(j[1]));else{for(var l=[],m=1;m<j.length;m++)l.push(new Sk.builtin.str(j[m]));h.push(new Sk.builtin.tuple(l))}j.index===g.lastIndex&&(g.lastIndex+=1)}return new Sk.builtin.list(h)},_findall.co_varnames=["pattern","string","flags"],_findall.$defaults=[new Sk.builtin.int_(0)],mod.findall=new Sk.builtin.func(_findall),matchobj=function(a,b){b.__init__=new Sk.builtin.func(function(a,b,c,d){return a.thematch=b,a.re=c,a.string=d,Sk.builtin.none.none$}),b.groups=new Sk.builtin.func(function(a){var b=a.thematch.v.slice(1);return new Sk.builtin.tuple(b)}),b.group=new Sk.builtin.func(function(a,b){if(b=void 0===b?0:Sk.builtin.asnum$(b),b>=a.thematch.v.length)throw new Sk.builtin.IndexError("Index out of range: "+b);return a.thematch.v[b]})},mod.MatchObject=Sk.misceval.buildClass(mod,matchobj,"MatchObject",[]),mod._findre=function(res,string){res=res.replace(/([^\\\\]){,(?![^\\[]*\\])/g,"$1{0,");var matches,sitem,retval,re=eval(res),patt=/\\n$/,str=Sk.ffi.remapToJs(string);if(matches=str.match(patt)?str.slice(0,-1).match(re):str.match(re),retval=new Sk.builtin.list,null==matches)return retval;for(var i=0;i<matches.length;++i)sitem=new Sk.builtin.str(matches[i]),retval.v.push(sitem);return retval},_search=function(a,b,c){var d,e;if(Sk.builtin.pyCheckArgsLen("search",arguments.length,2,3),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("pattern must be a string");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("string must be a string");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError("flags must be a number");return(e="/"+a.v.replace(/\\//g,"\\\\/")+"/",lst=mod._findre(e,b),1>lst.v.length)?Sk.builtin.none.none$:(d=Sk.misceval.callsimArray(mod.MatchObject,[lst,a,b]),d)},_search.co_varnames=["pattern","string","flags"],_search.$defaults=[new Sk.builtin.int_(0)],mod.search=new Sk.builtin.func(_search),_match=function(a,b,c){var d,e;if(Sk.builtin.pyCheckArgsLen("match",arguments.length,2,3),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("pattern must be a string");if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("string must be a string");if(void 0===c&&(c=0),!Sk.builtin.checkNumber(c))throw new Sk.builtin.TypeError("flags must be a number");return(pat=Sk.ffi.remapToJs(a),e="/^"+pat.replace(/\\//g,"\\\\/")+"/",lst=mod._findre(e,b),1>Sk.ffi.remapToJs(lst).length)?Sk.builtin.none.none$:(d=Sk.misceval.callsimArray(mod.MatchObject,[lst,a,b]),d)},_match.co_varnames=["pattern","string","flags"],_match.$defaults=[new Sk.builtin.int_(0)],mod.match=new Sk.builtin.func(_match),regexobj=function(a,b){var c,d,e,f,g,h;b.__init__=new Sk.builtin.func(function(a,b,c){return a.re=b,a.flags=void 0===c?0:c,Sk.builtin.none.none$}),h=new Sk.builtin.func(function(a){var b="re.compile(\'"+Sk.ffi.remapToJs(a.re)+"\')";return Sk.ffi.remapToPy(b.substring(0,212))}),b.__str__=h,b.__repr__=h,c=function(a,b,c){var d=Sk.ffi.remapToJs(a),e=null==b?0:Sk.ffi.remapToJs(b),f=null==c?d.length:Sk.ffi.remapToJs(c);return"^"==e&&(e=d.indexOf("\\n")+1),null===f&&(f=d.length),Sk.ffi.remapToPy(d.substring(e,f))},d=function(a,b,d,e){Sk.builtin.pyCheckArgsLen("search",arguments.length,2,4);var f=c(b,d,e);return _search(a.re,f,a.flags)},d.co_varnames=["self","string","pos","endpos"],d.$defaults=[new Sk.builtin.int_(0),Sk.builtin.none.none$],b.search=new Sk.builtin.func(d),e=function(a,b,d,e){Sk.builtin.pyCheckArgsLen("match",arguments.length,2,4);var f=c(b,d,e);return _match(a.re,f,a.flags)},e.co_varnames=["self","string","pos","endpos"],e.$defaults=[new Sk.builtin.int_(0),Sk.builtin.none.none$],b.match=new Sk.builtin.func(e),f=function(a,b,c){if(Sk.builtin.pyCheckArgsLen("split",arguments.length,2,3),void 0===c&&(c=0),!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("maxsplit must be an integer");return _split(a.re,b,c,a.flags)},f.co_varnames=["self","string","maxsplit"],f.$defaults=[new Sk.builtin.int_(0)],b.split=new Sk.builtin.func(f),g=function(a,b,d,e){Sk.builtin.pyCheckArgsLen("findall",arguments.length,2,4);var f=c(b,d,e);return _findall(a.re,f,a.flags)},g.co_varnames=["self","string","pos","endpos"],g.$defaults=[new Sk.builtin.int_(0),Sk.builtin.none.none$],b.findall=new Sk.builtin.func(g)},mod.RegexObject=Sk.misceval.buildClass(mod,regexobj,"RegexObject",[]),mod.compile=new Sk.builtin.func(function(a,b){var c;if(Sk.builtin.pyCheckArgsLen("compile",arguments.length,1,2),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("pattern must be a string");if(void 0===b&&(b=0),!Sk.builtin.checkNumber(b))throw new Sk.builtin.TypeError("flags must be a number");return c=Sk.misceval.callsimArray(mod.RegexObject,[a,b]),c}),mod.purge=new Sk.builtin.func(function(){}),mod};',"src/lib/repr.py":'raise NotImplementedError("repr is not yet implemented in Skulpt")\n',"src/lib/rexec.py":'raise NotImplementedError("rexec is not yet implemented in Skulpt")\n',"src/lib/rfc822.py":'raise NotImplementedError("rfc822 is not yet implemented in Skulpt")\n',"src/lib/rlcompleter.py":'raise NotImplementedError("rlcompleter is not yet implemented in Skulpt")\n',"src/lib/robotparser.py":'raise NotImplementedError("robotparser is not yet implemented in Skulpt")\n',"src/lib/runpy.py":'raise NotImplementedError("runpy is not yet implemented in Skulpt")\n',"src/lib/sched.py":'raise NotImplementedError("sched is not yet implemented in Skulpt")\n',"src/lib/sets.py":'raise NotImplementedError("sets is not yet implemented in Skulpt")\n',"src/lib/sgmllib.py":'raise NotImplementedError("sgmllib is not yet implemented in Skulpt")\n',"src/lib/sha.py":'raise NotImplementedError("sha is not yet implemented in Skulpt")\n',"src/lib/shelve.py":'raise NotImplementedError("shelve is not yet implemented in Skulpt")\n',"src/lib/shlex.py":'raise NotImplementedError("shlex is not yet implemented in Skulpt")\n',"src/lib/shutil.py":'raise NotImplementedError("shutil is not yet implemented in Skulpt")\n',"src/lib/signal.js":'var $builtinmodule=function(){var a={SIG_DFL:new Sk.builtin.int_(0),SIG_IGN:new Sk.builtin.int_(1),CTRL_C_EVENT:new Sk.builtin.int_(0),CTRL_BREAK_EVENT:new Sk.builtin.int_(0),NSIG:new Sk.builtin.int_(23),SIGHUP:new Sk.builtin.int_(1),SIGNINT:new Sk.builtin.int_(2),SIGILL:new Sk.builtin.int_(4),SIGFPE:new Sk.builtin.int_(8),SIGKILL:new Sk.builtin.int_(9),SIGSEGV:new Sk.builtin.int_(11),SIGTERM:new Sk.builtin.int_(15),SIGBREAK:new Sk.builtin.int_(21),SIGABRT:new Sk.builtin.int_(22),pause:new Sk.builtin.func(function(){Sk.builtin.pyCheckArgsLen("pause",arguments.length,0,0);var a=new Sk.misceval.Suspension;return a.resume=function(){return Sk.builtin.none.none$},a.data={type:"Sk.promise",promise:new Promise(function(a){if(null!=Sk.signals&&Sk.signals.addEventListener){function handleSignal(){Sk.signals.removeEventListener(handleSignal),a()}Sk.signals.addEventListener(handleSignal)}else console.warn("signal.pause() not supported"),Sk.misceval.print_("signal.pause() not supported"),a()})},a}),signal:new Sk.builtin.func(function(){throw new Sk.builtin.NotImplementedError("signal.signal is not supported.")})};return a};',"src/lib/site.py":'raise NotImplementedError("site is not yet implemented in Skulpt")\n',"src/lib/smtpd.py":'raise NotImplementedError("smtpd is not yet implemented in Skulpt")\n',"src/lib/smtplib.py":'raise NotImplementedError("smtplib is not yet implemented in Skulpt")\n',"src/lib/sndhdr.py":'raise NotImplementedError("sndhdr is not yet implemented in Skulpt")\n',"src/lib/socket.py":'raise NotImplementedError("socket is not yet implemented in Skulpt")\n',"src/lib/sqlite3/__init__.py":'raise NotImplementedError("sqlite3 is not yet implemented in Skulpt")\n',"src/lib/sre.py":'raise NotImplementedError("sre is not yet implemented in Skulpt")\n',"src/lib/sre_compile.py":'raise NotImplementedError("sre_compile is not yet implemented in Skulpt")\n',"src/lib/sre_constants.py":'raise NotImplementedError("sre_constants is not yet implemented in Skulpt")\n',"src/lib/sre_parse.py":'raise NotImplementedError("sre_parse is not yet implemented in Skulpt")\n',"src/lib/ssl.py":'raise NotImplementedError("ssl is not yet implemented in Skulpt")\n',"src/lib/stat.py":'raise NotImplementedError("stat is not yet implemented in Skulpt")\n',"src/lib/statvfs.py":'raise NotImplementedError("statvfs is not yet implemented in Skulpt")\n',"src/lib/string.js":'var $builtinmodule=function(){var a={};return a.ascii_lowercase=new Sk.builtin.str("abcdefghijklmnopqrstuvwxyz"),a.ascii_uppercase=new Sk.builtin.str("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),a.ascii_letters=new Sk.builtin.str(a.ascii_lowercase.v+a.ascii_uppercase.v),a.lowercase=new Sk.builtin.str("abcdefghijklmnopqrstuvwxyz"),a.uppercase=new Sk.builtin.str("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),a.letters=new Sk.builtin.str(a.lowercase.v+a.uppercase.v),a.digits=new Sk.builtin.str("0123456789"),a.hexdigits=new Sk.builtin.str("0123456789abcdefABCDEF"),a.octdigits=new Sk.builtin.str("01234567"),a.punctuation=new Sk.builtin.str("!\\"#$%&\'()*+,-./:;<=>?@[\\\\]^_`{|}~"),a.whitespace=new Sk.builtin.str("\\t\\n\\x0B\\f\\r "),a.printable=new Sk.builtin.str(a.digits.v+a.letters.v+a.punctuation.v+" \\t\\n\\r\\x0B\\f"),a.split=new Sk.builtin.func(function(...a){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.split,a)}),a.capitalize=new Sk.builtin.func(function(a){return Sk.misceval.callsimArray(Sk.builtin.str.prototype.capitalize,[a])}),a.join=new Sk.builtin.func(function(a,b){return void 0===b&&(b=new Sk.builtin.str(" ")),Sk.misceval.callsimArray(Sk.builtin.str.prototype.join,[b,a])}),a.capwords=new Sk.builtin.func(function(b,c){if(Sk.builtin.pyCheckArgsLen("capwords",arguments.length,1,2),!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("s must be a string");if(void 0===c&&(c=new Sk.builtin.str(" ")),!Sk.builtin.checkString(c))throw new Sk.builtin.TypeError("sep must be a string");for(var d=Sk.misceval.callsimArray(a.split,[b,c]).v,e=[],f=0;f<d.length;f++){var g=d[f],h=Sk.misceval.callsimArray(a.capitalize,[g]);e.push(h)}return Sk.misceval.callsimArray(a.join,[new Sk.builtin.list(e),c])}),a};',"src/lib/string.py":'raise NotImplementedError("string is not yet implemented in Skulpt")\n',"src/lib/stringold.py":'raise NotImplementedError("stringold is not yet implemented in Skulpt")\n',"src/lib/stringprep.py":'raise NotImplementedError("stringprep is not yet implemented in Skulpt")\n',"src/lib/struct.py":'raise NotImplementedError("struct is not yet implemented in Skulpt")\n',"src/lib/subprocess.py":'raise NotImplementedError("subprocess is not yet implemented in Skulpt")\n',"src/lib/sunau.py":'raise NotImplementedError("sunau is not yet implemented in Skulpt")\n',"src/lib/sunaudio.py":'raise NotImplementedError("sunaudio is not yet implemented in Skulpt")\n',"src/lib/symbol.py":'raise NotImplementedError("symbol is not yet implemented in Skulpt")\n',"src/lib/symtable.py":'raise NotImplementedError("symtable is not yet implemented in Skulpt")\n',"src/lib/tabnanny.py":'raise NotImplementedError("tabnanny is not yet implemented in Skulpt")\n',"src/lib/tarfile.py":'raise NotImplementedError("tarfile is not yet implemented in Skulpt")\n',"src/lib/telnetlib.py":'raise NotImplementedError("telnetlib is not yet implemented in Skulpt")\n',"src/lib/tempfile.py":'raise NotImplementedError("tempfile is not yet implemented in Skulpt")\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/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":'raise NotImplementedError("decimaltestdata is not yet implemented in Skulpt")\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 <gward@python.net>\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":'raise NotImplementedError("this is not yet implemented in Skulpt")\n',"src/lib/threading.py":'raise NotImplementedError("threading is not yet implemented in Skulpt")\n',"src/lib/time.js":'var $builtinmodule=function(){function check_struct_time(a){if(!(a instanceof b))throw new Sk.builtin.TypeError("Required argument \'struct_time\' must be of type: \'struct_time\'");var c,d=a.v.length,e=a.v;for(c=0;c<d;++c)if(!Sk.builtin.checkInt(e[c]))throw new Sk.builtin.TypeError("struct_time may only contain integers");return!0}function padLeft(a,b,d){var c=a.toString();return Array(b-c.length+1).join(d||" ")+c}function isLeapYear(a){return 0==(3&a)&&(0!=a%100||0==a%400)}function getDayOfYear(a,b){b=b||!1;var c=b?a.getUTCMonth():a.getMonth(),d=b?a.getUTCDate():a.getDate(),e=[0,31,59,90,120,151,181,212,243,273,304,334][c]+d;return 1<c&&isLeapYear(b?a.getUTCFullYear():a.getFullYear())&&e++,e}function stdTimezoneOffset(){var a=Math.max,b=new Date(2002,0,1),c=new Date(2002,6,1);return a(b.getTimezoneOffset(),c.getTimezoneOffset())}function dst(a){return a.getTimezoneOffset()<stdTimezoneOffset()}function timeZoneName(a){var b,c=/\\((.*)\\)/.exec(a.toString());if(null!=this.navigator&&(b=this.navigator.userLanguage||this.navigator.language),c&&1<c.length)return c[1];if(void 0===b)return null;try{var d=a.toLocaleString(b,{timeZoneName:"short"});return c=d.split(" "),c[c.length-1]}catch(a){return null}}function date_to_struct_time(a,c){return c=c||!1,new b([Sk.builtin.assk$(c?a.getUTCFullYear():a.getFullYear()),Sk.builtin.assk$((c?a.getUTCMonth():a.getMonth())+1),Sk.builtin.assk$(c?a.getUTCDate():a.getDate()),Sk.builtin.assk$(c?a.getUTCHours():a.getHours()),Sk.builtin.assk$(c?a.getUTCMinutes():a.getMinutes()),Sk.builtin.assk$(c?a.getUTCSeconds():a.getSeconds()),Sk.builtin.assk$(((c?a.getUTCDay():a.getDay())+6)%7),Sk.builtin.assk$(getDayOfYear(a,c)),Sk.builtin.assk$(c?0:dst(a)?1:0)])}function from_seconds(a,b){var c=new Date;if(a){Sk.builtin.pyCheckType("secs","number",Sk.builtin.checkNumber(a));var d=Sk.builtin.asnum$(a);c.setTime(1e3*d)}return date_to_struct_time(c,b)}function asctime_f(a){if(Sk.builtin.pyCheckArgsLen("asctime",arguments.length,0,1),!a||Sk.builtin.checkNone(a)?a=from_seconds():!(a instanceof b)&&(a=new b(a)),a instanceof Sk.builtin.tuple&&9==a.v.length){var e=[d[Sk.builtin.asnum$(a.v[6])],c[Sk.builtin.asnum$(a.v[1])-1],padLeft(Sk.builtin.asnum$(a.v[2]).toString(),2,"0"),padLeft(Sk.builtin.asnum$(a.v[3]).toString(),2,"0")+":"+padLeft(Sk.builtin.asnum$(a.v[4]).toString(),2,"0")+":"+padLeft(Sk.builtin.asnum$(a.v[5]).toString(),2,"0"),padLeft(Sk.builtin.asnum$(a.v[0]).toString(),4,"0")];return new Sk.builtin.str(e.join(" "))}}function mktime_f(a){if(Sk.builtin.pyCheckArgsLen("mktime",arguments.length,1,1),a instanceof Sk.builtin.tuple&&9==a.v.length){var b=new Date(Sk.builtin.asnum$(a.v[0]),Sk.builtin.asnum$(a.v[1])-1,Sk.builtin.asnum$(a.v[2]),Sk.builtin.asnum$(a.v[3]),Sk.builtin.asnum$(a.v[4]),Sk.builtin.asnum$(a.v[5]));return Sk.builtin.assk$(b.getTime()/1e3,void 0)}throw new Sk.builtin.TypeError("mktime() requires a struct_time or 9-tuple")}var a={__package__:new Sk.builtin.str("")},b=Sk.builtin.make_structseq("time","struct_time",{tm_year:"year, for example, 1993",tm_mon:"month of year, range [1, 12]",tm_mday:"day of month, range [1, 31]",tm_hour:"hours, range [0, 23]",tm_min:"minutes, range [0, 59]",tm_sec:"seconds, range [0, 61]",tm_wday:"day of week, range [0, 6], Monday is 0",tm_yday:"day of year, range [1, 366]",tm_isdst:"1 if summer time is in effect, 0 if not, and -1 if unknown"});a.struct_time=b,a.time=new Sk.builtin.func(function(){Sk.builtin.pyCheckArgsLen("time",arguments.length,0,0);var a=Date.now();return this.performance&&this.performance.now&&(a+=performance.now()%1),Sk.builtin.assk$(a/1e3,void 0)}),a.sleep=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("sleep",arguments.length,1,1),Sk.builtin.pyCheckType("delay","float",Sk.builtin.checkNumber(a)),new Sk.misceval.promiseToSuspension(new Promise(function(b){Sk.setTimeout(function(){b(Sk.builtin.none.none$)},1e3*Sk.ffi.remapToJs(a))}))}),a.localtime=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("localtime",arguments.length,0,1),from_seconds(a,!1)}),a.gmtime=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("gmtime",arguments.length,0,1),from_seconds(a,!0)});var c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return a.asctime=new Sk.builtin.func(asctime_f),a.ctime=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("ctime",arguments.length,0,1),asctime_f(from_seconds(a))}),a.mktime=new Sk.builtin.func(mktime_f),a.timezone=new Sk.builtin.int_(60*stdTimezoneOffset()),a.altzone=new Sk.builtin.int_(60*function altTimezoneOffset(){var a=Math.min,b=new Date(2002,0,1),c=new Date(2002,6,1);return a(b.getTimezoneOffset(),c.getTimezoneOffset())}()),a.daylight=new Sk.builtin.int_(dst(new Date)?1:0),a.tzname=new Sk.builtin.tuple(function timeZoneNames(){var a=new Date(2002,0,1),b=new Date(2002,6,1);return dst(a)?[new Sk.builtin.str(timeZoneName(b)),new Sk.builtin.str(timeZoneName(a))]:[new Sk.builtin.str(timeZoneName(a)),new Sk.builtin.str(timeZoneName(b))]}()),a.accept2dyear=Sk.builtin.assk$(1),a.clock=new Sk.builtin.func(function(){var a=0;return a=this.performance&&this.performance.now?performance.now()/1e3:new Date().getTime()/1e3,new Sk.builtin.float_(a)}),a.strftime=new Sk.builtin.func(function strftime_f(a,c){var d;if(Sk.builtin.pyCheckArgsLen("strftime",arguments.length,1,2),!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("format must be a string");return c?!(c instanceof b)&&(c=new b(c)):c=from_seconds(),check_struct_time(c),d=Sk.ffi.remapToJs(a),Sk.ffi.remapToPy(strftime(d,new Date(1e3*mktime_f(c).v)))}),a.tzset=new Sk.builtin.func(function tzset_f(){throw new Sk.builtin.NotImplementedError("time.tzset() is not yet implemented")}),a.strptime=new Sk.builtin.func(function strptime_f(a,b){Sk.builtin.pyCheckArgsLen("strptime",arguments.length,1,2),Sk.builtin.pyCheckType("string","string",Sk.builtin.checkString(a)),void 0===b?b=new Sk.builtin.str("%a %b %d %H:%M:%S %Y"):Sk.builtin.pyCheckType("format","string",Sk.builtin.checkString(b));let c=date_to_struct_time(strptime(Sk.ffi.remapToJs(a),Sk.ffi.remapToJs(b),!0));return c.v[8]=new Sk.builtin.int_(-1),c}),a};',"src/lib/timeit.py":'raise NotImplementedError("timeit is not yet implemented in Skulpt")\n',"src/lib/toaiff.py":'raise NotImplementedError("toaiff is not yet implemented in Skulpt")\n',"src/lib/token.js":'var $builtinmodule=function(){var a={__file__:"/src/lib/token.py"};const b=[];for(token in Sk.token.tok_name){const c=Sk.token.tok_name[token].slice(2),d=parseInt(token,10);b.push(Sk.ffi.remapToPy(d)),b.push(Sk.ffi.remapToPy(c)),a[c]=Sk.ffi.remapToPy(d)}return a.tok_name=new Sk.builtin.dict(b),a.ISTERMINAL=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("ISTERMINAL",arguments.length,1,1),Sk.token.ISTERMINAL(Sk.ffi.remapToJs(a))}),a.ISNONTERMINAL=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("ISNONTERMINAL",arguments.length,1,1),Sk.token.ISNONTERMINAL(Sk.ffi.remapToJs(a))}),a.ISEOF=new Sk.builtin.func(function(a){return Sk.builtin.pyCheckArgsLen("ISEOF",arguments.length,1,1),Sk.token.ISEOF(Sk.ffi.remapToJs(a))}),a};',"src/lib/tokenize.js":'var $builtinmodule=function(){var a={tokenize:new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgsLen("tokenize",1,1),Sk.builtin.checkFunction(a);const b=[];return Sk._tokenize("<stdin>",function jsReadline(){const b=Sk.misceval.callsimArray(a);return Sk.ffi.remapToJs(b)},"UTF-8",function receiveToken(a){b.push(new Sk.builtin.tuple([Sk.ffi.remapToPy(a.type),Sk.ffi.remapToPy(a.string),new Sk.builtin.tuple([Sk.ffi.remapToPy(a.start[0]),Sk.ffi.remapToPy(a.start[1])]),new Sk.builtin.tuple([Sk.ffi.remapToPy(a.end[0]),Sk.ffi.remapToPy(a.end[1])]),Sk.ffi.remapToPy(a.line)]))}),new Sk.builtin.list(b)})};return a};',"src/lib/trace.py":'raise NotImplementedError("trace is not yet implemented in Skulpt")\n',"src/lib/traceback.py":'raise NotImplementedError("traceback is not yet implemented in Skulpt")\n',"src/lib/tty.py":'raise NotImplementedError("tty is not yet implemented in Skulpt")\n',"src/lib/turtle.js":'var $builtinmodule=function(){"use strict";var e=function getConfiguredTarget(){var e,t;for(e=Sk.TurtleGraphics&&Sk.TurtleGraphics.target||"turtle",t="string"==typeof e?document.getElementById(e):e;t.firstChild;)t.removeChild(t.firstChild);return t}();return e.turtleInstance?e.turtleInstance.reset():e.turtleInstance=function generateTurtleModule(e){var t=Math.round,r=Math.max,n=Math.sqrt,a=Math.min,s=Math.abs,o=Math.PI,d=Math.atan2,_=Math.sin,c=Math.cos;function getAsset(e){var t=g.assets,r="function"==typeof t?t(e):t[e];return"string"==typeof r?new Promise(function(t,n){var a=new Image;a.onload=function(){g.assets[e]=this,t(a)},a.onerror=function(){n(new Error("Missing asset: "+r))},a.src=r}):new InstantPromise(void 0,r)}function InstantPromise(e,t){this.lastResult=t,this.lastError=e}function FrameManager(){this.reset()}function getFrameManager(){return A||(A=new FrameManager),A}function MouseHandler(){var t=this;for(var r in this._target=getTarget(),this._managers={},this._handlers={mousedown:function(r){t.onEvent("mousedown",r)},mouseup:function(r){t.onEvent("mouseup",r)},mousemove:function(r){t.onEvent("mousemove",r)}},this._handlers)this._target.addEventListener(r,this._handlers[r])}function EventManager(e,t){this._type=e,this._target=t,this._handlers=void 0,getMouseHandler().addManager(e,this)}function Turtle(e){if(getFrameManager().addTurtle(this),this._screen=getScreen(),this._managers={},this._shape=e.v,!v.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=(g.worldWidth||g.width||getWidth())/2,t=(g.worldHeight||g.height||getHeight())/2,this.setUpWorld(-e,-t,e,t)}function ensureAnonymous(){return f||(f=Sk.misceval.callsimArray(y.Turtle)),f.instance}function getTarget(){return e}function getScreen(){return p||(p=new Screen),p}function getMouseHandler(){return h||(h=new MouseHandler),h}function getWidth(){return 0|(p&&p._width||g.width||getTarget().clientWidth||T.width)}function getHeight(){return 0|(p&&p._height||g.height||getTarget().clientHeight||T.height)}function createLayer(e,t){var r,n=document.createElement("canvas"),a=getWidth(),s=getHeight(),l=getTarget().firstChild?-s+"px":"0";return n.width=a,n.height=s,n.style.position="relative",n.style.display="block",n.style.setProperty("margin-top",l),n.style.setProperty("z-index",e),t&&(n.style.display="none"),getTarget().appendChild(n),r=n.getContext("2d"),r.lineCap="round",r.lineJoin="round",applyWorld(getScreen(),r),r}function cancelAnimationFrame(){u&&((window.cancelAnimationFrame||window.mozCancelAnimationFrame)(u),u=void 0),m&&(window.clearTimeout(m),m=void 0)}function applyWorld(e,t){var r=e.llx,n=e.lly,a=e.urx,s=e.ury,l=e.xScale,i=e.yScale;t&&(clearLayer(t),t.restore(),t.save(),t.scale(1/l,1/i),t.translate(-r,-s))}function pushUndo(e){var t,r,n;if(g.allowUndo&&e._bufferSize){for(e._undoBuffer||(e._undoBuffer=[]);e._undoBuffer.length>e._bufferSize;)e._undoBuffer.shift();for(r={},t=["x","y","angle","radians","color","fill","down","filling","shown","shape","size"],n=0;n<t.length;n++)r[t[n]]=e["_"+t[n]];return e._undoBuffer.push(r),e.addUpdate(function(){r.fillBuffer=this.fillBuffer?this.fillBuffer.slice():void 0,e._paper&&e._paper.canvas&&(r.image=e._paper.canvas.toDataURL())},!1)}}function popUndo(e){var t;if(e._bufferSize&&e._undoBuffer&&(t=e._undoBuffer.pop(),!!t)){for(var r in t)"image"!=r&&"fillBuffer"!==r&&(e["_"+r]=t[r]);return e.addUpdate(function(){var e;t.image&&(L.src=t.image,e=L),clearLayer(this.context(),!1,L),delete t.image},!0,t)}}function removeLayer(e){e&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas)}function clearLayer(e,t,r){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),r&&e.drawImage(r,0,0),e.restore())}function drawTurtle(e,t){var r,n,a,s=v[e.shape],l=getScreen(),u=getWidth(),m=getHeight(),p=l.xScale,g=l.yScale;if(t){if(r=c(e.radians)/p,n=_(e.radians)/g,a=d(n,r)-o/2,t.save(),t.translate(e.x,e.y),t.scale(p,g),s.nodeName){var f=s.naturalWidth,h=s.naturalHeight;t.drawImage(s,0,0,f,h,-f/2,-h/2,f,h)}else{t.rotate(a),t.beginPath(),t.lineWidth=1,t.strokeStyle=e.color,t.fillStyle=e.fill,t.moveTo(-s[0][0],s[0][1]);for(var $=1;$<s.length;$++)t.lineTo(-s[$][0],s[$][1]);t.closePath(),t.fill(),t.stroke()}t.restore()}}function drawDot(e,t){var r=this.context(),n=getScreen(),l=n.xScale,i=n.yScale;r&&(r.beginPath(),r.moveTo(this.x,this.y),e*=a(s(l),s(i)),r.arc(this.x,this.y,e/2,0,Turtle.RADIANS),r.closePath(),r.fillStyle=t||this.color,r.fill())}function measureText(e,t){return t&&(S.font=t),S.measureText(e).width}function drawText(e,t,r){var n=this.context();n&&(n.save(),r&&(n.font=r),t&&t.match(/^(left|right|center)$/)&&(n.textAlign=t),n.scale(1,-1),n.fillStyle=this.fill,n.fillText(e,this.x,-this.y),n.restore())}function drawLine(e,t){var r=this.context();r&&(t&&(r.beginPath(),r.moveTo(this.x,this.y)),r.lineWidth=this.size*getScreen().lineScale,r.strokeStyle=this.color,r.lineTo(e.x,e.y),r.stroke())}function drawFill(){var e,t=this.context(),r=this.fillBuffer;if(t&&r&&r.length){for(t.save(),t.beginPath(),t.moveTo(r[0].x,r[0].y),e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);for(t.closePath(),t.fillStyle=this.fill,t.fill(),e=1;e<r.length;e++)r[e].stroke&&(t.beginPath(),t.moveTo(r[e-1].x,r[e-1].y),t.lineWidth=r[e].size*getScreen().lineScale,t.strokeStyle=r[e].color,t.lineTo(r[e].x,r[e].y),t.stroke());t.restore()}}function partialTranslate(e,t,r,n,a){return function(){return e.addUpdate(function(e){this.down&&drawLine.call(this,e,n)},a,{x:t,y:r},n)}}function translate(e,a,l,o,d,_,c){var u,m=e._computed_speed,p=getScreen(),g=s(p.xScale),f=s(p.yScale),h=a,$=l,w=n(o*o*g+d*d*f),b=m?t(r(1,w/m)):1,v=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise;for(e.addUpdate(function(){this.filling&&this.fillBuffer.push({x:this.x,y:this.y,stroke:this.down,color:this.color,size:this.size})},!1),u=0;u<b;u++)h=a+o/b*(u+1),$=l+d/b*(u+1),v=v.then(partialTranslate(e,h,$,_,m||!c)),_=!1;return v.then(function(){return[a+o,l+d]})}function partialRotate(e,t,r,n){return function(){return e.addUpdate(void 0,n,{angle:t,radians:r})}}function rotate(e,n,a,l){var o,d=e._computed_speed,_=360*(a/e._fullCircle),c=d?t(r(1,s(_)/d)):1,u={},m=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise;for(o=0;o<c;o++)calculateHeading(e,n+a/c*(o+1),u),m=m.then(partialRotate(e,u.angle,u.radians,d||!l));return m.then(function(){return calculateHeading(e,n+a)})}function getCoordinates(e,t){return void 0===t&&(t=e&&(e.y||e._y||e[1])||0,e=e&&(e.x||e._x||e[0])||0),{x:e,y:t}}function hexToRGB(e){var t,r,n;return(t=/^rgba?\\((\\d+),(\\d+),(\\d+)(?:,([.\\d]+))?\\)$/.exec(e))?(n=[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])],t[4]&&n.push(parseFloat(t[4]))):/^#?[a-f\\d]{3}|[a-f\\d]{6}$/i.exec(e)?(4===e.length&&(e=e.replace(/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i,function(e,t,r,n){return t+t+r+r+n+n})),r=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e),n=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]):n=e,n}function createColor(e,t,n,s,l){var o;if(void 0!==n&&(t=[t,n,s,l]),t.constructor===Array&&t.length){if(255===e){for(o=0;3>o;o++)if("number"==typeof t[o])t[o]=r(0,a(255,parseInt(t[o])));else throw new Sk.builtin.ValueError("bad color sequence");}else for(o=0;3>o;o++)if("number"!=typeof t[o])throw new Sk.builtin.ValueError("bad color sequence");else if(1>=t[o])t[o]=r(0,a(255,parseInt(255*t[o])));else throw new Sk.builtin.ValueError("bad color sequence");"number"==typeof t[o]?(t[3]=r(0,a(1,t[o])),t="rgba("+t.join(",")+")"):t="rgb("+t.slice(0,3).join(",")+")"}else if("string"==typeof t&&!t.match(/\\s*url\\s*\\(/i))t=t.replace(/\\s+/g,"");else return"black";return t}function calculateHeading(e,t,r){var n=e._angle||0,a=e._radians||0;return r||(r={}),"number"==typeof t&&(e._isRadians?n=a=t%Turtle.RADIANS:e._fullCircle?(n=t%e._fullCircle,a=n/e._fullCircle*Turtle.RADIANS):n=a=0,0>n&&(n+=e._fullCircle,a+=Turtle.RADIANS)),r.angle=n,r.radians=a,r}function pythonToJavascriptFunction(e,t){return function(){var r=Array.prototype.slice.call(arguments),n=r.map(function(e){return Sk.ffi.remapToPy(e)});return"undefined"!=typeof t&&n.unshift(t),Sk.misceval.applyAsync(void 0,e,void 0,void 0,void 0,n).catch(Sk.uncaughtException)}}function addModuleMethod(e,t,r,n){var a,s=r.replace(/^\\$/,""),l=s.replace(/_\\$[a-z]+\\$$/i,""),o=e.prototype[r].length,d=e.prototype[r].minArgs,_=e.prototype[r].co_varnames||[],c=e.prototype[r].returnType,u=e.prototype[r].isSk;void 0===d&&(d=o),a=function(){var e,t,a,s,_,m=Array.prototype.slice.call(arguments,0),p=n?n():m.shift().instance;if(m.length<d||m.length>o)throw _=d===o?"exactly "+o:"between "+d+" and "+o,new Sk.builtin.TypeError(l+"() takes "+_+" positional argument(s) ("+m.length+" given)");for(e=m.length;0<=--e;)void 0!==m[e]&&(m[e]=m[e]instanceof Sk.builtin.func?pythonToJavascriptFunction(m[e]):m[e]instanceof Sk.builtin.method?pythonToJavascriptFunction(m[e].im_func,m[e].im_self):m[e]&&m[e].$d instanceof Sk.builtin.dict&&m[e].instance?m[e].instance:Sk.ffi.remapToJs(m[e]));var g=m.slice(0);for(m=[],e=g.length;0<=e;--e)null!==g[e]&&(m[e]=g[e]);try{t=p[r].apply(p,m)}catch(t){throw window&&window.console&&(window.console.log("wrapped method failed"),window.console.log(t.stack)),t}return t instanceof InstantPromise&&(t=t.lastResult),t instanceof Promise?(t=t.catch(function(t){throw window&&window.console&&(window.console.log("promise failed"),window.console.log(t.stack)),t}),a=new Sk.misceval.Suspension,a.resume=function(){return void 0===s?Sk.builtin.none.none$:Sk.ffi.remapToPy(s)},a.data={type:"Sk.promise",promise:t.then(function(e){return s=e,e})},a):void 0===t?Sk.builtin.none.none$:u?t:"function"==typeof c?c(t):Sk.ffi.remapToPy(t)},a.co_name=new Sk.builtin.str(l),a.co_varnames=_.slice(),a.$defaults=[];for(var m=d;m<_.length;m++)a.$defaults.push(Sk.builtin.none.none$);n||a.co_varnames.unshift("self"),t[s]=new Sk.builtin.func(a)}function initTurtle(e,t){Sk.builtin.pyCheckArgs("__init__",arguments,2,3,!1,!1),e.instance=new Turtle(t),e.instance.skInstance=e}function focusTurtle(e){return void 0!==e&&(w=!!e,w?getTarget().focus():getTarget().blur()),w}function resetTurtle(){for(cancelAnimationFrame(),getScreen().reset(),getFrameManager().reset();e.firstChild;)e.removeChild(e.firstChild);h&&h.reset(),$=0,p=void 0,f=void 0,h=void 0,k=0}function stopTurtle(){cancelAnimationFrame(),h&&h.reset(),$=0,p=void 0,f=void 0,h=void 0,k=0}var u,m,p,g,f,h,y={__name__:new Sk.builtin.str("turtle")},$=0,w=!0,b=1e3/30,v={},k=0,x={},T={target:"turtle",width:400,height:400,worldWidth:0,worldHeight:0,animate:!0,bufferSize:0,allowUndo:!0,assets:{}};e.hasAttribute("tabindex")||e.setAttribute("tabindex",0),x.FLOAT=function(e){return new Sk.builtin.float_(e)},x.COLOR=function(e){if("string"==typeof e)return new Sk.builtin.str(e);for(var t=0;3>t;t++)e[t]=Sk.builtin.assk$(e[t]);return 4===e.length&&(e[3]=new Sk.builtin.float_(e[3])),new Sk.builtin.tuple(e)},x.TURTLE_LIST=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].skInstance);return new Sk.builtin.tuple(t)},v.arrow=[[-10,0],[10,0],[0,10]],v.square=[[10,-10],[10,10],[-10,10],[-10,-10]],v.triangle=[[10,-5.77],[0,11.55],[-10,-5.77]],v.classic=[[0,0],[-5,-9],[0,-7],[5,-9]],v.turtle=[[0,16],[-2,14],[-1,10],[-4,7],[-7,9],[-9,8],[-6,5],[-7,1],[-5,-3],[-8,-6],[-6,-8],[-4,-5],[0,-7],[4,-5],[6,-8],[8,-6],[5,-3],[7,1],[6,5],[9,8],[7,9],[4,7],[1,10],[2,14]],v.circle=[[10,0],[9.51,3.09],[8.09,5.88],[5.88,8.09],[3.09,9.51],[0,10],[-3.09,9.51],[-5.88,8.09],[-8.09,5.88],[-9.51,3.09],[-10,0],[-9.51,-3.09],[-8.09,-5.88],[-5.88,-8.09],[-3.09,-9.51],[-0,-10],[3.09,-9.51],[5.88,-8.09],[8.09,-5.88],[9.51,-3.09]],g=function(){for(var e in Sk.TurtleGraphics||(Sk.TurtleGraphics={}),T)Sk.TurtleGraphics.hasOwnProperty(e)||(Sk.TurtleGraphics[e]=T[e]);return Sk.TurtleGraphics}(),InstantPromise.prototype.then=function(e){if(this.lastError)return this;try{this.lastResult=e(this.lastResult)}catch(t){this.lastResult=void 0,this.lastError=t}return this.lastResult instanceof Promise?this.lastResult:this},InstantPromise.prototype.catch=function(e){if(this.lastError)try{this.lastResult=e(this.lastError),this.lastError=void 0}catch(t){this.lastResult=void 0,this.lastError=t}return this.lastResult instanceof Promise?this.lastResult:this};var A;(function(e){function animationFrame(e){return g.animate?!e&&t?t:function(t){return m=window.setTimeout(t,e||b),m}:function(e){e()}}var t;(function(e){e&&(t=function(t){return u=e(t)})})(window.requestAnimationFrame||window.mozRequestAnimationFrame),e.willRenderNext=function(){return!!(this._buffer&&this._frameCount+1===this.frameBuffer())},e.turtles=function(){return this._turtles},e.addTurtle=function(e){this._turtles.push(e)},e.reset=function(){if(this._turtles)for(var e=this._turtles.length;0<=--e;)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){var r=!1;return t&&(this._frameCount+=1),this.frames().push(e),r=!g.animate||this._buffer&&this._frameCount===this.frameBuffer(),r?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,r=this._frames,n=this._animationFrame,a=this._turtles,s=getScreen().spriteLayer();return this._frames=[],this._frameCount=0,new Promise(function(l){n(function paint(){for(t=0;t<r.length;t++)r[t]&&r[t]();for(clearLayer(s),t=0;t<a.length;t++)e=a[t],e.getState().shown&&drawTurtle(e.getState(),s);l()})})}})(FrameManager.prototype),function(e){e.onEvent=function(t,r){function computeCoordinates(){if(!_){var t=getScreen(),l=t.spriteLayer().canvas.getBoundingClientRect();e=0|r.clientX-l.left,n=0|r.clientY-l.top,a=e*t.xScale+t.llx,s=n*t.yScale+t.ury,_=!0}}var e,n,a,s,l,o=this._managers[t],d=this._managers.mousemove,_=!1;if(("mousedown"===t||"mouseup"===t)&&d&&d.length)for(computeCoordinates(),l=d.length;0<=--l;)d[l].test(e,n,a,s)&&d[l].canMove("mousedown"===t);if(o&&o.length)for(computeCoordinates(),l=o.length;0<=--l;)"mousemove"===t&&o[l].canMove()&&o[l].test(e,n,a,s)?o[l].trigger([a,s]):"mousedown"===t&&o[l].test(e,n,a,s)&&o[l].trigger([a,s])},e.reset=function(){this._managers={}},e.addManager=function(e,t){this._managers[e]||(this._managers[e]=[]),this._managers[e].push(t)}}(MouseHandler.prototype),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,r,n){return this._target&&this._target.hitTest?this._target.hitTest(e,t,r,n):!!this._target},e.trigger=function(e){var t,r=this._handlers;if(r&&r.length)for(t=0;t<r.length;t++)r[t].apply({},e)},e.addHandler=function(e,t){var r=this._handlers;if(!t&&r&&r.length)for(;r.shift(););return"function"==typeof e?void(!r&&(r=this._handlers=[]),r.push(e)):void(r&&!r.length&&this.reset())}}(EventManager.prototype),Turtle.RADIANS=2*o,function(e){function circleRotate(e,t,r){return function(){return e.addUpdate(void 0,!1,{angle:t,radians:r})}}function circleSegment(e,t,r,n,a,s){return function(){return e.translate(t,r,n,a,s,!0)}}e.hitTest=function(e,t){var r=getScreen().hitTestLayer();clearLayer(r),drawTurtle(this.getState(),r);var n=r.getImageData(e,t,1,1).data;return n[3]||n[0]||n[1]||n[2]},e.addUpdate=function(e,t,r){var n=this,a=this.getState(),s=Array.prototype.slice.call(arguments,r?2:3);return getFrameManager().addFrame(function(){if(e&&e.apply(a,s),r)for(var t in r)a[t]=r[t]},t)},e.getState=function(){var e=this;return this._state||(this._state={x:this._x,y:this._y,angle:this._angle,radians:this._radians,shape:this._shape,color:this._color,fill:this._fill,filling:this._filling,size:this._size,speed:this._computed_speed,down:this._down,shown:this._shown,colorMode:this._colorMode,context:function(){return e.getPaper()}}),this._state},e.translate=function(e,t,r,n,a,s){var l=this;return translate(this,e,t,r,n,a,s).then(function(e){l._x=e[0],l._y=e[1]})},e.rotate=function(e,t,r){var n=this;return rotate(this,e,t,r).then(function(e){n._angle=e.angle,n._radians=e.radians})},e.queueMoveBy=function(e,t,r,n){var a=c(r)*n,s=_(r)*n;return this.translate(e,t,a,s,!0)},e.queueTurnTo=function(e,t){return t%=this._fullCircle,0>t&&(t+=this._fullCircle),this.rotate(e,t-e)},e.getManager=function(e){return this._managers[e]||(this._managers[e]=new EventManager(e,this)),this._managers[e]},e.getPaper=function(){return this._paper||(this._paper=createLayer(2))},e.reset=function(){for(var e in this._x=0,this._y=0,this._radians=0,this._angle=0,this._shown=!0,this._down=!0,this._color="black",this._fill="black",this._size=1,this._filling=!1,this._undoBuffer=[],this._speed=3,this._computed_speed=5,this._colorMode=1,this._state=void 0,this._managers)this._managers[e].reset();this._isRadians=!1,this._fullCircle=360,this._bufferSize="number"==typeof g.bufferSize?g.bufferSize:0,removeLayer(this._paper),this._paper=void 0},e.$degrees=function(e){return e="number"==typeof e?s(e):360,this._isRadians=!1,this._angle=e&&this._fullCircle?this._angle/this._fullCircle*e:this._radians=0,this._fullCircle=e,this.addUpdate(void 0,!1,{angle:this._angle,radians:this._radians})},e.$degrees.minArgs=0,e.$degrees.co_varnames=["fullcircle"],e.$degrees.returnType=x.FLOAT,e.$radians=function(){return this._isRadians||(this._isRadians=!0,this._angle=this._radians,this._fullCircle=Turtle.RADIANS),this._angle},e.$radians.returnType=x.FLOAT,e.$position=e.$pos=function(){return[this.$xcor(),this.$ycor()]},e.$position.returnType=function(e){return new Sk.builtin.tuple([new Sk.builtin.float_(e[0]),new Sk.builtin.float_(e[1])])},e.$towards=function(e,t){var r=getCoordinates(e,t),n=o+d(this._y-r.y,this._x-r.x),a=n*(this._fullCircle/Turtle.RADIANS);return a},e.$towards.co_varnames=["x","y"],e.$towards.minArgs=1,e.$towards.returnType=x.FLOAT,e.$distance=function(e,t){var r=getCoordinates(e,t),a=r.x-this._x,s=r.y-this._y;return n(a*a+s*s)},e.$distance.co_varnames=["x","y"],e.$distance.minArgs=1,e.$distance.returnType=x.FLOAT,e.$heading=function(){return 1e-13>s(this._angle)?0:this._angle},e.$heading.returnType=x.FLOAT,e.$xcor=function(){return 1e-13>s(this._x)?0:this._x},e.$xcor.returnType=x.FLOAT,e.$ycor=function(){return 1e-13>s(this._y)?0:this._y},e.$ycor.returnType=x.FLOAT,e.$forward=e.$fd=function(e){return pushUndo(this),this.queueMoveBy(this._x,this._y,this._radians,e)},e.$forward.co_varnames=e.$fd.co_varnames=["distance"],e.$undo=function(){popUndo(this)},e.$undobufferentries=function(){return this._undoBuffer.length},e.$setundobuffer=function(e){this._bufferSize="number"==typeof e?a(s(e),1e3):0},e.$setundobuffer.co_varnames=["size"],e.$backward=e.$back=e.$bk=function(e){return pushUndo(this),this.queueMoveBy(this._x,this._y,this._radians,-e)},e.$backward.co_varnames=e.$back.co_varnames=e.$bk.co_varnames=["distance"],e.$goto_$rw$=e.$setpos=e.$setposition=function(e,t){var r=getCoordinates(e,t);return pushUndo(this),this.translate(this._x,this._y,r.x-this._x,r.y-this._y,!0)},e.$goto_$rw$.co_varnames=e.$setpos.co_varnames=e.$setposition.co_varnames=["x","y"],e.$goto_$rw$.minArgs=e.$setpos.minArgs=e.$setposition.minArgs=1,e.$setx=function(e){return this.translate(this._x,this._y,e-this._x,0,!0)},e.$setx.co_varnames=["x"],e.$sety=function(e){return this.translate(this._x,this._y,0,e-this._y,!0)},e.$sety.co_varnames=["y"],e.$home=function(){var e=this,t=this._angle;return pushUndo(this),e.translate(this._x,this._y,-this._x,-this._y,!0).then(function(){return e.queueTurnTo(t,0)}).then(function(){})},e.$right=e.$rt=function(e){return pushUndo(this),this.rotate(this._angle,-e)},e.$right.co_varnames=e.$rt.co_varnames=["angle"],e.$left=e.$lt=function(e){return pushUndo(this),this.rotate(this._angle,e)},e.$left.co_varnames=e.$lt.co_varnames=["angle"],e.$setheading=e.$seth=function(e){return pushUndo(this),this.queueTurnTo(this._angle,e)},e.$setheading.co_varnames=e.$seth.co_varnames=["angle"],e.$circle=function(e,t,r){var n,d,u,m,p,g,f,h,$,b=this,v=this._x,k=this._y,T=this._angle,A={},L=1/getScreen().lineScale,S=!0;for(pushUndo(this),void 0===t&&(t=b._fullCircle),void 0===r&&(d=s(t)/b._fullCircle,r=1+(0|a(11+s(e*L)/6,59)*d)),u=t/r,m=.5*u,p=2*e*_(u*o/b._fullCircle),0>e?(p=-p,u=-u,m=-m,n=T-t):n=T+t,$=getFrameManager().willRenderNext()?Promise.resolve():new InstantPromise,T+=m,g=0;g<r;g++)calculateHeading(b,T+u*g,A),f=c(A.radians)*p,h=_(A.radians)*p,$=$.then(circleRotate(b,A.angle,A.radians)).then(circleSegment(b,v,k,f,h,S)),v+=f,k+=h,S=!1;return $=$.then(function(){return calculateHeading(b,n,A),b._angle=A.angle,b._radians=A.radians,b.addUpdate(void 0,!0,A)}),$},e.$circle.co_varnames=["radius","extent","steps"],e.$circle.minArgs=1,e.$penup=e.$up=e.$pu=function(){return this._down=!1,this.addUpdate(void 0,!1,{down:!1})},e.$pendown=e.$down=e.$pd=function(){return this._down=!0,this.addUpdate(void 0,!1,{down:!0})},e.$isdown=function(){return this._down},e.$speed=function(e){return void 0===e?this._speed:(this._speed=r(0,a(1e3,e)),this._computed_speed=r(0,2*e-1),this.addUpdate(void 0,!1,{speed:this._computed_speed}))},e.$speed.minArgs=0,e.$speed.co_varnames=["speed"],e.$pencolor=function(e,t,r,n){return void 0===e?hexToRGB(this._color):(this._color=createColor(this._colorMode,e,t,r,n),this.addUpdate(void 0,this._shown,{color:this._color}))},e.$pencolor.co_varnames=["r","g","b","a"],e.$pencolor.minArgs=0,e.$pencolor.returnType=x.COLOR,e.$fillcolor=function(e,t,r,n){return void 0===e?hexToRGB(this._fill):(this._fill=createColor(this._colorMode,e,t,r,n),this.addUpdate(void 0,this._shown,{fill:this._fill}))},e.$fillcolor.co_varnames=["r","g","b","a"],e.$fillcolor.minArgs=0,e.$fillcolor.returnType=x.COLOR,e.$color=function(e,t,r,n){return void 0===e?[this.$pencolor(),this.$fillcolor()]:(void 0===t||void 0!==r?(this._color=createColor(this._colorMode,e,t,r,n),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}))},e.$color.minArgs=0,e.$color.co_varnames=["color","fill","b","a"],e.$color.returnType=function(e){return new Sk.builtin.tuple([x.COLOR(e[0]),x.COLOR(e[1])])},e.$fill=function(e){this;return void 0===e?this._filling:(e=!!e,e===this._filling)?void 0:(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})))},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,l,i){return pushUndo(this),e=Sk.builtin.asnum$(e),e="number"==typeof e?r(1,0|s(e)):r(this._size+4,2*this._size),t=void 0===t?this._color:createColor(this._colorMode,t,n,l,i),this.addUpdate(drawDot,!0,void 0,e,t)},e.$dot.co_varnames=["size","color","g","b","a"],e.$write=function(e,t,r,n){var a,s,l,i,o,d=this;return pushUndo(this),e+="",n&&n.constructor===Array&&(s="string"==typeof n[0]?n[0]:"Arial",l=(n[1]||"12pt")+"",i="string"==typeof n[2]?n[2]:"normal",/^\\d+$/.test(l)&&(l+="pt"),n=[i,l,s].join(" ")),r||(r="left"),a=this.addUpdate(drawText,!0,void 0,e,r,n),t&&("left"===r||"center"===r)&&(o=measureText(e,n),"center"===r&&(o/=2),a=a.then(function(){var e=d.getState();return d.translate(e.x,e.y,o,0,!0)})),a},e.$write.co_varnames=["message","move","align","font"],e.$write.minArgs=1,e.$pensize=e.$width=function(e){return void 0===e?this._size:(this._size=e,this.addUpdate(void 0,this._shown,{size:e}))},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&&v[e]?(this._shape=e,this.addUpdate(void 0,this._shown,{shape:e})):this._shape},e.$shape.minArgs=0,e.$shape.co_varnames=["name"],e.$colormode=function(e){return void 0===e?this._colorMode:(this._colorMode=255===e?255:1,this.addUpdate(void 0,this._shown,{colorMode:this._colorMode}))},e.$colormode.minArgs=0,e.$colormode.co_varnames=["cmode"],e.$colormode.returnType=function(e){return 255===e?new Sk.builtin.int_(255):new Sk.builtin.float_(1)},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,r){this.getManager("mousedown").addHandler(e,r)},e.$onclick.minArgs=1,e.$onclick.co_varnames=["method","btn","add"],e.$onrelease=function(e,t,r){this.getManager("mouseup").addHandler(e,r)},e.$onrelease.minArgs=1,e.$onrelease.co_varnames=["method","btn","add"],e.$ondrag=function(e,t,r){this.getManager("mousemove").addHandler(e,r)},e.$ondrag.minArgs=1,e.$ondrag.co_varnames=["method","btn","add"],e.$getscreen=function(){return Sk.misceval.callsimArray(y.Screen)},e.$getscreen.isSk=!0,e.$clone=function(){var e=Sk.misceval.callsimOrSuspendArray(y.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(){for(var 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,r,n){var l=this;l.llx=e,l.lly=t,l.urx=r,l.ury=n,l.xScale=(r-e)/getWidth(),l.yScale=-1*(n-t)/getHeight(),l.lineScale=a(s(l.xScale),s(l.yScale))},e.$setup=function(e,t,r,n){return isNaN(parseFloat(e))&&(e=getWidth()),isNaN(parseFloat(t))&&(t=getHeight()),1>=e&&(e=getWidth()*e),1>=t&&(t=getHeight()*t),this._width=e,this._height=t,this._xOffset=void 0===r||isNaN(parseInt(r))?0:parseInt(r),this._yOffset=void 0===n||isNaN(parseInt(n))?0:parseInt(n),"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){return t?void(v[e]=t):getAsset(e).then(function(t){v[e]=t})},e.$register_shape.minArgs=1,e.$getshapes=function(){return Object.keys(v)},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?void 0===this._delay?b:this._delay:this.$tracer(void 0,e)},e.$delay.co_varnames=["delay"],e._setworldcoordinates=function(e,t,r,n){var a=this,s=getFrameManager().turtles();return this.setUpWorld(e,t,r,n),this._sprites&&applyWorld(this,this._sprites),this._background&&applyWorld(this,this._background),this.$clear()},e.$setworldcoordinates=function(e,t,r,n){return this._mode="world",this._setworldcoordinates(e,t,r,n)},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 r=0;r<t.length;r++)t[r].reset(),applyWorld(e,t[r]._paper)},!0)},e.$window_width=function(){return getWidth()},e.$window_height=function(){return getHeight()},e.$delay.minArgs=0,e.$turtles=function(){return getFrameManager().turtles()},e.$turtles.returnType=x.TURTLE_LIST,e.$bgpic=function(e){var t;return e?(t=this,getAsset(e).then(function(e){clearLayer(t.bgLayer(),void 0,e)})):this._bgpic},e.$bgpic.minArgs=0,e.$bgpic.co_varnames=["name"],e.$bgcolor=function(e,t,r,n){return void 0===e?hexToRGB(this._bgcolor):(this._bgcolor=createColor(this._colorMode,e,t,r,n),void clearLayer(this.bgLayer(),this._bgcolor))},e.$bgcolor.minArgs=0,e.$bgcolor.co_varnames=["color","g","b","a"],e.$bgcolor.returnType=x.COLOR,e.$mainloop=e.$done=function(){},e.$bye=function(){return Sk.TurtleGraphics.reset()},e.$exitonclick=function(){return this._exitOnClick=!0,this.getManager("mousedown").addHandler(function(){resetTurtle()},!1)},e.$onclick=function(e,t,r){this._exitOnClick||this.getManager("mousedown").addHandler(e,r)},e.$onclick.minArgs=1,e.$onclick.co_varnames=["method","btn","add"];var t={8:/^back(space)?$/i,9:/^tab$/i,13:/^(enter|return)$/i,16:/^shift$/i,17:/^(ctrl|control)$/i,18:/^alt$/i,27:/^esc(ape)?$/i,32:/^space$/i,33:/^page[\\s\\-]?up$/i,34:/^page[\\s\\-]?down$/i,35:/^end$/i,36:/^home$/i,37:/^left([\\s\\-]?arrow)?$/i,38:/^up([\\s\\-]?arrow)?$/i,39:/^right([\\s\\-]?arrow)?$/i,40:/^down([\\s\\-]?arrow)?$/i,45:/^insert$/i,46:/^del(ete)?$/i};e._createKeyRepeater=function(e,t){var r=this;r._keyLogger[t]=window.setTimeout(function(){r._keyListeners[e](),r._keyLogger[t]=window.setInterval(function(){r._keyListeners[e]()},50)},333)},e._createKeyDownListener=function(){var r=this;this._keyDownListener||(this._keyDownListener=function(n){var e=String.fromCharCode;if(focusTurtle()){var a,s,l=n.charCode||n.keyCode,i=e(l).toLowerCase();if(!r._keyLogger[l])for(a in r._keyListeners)if(s=1<a.length&&t[l]&&t[l].test(a),a===i||s){r._keyListeners[a](),r._createKeyRepeater(a,l),n.preventDefault();break}}},getTarget().addEventListener("keydown",this._keyDownListener))},e._createKeyUpListener=function(){var t=this;this._keyUpListener||(this._keyUpListener=function(r){var e=t._keyLogger[r.charCode||r.keyCode];void 0!==e&&(r.preventDefault(),window.clearInterval(e),window.clearTimeout(e),delete t._keyLogger[r.charCode||r.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 r=e;e=t,t=r}t=(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,r){this.getManager("mousedown").addHandler(e,r)},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,r(0,0|t)))},e.$ontimer.minArgs=0,e.$ontimer.co_varnames=["method","interval"]}(Screen.prototype);var L=new Image,S=document.createElement("canvas").getContext("2d");for(var C in initTurtle.co_varnames=["self","shape"],initTurtle.co_name=new Sk.builtin.str("Turtle"),initTurtle.co_argcount=2,initTurtle.$defaults=[Sk.builtin.none.none$,new Sk.builtin.str("classic")],Turtle.prototype)/^\\$[a-z_]+/.test(C)&&addModuleMethod(Turtle,y,C,ensureAnonymous);return addModuleMethod(Screen,y,"$mainloop",getScreen),addModuleMethod(Screen,y,"$done",getScreen),addModuleMethod(Screen,y,"$bye",getScreen),addModuleMethod(Screen,y,"$tracer",getScreen),addModuleMethod(Screen,y,"$update",getScreen),addModuleMethod(Screen,y,"$delay",getScreen),addModuleMethod(Screen,y,"$window_width",getScreen),addModuleMethod(Screen,y,"$window_height",getScreen),addModuleMethod(Screen,y,"$title",getScreen),y.Turtle=Sk.misceval.buildClass(y,function TurtleWrapper(e,t){for(var r in t.__init__=new Sk.builtin.func(initTurtle),Turtle.prototype)/^\\$[a-z_]+/.test(r)&&addModuleMethod(Turtle,t,r)},"Turtle",[]),y.Screen=Sk.misceval.buildClass(y,function ScreenWrapper(e,t){for(var r in t.__init__=new Sk.builtin.func(function(e){e.instance=getScreen()}),Screen.prototype)/^\\$[a-z_]+/.test(r)&&addModuleMethod(Screen,t,r)},"Screen",[]),{skModule:y,reset:resetTurtle,stop:stopTurtle,focus:focusTurtle,Turtle:Turtle,Screen:Screen}}(e),Sk.TurtleGraphics.module=e.turtleInstance.skModule,Sk.TurtleGraphics.reset=e.turtleInstance.reset,Sk.TurtleGraphics.stop=e.turtleInstance.stop,Sk.TurtleGraphics.focus=e.turtleInstance.focus,Sk.TurtleGraphics.raw={Turtle:e.turtleInstance.Turtle,Screen:e.turtleInstance.Screen},e.turtleInstance.skModule};',"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\n# EllipsisType = 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',"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 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 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/urllib/__init__.js":"var $builtinmodule=function(){return{}};","src/lib/urllib/request/__init__.js":'var $builtinmodule=function(){var a={};return a.Response=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.data$=b.responseText,a.lineList=a.data$.split("\\n"),a.lineList=a.lineList.slice(0,-1);for(var c=0;c<a.lineList.length;c++)a.lineList[c]+="\\n";a.currentLine=0,a.pos$=0}),b.__str__=new Sk.builtin.func(function(){return Sk.ffi.remapToPy("<Response>")}),b.__iter__=new Sk.builtin.func(function(a){var b=a.lineList;return Sk.builtin.makeGenerator(function(){return this.$index>=this.$lines.length?void 0:new Sk.builtin.str(this.$lines[this.$index++])},{$obj:a,$index:0,$lines:b})}),b.read=new Sk.builtin.func(function(a,b){if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var c=a.data$.length;void 0===b&&(b=c);var d=new Sk.builtin.str(a.data$.substr(a.pos$,b));return a.pos$+=b,a.pos$>=c&&(a.pos$=c),d}),b.readline=new Sk.builtin.func(function(a){var b="";return a.currentLine<a.lineList.length&&(b=a.lineList[a.currentLine],a.currentLine++),new Sk.builtin.str(b)}),b.readlines=new Sk.builtin.func(function(a){for(var b=[],c=a.currentLine;c<a.lineList.length;c++)b.push(new Sk.builtin.str(a.lineList[c]));return new Sk.builtin.list(b)})},"Response",[]),a.urlopen=new Sk.builtin.func(function(b,c){var d=new Promise(function(d){var e=new XMLHttpRequest;e.addEventListener("loadend",function(){d(Sk.misceval.callsimArray(a.Response,[e]))}),c?(e.open("POST",b.v),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.setRequestHeader("Content-length",c.v.length),e.send(c.v)):(e.open("GET",b.v),e.send(null))}),e=new Sk.misceval.Suspension;return e.resume=function(){return resolution},e.data={type:"Sk.promise",promise:d.then(function(a){return resolution=a,a},function(a){return resolution="",a})},e}),a};',"src/lib/urllib2.py":'raise NotImplementedError("urllib2 is not yet implemented in Skulpt")\n',"src/lib/urlparse.py":'raise NotImplementedError("urlparse is not yet implemented in Skulpt")\n',"src/lib/user.py":'raise NotImplementedError("user is not yet implemented in Skulpt")\n',"src/lib/uu.py":'raise NotImplementedError("uu is not yet implemented in Skulpt")\n',"src/lib/uuid.py":'raise NotImplementedError("uuid is not yet implemented in Skulpt")\n',"src/lib/warnings.py":'raise NotImplementedError("warnings is not yet implemented in Skulpt")\n',"src/lib/wave.py":'raise NotImplementedError("wave is not yet implemented in Skulpt")\n',"src/lib/weakref.py":'raise NotImplementedError("weakref is not yet implemented in Skulpt")\n',"src/lib/webbrowser.js":'var $builtinmodule=function(){function open_tab(a){return(Sk.builtin.pyCheckType("url","string",Sk.builtin.checkString(a)),!b)?Sk.builtin.bool.false$:(a=a.$jsstr(),window.open(a,"_blank"),Sk.builtin.bool.true$)}var a={},b="undefined"!=typeof window&&"undefined"!=typeof window.navigator;return a.__name__=new Sk.builtin.str("webbrowser"),a.open=new Sk.builtin.func(function open(a){return Sk.builtin.pyCheckArgsLen("open",arguments.length+1,1,3),open_tab(a)}),a.open_new=new Sk.builtin.func(function open_new(a){return Sk.builtin.pyCheckArgsLen("open_new",arguments.length,1,1),open_tab(a)}),a.open_new_tab=new Sk.builtin.func(function open_new_tab(a){return Sk.builtin.pyCheckArgsLen("open_new_tab",arguments.length,1,1),open_tab(a)}),a.DefaultBrowser=Sk.misceval.buildClass(a,function dflbrowser(a,b){b.__init__=new Sk.builtin.func(function __init__(){return Sk.builtin.none.none$}),b.open=new Sk.builtin.func(function open(a,b){return Sk.builtin.pyCheckArgsLen("open",arguments.length,2,4),open_tab(b)}),b.open_new=new Sk.builtin.func(function open_new(a,b){return Sk.builtin.pyCheckArgsLen("open_new",arguments.length,2,2),open_tab(b)}),b.open_new_tab=new Sk.builtin.func(function open_new_tab(a,b){return Sk.builtin.pyCheckArgsLen("open_new_tab",arguments.length,2,2),open_tab(b)})},"DefaultBrowser",[]),a.get=new Sk.builtin.func(function get(){return Sk.builtin.pyCheckArgsLen("get",arguments.length,0,1),Sk.misceval.callsimArray(a.DefaultBrowser,[])}),a};',"src/lib/webbrowser.py":'raise NotImplementedError("webbrowser is not yet implemented in Skulpt")\n',"src/lib/webgl/__init__.js":'var $builtinmodule=function(){var a={__name__:new Sk.builtin.str("webgl")},c=function(a){return"<table style=\\"background-color: #8CE; width: 100%; height: 100%;\\"><tr><td align=\\"center\\"><div style=\\"display: table-cell; vertical-align: middle;\\"><div style=\\"\\">"+a+"</div></div></td></tr></table>"},d="This page requires a browser that supports WebGL.<br/><a href=\\"http://get.webgl.org\\">Click here to upgrade your browser.</a>",e=function(a){for(var b=["webgl","experimental-webgl","webkit-3d","moz-webgl"],c=null,d=0;d<b.length;++d){try{c=a.getContext(b[d])}catch(a){}if(c)break}if(c){function returnFalse(){return!1}a.onselectstart=returnFalse,a.onmousedown=returnFalse}return c},f=function(a,f){var g=document.getElementById(a);if(f||(f=g.getElementsByTagName("canvas")[0]),!f)return void(g.innerHTML=c(d));var h=e(f);if(!h){var i=navigator.userAgent.match(/(\\w+\\/.*? )/g),j={};try{for(var k=0;k<i.length;++k){for(var l=i[k].match(/(\\w+)/g),m=[],n=1;n<l.length;++n)m.push(parseInt(l[n]));j[l[0]]=m}}catch(a){}g.innerHTML=j.Chrome&&(7<j.Chrome[0]||7==j.Chrome[0]&&0<j.Chrome[1]||7==j.Chrome[0]&&0==j.Chrome[1]&&521<=j.Chrome[2])?c("It doesn\'t appear your computer can support WebGL.<br/><a href=\\"http://get.webgl.org\\">Click here for more information.</a>"):c(d)}return h};return a.Context=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){var c=document.getElementById(b.v),d=f(b.v,c);if(!d)throw new Error("Your browser does not appear to support WebGL.");for(var e in a.gl=d,d.__proto__)if("number"==typeof d.__proto__[e])Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(e),d.__proto__[e]);else if("function"==typeof d.__proto__[e])switch(e){case"bufferData":break;case"clearColor":break;case"drawArrays":break;case"getAttribLocation":break;case"getUniformLocation":break;case"shaderSource":break;case"uniformMatrix4fv":break;case"vertexAttribPointer":break;case"viewport":break;default:(function(b){Sk.abstr.objectSetItem(a.$d,new Sk.builtin.str(e),new Sk.builtin.func(function(){var a=d.__proto__[b];return a.apply(d,arguments)}))})(e);}d.clearColor(100/255,149/255,237/255,1),d.clear(d.COLOR_BUFFER_BIT)}),b.tp$getattr=Sk.generic.getAttr,b.bufferData=new Sk.builtin.func(function(a,b,c,d){a.gl.bufferData(b,c.v,d)}),b.clearColor=new Sk.builtin.func(function(a,b,c,d,e){a.gl.clearColor(Sk.builtin.asnum$(b),Sk.builtin.asnum$(c),Sk.builtin.asnum$(d),Sk.builtin.asnum$(e))}),b.getAttribLocation=new Sk.builtin.func(function(a,b,c){return a.gl.getAttribLocation(b,c.v)}),b.getUniformLocation=new Sk.builtin.func(function(a,b,c){return a.gl.getUniformLocation(b,c.v)}),b.shaderSource=new Sk.builtin.func(function(a,b,c){a.gl.shaderSource(b,c.v)}),b.drawArrays=new Sk.builtin.func(function(a,b,c,d){a.gl.drawArrays(Sk.builtin.asnum$(b),Sk.builtin.asnum$(c),Sk.builtin.asnum$(d))}),b.vertexAttribPointer=new Sk.builtin.func(function(a,b,c,d,e,f,g){a.gl.vertexAttribPointer(b,Sk.builtin.asnum$(c),Sk.builtin.asnum$(d),e,Sk.builtin.asnum$(f),Sk.builtin.asnum$(g))}),b.viewport=new Sk.builtin.func(function(a,b,c,d,e){a.gl.viewport(Sk.builtin.asnum$(b),Sk.builtin.asnum$(c),Sk.builtin.asnum$(d),Sk.builtin.asnum$(e))}),b.uniformMatrix4fv=new Sk.builtin.func(function(a,b,c,d){a.gl.uniformMatrix4fv(Sk.builtin.asnum$(b),c,d.v)}),b.setDrawFunc=new Sk.builtin.func(function(a,b){var c=new Date().getTime(),d=setInterval(function(){Sk.misceval.callsimArray(b,[a,new Date().getTime()-c])},1e3/60)})},"Context",[]),a.Float32Array=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v="number"==typeof b?new Float32Array(b):new Float32Array(Sk.ffi.remapToJs(b))}),b.__repr__=new Sk.builtin.func(function(a){for(var b=[],c=0;c<a.v.length;++c)b.push(a.v[c]);return new Sk.builtin.str("["+b.join(", ")+"]")})},"Float32Array",[]),a.Matrix4x4=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a,b){a.v=new Float32Array(Sk.ffi.remapToJs(b))}),b.identity=new Sk.builtin.func(function(a){var b=a.v;b[0]=1,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=1,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=1,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1}),b.perspective=new Sk.builtin.func(function(b,c,d,e,g){var h=Math.tan,i=Math.PI,j=h(.5*i-.5*(Sk.builtin.asnum$(c)*i/180)),l=Sk.builtin.asnum$(d),a=Sk.builtin.asnum$(e),n=Sk.builtin.asnum$(g),f=1/(a-n),k=b.v;k[0]=j/l,k[1]=0,k[2]=0,k[3]=0,k[4]=0,k[5]=j,k[6]=0,k[7]=0,k[8]=0,k[9]=0,k[10]=(a+n)*f,k[11]=-1,k[12]=0,k[13]=0,k[14]=2*(a*n*f),k[15]=0}),b.translate=new Sk.builtin.func(function(a,b){var c=a.v,d=Sk.ffi.remapToJs(b);c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=d[0],c[13]=d[1],c[14]=d[2],c[15]=1}),b.__repr__=new Sk.builtin.func(function(a){for(var b=[],c=0;c<a.v.length;++c)b.push(a.v[c]);return new Sk.builtin.str("["+b.join(", ")+"]")})},"Matrix4x4",[]),a};',"src/lib/webgl/math.js":'var $builtinmodule=function(){var a={};return a.Mat44=Sk.misceval.buildClass(a,function(b,c){var d=Math.sqrt;c.__init__=new Sk.builtin.func(function(a){Sk.misceval.callsimArray(c.loadIdentity,[a]),a.stack=[]}),c.push=new Sk.builtin.func(function(a){a.stack.push(a.elements.slice(0))}),c.pop=new Sk.builtin.func(function(a){a.elements=a.stack.pop()}),c.loadIdentity=new Sk.builtin.func(function(a){a.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}),c.transform3=new Sk.builtin.func(function(b,c){var d=b.elements;return Sk.misceval.callsimArray(a.Vec3,[d[0]*c.x+d[4]*c.y+d[8]*c.z,d[1]*c.x+d[5]*c.y+d[9]*c.z,d[2]*c.x+d[6]*c.y+d[10]*c.z])}),c.scale=new Sk.builtin.func(function(a,b,c,d){return a.elements[0]*=b,a.elements[1]*=b,a.elements[2]*=b,a.elements[3]*=b,a.elements[4]*=c,a.elements[5]*=c,a.elements[6]*=c,a.elements[7]*=c,a.elements[8]*=d,a.elements[9]*=d,a.elements[10]*=d,a.elements[11]*=d,a}),c.translate=new Sk.builtin.func(function(a,b,c,d){return a.elements[12]+=a.elements[0]*b+a.elements[4]*c+a.elements[8]*d,a.elements[13]+=a.elements[1]*b+a.elements[5]*c+a.elements[9]*d,a.elements[14]+=a.elements[2]*b+a.elements[6]*c+a.elements[10]*d,a.elements[15]+=a.elements[3]*b+a.elements[7]*c+a.elements[11]*d,a}),c.rotate=new Sk.builtin.func(function(b,c,e,f,g){var h=Math.cos,i=Math.sin,j=Math.PI,k=d(e*e+f*f+g*g),l=i(c*j/180),m=h(c*j/180);if(0<k){var n,o,p,q,r,s,t,u,v,w,A;e/=k,f/=k,g/=k,n=e*e,o=f*f,p=g*g,q=e*f,r=f*g,s=g*e,t=e*l,u=f*l,v=g*l,w=1-m,A=Sk.misceval.callsimArray(a.Mat44),A.elements[0]=w*n+m,A.elements[1]=w*q-v,A.elements[2]=w*s+u,A.elements[3]=0,A.elements[4]=w*q+v,A.elements[5]=w*o+m,A.elements[6]=w*r-t,A.elements[7]=0,A.elements[8]=w*s-u,A.elements[9]=w*r+t,A.elements[10]=w*p+m,A.elements[11]=0,A.elements[12]=0,A.elements[13]=0,A.elements[14]=0,A.elements[15]=1,A=A.multiply(b),b.elements=A.elements}return b}),c.multiply=new Sk.builtin.func(function(b,c){for(var d=Sk.misceval.callsimArray(a.Mat44),e=0;4>e;e++)d.elements[4*e+0]=b.elements[4*e+0]*c.elements[0]+b.elements[4*e+1]*c.elements[4]+b.elements[4*e+2]*c.elements[8]+b.elements[4*e+3]*c.elements[12],d.elements[4*e+1]=b.elements[4*e+0]*c.elements[1]+b.elements[4*e+1]*c.elements[5]+b.elements[4*e+2]*c.elements[9]+b.elements[4*e+3]*c.elements[13],d.elements[4*e+2]=b.elements[4*e+0]*c.elements[2]+b.elements[4*e+1]*c.elements[6]+b.elements[4*e+2]*c.elements[10]+b.elements[4*e+3]*c.elements[14],d.elements[4*e+3]=b.elements[4*e+0]*c.elements[3]+b.elements[4*e+1]*c.elements[7]+b.elements[4*e+2]*c.elements[11]+b.elements[4*e+3]*c.elements[15];return b.elements=d.elements,b}),c.lookAt=new Sk.builtin.func(function(b,c,e,f,g,h,i,j,k,l){var m=[c-g,e-h,f-i],n=d(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]);n&&(m[0]/=n,m[1]/=n,m[2]/=n);var o=[j,k,l],p=[];p[0]=o[1]*m[2]-o[2]*m[1],p[1]=-o[0]*m[2]+o[2]*m[0],p[2]=o[0]*m[1]-o[1]*m[0],o[0]=m[1]*p[2]-m[2]*p[1],o[1]=-m[0]*p[2]+m[2]*p[0],o[2]=m[0]*p[1]-m[1]*p[0],n=d(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),n&&(p[0]/=n,p[1]/=n,p[2]/=n),n=d(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]),n&&(o[0]/=n,o[1]/=n,o[2]/=n);var q=Sk.misceval.callsimArray(a.Mat44);return q.elements[0]=p[0],q.elements[4]=p[1],q.elements[8]=p[2],q.elements[12]=0,q.elements[1]=o[0],q.elements[5]=o[1],q.elements[9]=o[2],q.elements[13]=0,q.elements[2]=m[0],q.elements[6]=m[1],q.elements[10]=m[2],q.elements[14]=0,q.elements[3]=0,q.elements[7]=0,q.elements[11]=0,q.elements[15]=1,q=q.multiply(b),b.elements=q.elements,b.translate(-c,-e,-f),b})},"Mat44",[]),a.Mat33=Sk.misceval.buildClass(a,function(a,b){b.__init__=new Sk.builtin.func(function(a){Sk.misceval.callsimArray(b.loadIdentity,[a])}),b.loadIdentity=new Sk.builtin.func(function(a){a.elements=[1,0,0,0,1,0,0,0,1]})},"Mat33",[]),a.Vec3=Sk.misceval.buildClass(a,function(b,c){c.__init__=new Sk.builtin.func(function(a,b,c,d){a.x=b,a.y=c,a.z=d}),c.__sub__=new Sk.builtin.func(function(b,c){return Sk.misceval.callsimArray(a.Vec3,[b.x-c.x,b.y-c.y,b.z-c.z])})},"Vec3",[]),a.cross=new Sk.builtin.func(function(b,c){return Sk.asserts.assert(b instanceof a.Vec3&&c instanceof a.Vec3),Sk.misceval.callsimArray(a.Vec3,[b.y*c.z-b.z*c.y,b.z*c.x-b.x*c.z,b.x*c.y-b.y*c.x])}),a};',"src/lib/webgl/matrix4.js":"var $builtinmodule=function(){var a=Math.PI,b={},c=new Float32Array(3),d=new Float32Array(3),e=new Float32Array(3),f=new Float32Array(4),g=new Float32Array(4),h=new Float32Array(4),i=new Float32Array(16),j=new Float32Array(16),k=new Float32Array(16),l=function(b,c){for(var a=Math.sqrt,d=0,e=c.length,f=0;f<e;++f)d+=c[f]*c[f];if(d=a(d),1e-5<d)for(var f=0;f<e;++f)b[f]=c[f]/d;else for(var f=0;f<e;++f)b[f]=0;return b},m=function(c,d,a){return c[0]=d[1]*a[2]-d[2]*a[1],c[1]=d[2]*a[0]-d[0]*a[2],c[2]=d[0]*a[1]-d[1]*a[0],c},n=function(c,d,a){for(var b=d.length,e=0;e<b;++e)c[e]=d[e]-a[e];return c},o=function(c,a){return c[0]*a[0]+c[1]*a[1]+c[2]*a[2]};return b.lookAt=new Sk.builtin.func(function(a,b,f,g){var h=c,i=d,j=l(h,n(h,b.v,f.v)),k=l(i,m(i,g.v,j)),p=m(e,j,k),q=a.v;return q[0]=k[0],q[1]=p[0],q[2]=j[0],q[3]=0,q[4]=k[1],q[5]=p[1],q[6]=j[1],q[7]=0,q[8]=k[2],q[9]=p[2],q[10]=j[2],q[11]=0,q[12]=-o(k,b.v),q[13]=-o(p,b.v),q[14]=-o(j,b.v),q[15]=1,a}),b.perspective=new Sk.builtin.func(function(b,c,d,e,g){var h=Math.tan,i=h(.5*a-.5*(c*a/180)),f=1/(e-g),j=b.v;return j[0]=i/d,j[1]=0,j[2]=0,j[3]=0,j[4]=0,j[5]=i,j[6]=0,j[7]=0,j[8]=0,j[9]=0,j[10]=(e+g)*f,j[11]=-1,j[12]=0,j[13]=0,j[14]=2*(e*g*f),j[15]=0,b}),b.rotationY=new Sk.builtin.func(function(b,d){var e=Math.sin,f=Math.cos,g=b.v,h=f(d*a/180),c=e(d*a/180);return g[0]=h,g[1]=0,g[2]=-c,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=c,g[9]=0,g[10]=h,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,b}),b.identity=new Sk.builtin.func(function(a){var b=a.v;return b[0]=1,b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[5]=1,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[10]=1,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,a}),b.mul=new Sk.builtin.func(function(c,d,e){var f=c.v,g=d.v,a=e.v,b=g[0],h=g[1],i=g[2],j=g[3],k=g[4],l=g[5],m=g[6],n=g[7],o=g[8],p=g[9],q=g[10],r=g[11],s=g[12],t=g[13],u=g[14],v=g[15],w=a[0],x=a[1],y=a[2],z=a[3],A=a[4],B=a[5],C=a[6],D=a[7],E=a[8],F=a[9],G=a[10],H=a[11],I=a[12],J=a[13],K=a[14],L=a[15];return f[0]=b*w+h*A+i*E+j*I,f[1]=b*x+h*B+i*F+j*J,f[2]=b*y+h*C+i*G+j*K,f[3]=b*z+h*D+i*H+j*L,f[4]=k*w+l*A+m*E+n*I,f[5]=k*x+l*B+m*F+n*J,f[6]=k*y+l*C+m*G+n*K,f[7]=k*z+l*D+m*H+n*L,f[8]=o*w+p*A+q*E+r*I,f[9]=o*x+p*B+q*F+r*J,f[10]=o*y+p*C+q*G+r*K,f[11]=o*z+p*D+q*H+r*L,f[12]=s*w+t*A+u*E+v*I,f[13]=s*x+t*B+u*F+v*J,f[14]=s*y+t*C+u*G+v*K,f[15]=s*z+t*D+u*H+v*L,c}),b.invert=new Sk.builtin.func(function(a,b){var c=a.v,e=b.v,f=e[0],g=e[1],h=e[2],i=e[3],j=e[4],k=e[5],l=e[6],m=e[7],n=e[8],o=e[9],p=e[10],q=e[11],r=e[12],s=e[13],t=e[14],u=e[15],v=p*u,w=t*q,x=l*u,y=t*m,z=l*q,A=p*m,B=h*u,C=t*i,D=h*q,E=p*i,F=h*m,G=l*i,H=n*s,I=r*o,J=j*s,K=r*k,L=j*o,M=n*k,N=f*s,O=r*g,P=f*o,Q=n*g,R=f*k,S=j*g,T=v*k+y*o+z*s-(w*k+x*o+A*s),U=w*g+B*o+E*s-(v*g+C*o+D*s),V=x*g+C*k+F*s-(y*g+B*k+G*s),W=A*g+D*k+G*o-(z*g+E*k+F*o),X=1/(f*T+j*U+n*V+r*W);return c[0]=X*T,c[1]=X*U,c[2]=X*V,c[3]=X*W,c[4]=X*(w*j+x*n+A*r-(v*j+y*n+z*r)),c[5]=X*(v*f+C*n+D*r-(w*f+B*n+E*r)),c[6]=X*(y*f+B*j+G*r-(x*f+C*j+F*r)),c[7]=X*(z*f+E*j+F*n-(A*f+D*j+G*n)),c[8]=X*(H*m+K*q+L*u-(I*m+J*q+M*u)),c[9]=X*(I*i+N*q+Q*u-(H*i+O*q+P*u)),c[10]=X*(J*i+O*m+R*u-(K*i+N*m+S*u)),c[11]=X*(M*i+P*m+S*q-(L*i+Q*m+R*q)),c[12]=X*(J*p+M*t+I*l-(L*t+H*l+K*p)),c[13]=X*(P*t+H*h+O*p-(N*p+Q*t+I*h)),c[14]=X*(N*l+S*t+K*h-(R*t+J*h+O*l)),c[15]=X*(R*p+L*h+Q*l-(P*l+S*p+M*h)),a}),b.transpose=new Sk.builtin.func(function(a,b){for(var c=a.v,d=b.v,e=0;4>e;++e)for(var f=0;4>f;++f)c[4*e+f]=d[4*f+e];return c}),b};","src/lib/webgl/models.js":'var $builtinmodule=function(a){var c={},d=function(a,c){var d=c||gl.ARRAY_BUFFER,e=gl.createBuffer();if(this.target=d,this.buf=e,this.set(a),this.numComponents_=a.numComponents,this.numElements_=a.numElements,this.totalComponents_=this.numComponents_*this.numElements_,a.buffer instanceof Float32Array)this.type_=gl.FLOAT;else if(a.buffer instanceof Uint8Array)this.type_=gl.UNSIGNED_BYTE;else if(a.buffer instanceof Int8Array)this.type_=gl._BYTE;else if(a.buffer instanceof Uint16Array)this.type_=gl.UNSIGNED_SHORT;else if(a.buffer instanceof Int16Array)this.type_=gl.SHORT;else throw"unhandled type:"+typeof a.buffer};return d.prototype.set=function(a){gl.bindBuffer(this.target,this.buf),gl.bufferData(this.target,a.buffer,gl.STATIC_DRAW)},d.prototype.type=function(){return this.type_},d.prototype.numComponents=function(){return this.numComponents_},d.prototype.numElements=function(){return this.numElements_},d.prototype.totalComponents=function(){return this.totalComponents_},d.prototype.buffer=function(){return this.buf},d.prototype.stride=function(){return 0},d.prototype.offset=function(){return 0},c.Model=Sk.misceval.buildClass(c,function(c,e){e.__init__=new Sk.builtin.func(function(c,e,f,g){c.buffers={};var h=function(a,e){var f="indices"==a?gl.ELEMENT_ARRAY_BUFFER:gl.ARRAY_BUFFER;b=c.buffers[a],b?b.set(e):b=new d(e,f),c.buffers[a]=b};for(a in f)h(a,f[a]);var i={},j=0;for(var k in g)i[k]=j++;c.mode=gl.TRIANGLES,c.textures=g.v,c.textureUnits=i,c.shader=e}),e.drawPrep=new Sk.builtin.func(function(a,c){var d=a.shader,e=a.buffers,f=a.textures;for(var g in c=Sk.ffi.remapToJs(c),Sk.misceval.callsimArray(d.use,[d]),e){var h=e[g];if("indices"==g)gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,h.buffer());else{var i=d.attrib[g];i&&i(h)}}for(var j in f){var k=a.textureUnits[j];d.setUniform$impl(d,textuer,k),f[j].bindToUnit(k)}for(var l in c)d.setUniform$impl(d,l,c[l])}),e.draw=new Sk.builtin.func(function(a,c,d){var e=a.shader;for(uniform in c=Sk.ffi.remapToJs(c),c)e.setUniform$impl(e,uniform,c[uniform]);if(d)for(var f in d){var g=a.textureUnits[f];e.setUniform$impl(e,f,g),d[f].bindToUnit(g)}var h=a.buffers;gl.drawElements(a.mode,h.indices.totalComponents(),gl.UNSIGNED_SHORT,0)})},"Model",[]),c};',"src/lib/webgl/primitives.js":'var $builtinmodule=function(){var a={},b=function(a,b,c){c=c||"Float32Array";var d=window[c];b.length?(this.buffer=new d(b),b=this.buffer.length/a,this.cursor=b):(this.buffer=new d(a*b),this.cursor=0),this.numComponents=a,this.numElements=b,this.type=c};return b.prototype.stride=function(){return 0},b.prototype.offset=function(){return 0},b.prototype.getElement=function(a){for(var b=a*this.numComponents,c=[],d=0;d<this.numComponents;++d)c.push(this.buffer[b+d]);return c},b.prototype.setElement=function(a,b){for(var c=a*this.numComponents,d=0;d<this.numComponents;++d)this.buffer[c+d]=b[d]},b.prototype.clone=function(){var a=new b(this.numComponents,this.numElements,this.type);return a.pushArray(this),a},b.prototype.push=function(a){this.setElement(this.cursor++,a)},b.prototype.pushArray=function(a){for(var b=0;b<a.numElements;++b)this.push(a.getElement(b))},b.prototype.pushArrayWithOffset=function(a,b){for(var c,d=0;d<a.numElements;++d){c=a.getElement(d);for(var e=0;e<b.length;++e)c[e]+=b[e];this.push(c)}},b.prototype.computeExtents=function(){for(var a=Math.max,b=Math.min,c,d=this.numElements,e=this.numComponents,f=this.getElement(0),g=this.getElement(0),h=1;h<d;++h){c=this.getElement(h);for(var i=0;i<e;++i)f[i]=b(f[i],c[i]),g[i]=a(g[i],c[i])}return{min:f,max:g}},a.createCube=new Sk.builtin.func(function(a){for(var c,d=[[3,7,5,1],[0,4,6,2],[6,7,3,2],[0,1,5,4],[5,7,6,4],[2,3,1,0]],e=a/2,g=[[-e,-e,-e],[+e,-e,-e],[-e,+e,-e],[+e,+e,-e],[-e,-e,+e],[+e,-e,+e],[-e,+e,+e],[+e,+e,+e]],h=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],i=[[0,0],[1,0],[1,1],[0,1]],j=24,k=new b(3,j),l=new b(3,j),m=new b(2,j),n=new b(3,12,"Uint16Array"),o=0;6>o;++o){c=d[o];for(var p=0;4>p;++p){var q=g[c[p]],r=h[o],s=i[p];k.push(q),l.push(r),m.push(s)}var t=4*o;n.push([t+0,t+1,t+2]),n.push([t+0,t+2,t+3])}return{position:k,normal:l,texCoord:m,indices:n}}),a};',"src/lib/whichdb.py":'raise NotImplementedError("whichdb is not yet implemented in Skulpt")\n',"src/lib/wsgiref/__init__.py":'raise NotImplementedError("wsgiref is not yet implemented in Skulpt")\n',"src/lib/xdrlib.py":'raise NotImplementedError("xdrlib is not yet implemented in Skulpt")\n',"src/lib/xml/__init__.py":'raise NotImplementedError("xml is not yet implemented in Skulpt")\n',"src/lib/xml/dom/__init__.py":'raise NotImplementedError("dom is not yet implemented in Skulpt")\n',"src/lib/xml/etree/__init__.py":'raise NotImplementedError("etree is not yet implemented in Skulpt")\n',"src/lib/xml/parsers/__init__.py":'raise NotImplementedError("parsers is not yet implemented in Skulpt")\n',"src/lib/xml/sax/__init__.py":'raise NotImplementedError("sax is not yet implemented in Skulpt")\n',"src/lib/xmllib.py":'raise NotImplementedError("xmllib is not yet implemented in Skulpt")\n',"src/lib/xmlrpclib.py":'raise NotImplementedError("xmlrpclib is not yet implemented in Skulpt")\n',"src/lib/zipfile.py":'raise NotImplementedError("zipfile is not yet implemented in Skulpt")\n'}}},312:function(e,t,n){(function(){"use strict";var e,t=t||{};t.scope={},t.ASSUME_ES5=!1,t.ASSUME_NO_NATIVE_MAP=!1,t.ASSUME_NO_NATIVE_SET=!1,t.SIMPLE_FROUND_POLYFILL=!1,t.defineProperty=t.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){e!=Array.prototype&&e!=Object.prototype&&(e[t]=n.value)},t.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:void 0!==n.g&&null!=n.g?n.g:e},t.global=t.getGlobal(this),t.polyfill=function(e,n,i,r){if(n){for(i=t.global,e=e.split("."),r=0;r<e.length-1;r++){var s=e[r];s in i||(i[s]={}),i=i[s]}(n=n(r=i[e=e[e.length-1]]))!=r&&null!=n&&t.defineProperty(i,e,{configurable:!0,writable:!0,value:n})}},t.polyfill("Array.prototype.includes",(function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var i=n.length;for(0>(t=t||0)&&(t=Math.max(t+i,0));t<i;t++){var r=n[t];if(r===e||Object.is(r,e))return!0}return!1}}),"es7","es3"),t.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.polyfill("Object.entries",(function(e){return e||function(e){var n,i=[];for(n in e)t.owns(e,n)&&i.push([n,e[n]]);return i}}),"es8","es3"),t.checkStringArgs=function(e,t,n){if(null==e)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return e+""},t.stringPadding=function(e,t){return e=void 0!==e?String(e):" ",0<t&&e?e.repeat(Math.ceil(t/e.length)).substring(0,t):""},t.polyfill("String.prototype.padStart",(function(e){return e||function(e,n){var i=t.checkStringArgs(this,null,"padStart");return t.stringPadding(n,e-i.length)+i}}),"es8","es3"),t.polyfill("Object.values",(function(e){return e||function(e){var n,i=[];for(n in e)t.owns(e,n)&&i.push(e[n]);return i}}),"es8","es3"),t.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},t.arrayIterator=function(e){return{next:t.arrayIteratorImpl(e)}},t.SYMBOL_PREFIX="jscomp_symbol_",t.initSymbol=function(){t.initSymbol=function(){},t.global.Symbol||(t.global.Symbol=t.Symbol)},t.SymbolClass=function(e,n){this.$jscomp$symbol$id_=e,t.defineProperty(this,"description",{configurable:!0,writable:!0,value:n})},t.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_},t.Symbol=(e=0,function n(i){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return new t.SymbolClass(t.SYMBOL_PREFIX+(i||"")+"_"+e++,i)}),t.initSymbolIterator=function(){t.initSymbol();var e=t.global.Symbol.iterator;e||(e=t.global.Symbol.iterator=t.global.Symbol("Symbol.iterator")),"function"!=typeof Array.prototype[e]&&t.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return t.iteratorPrototype(t.arrayIteratorImpl(this))}}),t.initSymbolIterator=function(){}},t.initSymbolAsyncIterator=function(){t.initSymbol();var e=t.global.Symbol.asyncIterator;e||(e=t.global.Symbol.asyncIterator=t.global.Symbol("Symbol.asyncIterator")),t.initSymbolAsyncIterator=function(){}},t.iteratorPrototype=function(e){return t.initSymbolIterator(),(e={next:e})[t.global.Symbol.iterator]=function(){return this},e},t.iteratorFromArray=function(e,n){t.initSymbolIterator(),e instanceof String&&(e+="");var i=0,r={next:function(){if(i<e.length){var t=i++;return{value:n(t,e[t]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r},t.polyfill("Array.prototype.values",(function(e){return e||function(){return t.iteratorFromArray(this,(function(e,t){return t}))}}),"es8","es3"),function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:i})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n||4&n&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(i,r,function(t){return e[t]}.bind(null,r));return i},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,t,n){n(2),Sk.global.strftime=n(3),Sk.global.strptime=n(4),n(5),n(7),n(9),n(10),n(11),n(12),n(13),n(14),n(15),n(16),n(17),n(18),[Sk.builtin.object,Sk.builtin.type].forEach((e=>{Sk.abstr.setUpSlots(e),Sk.abstr.setUpMethods(e),Sk.abstr.setUpGetSets(e)})),n(19),n(20),n(21),[Sk.builtin.str,Sk.builtin.none,Sk.builtin.NotImplemented,Sk.builtin.object].forEach((e=>{(e=e.prototype).__doc__=e.hasOwnProperty("tp$doc")?new Sk.builtin.str(e.tp$doc):Sk.builtin.none.none$})),n(22),n(23),n(24),n(25),n(26),n(27),n(28),n(29),n(31),n(32),n(33),n(34),n(35),n(36),n(37),n(38),n(39),n(40),n(41),n(42),n(43),n(44),n(45),n(46),n(47),n(48),n(49),n(50),n(51),n(52),n(53),n(54),n(55),n(56),n(57),n(58),n(59),n(60),n(61),n(62),n(63),n(64),n(65)},function(e,t,n){(function(e){var t={build:{githash:"6c99c2196851bb29f0e503afccb01804f089cb60",date:"2021-02-23T18:59:26.986Z"}};t.global=void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t.exportSymbol=function(e,n){e=e.split(".");var i,r=t.global;for(i=0;i<e.length-1;i++){var s=e[i];r=r.hasOwnProperty(s)?r[s]:r[s]={}}void 0!==n&&(r[s=e[i]]=n)},t.isArrayLike=function(e){return!!(e instanceof Array||e&&e.length&&"number"==typeof e.length)},t.js_beautify=function(e){return e},t.exportSymbol("Sk",t),t.exportSymbol("Sk.global",t.global),t.exportSymbol("Sk.build",t.build),t.exportSymbol("Sk.exportSymbol",t.exportSymbol),t.exportSymbol("Sk.isArrayLike",t.isArrayLike),t.exportSymbol("Sk.js_beautify",t.js_beautify)}).call(this,n(0))},function(e,t){!function(){function t(e,t){return""===t||9<e?e:(null==t&&(t="0"),t+e)}function n(e){return 99<e?e:9<e?"0"+e:"00"+e}function i(e){return 0===e?12:12<e?e-12:e}function r(e,t){t=t||"sunday";var n=e.getDay();return"monday"===t&&(0===n?n=6:n--),t=Date.UTC(e.getFullYear(),0,1),e=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),Math.floor((Math.floor((e-t)/864e5)+7-n)/7)}function s(e){var t=e%10;if(11<=(e%=100)&&13>=e||0===t||4<=t)return"th";switch(t){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function o(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(e)}var a={de_DE:{days:"Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag".split(" "),shortDays:"So Mo Di Mi Do Fr Sa".split(" "),months:"Januar Februar März April Mai Juni Juli August September Oktober November Dezember".split(" "),shortMonths:"Jan Feb Mär Apr Mai Jun Jul Aug Sep Okt Nov Dez".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d.%m.%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},en_CA:{days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),ordinalSuffixes:"st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}},en_US:{days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),shortDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),ordinalSuffixes:"st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%m/%d/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}},es_MX:{days:"domingo lunes martes miércoles jueves viernes sábado".split(" "),shortDays:"dom lun mar mié jue vie sáb".split(" "),months:"enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiembre;octubre;noviembre; diciembre".split(";"),shortMonths:"ene feb mar abr may jun jul ago sep oct nov dic".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},fr_FR:{days:"dimanche lundi mardi mercredi jeudi vendredi samedi".split(" "),shortDays:"dim. lun. mar. mer. jeu. ven. sam.".split(" "),months:"janvier février mars avril mai juin juillet août septembre octobre novembre décembre".split(" "),shortMonths:"janv. févr. mars avril mai juin juil. août sept. oct. nov. déc.".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},it_IT:{days:"domenica lunedì martedì mercoledì giovedì venerdì sabato".split(" "),shortDays:"dom lun mar mer gio ven sab".split(" "),months:"gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre".split(" "),shortMonths:"pr mag giu lug ago set ott nov dic".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},nl_NL:{days:"zondag maandag dinsdag woensdag donderdag vrijdag zaterdag".split(" "),shortDays:"zo ma di wo do vr za".split(" "),months:"januari februari maart april mei juni juli augustus september oktober november december".split(" "),shortMonths:"jan feb mrt apr mei jun jul aug sep okt nov dec".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},pt_BR:{days:"domingo segunda terça quarta quinta sexta sábado".split(" "),shortDays:"Dom Seg Ter Qua Qui Sex Sáb".split(" "),months:"janeiro fevereiro março abril maio junho julho agosto setembro outubro novembro dezembro".split(" "),shortMonths:"Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},ru_RU:{days:"Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота".split(" "),shortDays:"Вс Пн Вт Ср Чт Пт Сб".split(" "),months:"Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь".split(" "),shortMonths:"янв фев мар апр май июн июл авг сен окт ноя дек".split(" "),AM:"AM",PM:"PM",am:"am",pm:"pm",formats:{c:"%a %d %b %Y %X",D:"%d.%m.%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},tr_TR:{days:"Pazar Pazartesi Salı Çarşamba Perşembe Cuma Cumartesi".split(" "),shortDays:"Paz Pzt Sal Çrş Prş Cum Cts".split(" "),months:"Ocak Şubat Mart Nisan Mayıs Haziran Temmuz Ağustos Eylül Ekim Kasım Aralık".split(" "),shortMonths:"Oca Şub Mar Nis May Haz Tem Ağu Eyl Eki Kas Ara".split(" "),AM:"ÖÖ",PM:"ÖS",am:"ÖÖ",pm:"ÖS",formats:{c:"%a %d %b %Y %X %Z",D:"%d-%m-%Y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%T",x:"%D"}},zh_CN:{days:"星期日 星期一 星期二 星期三 星期四 星期五 星期六".split(" "),shortDays:"日一二三四五六".split(""),months:"一月份 二月份 三月份 四月份 五月份 六月份 七月份 八月份 九月份 十月份 十一月份 十二月份".split(" "),shortMonths:"一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月".split(" "),AM:"上午",PM:"下午",am:"上午",pm:"下午",formats:{c:"%a %d %b %Y %X %Z",D:"%d/%m/%y",F:"%Y-%m-%d",R:"%H:%M",r:"%I:%M:%S %p",T:"%H:%M:%S",v:"%e-%b-%Y",X:"%r",x:"%D"}}},l=a.en_US,u=new function e(u,c,p){function h(e,a,l,u){for(var c="",p=null,d=!1,f=e.length,b=!1,g=0;g<f;g++){var S=e.charCodeAt(g);if(!0===d)if(45===S)p="";else if(95===S)p=" ";else if(48===S)p="0";else if(58===S)b&&o("[WARNING] detected use of unsupported %:: or %::: modifiers to strftime"),b=!0;else{switch(S){case 37:c+="%";break;case 65:c+=l.days[a.getDay()];break;case 66:c+=l.months[a.getMonth()];break;case 67:c+=t(Math.floor(a.getFullYear()/100),p);break;case 68:c+=h(l.formats.D,a,l,u);break;case 70:c+=h(l.formats.F,a,l,u);break;case 72:c+=t(a.getHours(),p);break;case 73:c+=t(i(a.getHours()),p);break;case 76:c+=n(Math.floor(u%1e3));break;case 77:c+=t(a.getMinutes(),p);break;case 80:c+=12>a.getHours()?l.am:l.pm;break;case 82:c+=h(l.formats.R,a,l,u);break;case 83:c+=t(a.getSeconds(),p);break;case 84:c+=h(l.formats.T,a,l,u);break;case 85:c+=t(r(a,"sunday"),p);break;case 87:c+=t(r(a,"monday"),p);break;case 88:c+=h(l.formats.X,a,l,u);break;case 89:c+=a.getFullYear();break;case 90:m&&0===_?c+="GMT":c+=(p=a.toString().match(/\(([\w\s]+)\)/))&&p[1]||"";break;case 97:c+=l.shortDays[a.getDay()];break;case 98:case 104:c+=l.shortMonths[a.getMonth()];break;case 99:c+=h(l.formats.c,a,l,u);break;case 100:c+=t(a.getDate(),p);break;case 101:c+=t(a.getDate(),null==p?" ":p);break;case 106:p=new Date(a.getFullYear(),0,1),c+=n(p=Math.ceil((a.getTime()-p.getTime())/864e5));break;case 107:c+=t(a.getHours(),null==p?" ":p);break;case 108:c+=t(i(a.getHours()),null==p?" ":p);break;case 109:c+=t(a.getMonth()+1,p);break;case 110:c+="\n";break;case 111:p=a.getDate(),c=l.ordinalSuffixes?c+(String(p)+(l.ordinalSuffixes[p-1]||s(p))):c+(String(p)+s(p));break;case 112:c+=12>a.getHours()?l.AM:l.PM;break;case 114:c+=h(l.formats.r,a,l,u);break;case 115:c+=Math.floor(u/1e3);break;case 116:c+="\t";break;case 117:c+=0===(p=a.getDay())?7:p;break;case 118:c+=h(l.formats.v,a,l,u);break;case 119:c+=a.getDay();break;case 120:c+=h(l.formats.x,a,l,u);break;case 121:c+=(""+a.getFullYear()).slice(2);break;case 122:m&&0===_?c+=b?"+00:00":"+0000":(p=0!==_?_/6e4:-a.getTimezoneOffset(),d=b?":":"",S=Math.abs(p%60),c+=(0>p?"-":"+")+t(Math.floor(Math.abs(p/60)))+d+t(S));break;default:d&&(c+="%"),c+=e[g]}p=null,d=!1}else 37===S?d=!0:c+=e[g]}return c}var d,f=u||l,_=c||0,m=p||!1,b=0,g=function(e,t){if(t){var n=t.getTime();if(m){var i=6e4*(t.getTimezoneOffset()||0);6e4*((t=new Date(n+i+_)).getTimezoneOffset()||0)!==i&&(t=6e4*(t.getTimezoneOffset()||0),t=new Date(n+t+_))}}else(n=Date.now())>b?(b=n,d=new Date(b),n=b,m&&(d=new Date(b+6e4*(d.getTimezoneOffset()||0)+_))):n=b,t=d;return h(e,t,f,n)};return g.localize=function(t){return new e(t||f,_,m)},g.localizeByIdentifier=function(e){var t=a[e];return t?g.localize(t):(o('[WARNING] No locale found with identifier "'+e+'".'),g)},g.timezone=function(t){var n=_,i=m,r=typeof t;return"number"!==r&&"string"!==r||(i=!0,"string"===r?n=(n="-"===t[0]?-1:1)*(60*(r=parseInt(t.slice(1,3),10))+(t=parseInt(t.slice(3,5),10)))*6e4:"number"===r&&(n=6e4*t)),new e(f,n,i)},g.utc=function(){return new e(f,_,!0)},g}(l,0,!1);if(void 0!==e)e.exports=u;else(function(){return this||(0,eval)("this")}()).strftime=u;"function"!=typeof Date.now&&(Date.now=function(){return+new Date})}()},function(e,t,n){!function(){var t=function(e,n,i){return t.parse(e,n,i)};t.version="0.0.1",(e.exports=t).strptime=t,t.locale={a:"Sun Mon Tue Wed Thu Fri Sat".split(" "),A:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),b:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),B:"January February March April May June July August September October November December".split(" "),f:"Jan. Feb. Mar. Apr. May Jun. Jul. Aug. Sep. Oct. Nov. Dec.".split(" "),c:"%Y-%m-%d %H:%M:%S",P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%y",X:"%H:%M:%S",day:["Yesterday","Today","Tomorrow"],bg:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),Bg:"January February March April May June July August September October November December".split(" "),fg:"Jan. Feb. Mar. Apr. May Jun. Jul. Aug. Sep. Oct. Nov. Dec.".split(" "),Date_dBY_year_in_HM:"%#B %-d, %Y at %-H:%M",Date_dBY_year:"%#B %-d, %Y",Date_dBY:"%#B %-d, %Y",Date_AdBY:"%A, %#B %-d, %Y",Date_dBA:"%#B %-d, %A",Date_df_in_HM:"%#f, %-d at %-H:%M",Date_dfY:"%-d %#f %Y",Date_dB_in_HM:"%#B %-d at %-H:%M",Date_df:"%-d %#f"},function(e){function t(e,n,i,r,o,a){if(n=String(n),i=String(i),n=n.replace(/^[#_0\^\-!~]+/,""),!(r=s[n]))return e;var l=!1;if(-1===i.indexOf("!")&&1===n.length&&(-1<i.indexOf("~")||-1<"bBf".indexOf(n)&&/%[0\-_]?d[\s]+$/.test(a.substr(0,o)))&&(l=!0),("I"===n||"l"===n)&&!/%[pP]/.test(a))throw Error("Undefined AM/PM");switch(typeof r){case"function":return r();case"string":return r;case"object":return t.make.push([r.make,i,l]),"("+r.reg+")";default:return e}}function n(e,t){return e=String(e),-1!==(t=String(t)).indexOf("#")?e.substr(0,1).toUpperCase()+e.substr(1):-1!==t.indexOf("^")?e.substr(0,1)+e.substr(1).toLowerCase():e}var i=Array.prototype.indexOf||function(e){for(var t=this.length,n=0;n<t;){if(e==this[n])return n;n++}return-1},r=e.locale,s={"%":"\\%",a:"\\S+",A:"\\S+",b:{reg:"\\S+",make:function(e,t,s,o){return-1!==(t=i.call(o?r.bg:r.b,n(t,s)))&&(e.setUTCMonth(t),!0)}},h:{reg:"\\S+",make:function(e,t,s,o){return-1!==(t=i.call(o?r.bg:r.b,n(t,s)))&&(e.setUTCMonth(t),!0)}},B:{reg:"\\S+",make:function(e,t,s,o){return-1!==(t=i.call(o?r.Bg:r.B,n(t,s)))&&(e.setUTCMonth(t),!0)}},f:{reg:"\\S+",make:function(e,t,s,o){return-1!==(t=i.call(o?r.fg:r.f,n(t,s)))&&(e.setUTCMonth(t),!0)}},g:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(0>(t=parseInt(t,10))||99<t)&&(t+=100*parseInt((new Date).getUTCFullYear()/100,10),e.setUTCFullYear(t),!0)}},G:{reg:"\\d{4}",make:function(e,t){return t=parseInt(t,10),e.setUTCFullYear(t),!0}},d:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(1>(t=parseInt(t,10))||31<t)&&(e.setUTCDate(t),!0)}},e:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(1>(t=parseInt(t,10))||31<t)&&(e.setUTCDate(t),!0)}},H:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(0>(t=parseInt(t,10))||23<t)&&(e.setUTCHours(t),!0)}},I:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(1>(t=parseInt(t,10))||12<t)&&(e.setUTCHours(e.getUTCHours()+t),!0)}},m:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(1>(t=parseInt(t,10))||12<t)&&(e.setUTCMonth(t-1),!0)}},M:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(0>(t=parseInt(t,10))||59<t)&&(e.setUTCMinutes(t),!0)}},n:"\\n",p:{reg:"\\S+",make:function(e,t){return-1!==(t=i.call(r.P,t.toLowerCase()))&&(1===t&&e.setUTCHours(e.getUTCHours()+12),!0)}},P:{reg:"\\S+",make:function(e,t){return-1!==(t=i.call(r.P,t.toLowerCase()))&&(1===t&&e.setUTCHours(e.getUTCHours()+12),!0)}},S:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(0>(t=parseInt(t,10))||60<t)&&(e.setUTCSeconds(t),!0)}},t:"\\t",u:"\\d",U:"[\\d\\s]?\\d",w:"\\d",W:"[\\d\\s]?\\d",y:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(0>(t=parseInt(t,10))||99<t)&&(t+=100*parseInt((new Date).getUTCFullYear()/100,10),e.setUTCFullYear(t),!0)}},Y:{reg:"\\d{4}",make:function(e,t){return t=parseInt(t,10),e.setUTCFullYear(t),!0}},z:{reg:"[+\\-]\\d{4}",make:function(e,t){if(!(t=t.match(/^([+\-])(\d{2})(\d{2})$/)))return!1;var n=6e4*(60*parseInt(t[2],10)+parseInt(t[3],10));return"+"===t[1]&&(n=-n),e.setTime(e.getTime()+n),!0}},l:{reg:"[\\d\\s]?\\d",make:function(e,t){return!(1>(t=parseInt(t,10))||12<t)&&(e.setUTCHours(e.getUTCHours()+t),!0)}},s:{reg:"\\d+",make:function(e,t){return t=parseInt(t,10),e.setTime(1e3*t),!0}},c:r.c,r:r.r,R:"%H:%M",T:"%H:%M:%S",x:r.x,X:r.X,D:"%m/%d/%y",F:"%Y-%m-%d",Date_iso:"%Y-%m-%dT%H:%M:%S",Date_dBY_year_in_HM:r.Date_dBY_year_in_HM,Date_dBY_year:r.Date_dBY_year,Date_dBY:r.Date_dBY,Date_dBA:r.Date_dBA,Date_AdBY:r.Date_AdBY,Date_df_in_HM:r.Date_df_in_HM,Date_dfY:r.Date_dfY,Date_dB_in_HM:r.Date_dB_in_HM,Date_dmY__dot:"%d.%m.%Y",Date_df:r.Date_df,Date_FT:"%F %T",Date_dmY__minus:"%d-%m-%Y"};e.parse=function(e,n,i){e=String(e),n=String(n);for(var r=5;/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/g.test(n)&&r;)n=n.replace(/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/,t),r--;if(t.make=[],n=n.replace(/%(([#\^!~]{0,2})[aAbBfh]|([0\-_]?)[degHImMSVWyl]|[GnpPtuUwYzZs%])/g,t),!(e=e.match(new RegExp(n)))||!t.make.length)return null;n=new Date(Date.UTC(0,0)),r=0;for(var s=t.make.length;r<s;r++){var o=t.make[r];if(!o[0](n,e[r+1],o[1],o[2]))return null}return i&&n.setTime(n.getTime()+6e4*n.getTimezoneOffset()),n}}(t)}()},function(e,t,n){e=n(6);const i=Sk.global.JSBI=void 0!==Sk.global.BigInt?{}:e;if(void 0===Sk.global.BigInt){const e=i.__isBigInt;i.__isBigInt=e?t=>null!==t&&e(t):e=>e instanceof i,i.powermod=(e,t,n)=>{const r=i.BigInt(1);let s=r;for(t=i.greaterThan(t,i.__ZERO)?t:i.unaryMinus(t);i.greaterThan(t,i.__ZERO);)i.bitwiseAnd(t,r)&&(s=i.remainder(i.multiply(s,e),n)),t=i.signedRightShift(t,r),e=i.remainder(i.multiply(e,e),n);return s}}else Object.assign(i,{BigInt:Sk.global.BigInt,toNumber:e=>Number(e),toString:e=>e.toString(),__isBigInt:e=>"bigint"==typeof e,unaryMinus:e=>-e,bitwiseNot:e=>~e,bitwiseAnd:(e,t)=>e&t,bitwiseOr:(e,t)=>e|t,bitwiseXor:(e,t)=>e^t,exponentiate:(e,t)=>{const n=i.BigInt(1);let r=n;for(t=t>i.__ZERO?t:-t;t>i.__ZERO;)t&n&&(r*=e),t>>=n,e*=e;return r},powermod:(e,t,n)=>{const r=i.BigInt(1);let s=r;for(t=t>i.__ZERO?t:-t;t>i.__ZERO;)t&r&&(s=s*e%n),t>>=r,e=e*e%n;return s},multiply:(e,t)=>e*t,divide:(e,t)=>e/t,remainder:(e,t)=>e%t,add:(e,t)=>e+t,subtract:(e,t)=>e-t,leftShift:(e,t)=>e<<t,signedRightShift:(e,t)=>e>>t,unsignedRightShift:(e,t)=>e>>>t,lessThan:(e,t)=>e<t,lessThanOrEqual:(e,t)=>e<=t,greaterThan:(e,t)=>e>t,greaterThanOrEqual:(e,t)=>e>=t,equal:(e,t)=>e===t,notEqual:(e,t)=>e!==t});i.__ZERO=i.BigInt(0),i.__MAX_SAFE=i.BigInt(Number.MAX_SAFE_INTEGER),i.__MIN_SAFE=i.BigInt(-Number.MAX_SAFE_INTEGER),i.numberIfSafe=e=>i.lessThan(e,i.__MAX_SAFE)&&i.greaterThan(e,i.__MIN_SAFE)?i.toNumber(e):e},function(e,t,n){e.exports=function(){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){for(var n,i=0;i<t.length;i++)(n=t[i]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function o(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function a(){return a=o()?Reflect.construct:function(e,t,n){var i=[null];return i.push.apply(i,t),e=new(Function.bind.apply(e,i)),n&&s(e,n.prototype),e},a.apply(null,arguments)}function l(e){var t="function"==typeof Map?new Map:void 0;return l=function(e){function n(){return a(e,arguments,r(this).constructor)}if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},l(e)}function u(e){var t=o();return function(){var n=r(e);if(t){var i=r(this).constructor;n=Reflect.construct(n,arguments,i)}else n=n.apply(this,arguments);if(!n||"object"!=typeof n&&"function"!=typeof n){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");n=this}return n}}function c(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function h(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=c(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return{s:t=function(){},n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw r}}}}var d=Math.imul,f=Math.clz32,_=function(t){function r(e,t){var n;if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");if(e>r.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=a.call(this,e)).sign=t,n}var s=Math.abs,o=Math.max;i(r,t);var a=u(r);return n(r,[{key:"toDebugString",value:function(){var e,t=["BigInt["],n=h(this);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.push((i?(i>>>0).toString(16):i)+", ")}}catch(e){n.e(e)}finally{n.f()}return t.push("]"),t.join("")}},{key:"toString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10;if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":e&e-1?r.__toStringGeneric(this,e,!1):r.__toStringBasePowerOfTwo(this,e)}},{key:"__copy",value:function(){for(var e=new r(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:"__trim",value:function(){for(var e=this.length,t=this[e-1];0===t;)t=this[--e-1],this.pop();return 0===e&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var e=0;e<this.length;e++)this[e]=0}},{key:"__clzmsd",value:function(){return r.__clz32(this[this.length-1])}},{key:"__inplaceMultiplyAdd",value:function(e,t,n){n>this.length&&(n=this.length);var i=65535&e;e>>>=16;var s=0,o=65535&t;t>>>=16;for(var a=0;a<n;a++){var l=this.__digit(a),u=65535&l,c=l>>>16;l=r.__imul(u,i),u=r.__imul(u,e);var p=r.__imul(c,i),h=o+(65535&l);s=(o=(u>>>16)+(p>>>16)+(65535&(c=r.__imul(c,e)))+((l=t+s+(h>>>16)+(l>>>16)+(65535&u)+(65535&p))>>>16))>>>16,o&=65535,t=c>>>16,this.__setDigit(a,65535&h|l<<16)}if(0!==s||0!==o||0!==t)throw Error("implementation bug")}},{key:"__inplaceAdd",value:function(e,t,n){for(var i,r=0,s=0;s<n;s++)r=(i=this.__halfDigit(t+s)+e.__halfDigit(s)+r)>>>16,this.__setHalfDigit(t+s,i);return r}},{key:"__inplaceSub",value:function(e,t,n){var i=0;if(1&t){t>>=1;for(var r=this.__digit(t),s=65535&r,o=0;o<n-1>>>1;o++){var a=e.__digit(o);i=1&(r=(r>>>16)-(65535&a)-i)>>>16,this.__setDigit(t+o,r<<16|65535&s),i=1&(s=(65535&(r=this.__digit(t+o+1)))-(a>>>16)-i)>>>16}var l=(r>>>16)-(65535&(a=e.__digit(o)))-i;if(i=1&l>>>16,this.__setDigit(t+o,l<<16|65535&s),t+o+1>=this.length)throw new RangeError("out of bounds");!(1&n)&&(i=1&(s=(65535&(r=this.__digit(t+o+1)))-(a>>>16)-i)>>>16,this.__setDigit(t+e.length,4294901760&r|65535&s))}else{for(t>>=1,s=0;s<e.length-1;s++)i=1&(r=((r=this.__digit(t+s))>>>16)-((a=e.__digit(s))>>>16)-(i=1&(o=(65535&r)-(65535&a)-i)>>>16))>>>16,this.__setDigit(t+s,r<<16|65535&o);i=1&(r=(65535&(o=this.__digit(t+s)))-(65535&(e=e.__digit(s)))-i)>>>16,a=0,!(1&n)&&(i=1&(a=(o>>>16)-(e>>>16)-i)>>>16),this.__setDigit(t+s,a<<16|65535&r)}return i}},{key:"__inplaceRightShift",value:function(e){if(0!==e){for(var t,n=this.__digit(0)>>>e,i=this.length-1,r=0;r<i;r++)t=this.__digit(r+1),this.__setDigit(r,t<<32-e|n),n=t>>>e;this.__setDigit(i,n)}}},{key:"__digit",value:function(e){return this[e]}},{key:"__unsignedDigit",value:function(e){return this[e]>>>0}},{key:"__setDigit",value:function(e,t){this[e]=0|t}},{key:"__setDigitGrow",value:function(e,t){this[e]=0|t}},{key:"__halfDigitLength",value:function(){var e=this.length;return 65535>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:"__halfDigit",value:function(e){return 65535&this[e>>>1]>>>((1&e)<<4)}},{key:"__setHalfDigit",value:function(e,t){var n=e>>>1,i=this.__digit(n);this.__setDigit(n,1&e?65535&i|t<<16:4294901760&i|65535&t)}}],[{key:"BigInt",value:function(t){var n=Math.floor,i=Number.isFinite;if("number"==typeof t){if(0===t)return r.__zero();if((0|t)===t)return 0>t?r.__oneDigit(-t,!0):r.__oneDigit(t,!1);if(!i(t)||n(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return r.__fromDouble(t)}if("string"==typeof t){if(null===(n=r.__fromString(t)))throw new SyntaxError("Cannot convert "+t+" to a BigInt");return n}if("boolean"==typeof t)return!0===t?r.__oneDigit(1,!1):r.__zero();if("object"===e(t))return t.constructor===r?t:(t=r.__toPrimitive(t),r.BigInt(t));throw new TypeError("Cannot convert "+t+" to a BigInt")}},{key:"toNumber",value:function(e){var t=e.length;if(0===t)return 0;if(1===t){var n=e.__unsignedDigit(0);return e.sign?-n:n}var i=e.__digit(t-1),s=r.__clz32(i);if(1024<(n=32*t-s))return e.sign?-1/0:1/0;--n;var o=t-1,a=s+1;s=(32===a?0:i<<a)>>>12;var l=a-12;return t=12<=a?0:i<<20+a,a=20+a,0<l&&0<o&&(o--,s|=(i=e.__digit(o))>>>32-l,t=i<<l,a=l),0<a&&0<o&&(o--,t|=(i=e.__digit(o))>>>32-a,a-=32),1!==(i=r.__decideRounding(e,a,o,i))&&(0!==i||1&~t)||0!=(t=t+1>>>0)||!(0!=++s>>>20&&(s=0,1023<++n))?(e=e.sign?-2147483648:0,n=n+1023<<20,r.__kBitConversionInts[1]=e|n|s,r.__kBitConversionInts[0]=t,r.__kBitConversionDouble[0]):e.sign?-1/0:1/0}},{key:"unaryMinus",value:function(e){if(0===e.length)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:"bitwiseNot",value:function(e){return e.sign?r.__absoluteSubOne(e).__trim():r.__absoluteAddOne(e,!0)}},{key:"exponentiate",value:function(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return r.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return!e.sign||1&t.__digit(0)?e:r.unaryMinus(e);if(1<t.length)throw new RangeError("BigInt too big");if(1===(t=t.__unsignedDigit(0)))return e;if(t>=r.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){var n=1+(t>>>5);return(e=new r(n,e.sign&&!!(1&t))).__initializeDigits(),e.__setDigit(n-1,1<<(31&t)),e}n=null;var i=e;for(1&t&&(n=e),t>>=1;0!==t;t>>=1)i=r.multiply(i,i),1&t&&(n=null===n?i:r.multiply(n,i));return n}},{key:"multiply",value:function(e,t){if(0===e.length)return e;if(0===t.length)return t;var n=e.length+t.length;32<=e.__clzmsd()+t.__clzmsd()&&n--,(n=new r(n,e.sign!==t.sign)).__initializeDigits();for(var i=0;i<e.length;i++)r.__multiplyAccumulate(t,e.__digit(i),n,i);return n.__trim()}},{key:"divide",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>r.__absoluteCompare(e,t))return r.__zero();var n=e.sign!==t.sign,i=t.__unsignedDigit(0);if(1===t.length&&65535>=i){if(1===i)return n===e.sign?e:r.unaryMinus(e);e=r.__absoluteDivSmall(e,i,null)}else e=r.__absoluteDivLarge(e,t,!0,!1);return e.sign=n,e.__trim()}},{key:"remainder",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>r.__absoluteCompare(e,t))return e;var n=t.__unsignedDigit(0);return 1===t.length&&65535>=n?1===n||0===(t=r.__absoluteModSmall(e,n))?r.__zero():r.__oneDigit(t,e.sign):((t=r.__absoluteDivLarge(e,t,!1,!0)).sign=e.sign,t.__trim())}},{key:"add",value:function(e,t){var n=e.sign;return n===t.sign?r.__absoluteAdd(e,t,n):0<=r.__absoluteCompare(e,t)?r.__absoluteSub(e,t,n):r.__absoluteSub(t,e,!n)}},{key:"subtract",value:function(e,t){var n=e.sign;return n===t.sign?0<=r.__absoluteCompare(e,t)?r.__absoluteSub(e,t,n):r.__absoluteSub(t,e,!n):r.__absoluteAdd(e,t,n)}},{key:"leftShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?r.__rightShiftByAbsolute(e,t):r.__leftShiftByAbsolute(e,t)}},{key:"signedRightShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?r.__leftShiftByAbsolute(e,t):r.__rightShiftByAbsolute(e,t)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(e,t){return 0>r.__compareToBigInt(e,t)}},{key:"lessThanOrEqual",value:function(e,t){return 0>=r.__compareToBigInt(e,t)}},{key:"greaterThan",value:function(e,t){return 0<r.__compareToBigInt(e,t)}},{key:"greaterThanOrEqual",value:function(e,t){return 0<=r.__compareToBigInt(e,t)}},{key:"equal",value:function(e,t){if(e.sign!==t.sign||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}},{key:"notEqual",value:function(e,t){return!r.equal(e,t)}},{key:"bitwiseAnd",value:function(e,t){if(!e.sign&&!t.sign)return r.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var n=o(e.length,t.length)+1;return e=r.__absoluteSubOne(e,n),t=r.__absoluteSubOne(t),e=r.__absoluteOr(e,t,e),r.__absoluteAddOne(e,!0,e).__trim()}return e.sign&&(e=(t=[t,e])[0],t=t[1]),r.__absoluteAndNot(e,r.__absoluteSubOne(t)).__trim()}},{key:"bitwiseXor",value:function(e,t){if(!e.sign&&!t.sign)return r.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var n=o(e.length,t.length);return e=r.__absoluteSubOne(e,n),t=r.__absoluteSubOne(t),r.__absoluteXor(e,t,e).__trim()}return n=o(e.length,t.length)+1,e.sign&&(e=(t=[t,e])[0],t=t[1]),t=r.__absoluteSubOne(t,n),t=r.__absoluteXor(t,e,t),r.__absoluteAddOne(t,!0,t).__trim()}},{key:"bitwiseOr",value:function(e,t){var n=o(e.length,t.length);return e.sign||t.sign?e.sign&&t.sign?(e=r.__absoluteSubOne(e,n),t=r.__absoluteSubOne(t),e=r.__absoluteAnd(e,t,e),r.__absoluteAddOne(e,!0,e).__trim()):(e.sign&&(e=(t=[t,e])[0],t=t[1]),t=r.__absoluteSubOne(t,n),t=r.__absoluteAndNot(t,e,t),r.__absoluteAddOne(t,!0,t).__trim()):r.__absoluteOr(e,t).__trim()}},{key:"asIntN",value:function(e,t){if(0===t.length)return t;if(0===e)return r.__zero();if(e>=r.__kMaxLengthBits)return t;var n=e+31>>>5;if(t.length<n)return t;var i=t.__unsignedDigit(n-1),s=1<<(31&e-1);if(t.length===n&&i<s)return t;if((i&s)!==s)return r.__truncateToNBits(e,t);if(!t.sign)return r.__truncateAndSubFromPowerOfTwo(e,t,!0);if(!(i&s-1)){for(var o=n-2;0<=o;o--)if(0!==t.__digit(o))return r.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&i===s?t:r.__truncateToNBits(e,t)}return r.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:"asUintN",value:function(e,t){if(0===t.length)return t;if(0===e)return r.__zero();if(t.sign){if(e>r.__kMaxLengthBits)throw new RangeError("BigInt too big");return r.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=r.__kMaxLengthBits)return t;var n=e+31>>>5;if(t.length<n)return t;var i=31&e;return t.length!=n||0!==i&&0!=t.__digit(n-1)>>>i?r.__truncateToNBits(e,t):t}},{key:"ADD",value:function(e,t){if(e=r.__toPrimitive(e),t=r.__toPrimitive(t),"string"==typeof e)return"string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=r.__toNumeric(e),t=r.__toNumeric(t),r.__isBigInt(e)&&r.__isBigInt(t))return r.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(e,t){return r.__compare(e,t,0)}},{key:"LE",value:function(e,t){return r.__compare(e,t,1)}},{key:"GT",value:function(e,t){return r.__compare(e,t,2)}},{key:"GE",value:function(e,t){return r.__compare(e,t,3)}},{key:"EQ",value:function(t,n){for(;;){if(r.__isBigInt(t))return r.__isBigInt(n)?r.equal(t,n):r.EQ(n,t);if("number"==typeof t){if(r.__isBigInt(n))return r.__equalToNumber(n,t);if("object"!==e(n))return t==n;n=r.__toPrimitive(n)}else if("string"==typeof t){if(r.__isBigInt(n))return null!==(t=r.__fromString(t))&&r.equal(t,n);if("object"!==e(n))return t==n;n=r.__toPrimitive(n)}else if("boolean"==typeof t){if(r.__isBigInt(n))return r.__equalToNumber(n,+t);if("object"!==e(n))return t==n;n=r.__toPrimitive(n)}else if("symbol"===e(t)){if(r.__isBigInt(n))return!1;if("object"!==e(n))return t==n;n=r.__toPrimitive(n)}else{if("object"!==e(t))return t==n;if("object"===e(n)&&n.constructor!==r)return t==n;t=r.__toPrimitive(t)}}}},{key:"NE",value:function(e,t){return!r.EQ(e,t)}},{key:"__zero",value:function(){return new r(0,!1)}},{key:"__oneDigit",value:function(e,t){return(t=new r(1,t)).__setDigit(0,e),t}},{key:"__decideRounding",value:function(e,t,n,i){if(0<t)return-1;if(0>t)t=-t-1;else{if(0===n)return-1;n--,i=e.__digit(n),t=31}if(!(i&(t=1<<t)))return-1;if(i&--t)return 1;for(;0<n;)if(n--,0!==e.__digit(n))return 1;return 0}},{key:"__fromDouble",value:function(e){r.__kBitConversionDouble[0]=e;var t=(2047&r.__kBitConversionInts[1]>>>20)-1023,n=1+(t>>>5);e=new r(n,0>e);var i=1048575&r.__kBitConversionInts[1]|1048576,s=r.__kBitConversionInts[0];if(20>(t&=31)){var o=20-t,a=o+32;t=i>>>o,i=i<<32-o|s>>>o,s<<=32-o}else 20===t?(a=32,t=i,i=s):(a=32-(o=t-20),t=i<<o|s>>>32-o,i=s<<o);for(e.__setDigit(n-1,t),n-=2;0<=n;n--)0<a?(a-=32,t=i,i=s):t=0,e.__setDigit(n,t);return e.__trim()}},{key:"__isWhitespace",value:function(e){return!!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?10>=(e&=131071)||40==e||41==e||47==e||95==e||4096==e:65279==e)}},{key:"__fromString",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=0,i=e.length,s=0;if(s===i)return r.__zero();for(var o=e.charCodeAt(s);r.__isWhitespace(o);){if(++s===i)return r.__zero();o=e.charCodeAt(s)}if(43===o){if(++s===i)return null;o=e.charCodeAt(s),n=1}else if(45===o){if(++s===i)return null;o=e.charCodeAt(s),n=-1}if(0===t){if(t=10,48===o){if(++s===i)return r.__zero();if(88===(o=e.charCodeAt(s))||120===o){if(t=16,++s===i)return null;o=e.charCodeAt(s)}else if(79===o||111===o){if(t=8,++s===i)return null;o=e.charCodeAt(s)}else if(66===o||98===o){if(t=2,++s===i)return null;o=e.charCodeAt(s)}}}else if(16===t&&48===o){if(++s===i)return r.__zero();if(88===(o=e.charCodeAt(s))||120===o){if(++s===i)return null;o=e.charCodeAt(s)}}for(;48===o;){if(++s===i)return r.__zero();o=e.charCodeAt(s)}var a=i-s,l=r.__kMaxBitsPerChar[t],u=r.__kBitsPerCharTableMultiplier-1;if(a>1073741824/l)return null;a=new r(31+(l*a+u>>>r.__kBitsPerCharTableShift)>>>5,!1);var c=10>t?t:10,p=10<t?t-10:0;if(t&t-1){a.__initializeDigits(),h=!1,d=0;do{for(f=0,_=1;;){if(o-48>>>0<c)u=o-48;else{if(!((32|o)-97>>>0<p)){h=!0;break}u=(32|o)-87}if(4294967295<(m=_*t))break;if(_=m,f=f*t+u,d++,++s===i){h=!0;break}o=e.charCodeAt(s)}u=32*r.__kBitsPerCharTableMultiplier-1,a.__inplaceMultiplyAdd(_,f,l*d+u>>>r.__kBitsPerCharTableShift+5)}while(!h)}else{l>>=r.__kBitsPerCharTableShift;var h=[],d=[],f=!1;do{for(var _,m=u=0;;){if(o-48>>>0<c)_=o-48;else{if(!((32|o)-97>>>0<p)){f=!0;break}_=(32|o)-87}if(m+=l,u=u<<l|_,++s===i){f=!0;break}if(o=e.charCodeAt(s),32<m+l)break}h.push(u),d.push(m)}while(!f);r.__fillFromParts(a,h,d)}if(s!==i){if(!r.__isWhitespace(o))return null;for(s++;s<i;s++)if(o=e.charCodeAt(s),!r.__isWhitespace(o))return null}return 0!==n&&10!==t?null:(a.sign=-1===n,a.__trim())}},{key:"__fillFromParts",value:function(e,t,n){for(var i=0,r=0,s=0,o=t.length-1;0<=o;o--){var a=t[o],l=n[o];r|=a<<s,32===(s+=l)?(e.__setDigit(i++,r),s=0,r=0):32<s&&(e.__setDigit(i++,r),r=a>>>l-(s-=32))}if(0!==r){if(i>=e.length)throw Error("implementation bug");e.__setDigit(i++,r)}for(;i<e.length;i++)e.__setDigit(i,0)}},{key:"__toStringBasePowerOfTwo",value:function(e,t){var n=e.length,i=t-1;i=(15&(i=(51&(i=(85&i>>>1)+(85&i))>>>2)+(51&i))>>>4)+(15&i),--t;var s=e.__digit(n-1),o=r.__clz32(s),a=0|(32*n-o+i-1)/i;if(e.sign&&a++,268435456<a)throw Error("string too long");o=Array(a),--a;for(var l=0,u=0,c=0;c<n-1;c++){var p=e.__digit(c);for(l=(l|p<<u)&t,o[a--]=r.__kConversionChars[l],l=p>>>(u=i-u),u=32-u;u>=i;)o[a--]=r.__kConversionChars[l&t],l>>>=i,u-=i}for(o[a--]=r.__kConversionChars[(l|s<<u)&t],l=s>>>i-u;0!==l;)o[a--]=r.__kConversionChars[l&t],l>>>=i;if(e.sign&&(o[a--]="-"),-1!==a)throw Error("implementation bug");return o.join("")}},{key:"__toStringGeneric",value:function(e,t,n){var i=e.length;if(0===i)return"";if(1===i)return t=e.__unsignedDigit(0).toString(t),!1===n&&e.sign&&(t="-"+t),t;var s=32*i-r.__clz32(e.__digit(i-1));i=r.__kMaxBitsPerChar[t]-1,i=1+(0|((s*=r.__kBitsPerCharTableMultiplier)+(i-1))/i)>>1;var o=(s=r.exponentiate(r.__oneDigit(t,!1),r.__oneDigit(i,!1))).__unsignedDigit(0);if(1===s.length&&65535>=o){(s=new r(e.length,!1)).__initializeDigits();for(var a=0,l=2*e.length-1;0<=l;l--)a=a<<16|e.__halfDigit(l),s.__setHalfDigit(l,0|a/o),a=0|a%o;o=a.toString(t)}else s=(o=r.__absoluteDivLarge(e,s,!0,!0)).quotient,o=o.remainder.__trim(),o=r.__toStringGeneric(o,t,!0);for(s.__trim(),t=r.__toStringGeneric(s,t,!0);o.length<i;)o="0"+o;return!1===n&&e.sign&&(t="-"+t),t+o}},{key:"__unequalSign",value:function(e){return e?-1:1}},{key:"__absoluteGreater",value:function(e){return e?-1:1}},{key:"__absoluteLess",value:function(e){return e?1:-1}},{key:"__compareToBigInt",value:function(e,t){var n=e.sign;return n!==t.sign?r.__unequalSign(n):0<(e=r.__absoluteCompare(e,t))?r.__absoluteGreater(n):0>e?r.__absoluteLess(n):0}},{key:"__compareToNumber",value:function(e,t){if(1|t){var n=e.sign,i=0>t;if(n!==i)return r.__unequalSign(n);if(0===e.length){if(i)throw Error("implementation bug");return 0===t?0:-1}return 1<e.length?r.__absoluteGreater(n):(t=s(t),(e=e.__unsignedDigit(0))>t?r.__absoluteGreater(n):e<t?r.__absoluteLess(n):0)}return r.__compareToDouble(e,t)}},{key:"__compareToDouble",value:function(e,t){if(t!=t)return t;if(t===1/0)return-1;if(-1/0===t)return 1;var n=e.sign;if(n!==0>t)return r.__unequalSign(n);if(0===t)throw Error("implementation bug: should be handled elsewhere");if(0===e.length)return-1;if(r.__kBitConversionDouble[0]=t,2047==(t=2047&r.__kBitConversionInts[1]>>>20))throw Error("implementation bug: handled elsewhere");var i=t-1023;if(0>i)return r.__absoluteGreater(n);t=e.length;var s=e.__digit(t-1),o=r.__clz32(s),a=32*t-o;if(a<(i+=1))return r.__absoluteLess(n);if(a>i)return r.__absoluteGreater(n);i=1048576|1048575&r.__kBitConversionInts[1];var l=r.__kBitConversionInts[0];if((o=31-o)!=(a-1)%31)throw Error("implementation bug");if(20>o){var u=20-o;o=u+32,a=i>>>u,i=i<<32-u|l>>>u,l<<=32-u}else 20===o?(o=32,a=i,i=l):(o=32-(u=o-20),a=i<<u|l>>>32-u,i=l<<u);if((s>>>=0)>(a>>>=0))return r.__absoluteGreater(n);if(s<a)return r.__absoluteLess(n);for(t-=2;0<=t;t--){if(0<o?(o-=32,a=i>>>0,i=l,l=0):a=0,(s=e.__unsignedDigit(t))>a)return r.__absoluteGreater(n);if(s<a)return r.__absoluteLess(n)}if(0!==i||0!==l){if(0===o)throw Error("implementation bug");return r.__absoluteLess(n)}return 0}},{key:"__equalToNumber",value:function(e,t){return t|0===t?0===t?0===e.length:1===e.length&&e.sign===0>t&&e.__unsignedDigit(0)===s(t):0===r.__compareToDouble(e,t)}},{key:"__comparisonResultToBool",value:function(e,t){switch(t){case 0:return 0>e;case 1:return 0>=e;case 2:return 0<e;case 3:return 0<=e}throw Error("unreachable")}},{key:"__compare",value:function(e,t,n){if(e=r.__toPrimitive(e),t=r.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(r.__isBigInt(e)&&"string"==typeof t)return null!==(t=r.__fromString(t))&&r.__comparisonResultToBool(r.__compareToBigInt(e,t),n);if("string"==typeof e&&r.__isBigInt(t))return null!==(e=r.__fromString(e))&&r.__comparisonResultToBool(r.__compareToBigInt(e,t),n);if(e=r.__toNumeric(e),t=r.__toNumeric(t),r.__isBigInt(e)){if(r.__isBigInt(t))return r.__comparisonResultToBool(r.__compareToBigInt(e,t),n);if("number"!=typeof t)throw Error("implementation bug");return r.__comparisonResultToBool(r.__compareToNumber(e,t),n)}if("number"!=typeof e)throw Error("implementation bug");if(r.__isBigInt(t))return r.__comparisonResultToBool(r.__compareToNumber(t,e),2^n);if("number"!=typeof t)throw Error("implementation bug");return 0===n?e<t:1===n?e<=t:2===n?e>t:3===n?e>=t:void 0}},{key:"__absoluteAdd",value:function(e,t,n){if(e.length<t.length)return r.__absoluteAdd(t,e,n);if(0===e.length)return e;if(0===t.length)return e.sign===n?e:r.unaryMinus(e);var i=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&i++,n=new r(i,n);for(var s=i=0;s<t.length;s++){var o=t.__digit(s),a=e.__digit(s),l=(65535&a)+(65535&o)+i;i=(o=(a>>>16)+(o>>>16)+(l>>>16))>>>16,n.__setDigit(s,65535&l|o<<16)}for(;s<e.length;s++)i=(l=((l=e.__digit(s))>>>16)+((t=(65535&l)+i)>>>16))>>>16,n.__setDigit(s,65535&t|l<<16);return s<n.length&&n.__setDigit(s,i),n.__trim()}},{key:"__absoluteSub",value:function(e,t,n){if(0===e.length)return e;if(0===t.length)return e.sign===n?e:r.unaryMinus(e);n=new r(e.length,n);for(var i=0,s=0;s<t.length;s++){var o=e.__digit(s),a=t.__digit(s),l=(65535&o)-(65535&a)-i;i=1&(o=(o>>>16)-(a>>>16)-(i=1&l>>>16))>>>16,n.__setDigit(s,65535&l|o<<16)}for(;s<e.length;s++)i=1&(l=((l=e.__digit(s))>>>16)-(i=1&(t=(65535&l)-i)>>>16))>>>16,n.__setDigit(s,65535&t|l<<16);return n.__trim()}},{key:"__absoluteAddOne",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.length;null===n?n=new r(i,t):n.sign=t;for(var s,o=!0,a=0;a<i;a++)s=e.__digit(a),o&&(o=-1===s,s=0|s+1),n.__setDigit(a,s);return o&&n.__setDigitGrow(i,1),n}},{key:"__absoluteSubOne",value:function(e,t){for(var n,i=e.length,s=new r(t=t||i,!1),o=!0,a=0;a<i;a++)n=e.__digit(a),o&&(o=0===n,n=0|n-1),s.__setDigit(a,n);if(o)throw Error("implementation bug");for(e=i;e<t;e++)s.__setDigit(e,0);return s}},{key:"__absoluteAnd",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.length,s=t.length,o=s;for(i<s&&(o=i,i=e,e=t,t=i),i=o,null===n?n=new r(i,!1):i=n.length,s=0;s<o;s++)n.__setDigit(s,e.__digit(s)&t.__digit(s));for(;s<i;s++)n.__setDigit(s,0);return n}},{key:"__absoluteAndNot",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.length,s=t.length,o=s;i<s&&(o=i),s=i,null===n?n=new r(s,!1):s=n.length;for(var a=0;a<o;a++)n.__setDigit(a,e.__digit(a)&~t.__digit(a));for(;a<i;a++)n.__setDigit(a,e.__digit(a));for(;a<s;a++)n.__setDigit(a,0);return n}},{key:"__absoluteOr",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.length,s=t.length,o=s;if(i<s){o=i;var a=e;e=t,i=s,t=a}for(s=i,null===n?n=new r(s,!1):s=n.length,a=0;a<o;a++)n.__setDigit(a,e.__digit(a)|t.__digit(a));for(;a<i;a++)n.__setDigit(a,e.__digit(a));for(;a<s;a++)n.__setDigit(a,0);return n}},{key:"__absoluteXor",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.length,s=t.length,o=s;if(i<s){o=i;var a=e;e=t,i=s,t=a}for(s=i,null===n?n=new r(s,!1):s=n.length,a=0;a<o;a++)n.__setDigit(a,e.__digit(a)^t.__digit(a));for(;a<i;a++)n.__setDigit(a,e.__digit(a));for(;a<s;a++)n.__setDigit(a,0);return n}},{key:"__absoluteCompare",value:function(e,t){var n=e.length-t.length;if(0!=n)return n;for(n=e.length-1;0<=n&&e.__digit(n)===t.__digit(n);)n--;return 0>n?0:e.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(e,t,n,i){if(0!==t){for(var s=65535&t,o=t>>>16,a=t=0,l=0,u=0;u<e.length;u++,i++){var c=n.__digit(i),p=65535&c;c>>>=16;var h=e.__digit(u),d=65535&h,f=h>>>16;h=r.__imul(d,s),d=r.__imul(d,o);var _=r.__imul(f,s);t=(a=(d>>>16)+(_>>>16)+(65535&(f=r.__imul(f,o)))+(t=(c+=l+t+((p+=a+(65535&h))>>>16)+(h>>>16)+(65535&d)+(65535&_))>>>16))>>>16,a&=65535,l=f>>>16,c=65535&p|c<<16,n.__setDigit(i,c)}for(;0!==t||0!==a||0!==l;i++)s=((s=n.__digit(i))>>>16)+((e=(65535&s)+a)>>>16)+l+t,l=a=0,t=s>>>16,s=65535&e|s<<16,n.__setDigit(i,s)}}},{key:"__internalMultiplyAdd",value:function(e,t,n,i,s){for(var o=0,a=0;a<i;a++){var l=e.__digit(a),u=r.__imul(65535&l,t),c=(65535&u)+o+n;n=c>>>16,n=(u=(65535&(o=r.__imul(l>>>16,t)))+(u>>>16)+n)>>>16,o>>>=16,s.__setDigit(a,u<<16|65535&c)}if(s.length>i)for(s.__setDigit(i++,n+o);i<s.length;)s.__setDigit(i++,0);else if(0!==n+o)throw Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(e,t,n){null===n&&(n=new r(e.length,!1));for(var i=0,s=2*e.length-1;0<=s;s-=2){var o=0|(i=(i<<16|e.__halfDigit(s))>>>0)/t,a=0|(i=((i=0|i%t)<<16|e.__halfDigit(s-1))>>>0)/t;i=0|i%t,n.__setDigit(s>>>1,o<<16|a)}return n}},{key:"__absoluteModSmall",value:function(e,t){for(var n=0,i=2*e.length-1;0<=i;i--)n=0|(n=(n<<16|e.__halfDigit(i))>>>0)%t;return n}},{key:"__absoluteDivLarge",value:function(e,t,n,i){var s=t.__halfDigitLength(),o=t.length,a=e.__halfDigitLength()-s,l=null;n&&(l=new r(a+2>>>1,!1)).__initializeDigits();var u=new r(s+2>>>1,!1);u.__initializeDigits();var c=r.__clz16(t.__halfDigit(s-1));0<c&&(t=r.__specialLeftShift(t,c,0)),e=r.__specialLeftShift(e,c,1);for(var p=t.__halfDigit(s-1),h=0;0<=a;a--){var d=65535,f=e.__halfDigit(a+s);if(f!==p){d=0|(f=(f<<16|e.__halfDigit(a+s-1))>>>0)/p,f=0|f%p;for(var _=t.__halfDigit(s-2),m=e.__halfDigit(a+s-2);r.__imul(d,_)>>>0>(f<<16|m)>>>0&&(d--,!(65535<(f+=p))););}r.__internalMultiplyAdd(t,d,0,o,u),0!==(f=e.__inplaceSub(u,a,s+1))&&(f=e.__inplaceAdd(t,a,s),e.__setHalfDigit(a+s,e.__halfDigit(a+s)+f),d--),n&&(1&a?h=d<<16:l.__setDigit(a>>>1,h|d))}return i?(e.__inplaceRightShift(c),n?{quotient:l,remainder:e}:e):n?l:void 0}},{key:"__clz16",value:function(e){return r.__clz32(e)-16}},{key:"__specialLeftShift",value:function(e,t,n){var i=e.length,s=new r(i+n,!1);if(0===t){for(t=0;t<i;t++)s.__setDigit(t,e.__digit(t));return 0<n&&s.__setDigit(i,0),s}for(var o,a=0,l=0;l<i;l++)o=e.__digit(l),s.__setDigit(l,o<<t|a),a=o>>>32-t;return 0<n&&s.__setDigit(i,a),s}},{key:"__leftShiftByAbsolute",value:function(e,t){var n=r.__toShiftAmount(t);if(0>n)throw new RangeError("BigInt too big");t=n>>>5;var i=31&n,s=e.length,o=0!==i&&0!=e.__digit(s-1)>>>32-i,a=s+t+(o?1:0);if(n=new r(a,e.sign),0===i){for(i=0;i<t;i++)n.__setDigit(i,0);for(;i<a;i++)n.__setDigit(i,e.__digit(i-t))}else{for(var l=a=0;l<t;l++)n.__setDigit(l,0);for(var u=0;u<s;u++)l=e.__digit(u),n.__setDigit(u+t,l<<i|a),a=l>>>32-i;if(o)n.__setDigit(s+t,a);else if(0!==a)throw Error("implementation bug")}return n.__trim()}},{key:"__rightShiftByAbsolute",value:function(e,t){var n=e.length,i=e.sign,s=r.__toShiftAmount(t);if(0>s)return r.__rightShiftByMaximum(i);var o=31&s,a=n-(t=s>>>5);if(0>=a)return r.__rightShiftByMaximum(i);if(s=!1,i)if(e.__digit(t)&(1<<o)-1)s=!0;else for(var l=0;l<t;l++)if(0!==e.__digit(l)){s=!0;break}if(s&&0===o&&0==~e.__digit(n-1)&&a++,i=new r(a,i),0===o)for(o=t;o<n;o++)i.__setDigit(o-t,e.__digit(o));else{a=e.__digit(t)>>>o,l=n-t-1;for(var u=0;u<l;u++)n=e.__digit(u+t+1),i.__setDigit(u,n<<32-o|a),a=n>>>o;i.__setDigit(l,a)}return s&&(i=r.__absoluteAddOne(i,!0,i)),i.__trim()}},{key:"__rightShiftByMaximum",value:function(e){return e?r.__oneDigit(1,!0):r.__zero()}},{key:"__toShiftAmount",value:function(e){return 1<e.length||(e=e.__unsignedDigit(0))>r.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";if("object"!==e(t)||t.constructor===r)return t;var i=t[Symbol.toPrimitive];if(i){if("object"!==e(n=i(n)))return n;throw new TypeError("Cannot convert object to primitive value")}if((n=t.valueOf)&&"object"!==e(n=n.call(t)))return n;if((n=t.toString)&&"object"!==e(n=n.call(t)))return n;throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(e){return r.__isBigInt(e)?e:+e}},{key:"__isBigInt",value:function(t){return"object"===e(t)&&t.constructor===r}},{key:"__truncateToNBits",value:function(e,t){var n=e+31>>>5,i=new r(n,t.sign);--n;for(var s=0;s<n;s++)i.__setDigit(s,t.__digit(s));return t=t.__digit(n),31&e&&(t=t<<(e=32-(31&e))>>>e),i.__setDigit(n,t),i.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(e,t,n){var i=Math.min,s=e+31>>>5;n=new r(s,n);var o=0,a=0;for(i=i(--s,t.length);o<i;o++){var l=t.__digit(o),u=-(65535&l)-a;a=1&(l=-(l>>>16)-(a=1&u>>>16))>>>16,n.__setDigit(o,65535&u|l<<16)}for(;o<s;o++)n.__setDigit(o,0|-a);return t=s<t.length?t.__digit(s):0,0==(e&=31)?a=65535&(a=-(65535&t)-a)|-(t>>>16)-(1&a>>>16)<<16:(t=t<<(e=32-e)>>>e,a=(65535&(a=(65535&(e=1<<32-e))-(65535&t)-a)|(e>>>16)-(t>>>16)-(1&a>>>16)<<16)&e-1),n.__setDigit(s,a),n.__trim()}},{key:"__digitPow",value:function(e,t){for(var n=1;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}}]),r}(l(Array));return _.__kMaxLength=33554432,_.__kMaxLengthBits=_.__kMaxLength<<5,_.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],_.__kBitsPerCharTableShift=5,_.__kBitsPerCharTableMultiplier=1<<_.__kBitsPerCharTableShift,_.__kConversionChars="0123456789abcdefghijklmnopqrstuvwxyz".split(""),_.__kBitConversionBuffer=new ArrayBuffer(8),_.__kBitConversionDouble=new Float64Array(_.__kBitConversionBuffer),_.__kBitConversionInts=new Int32Array(_.__kBitConversionBuffer),_.__clz32=f||function(e){var t=Math.LN2,n=Math.log;return 0===e?32:0|31-(0|n(e>>>0)/t)},_.__imul=d||function(e,t){return 0|e*t},_}()},function(e,t,n){(function(e,t){!function(e,n){function i(e){delete a[e]}function r(e){if(l)setTimeout(r,0,e);else{var t=a[e];if(t){l=!0;try{var s=t.callback,o=t.args;switch(o.length){case 0:s();break;case 1:s(o[0]);break;case 2:s(o[0],o[1]);break;case 3:s(o[0],o[1],o[2]);break;default:s.apply(n,o)}}finally{i(e),l=!1}}}}if(!e.setImmediate){var s,o=1,a={},l=!1,u=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?s=function(e){t.nextTick((function(){r(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&r(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),s=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},s=function(t){e.port2.postMessage(t)}}():u&&"onreadystatechange"in u.createElement("script")?function(){var e=u.documentElement;s=function(t){var n=u.createElement("script");n.onreadystatechange=function(){r(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():s=function(e){setTimeout(r,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];return a[o]={callback:e,args:t},s(o),o++},c.clearImmediate=i}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(0),n(8))},function(e,t){function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function r(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function s(){d&&p&&(d=!1,p.length?h=p.concat(h):f=-1,h.length&&o())}function o(){if(!d){var e=r(s);d=!0;for(var t=h.length;t;){for(p=h,h=[];++f<t;)p&&p[f].run();f=-1,t=h.length}p=null,d=!1,function(e){if(c===clearTimeout)return clearTimeout(e);if((c===i||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}(e)}}function a(e,t){this.fun=e,this.array=t}function l(){}e=e.exports={};try{var u="function"==typeof setTimeout?setTimeout:n}catch(e){u=n}try{var c="function"==typeof clearTimeout?clearTimeout:i}catch(e){c=i}var p,h=[],d=!1,f=-1;e.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new a(e,t)),1!==h.length||d||r(o)},a.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=l,e.addListener=l,e.once=l,e.off=l,e.removeListener=l,e.removeAllListeners=l,e.emit=l,e.prependListener=l,e.prependOnceListener=l,e.listeners=function(e){return[]},e.binding=function(e){throw Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw Error("process.chdir is not supported")},e.umask=function(){return 0}},function(e,t){Sk.asserts={},Sk.asserts.assert=function(e,t){return e},Sk.exportSymbol("Sk.asserts.assert",Sk.asserts.assert),Sk.asserts.fail=function(e){},Sk.exportSymbol("Sk.asserts.fail",Sk.asserts.fail)},function(e,t){Sk.bool_check=function(e,t){if(null==e||"boolean"!=typeof e)throw Error("must specify "+t+" and it must be a boolean")},Sk.python2={print_function:!1,division:!1,absolute_import:null,unicode_literals:!1,python3:!1,class_repr:!1,inherit_from_object:!1,super_args:!1,octal_number_literal:!1,bankers_rounding:!1,python_version:!1,dunder_round:!1,exceptions:!1,no_long_type:!1,ceil_floor_int:!1,silent_octal_literal:!0},Sk.python3={print_function:!0,division:!0,absolute_import:null,unicode_literals:!0,python3:!0,class_repr:!0,inherit_from_object:!0,super_args:!0,octal_number_literal:!0,bankers_rounding:!0,python_version:!0,dunder_round:!0,exceptions:!0,no_long_type:!0,ceil_floor_int:!0,silent_octal_literal:!1},Sk.configure=function(e){Sk.output=e.output||Sk.output,Sk.asserts.assert("function"==typeof Sk.output),Sk.debugout=e.debugout||Sk.debugout,Sk.asserts.assert("function"==typeof Sk.debugout),Sk.uncaughtException=e.uncaughtException||Sk.uncaughtException,Sk.asserts.assert("function"==typeof Sk.uncaughtException),Sk.read=e.read||Sk.read,Sk.asserts.assert("function"==typeof Sk.read),Sk.nonreadopen=e.nonreadopen||!1,Sk.asserts.assert("boolean"==typeof Sk.nonreadopen),Sk.fileopen=e.fileopen||void 0,Sk.asserts.assert("function"==typeof Sk.fileopen||void 0===Sk.fileopen),Sk.filewrite=e.filewrite||void 0,Sk.asserts.assert("function"==typeof Sk.filewrite||void 0===Sk.filewrite),Sk.timeoutMsg=e.timeoutMsg||Sk.timeoutMsg,Sk.asserts.assert("function"==typeof Sk.timeoutMsg),Sk.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg),Sk.sysargv=e.sysargv||Sk.sysargv,Sk.asserts.assert(Sk.isArrayLike(Sk.sysargv)),Sk.__future__=e.__future__||Sk.python3,Sk.bool_check(Sk.__future__.print_function,"Sk.__future__.print_function"),Sk.bool_check(Sk.__future__.division,"Sk.__future__.division"),Sk.bool_check(Sk.__future__.unicode_literals,"Sk.__future__.unicode_literals"),Sk.bool_check(Sk.__future__.class_repr,"Sk.__future__.class_repr"),Sk.bool_check(Sk.__future__.inherit_from_object,"Sk.__future__.inherit_from_object"),Sk.bool_check(Sk.__future__.super_args,"Sk.__future__.super_args"),Sk.bool_check(Sk.__future__.octal_number_literal,"Sk.__future__.octal_number_literal"),Sk.bool_check(Sk.__future__.bankers_rounding,"Sk.__future__.bankers_rounding"),Sk.bool_check(Sk.__future__.python_version,"Sk.__future__.python_version"),Sk.bool_check(Sk.__future__.dunder_round,"Sk.__future__.dunder_round"),Sk.bool_check(Sk.__future__.exceptions,"Sk.__future__.exceptions"),Sk.bool_check(Sk.__future__.no_long_type,"Sk.__future__.no_long_type"),Sk.bool_check(Sk.__future__.ceil_floor_int,"Sk.__future__.ceil_floor_int"),Sk.bool_check(Sk.__future__.silent_octal_literal,"Sk.__future__.silent_octal_literal"),Sk.imageProxy=e.imageProxy||"http://localhost:8080/320x",Sk.asserts.assert("string"==typeof Sk.imageProxy||"function"==typeof Sk.imageProxy),Sk.inputfun=e.inputfun||Sk.inputfun,Sk.asserts.assert("function"==typeof Sk.inputfun),Sk.inputfunTakesPrompt=e.inputfunTakesPrompt||!1,Sk.asserts.assert("boolean"==typeof Sk.inputfunTakesPrompt),Sk.retainGlobals=e.retainglobals||e.retainGlobals||!1,Sk.asserts.assert("boolean"==typeof Sk.retainGlobals),Sk.debugging=e.debugging||!1,Sk.asserts.assert("boolean"==typeof Sk.debugging),Sk.killableWhile=e.killableWhile||!1,Sk.asserts.assert("boolean"==typeof Sk.killableWhile),Sk.killableFor=e.killableFor||!1,Sk.asserts.assert("boolean"==typeof Sk.killableFor),Sk.signals=e.signals,Sk.signals=!0===Sk.signals?{listeners:[],addEventListener(e){Sk.signals.listeners.push(e)},removeEventListener(e){0<=(e=Sk.signals.listeners.indexOf(e))&&Sk.signals.listeners.splice(e,1)},signal(e,t){for(var n=0;n<Sk.signals.listeners.length;n++)Sk.signals.listeners[n].call(null,e,t)}}:null,Sk.asserts.assert("object"==typeof Sk.signals),Sk.breakpoints=e.breakpoints||function(){return!0},Sk.asserts.assert("function"==typeof Sk.breakpoints),Sk.setTimeout=e.setTimeout,void 0===Sk.setTimeout&&(Sk.setTimeout="function"==typeof setTimeout?function(e,t){setTimeout(e,t)}:function(e,t){e()}),Sk.asserts.assert("function"==typeof Sk.setTimeout),"execLimit"in e&&(Sk.execLimit=e.execLimit),"yieldLimit"in e&&(Sk.yieldLimit=e.yieldLimit),e.syspath&&(Sk.syspath=e.syspath,Sk.asserts.assert(Sk.isArrayLike(Sk.syspath)),Sk.realsyspath=void 0,Sk.sysmodules=new Sk.builtin.dict([])),Sk.misceval.softspace_=!1,Sk.switch_version(Sk.__future__.python3),Sk.builtin.str.$next=Sk.__future__.python3?new Sk.builtin.str("__next__"):new Sk.builtin.str("next"),Sk.setupOperators(Sk.__future__.python3),Sk.setupDunderMethods(Sk.__future__.python3),Sk.setupObjects(Sk.__future__.python3),Sk.token.setupTokens(Sk.__future__.python3)},Sk.exportSymbol("Sk.configure",Sk.configure),Sk.uncaughtException=function(e){throw e},Sk.uncaughtException=function(e){throw e},Sk.exportSymbol("Sk.uncaughtException",Sk.uncaughtException),Sk.timeoutMsg=function(){return"Program exceeded run time limit."},Sk.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg),Sk.execLimit=Number.POSITIVE_INFINITY,Sk.yieldLimit=Number.POSITIVE_INFINITY,Sk.output=function(e){},Sk.read=function(e){if(void 0===Sk.builtinFiles)throw"skulpt-stdlib.js has not been loaded";if(void 0===Sk.builtinFiles.files[e])throw"File not found: '"+e+"'";return Sk.builtinFiles.files[e]},Sk.sysargv=[],Sk.getSysArgv=function(){return Sk.sysargv},Sk.exportSymbol("Sk.getSysArgv",Sk.getSysArgv),Sk.syspath=[],Sk.inBrowser=void 0!==Sk.global.document,Sk.debugout=function(e){},void 0!==Sk.global.write?Sk.output=Sk.global.write:void 0!==Sk.global.console&&void 0!==Sk.global.console.log?Sk.output=function(e){Sk.global.console.log(e)}:void 0!==Sk.global.print&&(Sk.output=Sk.global.print),void 0!==Sk.global.console&&void 0!==Sk.global.console.log?Sk.debugout=function(e){Sk.global.console.log(e)}:void 0!==Sk.global.print&&(Sk.debugout=Sk.global.print),Sk.inputfun=function(e){return window.prompt(e)},Sk.setup_method_mappings=function(){},Sk.setupDictIterators=function(e){},Sk.switch_version=function(e){const t={float_:{method_names:["__round__"],2:[!1],3:[!0]},int_:{method_names:["__round__"],2:[!1],3:[!0]},list:{method_names:["clear","copy","sort"],2:[!1,!1,!0],3:[!0,!0,!0]},dict:{method_names:["has_key","keys","items","values"],2:[!0,!0,!0,!0],3:[!1,!0,!0,!0]}};for(let s in t){const o=Sk.builtin[s],a=t[s].method_names;var n=t[s][3];if(e&&void 0===o.py3$methods)break;if(void 0===o.py3$methods){o.py3$methods={};for(var i=0;i<a.length;i++){var r=a[i];n[i]&&(o.py3$methods[r]=o.prototype[r].d$def)}}for(e?i=o.py3$methods:(n=t[s][2],i=o.py2$methods),r=0;r<a.length;r++){const e=a[r];delete o.prototype[e],n[r]&&(o.prototype[e]=new Sk.builtin.method_descriptor(o,i[e]))}}},Sk.exportSymbol("Sk.__future__",Sk.__future__),Sk.exportSymbol("Sk.inputfun",Sk.inputfun)},function(e,t){function n(e){return this.prototype[e.$mangled]}function i(e){e=e.$mangled;const t=this.prototype.tp$mro;for(let n=0;n<t.length;++n){const i=t[n].prototype;if(i.hasOwnProperty(e))return i[e]}}function r(e,t,r,s){const o=function(e){function t(e){return void 0===e.sk$klass?e:t(e.prototype.tp$base)}let n,i,r,s;0===e.length&&e.push(Sk.builtin.object);for(let o=0;o<e.length;o++){if(s=e[o],!Sk.builtin.checkClass(s))throw new Sk.builtin.TypeError("bases must be 'type' objects");if(!1===s.sk$acceptable_as_base_class)throw new Sk.builtin.TypeError("type '"+s.prototype.tp$name+"' is not an acceptable base type");if(r=t(s),void 0===i)i=r,n=s;else if(!i.$isSubType(r)){if(!r.$isSubType(i))throw new Sk.builtin.TypeError("multiple bases have instance layout conflicts");i=r,n=s}}return n}(r),a=t.prototype;Sk.abstr.setUpInheritance(e,t,o,s),Object.defineProperties(a,{sk$prototypical:{value:!0,writable:!0},tp$bases:{value:r,writable:!0},tp$mro:{value:null,writable:!0},hp$type:{value:!0,writable:!0}}),a.tp$mro=t.$buildMRO(),Object.defineProperties(t,{$typeLookup:{value:a.sk$prototypical?n:i,writable:!0},sk$klass:{value:!0,writable:!0}})}function s(e){for(;null!==e.prototype.tp$base;){if(void 0===e.sk$klass&&e.prototype.hasOwnProperty("__dict__"))return e=e.prototype.__dict__,Sk.builtin.checkDataDescr(e)?e:void 0;e=e.prototype.tp$base}}function o(e,t,n){if(void 0===e.sk$klass)throw new Sk.builtin.TypeError("can't set "+e.prototype.tp$name+"."+n.$jsstr());if(void 0===t)throw new Sk.builtin.TypeError("can't delete "+e.prototype.tp$name+"."+n.$jsstr())}void 0===Sk.builtin&&(Sk.builtin={}),Sk.builtin.type=function(e){return this instanceof Sk.builtin.type&&Sk.asserts.fail("calling new Sk.builtin.type is not safe"),e.ob$type},Object.defineProperties(Sk.builtin.type.prototype,{call:{value:Function.prototype.call},apply:{value:Function.prototype.apply},tp$slots:{value:{tp$doc:"type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type",tp$call:function(e,t){if(this===Sk.builtin.type){if(1===e.length&&(void 0===t||!t.length))return e[0].ob$type;if(3!==e.length)throw new Sk.builtin.TypeError("type() takes 1 or 3 arguments")}let n=this.prototype.tp$new(e,t);if(n.$isSuspension)return Sk.misceval.chain(n,(i=>{if(n=i,n.ob$type.$isSubType(this))return n.tp$init(e,t)}),(()=>n));if(n.ob$type.$isSubType(this)){const i=n.tp$init(e,t);return void 0!==i&&i.$isSuspension?Sk.misceval.chain(i,(()=>n)):n}return n},tp$new:function(e,t){if(3!==e.length){if(1===e.length&&(void 0===t||!t.length))return e[0].ob$type;throw new Sk.builtin.TypeError("type() takes 1 or 3 arguments")}let n;if(t=e[0],n=e[1],"dict"!==(e=e[2]).tp$name)throw new Sk.builtin.TypeError("type() argument 3 must be dict, not "+Sk.abstr.typeName(e));if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("type() argument 1 must be str, not "+Sk.abstr.typeName(t));if(t=t.$jsstr(),"tuple"!==n.tp$name)throw new Sk.builtin.TypeError("type() argument 2 must be tuple, not "+Sk.abstr.typeName(n));n=n.sk$asarray();const i=function(){this.$d=new Sk.builtin.dict};return r(t,i,n,this.constructor),Sk.globals&&(i.prototype.__module__=Sk.globals.__name__),i.prototype.__doc__=Sk.builtin.none.none$,void 0===i.$typeLookup(Sk.builtin.str.$dict)&&(i.prototype.__dict__=new Sk.builtin.getset_descriptor(i,a)),e.$items().forEach((([e,t])=>{i.prototype[e.$mangled]=t})),i.prototype.hasOwnProperty("__new__")&&((e=i.prototype.__new__)instanceof Sk.builtin.func&&(i.prototype.__new__=new Sk.builtin.staticmethod(e))),i.$allocateSlots(),i},tp$getattr:function(e,t){var n=this.ob$type;const i=n.$typeLookup(e);let r;return void 0!==i&&(r=i.tp$descr_get,void 0!==r&&void 0!==i.tp$descr_set)?r.call(i,this,n,t):void 0!==(e=this.$typeLookup(e))?void 0!==(n=e.tp$descr_get)?t=n.call(e,null,this,t):e:void 0!==r?r.call(i,this,n,t):void 0!==i?i:void 0},tp$setattr:function(e,t,n){if(!this.sk$klass){if(void 0!==t)throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '"+this.prototype.tp$name+"'");throw new Sk.builtin.TypeError("can't delete attributes on type object '"+this.prototype.tp$name+"'")}const i=this.ob$type.$typeLookup(e);if(void 0!==i){const e=i.tp$descr_set;if(e)return e.call(i,this,t,n)}if(n=e.$mangled,void 0===t){if(!(t=this.prototype).hasOwnProperty(n))throw new Sk.builtin.AttributeError("type object '"+this.prototype.tp$name+"' has no attribute '"+e.$jsstr()+"'");delete t[n],void 0!==(e=Sk.dunderToSkulpt[n])&&(delete this.prototype[e],t.sk$prototypical||this.$allocateGetterSlot(n))}else this.prototype[n]=t,n in Sk.dunderToSkulpt&&this.$allocateSlot(n,t)},$r:function(){let e=this.prototype.__module__,t="",n="class";return e&&Sk.builtin.checkString(e)?t=e.v+".":e=null,e||this.sk$klass||Sk.__future__.class_repr||(n="type"),new Sk.builtin.str("<"+n+" '"+t+this.prototype.tp$name+"'>")}},writable:!0},tp$methods:{value:null,writable:!0},tp$getsets:{value:null,writable:!0},sk$type:{value:!0},$isSubType:{value:function(e){return this===e||this.prototype instanceof e||!this.prototype.sk$prototypical&&this.prototype.tp$mro.includes(e)}},$allocateSlot:{value:function(e,t){const n=(e=Sk.slots[e]).$slot_name,i=this.prototype;i.hasOwnProperty(n)&&delete i[n],i[n]=e.$slot_func(t)}},$allocateSlots:{value:function(){const e=this.prototype;this.prototype.sk$prototypical?Object.keys(e).forEach((t=>{t in Sk.slots&&this.$allocateSlot(t,e[t])})):Object.keys(Sk.slots).forEach((t=>{e.hasOwnProperty(t)?this.$allocateSlot(t,e[t]):this.$allocateGetterSlot(t)}))}},$allocateGetterSlot:{value:function(e){const t=Sk.slots[e].$slot_name,n=this.prototype;n.hasOwnProperty(t)||Object.defineProperty(n,t,{configurable:!0,get(){const e=n.tp$mro;for(let n=1;n<e.length;n++){const i=Object.getOwnPropertyDescriptor(e[n].prototype,t);if(void 0!==i&&i.value)return i.value}}})}},$typeLookup:{value:function(e){return this.prototype.sk$prototypical?this.prototype[e.$mangled]:i.call(this,e)},writable:!0},$mroMerge:{value:function(e){let t;this.prototype.sk$prototypical=!0;const n=[];for(;;){for(t=0;t<e.length;++t){var i=e[t];if(0!==i.length)break}if(t===e.length)return n;var r=[];for(t=0;t<e.length;++t)if(0!==(i=e[t]).length){const t=i[0];i=0;e:for(;i<e.length;++i){const n=e[i];for(let e=1;e<n.length;++e)if(n[e]===t)break e}i===e.length&&r.push(t)}if(0===r.length)throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy");for(r=r[0],n.length&&this.prototype.sk$prototypical&&Object.getPrototypeOf(n[n.length-1].prototype)!==r.prototype&&(this.prototype.sk$prototypical=!1),n.push(r),t=0;t<e.length;++t)0<(i=e[t]).length&&i[0]===r&&i.splice(0,1)}}},$buildMRO:{value:function(){const e=[[this]],t=this.prototype.tp$bases;for(var n=0;n<t.length;++n)e.push([...t[n].prototype.tp$mro]);n=[];for(let e=0;e<t.length;++e)n.push(t[e]);return e.push(n),this.$mroMerge(e)}},sk$attrError:{value(){return"type object '"+this.prototype.tp$name+"'"},writable:!0}}),Sk.builtin.type.prototype.tp$getsets={__base__:{$get(){return this.prototype.tp$base||Sk.builtin.none.none$}},__bases__:{$get(){return void 0===this.sk$tuple_bases&&(this.sk$tuple_bases=new Sk.builtin.tuple(this.prototype.tp$bases)),this.sk$tuple_bases}},__mro__:{$get(){return void 0===this.sk$tuple_mro&&(this.sk$tuple_mro=new Sk.builtin.tuple(this.prototype.tp$mro)),this.sk$tuple_mro}},__dict__:{$get(){return new Sk.builtin.mappingproxy(this.prototype)}},__doc__:{$get(){const e=this.$typeLookup(Sk.builtin.str.$doc);return e?void 0!==e.tp$descr_get?this===Sk.builtin.type?new Sk.builtin.str(this.prototype.tp$doc):e.tp$descr_get(null,this):this.prototype.__doc__:Sk.builtin.none.none$},$set(e){o(this,e,Sk.builtin.str.$doc),this.prototype.__doc__=e}},__name__:{$get(){return new Sk.builtin.str(this.prototype.tp$name)},$set(e){if(o(this,e,Sk.builtin.str.$name),!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("can only assign string to "+this.prototype.tp$name+".__name__, not '"+Sk.abstr.typeName(e)+"'");this.prototype.tp$name=e.$jsstr()}},__module__:{$get(){let e=this.prototype.__module__;return e&&e.ob$type!==Sk.builtin.getset_descriptor?e:new Sk.builtin.str("builtins")},$set(e){o(this,e,Sk.builtin.str.$module),this.prototype.__module__=e}}},Sk.builtin.type.prototype.tp$methods={mro:{$meth(){return new Sk.builtin.list(this.$buildMRO())},$flags:{NoArgs:!0}},__dir__:{$meth:function(){function e(e){e in Sk.reservedWords_||(-1!==(e=Sk.unfixReserved(e)).indexOf("$")||t.has(e)||(t.add(e),n.push(new Sk.builtin.str(e))))}const t=new Set,n=[];if(this.prototype.sk$prototypical)for(var i in this.prototype)e(i);else{i=this.prototype.tp$mro;for(let t=0;t<i.length;t++){const n=Object.getOwnPropertyNames(i[t].prototype);for(let t=0;t<n.length;t++)e(n[t])}}return new Sk.builtin.list(n)},$flags:{NoArgs:!0},$doc:"Specialized __dir__ implementation for types."}};const a={$get(){const e=s(this.ob$type);return void 0!==e?e.tp$descr_get(this,this.ob$type):Sk.generic.getSetDict.$get.call(this)},$set(e){const t=s(this.ob$type);return void 0!==t?t.tp$descr_set(this,e):Sk.generic.getSetDict.$set.call(this,e)},$doc:"dictionary for instance variables (if defined)",$name:"__dict__"}},function(e,t){Sk.generic={},Sk.generic.getAttr=function(e,t){let n;const i=this.ob$type,r=i.$typeLookup(e);if(void 0!==r&&(n=r.tp$descr_get,void 0!==n&&void 0!==r.tp$descr_set))return n.call(r,this,i,t);const s=this.$d;return void 0!==s&&void 0!==(e=s.quick$lookup(e))?e:void 0!==n?n.call(r,this,i,t):void 0!==r?r:void 0},Sk.exportSymbol("Sk.generic.getAttr",Sk.generic.getAttr),Sk.generic.setAttr=function(e,t,n){var i=this.ob$type.$typeLookup(e);if(null!=i){const e=i.tp$descr_set;if(e)return e.call(i,this,t,n)}if(void 0!==(n=this.$d))if(n.mp$ass_subscript){if(void 0!==t)return n.mp$ass_subscript(e,t);try{return n.mp$ass_subscript(e)}catch(t){if(t instanceof Sk.builtin.KeyError)throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(this)+"' object has no attribute '"+e.$jsstr()+"'");throw t}}else if("object"==typeof n){if(i=e.$mangled,void 0!==t)return void(n[i]=t);if(void 0!==n[i])return void delete n[i]}throw new Sk.builtin.AttributeError(this.sk$attrError()+" has no attribute '"+e.$jsstr()+"'")},Sk.exportSymbol("Sk.generic.setAttr",Sk.generic.setAttr),Sk.generic.new=function(e){return function(t,n){return this.constructor===e?new this.constructor:(t=new this.constructor,e.call(t),t)}},Sk.generic.newMethodDef={$meth(e,t){const n=this.prototype;if(1>e.length)throw e=n.tp$name,new Sk.builtin.TypeError(e+".__new__(): not enough arguments");var i=e.shift();if(void 0===i.sk$type)throw e=n.tp$name,new Sk.builtin.TypeError(e+"__new__(X): X is not a type object ("+Sk.abstr.typeName(i)+")");if(!i.$isSubType(this))throw e=n.tp$name,i=i.prototype.tp$name,new Sk.builtin.TypeError(e+".__new__("+i+"): "+i+" is not a subtype of "+e);const r=i.prototype.sk$staticNew.prototype;if(r.tp$new!==n.tp$new)throw e=n.tp$name,i=i.prototype.tp$name,new Sk.builtin.TypeError(e+".__new__("+i+") is not safe, use "+r.tp$name+".__new__()");return n.tp$new.call(i.prototype,e,t)},$flags:{FastCall:!0},$textsig:"($type, *args, **kwargs)",$name:"__new__"},Sk.generic.selfIter=function(){return this},Sk.generic.iterNextWithArrayCheckSize=function(){if(this.$seq.length!==this.$orig.get$size()){const e=this.tp$name.split("_")[0];throw new Sk.builtin.RuntimeError(e+" changed size during iteration")}if(!(this.$index>=this.$seq.length))return this.$seq[this.$index++]},Sk.generic.iterNextWithArray=function(){const e=this.$seq[this.$index++];return void 0===e&&(this.tp$iternext=()=>{}),e},Sk.generic.iterLengthHintWithArrayMethodDef={$meth:function(){return new Sk.builtin.int_(this.$seq.length-this.$index)},$flags:{NoArgs:!0}},Sk.generic.iterReverseLengthHintMethodDef={$meth:function(){return new Sk.builtin.int_(this.$index)},$flags:{NoArgs:!0}},Sk.generic.getSetDict={$get(){return this.$d},$set(e){if(void 0===e)this.$d=new Sk.builtin.dict;else{if(!(e instanceof Sk.builtin.dict))throw new Sk.builtin.TypeError("__dict__ must be set to a dictionary, not a '"+Sk.abstr.typeName(e)+"'");this.$d=e}},$doc:"dictionary for instance variables (if defined)",$name:"__dict__"},Sk.generic.seqCompare=function(e,t){if(this===e&&Sk.misceval.opAllowsEquality(t))return!0;if(!(e instanceof this.sk$builtinBase))return Sk.builtin.NotImplemented.NotImplemented$;const n=this.v;let i;if(e=e.v,n.length!==e.length&&("Eq"===t||"NotEq"===t))return"Eq"!==t;for(i=0;i<n.length&&i<e.length&&(n[i]===e[i]||Sk.misceval.richCompareBool(n[i],e[i],"Eq"));++i);const r=n.length,s=e.length;if(i>=r||i>=s)switch(t){case"Lt":return r<s;case"LtE":return r<=s;case"Eq":return r===s;case"NotEq":return r!==s;case"Gt":return r>s;case"GtE":return r>=s;default:Sk.asserts.fail()}return"Eq"!==t&&("NotEq"===t||Sk.misceval.richCompareBool(n[i],e[i],t))}},function(e,t){Sk.builtin.pyCheckArgs=function(e,t,n,i,r,s){if(t=t.length,void 0===i&&(i=1/0),r&&--t,s&&--t,t<n||t>i)throw new Sk.builtin.TypeError((n===i?e+"() takes exactly "+n+" arguments":t<n?e+"() takes at least "+n+" arguments":0<n?e+"() takes at most "+i+" arguments":e+"() takes no arguments")+" ("+t+" given)")},Sk.exportSymbol("Sk.builtin.pyCheckArgs",Sk.builtin.pyCheckArgs),Sk.builtin.pyCheckArgsLen=function(e,t,n,i,r,s){if(void 0===i&&(i=1/0),r&&--t,s&&--t,t<n||t>i)throw new Sk.builtin.TypeError((n===i?e+"() takes exactly "+n+" arguments":t<n?e+"() takes at least "+n+" arguments":e+"() takes at most "+i+" arguments")+" ("+t+" given)")},Sk.builtin.pyCheckType=function(e,t,n){if(!n)throw new Sk.builtin.TypeError(e+" must be a "+t)},Sk.exportSymbol("Sk.builtin.pyCheckType",Sk.builtin.pyCheckType),Sk.builtin.checkSequence=function(e){return null!=e&&void 0!==e.mp$subscript},Sk.exportSymbol("Sk.builtin.checkSequence",Sk.builtin.checkSequence),Sk.builtin.checkIterable=function(e){return void 0!==e&&(e.tp$iter?void 0!==e.tp$iter().tp$iternext:void 0!==e.mp$subscript)},Sk.exportSymbol("Sk.builtin.checkIterable",Sk.builtin.checkIterable),Sk.builtin.checkCallable=function(e){return null!=e&&void 0!==e.tp$call},Sk.builtin.checkNumber=function(e){return"number"==typeof e||e instanceof Sk.builtin.int_||e instanceof Sk.builtin.float_||e instanceof Sk.builtin.lng},Sk.exportSymbol("Sk.builtin.checkNumber",Sk.builtin.checkNumber),Sk.builtin.checkComplex=function(e){return e instanceof Sk.builtin.complex},Sk.exportSymbol("Sk.builtin.checkComplex",Sk.builtin.checkComplex),Sk.builtin.checkInt=function(e){return e instanceof Sk.builtin.int_||"number"==typeof e&&Number.isInteger(e)},Sk.exportSymbol("Sk.builtin.checkInt",Sk.builtin.checkInt),Sk.builtin.checkFloat=function(e){return e instanceof Sk.builtin.float_},Sk.exportSymbol("Sk.builtin.checkFloat",Sk.builtin.checkFloat),Sk.builtin.checkString=function(e){return e instanceof Sk.builtin.str},Sk.exportSymbol("Sk.builtin.checkString",Sk.builtin.checkString),Sk.builtin.checkBytes=function(e){return e instanceof Sk.builtin.bytes},Sk.builtin.checkClass=function(e){return e instanceof Sk.builtin.type},Sk.exportSymbol("Sk.builtin.checkClass",Sk.builtin.checkClass),Sk.builtin.checkBool=function(e){return e instanceof Sk.builtin.bool},Sk.exportSymbol("Sk.builtin.checkBool",Sk.builtin.checkBool),Sk.builtin.checkNone=function(e){return e===Sk.builtin.none.none$},Sk.exportSymbol("Sk.builtin.checkNone",Sk.builtin.checkNone),Sk.builtin.checkFunction=function(e){return null!=e&&void 0!==e.tp$call},Sk.exportSymbol("Sk.builtin.checkFunction",Sk.builtin.checkFunction),Sk.builtin.checkDataDescr=function(e){return e&&void 0!==e.tp$descr_set},Sk.exportSymbol("Sk.builtin.checkDataDescr",Sk.builtin.checkDataDescr),Sk.builtin.checkAnySet=function(e){return e instanceof Sk.builtin.set||e instanceof Sk.builtin.frozenset},Sk.builtin.checkMapping=function(e){return e instanceof Sk.builtin.dict||e instanceof Sk.builtin.mappingproxy||null!=e&&void 0!==e.mp$subscript&&void 0!==Sk.abstr.lookupSpecial(e,Sk.builtin.str.$keys)}},function(e,t){function n(e,t){switch(t){case"Add":return e.nb$reflected_add;case"Sub":return e.nb$reflected_subtract;case"Mult":return e.nb$reflected_multiply;case"MatMult":if(Sk.__future__.python3)return e.nb$reflected_matrix_multiply;case"Div":return e.nb$reflected_divide;case"FloorDiv":return e.nb$reflected_floor_divide;case"Mod":return e.nb$reflected_remainder;case"DivMod":return e.nb$reflected_divmod;case"Pow":return e.nb$reflected_power;case"LShift":return e.nb$reflected_lshift;case"RShift":return e.nb$reflected_rshift;case"BitAnd":return e.nb$reflected_and;case"BitXor":return e.nb$reflected_xor;case"BitOr":return e.nb$reflected_or}}function i(e,t,i){var r=t.constructor,s=e.constructor;return(r=r!==s&&void 0===r.sk$baseClass&&t instanceof s)&&(void 0!==(s=n(t,i))&&s!==n(e,i)&&(s=s.call(t,e))!==Sk.builtin.NotImplemented.NotImplemented$)?s:(s=function(e,t){switch(t){case"Add":return e.nb$add;case"Sub":return e.nb$subtract;case"Mult":return e.nb$multiply;case"MatMult":if(Sk.__future__.python3)return e.nb$matrix_multiply;case"Div":return e.nb$divide;case"FloorDiv":return e.nb$floor_divide;case"Mod":return e.nb$remainder;case"DivMod":return e.nb$divmod;case"Pow":return e.nb$power;case"LShift":return e.nb$lshift;case"RShift":return e.nb$rshift;case"BitAnd":return e.nb$and;case"BitXor":return e.nb$xor;case"BitOr":return e.nb$or}}(e,i),void 0!==s&&(s=s.call(e,t))!==Sk.builtin.NotImplemented.NotImplemented$||!r&&(void 0!==(s=n(t,i))&&(s=s.call(t,e))!==Sk.builtin.NotImplemented.NotImplemented$)?s:void 0)}Sk.abstr={},Sk.abstr.typeName=function(e){return null!=e&&void 0!==e.tp$name?e.tp$name:"<invalid type>"};const r={Add:"+",Sub:"-",Mult:"*",MatMult:"@",Div:"/",FloorDiv:"//",Mod:"%",DivMod:"divmod()",Pow:"** or pow()",LShift:"<<",RShift:">>",BitAnd:"&",BitXor:"^",BitOr:"|"},s={UAdd:"+",USub:"-",Invert:"~"};Sk.abstr.numberBinOp=function(e,t,n){var s;if(!(s=i(e,t,n)))throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("unsupported operand type(s) for "+r[n]+": '"+e+"' and '"+t+"'");return s},Sk.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp),Sk.abstr.numberInplaceBinOp=function(e,t,n){var s=function(e,t){switch(t){case"Add":return e.nb$inplace_add;case"Sub":return e.nb$inplace_subtract;case"Mult":return e.nb$inplace_multiply;case"MatMult":if(Sk.__future__.python3)return e.nb$inplace_matrix_multiply;case"Div":return e.nb$inplace_divide;case"FloorDiv":return e.nb$inplace_floor_divide;case"Mod":return e.nb$inplace_remainder;case"Pow":return e.nb$inplace_power;case"LShift":return e.nb$inplace_lshift;case"RShift":return e.nb$inplace_rshift;case"BitAnd":return e.nb$inplace_and;case"BitOr":return e.nb$inplace_or;case"BitXor":return e.nb$inplace_xor}}(e,n);if(void 0!==s&&(s=s.call(e,t))!==Sk.builtin.NotImplemented.NotImplemented$||(s=i(e,t,n)),!s)throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("unsupported operand type(s) for "+r[n]+"=: '"+e+"' and '"+t+"'");return s},Sk.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp),Sk.abstr.numberUnaryOp=function(e,t){if("Not"===t)return Sk.misceval.isTrue(e)?Sk.builtin.bool.false$:Sk.builtin.bool.true$;e:{switch(t){case"USub":var n=e.nb$negative;break e;case"UAdd":n=e.nb$positive;break e;case"Invert":n=e.nb$invert;break e}n=void 0}if(!(n=void 0!==n?n.call(e):void 0))throw e=Sk.abstr.typeName(e),new Sk.builtin.TypeError("bad operand type for unary "+s[t]+": '"+e+"'");return n},Sk.exportSymbol("Sk.abstr.numberUnaryOp",Sk.abstr.numberUnaryOp),Sk.abstr.fixSeqIndex_=function(e,t){return 0>(t=Sk.builtin.asnum$(t))&&e.sq$length&&(t+=e.sq$length()),t},Sk.abstr.sequenceContains=function(e,t,n){return e.sq$contains?e.sq$contains(t,n):(e=Sk.misceval.iterFor(Sk.abstr.iter(e),(function(e){return!(e!==t&&!Sk.misceval.richCompareBool(e,t,"Eq"))&&new Sk.misceval.Break(!0)}),!1),n?e:Sk.misceval.retryOptionalSuspensionOrThrow(e))},Sk.abstr.sequenceConcat=function(e,t){if(e.sq$concat)return e.sq$concat(t);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object can't be concatenated")},Sk.abstr.sequenceGetIndexOf=function(e,t){if(e.index)return Sk.misceval.callsimArray(e.index,[e,t]);let n=0;for(let i=Sk.abstr.iter(e),r=i.tp$iternext();void 0!==r;r=i.tp$iternext()){if(Sk.misceval.richCompareBool(t,r,"Eq"))return new Sk.builtin.int_(n);n+=1}throw new Sk.builtin.ValueError("sequence.index(x): x not in sequence")},Sk.abstr.sequenceGetCountOf=function(e,t){if(e.count)return Sk.misceval.callsimArray(e.count,[e,t]);let n=0;for(let i=Sk.abstr.iter(e),r=i.tp$iternext();void 0!==r;r=i.tp$iternext())Sk.misceval.richCompareBool(t,r,"Eq")&&(n+=1);return new Sk.builtin.int_(n)},Sk.abstr.sequenceGetItem=function(e,t,n){return"number"==typeof t&&(t=new Sk.builtin.int_(t)),Sk.abstr.objectGetItem(e,t,n)},Sk.abstr.sequenceSetItem=function(e,t,n,i){return"number"==typeof t&&(t=new Sk.builtin.int_(t)),Sk.abstr.objectSetItem(e,t,n,i)},Sk.abstr.sequenceDelItem=function(e,t,n){return Sk.abstr.objectDelItem(e,t,n)},Sk.abstr.sequenceGetSlice=function(e,t,n){return Sk.abstr.objectGetItem(e,new Sk.builtin.slice(t,n))},Sk.abstr.sequenceDelSlice=function(e,t,n){return Sk.abstr.objectDelItem(e,new Sk.builtin.slice(t,n))},Sk.abstr.sequenceSetSlice=function(e,t,n,i){return Sk.abstr.objectSetItem(e,new Sk.builtin.slice(t,n))},Sk.abstr.sequenceUnpack=function(e,t,n,i){if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError("cannot unpack non-iterable "+Sk.abstr.typeName(e)+" object");const r=Sk.abstr.iter(e),s=[];let o,a=0;return 0<t&&(o=Sk.misceval.iterFor(r,(e=>{if(s.push(e),++a===t)return new Sk.misceval.Break}))),Sk.misceval.chain(o,(()=>{if(s.length<t)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+n+", got "+s.length+")");if(!i)return Sk.misceval.chain(r.tp$iternext(!0),(e=>{if(void 0!==e)throw new Sk.builtin.ValueError("too many values to unpack (expected "+t+")");return s}));const e=[];return Sk.misceval.chain(Sk.misceval.iterFor(r,(t=>{e.push(t)})),(()=>{const i=e.length+t-n;if(0>i)throw new Sk.builtin.ValueError("not enough values to unpack (expected at least "+n+", got "+(n+i)+")");return s.push(new Sk.builtin.list(e.slice(0,i))),s.push(...e.slice(i)),s}))}))},Sk.abstr.mappingUnpackIntoKeywordArray=function(e,t,n){if(!(t instanceof Sk.builtin.dict)){var i=Sk.abstr.lookupSpecial(t,Sk.builtin.str.$keys);if(void 0===i)throw new Sk.builtin.TypeError("Object is not a mapping");return Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(i),(i=>Sk.misceval.iterFor(Sk.abstr.iter(i),(i=>{if(!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError((n.$qualname?n.$qualname+"() ":"")+"keywords must be strings");return Sk.misceval.chain(t.mp$subscript(i,!0),(t=>{e.push(i.v),e.push(t)}))}))))}t.$items().forEach((([t,i])=>{if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError((n.$qualname?n.$qualname+"() ":"")+"keywords must be strings");e.push(t.v),e.push(i)}))},Sk.abstr.copyKeywordsToNamedArgs=function(e,t,n,i,r){i=i||[];var s=n.length+i.length/2;if(s>t.length)throw new Sk.builtin.TypeError(e+"() expected at most "+t.length+" arguments ("+s+" given)");if(!i.length&&void 0===r)return n;if(s===t.length&&!i.length)return n;if(0===s&&t.length===(r&&r.length))return r;for(n=n.slice(0),s=0;s<i.length;s+=2){const r=i[s],o=i[s+1],a=t.indexOf(r);if(!(0<=a))throw new Sk.builtin.TypeError(e+"() got an unexpected keyword argument '"+r+"'");if(void 0!==n[a])throw new Sk.builtin.TypeError(e+"() got multiple values for argument '"+r+"'");n[a]=o}if(r){for(s=(i=t.length)-1;0<=s;s--)void 0===n[s]&&(n[s]=r[r.length-1-(i-1-s)]);if((t=t.filter(((e,t)=>void 0===n[t]))).length)throw new Sk.builtin.TypeError(e+"() missing "+t.length+" required positional arguments: "+t.join(", "))}return n},Sk.exportSymbol("Sk.abstr.copyKeywordsToNamedArgs",Sk.abstr.copyKeywordsToNamedArgs),Sk.abstr.checkNoKwargs=function(e,t){if(t&&t.length)throw new Sk.builtin.TypeError(e+"() takes no keyword arguments")},Sk.exportSymbol("Sk.abstr.checkNoKwargs",Sk.abstr.checkNoKwargs),Sk.abstr.checkNoArgs=function(e,t,n){if(t=t.length+(n?n.length:0))throw new Sk.builtin.TypeError(e+"() takes no arguments ("+t+" given)")},Sk.exportSymbol("Sk.abstr.checkNoArgs",Sk.abstr.checkNoArgs),Sk.abstr.checkOneArg=function(e,t,n){if(Sk.abstr.checkNoKwargs(e,n),1!==t.length)throw new Sk.builtin.TypeError(e+"() takes exactly one argument ("+t.length+" given)")},Sk.exportSymbol("Sk.abstr.checkOneArg",Sk.abstr.checkOneArg),Sk.abstr.checkArgsLen=function(e,t,n,i){if(void 0===i&&(i=1/0),(t=t.length)<n||t>i)throw new Sk.builtin.TypeError((n===i?e+"() takes exactly "+n+" arguments":t<n?e+"() takes at least "+n+" arguments":e+"() takes at most "+i+" arguments")+" ("+t+" given)")},Sk.exportSymbol("Sk.abstr.checkArgsLen",Sk.abstr.checkArgsLen),Sk.abstr.objectFormat=function(e,t){if(e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$format),t=Sk.misceval.callsimArray(e,[t]),!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("__format__ must return a str, not "+Sk.abstr.typeName(t));return t},Sk.abstr.objectHash=function(e){const t=e.tp$hash;if(void 0!==t){if(Sk.builtin.checkNone(t))throw new Sk.builtin.TypeError("unhashable type: '"+Sk.abstr.typeName(e)+"'");return e.tp$hash()}throw new Sk.builtin.TypeError("unsupported Javascript type")},Sk.abstr.objectAdd=function(e,t){if(e.nb$add)return e.nb$add(t);throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("unsupported operand type(s) for +: '"+e+"' and '"+t+"'")},Sk.abstr.objectNegative=function(e){if(e.nb$negative)return e.nb$negative();throw new Sk.builtin.TypeError("bad operand type for unary -: '"+Sk.abstr.typeName(e)+"'")},Sk.abstr.objectPositive=function(e){if(e.nb$positive)return e.nb$positive();throw new Sk.builtin.TypeError("bad operand type for unary +: '"+Sk.abstr.typeName(e)+"'")},Sk.abstr.objectDelItem=function(e,t,n){if(e.mp$ass_subscript)return e.mp$ass_subscript(t,void 0,n);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object does not support item deletion")},Sk.exportSymbol("Sk.abstr.objectDelItem",Sk.abstr.objectDelItem),Sk.abstr.objectGetItem=function(e,t,n){if(e.mp$subscript)return e.mp$subscript(t,n);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' does not support indexing")},Sk.exportSymbol("Sk.abstr.objectGetItem",Sk.abstr.objectGetItem),Sk.abstr.objectSetItem=function(e,t,n,i){if(e.mp$ass_subscript)return e.mp$ass_subscript(t,n,i);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' does not support item assignment")},Sk.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem),Sk.abstr.gattr=function(e,t,n){if(void 0===(n=e.tp$getattr(t,n)))throw new Sk.builtin.AttributeError(e.sk$attrError()+" has no attribute '"+t.$jsstr()+"'");return n.$isSuspension?Sk.misceval.chain(n,(function(n){if(void 0===n)throw new Sk.builtin.AttributeError(e.sk$attrError()+" has no attribute '"+t.$jsstr()+"'");return n})):n},Sk.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr),Sk.abstr.sattr=function(e,t,n,i){return e.tp$setattr(t,n,i)},Sk.exportSymbol("Sk.abstr.sattr",Sk.abstr.sattr),Sk.abstr.iternext=function(e,t){return e.tp$iternext(t)},Sk.exportSymbol("Sk.abstr.iternext",Sk.abstr.iternext),Sk.abstr.iter=function(e){if(e.tp$iter){if((e=e.tp$iter()).tp$iternext)return e;throw new Sk.builtin.TypeError("iter() returned non-iterator of type '"+Sk.abstr.typeName(e)+"'")}if(e.mp$subscript)return new Sk.builtin.seq_iter_(e);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not iterable")},Sk.exportSymbol("Sk.abstr.iter",Sk.abstr.iter),Sk.abstr.lookupSpecial=function(e,t){var n=e.ob$type;if(void 0===n)Sk.asserts.fail("javascript object sent to lookupSpecial");else if(void 0!==(t=n.$typeLookup(t)))return void 0!==t.tp$descr_get&&(t=t.tp$descr_get(e,n)),t},Sk.exportSymbol("Sk.abstr.lookupSpecial",Sk.abstr.lookupSpecial),Sk.abstr.typeLookup=function(e,t){return void 0!==(t=e.$typeLookup(t))&&t.tp$descr_get?t.tp$descr_get(null,e):t},Sk.abstr.markUnhashable=function(e){(e=e.prototype).__hash__=Sk.builtin.none.none$,e.tp$hash=Sk.builtin.none.none$},Sk.abstr.setUpInheritance=function(e,t,n,i){i=i||Sk.builtin.type;const r=null!==(n=void 0===n?Sk.builtin.object:n)?n.prototype:null;Object.setPrototypeOf(t,i.prototype),Object.setPrototypeOf(t.prototype,r),Object.defineProperties(t.prototype,{sk$object:{value:t,writable:!0},ob$type:{value:t,writable:!0},tp$name:{value:e,writable:!0},tp$base:{value:n,writable:!0}})},Sk.abstr.setUpBuiltinMro=function(e){let t=e.prototype.tp$base;const n=null===t?[]:[t];t!==Sk.builtin.object&&null!==t||(Object.defineProperty(e,"sk$baseClass",{value:!0,writable:!0}),Object.defineProperty(e.prototype,"sk$builtinBase",{value:e,writable:!0}));const i=[e];for(;null!==t;)i.push(t),t=t.prototype.tp$base;Object.defineProperties(e.prototype,{sk$prototypical:{value:!0,writable:!0},tp$bases:{value:n,writable:!0},tp$mro:{value:i,writable:!0}}),Object.defineProperty(e,"$typeLookup",{value:function(e){return this.prototype[e.$mangled]},writable:!0})},Sk.abstr.setUpGetSets=function(e,t){if(void 0!==Sk.builtin.getset_descriptor){var n=e.prototype;t=t||n.tp$getsets||{},Object.entries(t).forEach((([t,i])=>{i.$name=t,n[t]=new Sk.builtin.getset_descriptor(e,i)})),Object.defineProperty(n,"tp$getsets",{value:null,writable:!0})}},Sk.abstr.setUpMethods=function(e,t){if(void 0!==Sk.builtin.method_descriptor){var n=e.prototype;t=t||n.tp$methods||{},Object.entries(t).forEach((([t,i])=>{i.$name=t,n[t]=new Sk.builtin.method_descriptor(e,i)})),Object.defineProperty(n,"tp$methods",{value:null,writable:!0})}},Sk.abstr.setUpClassMethods=function(e,t){if(void 0!==Sk.builtin.classmethod_descriptor){var n=e.prototype;t=t||n.tp$classmethods||{},Object.entries(t).forEach((([t,i])=>{i.$name=t,n[t]=new Sk.builtin.classmethod_descriptor(e,i)})),Object.defineProperty(n,"tp$classmethods",{value:null,writable:!0})}};const o=Object.entries({Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"});Sk.abstr.setUpSlots=function(e,t){function n(t,n){r[t]=new Sk.builtin.wrapper_descriptor(e,Sk.slots[t],n)}function i(e,t){"string"==typeof e?n(e,t):e.forEach((e=>{n(e,t)}))}if(void 0!==Sk.builtin.wrapper_descriptor){var r=e.prototype;(t=t||r.tp$slots||{}).tp$new===Sk.generic.new&&(t.tp$new=Sk.generic.new(e)),t.tp$richcompare&&function(e){o.forEach((([t,n])=>{e[n]=function(e){return this.tp$richcompare(e,t)}}))}(t),t.tp$as_number&&function(e){const t=Sk.reflectedNumberSlots;Object.keys(t).forEach((n=>{if(void 0!==e[n]){const i=t[n],r=i.reflected,s=e[r];void 0!==s?null===s&&delete e[r]:e[r]=i.slot||e[n]}}))}(t),t.tp$as_sequence_or_mapping&&function(e){const t=Sk.sequenceAndMappingSlots;Object.keys(t).forEach((n=>{void 0!==e[n]&&t[n].forEach((t=>{e[t]=e[n]}))}))}(t),Object.entries(t).forEach((([e,t])=>{Object.defineProperty(r,e,{value:t,writable:!0})})),t.tp$new&&(r.__new__=new Sk.builtin.sk_method(Sk.generic.newMethodDef,e),Object.defineProperty(r,"sk$staticNew",{value:e,writable:!0})),Sk.subSlots.main_slots.forEach((([e,n])=>{void 0!==(e=t[e])&&i(n,e)}));var s=t.tp$hash;void 0!==s&&("function"==typeof s?n("__hash__",s):s===Sk.builtin.none.none$?r.__hash__=s:Sk.asserts.fail("invalid tp$hash")),t.tp$as_number&&Sk.subSlots.number_slots.forEach((([e,n])=>{void 0!==(e=t[e])&&i(n,e)})),t.tp$as_sequence_or_mapping&&Sk.subSlots.sequence_and_mapping_slots.forEach((([e,n])=>{void 0!==(e=t[e])&&i(n,e)})),Object.defineProperty(r,"tp$slots",{value:null,writable:!0})}},Sk.abstr.buildNativeClass=function(e,t){t=t||{},Sk.asserts.assert(t.hasOwnProperty("constructor"),"A constructor is required to build a native class");let n=t.constructor;if(e.includes(".")){var i=e.split(".");e=i.pop(),i=i.join(".")}Sk.abstr.setUpInheritance(e,n,t.base,t.meta),Sk.abstr.setUpBuiltinMro(n);const r=n.prototype;return Object.defineProperties(r,{tp$slots:{value:t.slots,writable:!0},tp$getsets:{value:t.getsets,writable:!0},tp$methods:{value:t.methods,writable:!0},tp$classmethods:{value:t.classmethods,writable:!0}}),Sk.abstr.setUpSlots(n,t.slots||{}),Sk.abstr.setUpMethods(n,t.methods),Sk.abstr.setUpGetSets(n,t.getsets),Sk.abstr.setUpClassMethods(n,t.classmethods),void 0!==i&&(r.__module__=new Sk.builtin.str(i)),Object.entries(t.proto||{}).forEach((([e,t])=>{Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!(e.includes("$")||e in Object.prototype)})})),Object.entries(t.flags||{}).forEach((([e,t])=>{Object.defineProperty(n,e,{value:t,writable:!0})})),void 0!==Sk.builtin.str&&r.hasOwnProperty("tp$doc")&&!r.hasOwnProperty("__doc__")&&(e=r.tp$doc||null,r.__doc__="string"==typeof e?new Sk.builtin.str(e):Sk.builtin.none.none$),n},Sk.abstr.buildIteratorClass=function(e,t){return Sk.asserts.assert(t.hasOwnProperty("constructor"),"must provide a constructor"),t.slots=t.slots||{},t.slots.tp$iter=Sk.generic.selfIter,t.slots.tp$iternext=t.slots.tp$iternext||t.iternext,t.slots.tp$getattr=t.slots.tp$getattr||Sk.generic.getAttr,e=Sk.abstr.buildNativeClass(e,t),Sk.abstr.built$iterators.push(e),e},Sk.abstr.built$iterators=[],Sk.abstr.setUpModuleMethods=function(e,t,n){Object.entries(n).forEach((([n,i])=>{i.$name=i.$name||n,t[n]=new Sk.builtin.sk_method(i,null,e)}))},Sk.abstr.superConstructor=function(e,t,n){var i=Array.prototype.slice.call(arguments,2);e.prototype.tp$base.apply(t,i)}},function(e,t){const n=new Map;Sk.builtin.object=Sk.abstr.buildNativeClass("object",{constructor:function(){Sk.asserts.assert(this instanceof Sk.builtin.object,"bad call to object, use 'new'")},base:null,slots:{tp$new(e,t){if(e.length||t&&t.length){if(this.tp$new!==Sk.builtin.object.prototype.tp$new)throw new Sk.builtin.TypeError("object.__new__() takes exactly one argument (the type to instantiate)");if(this.tp$init===Sk.builtin.object.prototype.tp$init)throw new Sk.builtin.TypeError(Sk.abstr.typeName(this)+"() takes no arguments")}return new this.constructor},tp$init(e,t){if(e.length||t&&t.length){if(this.tp$init!==Sk.builtin.object.prototype.tp$init)throw new Sk.builtin.TypeError("object.__init__() takes exactly one argument (the instance to initialize)");if(this.tp$new===Sk.builtin.object.prototype.tp$new)throw new Sk.builtin.TypeError(Sk.abstr.typeName(this)+".__init__() takes exactly one argument (the instance to initialize)")}},tp$getattr:Sk.generic.getAttr,tp$setattr:Sk.generic.setAttr,$r(){const e=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$module);let t="";return e&&Sk.builtin.checkString(e)&&(t=e.v+"."),new Sk.builtin.str("<"+t+Sk.abstr.typeName(this)+" object>")},tp$str(){return this.$r()},tp$hash(){let e=n.get(this);return void 0!==e||(e=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER-Number.MAX_SAFE_INTEGER/2),n.set(this,e)),e},tp$richcompare(e,t){switch(t){case"Eq":e=this===e||Sk.builtin.NotImplemented.NotImplemented$;break;case"NotEq":(e=this.tp$richcompare(e,"Eq"))!==Sk.builtin.NotImplemented.NotImplemented$&&(e=!Sk.misceval.isTrue(e));break;default:e=Sk.builtin.NotImplemented.NotImplemented$}return e},tp$doc:"The most base type"},getsets:{__class__:{$get(){return this.ob$type},$set(e){if(void 0===e)throw new Sk.builtin.TypeError("can't delete __class__ attribute");if(!Sk.builtin.checkClass(e))throw new Sk.builtin.TypeError("__class__ must be set to a class, not '"+Sk.abstr.typeName(e)+"' object");const t=this.ob$type;if(!(t.$isSubType(Sk.builtin.module)&&e.$isSubType(Sk.builtin.module)||void 0!==t.sk$klass&&void 0!==e.sk$klass))throw new Sk.builtin.TypeError(" __class__ assignment only supported for heap types or ModuleType subclasses");if(e.prototype.sk$builtinBase!==this.sk$builtinBase)throw new Sk.builtin.TypeError("__class__ assignment: '"+Sk.abstr.typeName(this)+"' object layout differs from '"+e.prototype.tp$name+"'");Object.setPrototypeOf(this,e.prototype)},$doc:"the object's class"}},methods:{__dir__:{$meth:function(){let e=[];if(this.$d)if(this.$d instanceof Sk.builtin.dict)e=this.$d.sk$asarray();else for(var t in this.$d)e.push(new Sk.builtin.str(t));return t=Sk.misceval.callsimArray(Sk.builtin.type.prototype.__dir__,[this.ob$type]),e.push(...t.v),t.v=e,t},$flags:{NoArgs:!0},$doc:"Default dir() implementation."},__format__:{$meth(e){if(!Sk.builtin.checkString(e)){if(Sk.__future__.exceptions)throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(e));throw new Sk.builtin.TypeError("format expects arg 2 to be string or unicode, not "+Sk.abstr.typeName(e))}if(""!==(e=Sk.ffi.remapToJs(e)))throw new Sk.builtin.NotImplementedError("format spec is not yet implemented");return this.tp$str()},$flags:{OneArg:!0},$doc:"Default object formatter."}},proto:{valueOf:Object.prototype.valueOf,toString:function(){return this.tp$str().v},hasOwnProperty:Object.prototype.hasOwnProperty,hp$type:void 0,sk$attrError(){return"'"+this.tp$name+"' object"}}}),Sk.abstr.setUpInheritance("type",Sk.builtin.type,Sk.builtin.object),Sk.abstr.setUpBuiltinMro(Sk.builtin.type)},function(e,t){function n(e,t,n){return Sk.abstr.checkNoArgs(this.$name,t,n),void 0===(e=this.call(e))?Sk.builtin.none.none$:e}function i(e,t,n){return Sk.abstr.checkOneArg(this.$name,t,n),void 0===(e=this.call(e,t[0]))?Sk.builtin.none.none$:e}function r(e,t,n){return Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,1,2),void 0===(e=this.call(e,...t))?Sk.builtin.none.none$:e}function s(e,t,n){return Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,2,2),this.call(e,t[0],t[1]),Sk.builtin.none.none$}function o(e,t,n){return(e=i.call(this,e,t,n))===Sk.builtin.NotImplemented.NotImplemented$?e:new Sk.builtin.bool(e)}function a(e,t){return function(n,i,r){return n=e.call(this,n,i,r),t(n)}}function l(e){return function(){const t=e.tp$descr_get?e.tp$descr_get(this):e;return Sk.misceval.callsimArray(t,[])}}function u(e,t,n,i){return function(r){return function(){var s=r.tp$descr_get?r.tp$descr_get(this):r;if(s=Sk.misceval.callsimArray(s,[]),!t(s))throw new Sk.builtin.TypeError(e+" should return "+n+" (returned "+Sk.abstr.typeName(s)+")");return void 0!==i?i(s):s}}}function c(e){return function(t){const n=e.tp$descr_get?e.tp$descr_get(this):e;return Sk.misceval.callsimArray(n,[t])}}function p(e,t){let n=this.ob$type.$typeLookup(Sk.builtin.str.$getattribute);if(n instanceof Sk.builtin.wrapper_descriptor)return n.d$wrapped.call(this,e,t);n.tp$descr_get&&(n=n.tp$descr_get(this));const i=Sk.misceval.tryCatch((()=>Sk.misceval.callsimOrSuspendArray(n,[e])),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e}));return t?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}function h(e,t,n){return function(i){return function(i,r,s){let o;void 0===r?(o=t,n=null):o=e;let a=this.ob$type.$typeLookup(new Sk.builtin.str(o));if(a instanceof Sk.builtin.wrapper_descriptor)return a.d$wrapped.call(this,i,r);if(a.tp$descr_get&&(a=a.tp$descr_get(this)),void 0===a){if(n)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object "+n);throw new Sk.builtin.AttributeError(o)}return i=Sk.misceval.callsimOrSuspendArray(a,void 0===r?[i]:[i,r]),s?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}}}function d(e,t){let n=e.ob$type;for(;n&&void 0!==n.sk$klass;)n=n.prototype.tp$base;if(n&&n.prototype.tp$setattr!==t)throw new Sk.builtin.TypeError("can't apply this "+t.$name+" to "+Sk.abstr.typeName(e)+" object")}Sk.slots=Object.create(null),e=Sk.slots,Sk.slots.__init__={$name:"__init__",$slot_name:"tp$init",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this):e;return t=Sk.misceval.callsimOrSuspendArray(i,t,n),Sk.misceval.chain(t,(e=>{if(!Sk.builtin.checkNone(e)&&void 0!==e)throw new Sk.builtin.TypeError("__init__() should return None, not "+Sk.abstr.typeName(e))}))}},$wrapper:function(e,t,n){return this.call(e,t,n),Sk.builtin.none.none$},$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Initialize self. See help(type(self)) for accurate signature."},e.__new__={$name:"__new__",$slot_name:"tp$new",$slot_func:function(e){const t=function(t,n){let i=e;return e.tp$descr_get&&(i=e.tp$descr_get(null,this.constructor)),Sk.misceval.callsimOrSuspendArray(i,[this.constructor,...t],n)};return t.sk$static_new=!1,t},$wrapper:null,$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Create and return a new object."},e.__call__={$name:"__call__",$slot_name:"tp$call",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this):e;return Sk.misceval.callsimOrSuspendArray(i,t,n)}},$wrapper:function(e,t,n){return void 0===(e=e.tp$call(t,n))?Sk.builtin.none.none$:e},$textsig:"($self, /, *args, **kwargs)",$flags:{FastCall:!0},$doc:"Call self as a function."},e.__repr__={$name:"__repr__",$slot_name:"$r",$slot_func:u("__repr__",Sk.builtin.checkString,"str"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return repr(self)."},e.__str__={$name:"__str__",$slot_name:"tp$str",$slot_func:u("__str__",Sk.builtin.checkString,"str"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return str(self)."};var f=u("__hash__",Sk.builtin.checkInt,"int",(e=>"number"==typeof e.v?e.v:e.tp$hash()));e.__hash__={$name:"__hash__",$slot_name:"tp$hash",$slot_func:function(e){return e===Sk.builtin.none.none$?Sk.builtin.none.none$:f(e)},$wrapper:a(n,(e=>new Sk.builtin.int_(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return hash(self)."},e.__getattribute__={$name:"__getattribute__",$slot_name:"tp$getattr",$slot_func:function(e){return function(e,t){let n=this.ob$type.$typeLookup(Sk.builtin.str.$getattr);if(void 0===n)return p.call(this,e,t);const i=Sk.misceval.chain(p.call(this,e,t),(t=>Sk.misceval.tryCatch((()=>void 0!==t?t:(n.tp$descr_get&&(n=n.tp$descr_get(this)),Sk.misceval.callsimOrSuspendArray(n,[e]))),(function(e){if(!(e instanceof Sk.builtin.AttributeError))throw e}))));return t?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}},$wrapper:function(e,t,n){if(Sk.abstr.checkOneArg(this.$name,t,n),t=t[0],!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("attribute name must be string, not '"+Sk.abstr.typeName(t)+"'");if(void 0===(n=this.call(e,t)))throw new Sk.builtin.AttributeError(Sk.abstr.typeName(e)+" has no attribute "+t.$jsstr());return n},$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Return getattr(self, name)."},e.__getattr__={$name:"__getattr__",$slot_name:"tp$getattr",$slot_func:e.__getattribute__.$slot_func,$wrapper:null,$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Return getattr(self, name)."},e.__setattr__={$name:"__setattr__",$slot_name:"tp$setattr",$slot_func:h("__setattr__","__delattr__"),$wrapper:function(e,t,n){return Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,2,2),d(e,this),this.call(e,t[0],t[1]),Sk.builtin.none.none$},$textsig:"($self, name, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Implement setattr(self, name, value)."},e.__delattr__={$name:"__delattr__",$slot_name:"tp$setattr",$slot_func:e.__setattr__.$slot_func,$wrapper:function(e,t,n){return Sk.abstr.checkOneArg(this.$name,t,n),d(e,this),this.call(e,t[0]),Sk.builtin.none.none$},$textsig:"($self, name, /)",$flags:{OneArg:!0},$doc:"Implement delattr(self, name)."},e.__get__={$name:"__get__",$slot_name:"tp$descr_get",$slot_func:function(e){return function(t,n,i){null===t&&(t=Sk.builtin.none.none$),null==n&&(n=Sk.builtin.none.none$);const r=e.tp$descr_get?e.tp$descr_get(this):e;return t=Sk.misceval.callsimOrSuspendArray(r,[t,n]),i?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)}},$wrapper:function(e,t,n){if(Sk.abstr.checkNoKwargs(this.$name,n),Sk.abstr.checkArgsLen(this.$name,t,1,2),n=t[0],t=t[1],n===Sk.builtin.none.none$&&(n=null),t===Sk.builtin.none.none$&&(t=null),null===t&&null===n)throw new Sk.builtin.TypeError("__get__(None, None) is invalid");return this.call(e,n,t)},$textsig:"($self, instance, owner, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Return an attribute of instance, which is of type owner."},e.__set__={$name:"__set__",$slot_name:"tp$descr_set",$slot_func:h("__set__","__delete__"),$wrapper:s,$textsig:"($self, instance, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Set an attribute of instance to value."},e.__delete__={$name:"__delete__",$slot_name:"tp$descr_set",$slot_func:e.__set__.$slot_func,$wrapper:i,$textsig:"($self, instance, /)",$flags:{OneArg:!0},$doc:"Delete an attribute of instance."},e.__eq__={$name:"__eq__",$slot_name:"ob$eq",$slot_func:c,$wrapper:o,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self==value."},e.__ge__={$name:"__ge__",$slot_name:"ob$ge",$slot_func:c,$wrapper:o,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>=value."},e.__gt__={$name:"__gt__",$slot_name:"ob$gt",$slot_func:c,$wrapper:o,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>value."},e.__le__={$name:"__le__",$slot_name:"ob$le",$slot_func:c,$wrapper:o,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<=value."},e.__lt__={$name:"__lt__",$slot_name:"ob$lt",$slot_func:c,$wrapper:o,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<value."},e.__ne__={$name:"__ne__",$slot_name:"ob$ne",$slot_func:c,$wrapper:o,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self!=value."},e.__iter__={$name:"__iter__",$slot_name:"tp$iter",$slot_func:l,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Implement iter(self)."},e.__next__={$name:"__next__",$slot_name:"tp$iternext",$slot_func:function(e){return function(t){const n=e.tp$descr_get?e.tp$descr_get(this):e,i=Sk.misceval.tryCatch((()=>Sk.misceval.callsimOrSuspendArray(n,[])),(e=>{if(!(e instanceof Sk.builtin.StopIteration))throw e}));return t?i:Sk.misceval.retryOptionalSuspensionOrThrow(i)}},$wrapper:function(e,t,n){return Sk.abstr.checkNoArgs(this.$name,t,n),Sk.misceval.chain(e.tp$iternext(!0),(e=>{if(void 0===e)throw new Sk.builtin.StopIteration;return e}))},$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Implement next(self)."},e.__len__={$name:"__len__",$slot_name:"sq$length",$slot_func:function(e){return function(t){const n=e.tp$descr_get?e.tp$descr_get(this):e;return t?(t=Sk.misceval.callsimOrSuspendArray(n,[]),Sk.misceval.chain(t,(e=>Sk.misceval.asIndexOrThrow(e)))):(t=Sk.misceval.callsimArray(n,[]),Sk.misceval.asIndexOrThrow(t))}},$wrapper:a(n,(e=>new Sk.builtin.int_(e))),$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return len(self)."},e.__contains__={$name:"__contains__",$slot_name:"sq$contains",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this):e;return t=Sk.misceval.callsimOrSuspendArray(i,[t]),t=Sk.misceval.chain(t,(e=>Sk.misceval.isTrue(e))),t.$isSuspension?n?t:Sk.misceval.retryOptionalSuspensionOrThrow(t):t}},$wrapper:a(i,(e=>new Sk.builtin.bool(e))),$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Return key in self."},e.__getitem__={$name:"__getitem__",$slot_name:"mp$subscript",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this):e;return t=Sk.misceval.callsimOrSuspendArray(i,[t]),n?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)}},$wrapper:i,$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Return self[key]."},e.__setitem__={$name:"__setitem__",$slot_name:"mp$ass_subscript",$slot_func:h("__setitem__","__delitem__","does not support item assignment"),$wrapper:s,$textsig:"($self, key, value, /)",$flags:{MinArgs:2,MaxArgs:2},$doc:"Set self[key] to value."},e.__delitem__={$name:"__delitem__",$slot_name:"mp$ass_subscript",$slot_func:e.__setitem__.$slot_func,$wrapper:i,$textsig:"($self, key, /)",$flags:{OneArg:!0},$doc:"Delete self[key]."},e.__add__={$name:"__add__",$slot_name:"nb$add",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self+value."},e.__radd__={$name:"__radd__",$slot_name:"nb$reflected_add",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value+self."},e.__iadd__={$name:"__iadd__",$slot_name:"nb$inplace_add",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self+=value."},e.__sub__={$name:"__sub__",$slot_name:"nb$subtract",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self-value."},e.__rsub__={$name:"__rsub__",$slot_name:"nb$reflected_subtract",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value-self."},e.__imul__={$name:"__imul__",$slot_name:"nb$inplace_multiply",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self*=value."},e.__mul__={$name:"__mul__",$slot_name:"nb$multiply",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self*value."},e.__rmul__={$name:"__rmul__",$slot_name:"nb$reflected_multiply",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value*self."},e.__isub__={$name:"__isub__",$slot_name:"nb$inplace_subtract",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self-=value."},e.__mod__={$name:"__mod__",$slot_name:"nb$remainder",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self%value."},e.__rmod__={$name:"__rmod__",$slot_name:"nb$reflected_remainder",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value%self."},e.__imod__={$name:"__imod__",$slot_name:"nb$inplace_remainder",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement value%=self."},e.__divmod__={$name:"__divmod__",$slot_name:"nb$divmod",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return divmod(self, value)."},e.__rdivmod__={$name:"__rdivmod__",$slot_name:"nb$reflected_divmod",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return divmod(value, self)"},e.__pos__={$name:"__pos__",$slot_name:"nb$positive",$slot_func:l,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"+self"},e.__neg__={$name:"__neg__",$slot_name:"nb$negative",$slot_func:l,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"-self"},e.__abs__={$name:"__abs__",$slot_name:"nb$abs",$slot_func:l,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"abs(self)"},e.__bool__={$name:"__bool__",$slot_name:"nb$bool",$slot_func:u("__bool__",Sk.builtin.checkBool,"bool",(e=>0!==e.v)),$wrapper:a(n,(e=>new Sk.builtin.bool(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"self != 0"},e.__invert__={$name:"__invert__",$slot_name:"nb$invert",$slot_func:l,$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"~self"},e.__lshift__={$name:"__lshift__",$slot_name:"nb$lshift",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self<<value."},e.__rlshift__={$name:"__rlshift__",$slot_name:"nb$reflected_lshift",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value<<self."},e.__rshift__={$name:"__rshift__",$slot_name:"nb$rshift",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self>>value."},e.__rrshift__={$name:"__rrshift__",$slot_name:"nb$reflected_rshift",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value>>self."},e.__ilshift__={$name:"__ilshift__",$slot_name:"nb$inplace_lshift",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self<<=value."},e.__irshift__={$name:"__irshift__",$slot_name:"nb$inplace_rshift",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self=>>value."},e.__and__={$name:"__and__",$slot_name:"nb$and",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self&value."},e.__rand__={$name:"__rand__",$slot_name:"nb$refelcted_and",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value&self."},e.__iand__={$name:"__iand__",$slot_name:"nb$and",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self&=value."},e.__xor__={$name:"__xor__",$slot_name:"nb$xor",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self^value."},e.__rxor__={$name:"__rxor__",$slot_name:"nb$reflected_xor",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value^self."},e.__ixor__={$name:"__ixor__",$slot_name:"nb$inplace_xor",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self^=value."},e.__or__={$name:"__or__",$slot_name:"nb$or",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self|value."},e.__ror__={$name:"__ror__",$slot_name:"nb$reflected_or",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value|self."},e.__ior__={$name:"__ior__",$slot_name:"nb$inplace_or",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self|=value."},e.__int__={$name:"__int__",$slot_name:"nb$int",$slot_func:u("__int__",Sk.builtin.checkInt,"int"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"int(self)"},e.__float__={$name:"__float__",$slot_name:"nb$float",$slot_func:u("__float__",Sk.builtin.checkFloat,"float"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"float(self)"},e.__floordiv__={$name:"__floordiv__",$slot_name:"nb$floor_divide",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self//value."},e.__rfloordiv__={$name:"__rfloordiv__",$slot_name:"nb$reflected_floor_divide",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value//self."},e.__ifloordiv__={$name:"__ifloordiv__",$slot_name:"nb$inplace_floor_divide",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self//=value."},e.__truediv__={$name:"__truediv__",$slot_name:"nb$divide",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self/value."},e.__rtruediv__={$name:"__rtruediv__",$slot_name:"nb$reflected_divide",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value/self."},e.__itruediv__={$name:"__itruediv__",$slot_name:"nb$inplace_divide",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self/=value."},e.__index__={$name:"__index__",$slot_name:"nb$index",$slot_func:u("__index__",Sk.builtin.checkInt,"int",(e=>e.v)),$wrapper:a(n,(e=>new Sk.builtin.int_(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"Return self converted to an integer, if self is suitable for use as an index into a list."},e.__pow__={$name:"__pow__",$slot_name:"nb$power",$slot_func:function(e){return function(t,n){const i=e.tp$descr_get?e.tp$descr_get(this):e;return null==n?Sk.misceval.callsimArray(i,[t]):Sk.misceval.callsimArray(i,[t,n])}},$wrapper:r,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Return pow(self, value, mod)."},e.__rpow__={$name:"__rpow__",$slot_name:"nb$reflected_power",$slot_func:e.__pow__.$slot_func,$wrapper:r,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Return pow(value, self, mod)."},e.__ipow__={$name:"__ipow__",$slot_name:"nb$inplace_power",$slot_func:e.__pow__.$slot_func,$wrapper:r,$textsig:"($self, value, mod=None, /)",$flags:{MinArgs:1,MaxArgs:2},$doc:"Implement **="},e.__matmul__={$name:"__matmul__",$slot_name:"nb$matrix_multiply",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return self@value."},e.__rmatmul__={$name:"__rmatmul__",$slot_name:"nb$reflected_matrix_multiply",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Return value@self."},e.__imatmul__={$name:"__imatmul__",$slot_name:"nb$inplace_matrix_multiply",$slot_func:c,$wrapper:i,$textsig:"($self, value, /)",$flags:{OneArg:!0},$doc:"Implement self@=value."},e.__long__={$name:"__long__",$slot_name:"nb$long",$slot_func:u("__long__",Sk.builtin.checkInt,"int"),$wrapper:n,$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"int(self)"};var _,m={next:{$name:"next",$slot_name:"tp$iternext",$slot_func:e.__next__.$slot_func,$wrapper:e.__next__.$wrapper,$textsig:e.__next__.$textsig,$flags:e.__next__.$flags},__nonzero__:{$name:"__nonzero__",$slot_name:"nb$bool",$slot_func:u("__nonzero__",Sk.builtin.checkInt,"int",(e=>0!==e.v)),$wrapper:a(n,(e=>new Sk.builtin.bool(e))),$textsig:"($self, /)",$flags:{NoArgs:!0},$doc:"x.__nonzero__() <==> x != 0"},__div__:{$name:"__div__",$slot_name:"nb$divide",$slot_func:c,$wrapper:i,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"x.__div__(y) <==> x/y"},__rdiv__:{$name:"__rdiv__",$slot_name:"nb$reflected_divide",$slot_func:c,$wrapper:i,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"x.__rdiv__(y) <==> x/y"},__idiv__:{$name:"__idiv__",$slot_name:"nb$inplace_divide",$slot_func:c,$wrapper:i,$textsig:"($self, other/)",$flags:{OneArg:!0},$doc:"implement self /= other"}};Sk.subSlots={main_slots:Object.entries({tp$init:"__init__",tp$call:"__call__",$r:"__repr__",tp$str:"__str__",tp$getattr:"__getattribute__",tp$setattr:["__setattr__","__delattr__"],ob$eq:"__eq__",ob$ne:"__ne__",ob$lt:"__lt__",ob$le:"__le__",ob$gt:"__gt__",ob$ge:"__ge__",tp$descr_get:"__get__",tp$descr_set:["__set__","__delete__"],tp$iter:"__iter__",tp$iternext:"__next__"}),number_slots:Object.entries({nb$abs:"__abs__",nb$negative:"__neg__",nb$positive:"__pos__",nb$int:"__int__",nb$long:"__long__",nb$float:"__float__",nb$add:"__add__",nb$reflected_add:"__radd__",nb$inplace_add:"__iadd__",nb$subtract:"__sub__",nb$reflected_subtract:"__rsub__",nb$inplace_subtract:"__isub__",nb$multiply:"__mul__",nb$reflected_multiply:"__rmul__",nb$inplace_multiply:"__imul__",nb$floor_divide:"__floordiv__",nb$reflected_floor_divide:"__rfloordiv__",nb$inplace_floor_divide:"__ifloordiv__",nb$invert:"__invert__",nb$remainder:"__mod__",nb$reflected_remainder:"__rmod__",nb$inplace_remainder:"__imod__",nb$divmod:"__divmod__",nb$reflected_divmod:"__rdivmod__",nb$power:"__pow__",nb$reflected_power:"__rpow__",nb$inplace_power:"__ipow__",nb$divide:"__truediv__",nb$reflected_divide:"__rtruediv__",nb$inplace_divide:"__itruediv__",nb$bool:"__bool__",nb$and:"__and__",nb$reflected_and:"__rand__",nb$inplace_and:"__iand__",nb$or:"__or__",nb$reflected_or:"__ror__",nb$inplace_or:"__ior__",nb$xor:"__xor__",nb$reflected_xor:"__rxor__",nb$inplace_xor:"__ixor__",nb$lshift:"__lshift__",nb$reflected_lshift:"__rlshift__",nb$rshift:"__rshift__",nb$reflected_rshift:"__rrshift__",nb$inplace_lshift:"__ilshift__",nb$inplace_rshift:"__irshift__",nb$matrix_multiply:"__matmul__",nb$reflected_matrix_multiply:"__rmatmul__",nb$inplace_matrix_multiply:"__imatmul__"}),sequence_and_mapping_slots:Object.entries({sq$length:"__len__",sq$contains:"__contains__",mp$subscript:"__getitem__",mp$ass_subscript:["__setitem__","__delitem__"],nb$add:"__add__",nb$multiply:"__mul__",nb$reflected_multiply:"__rmul__",nb$inplace_add:"__iadd__",nb$inplace_multiply:"__imul__"})},Sk.reflectedNumberSlots={nb$add:{reflected:"nb$reflected_add"},nb$subtract:{reflected:"nb$reflected_subtract",slot:function(e){return e instanceof this.constructor?e.nb$subtract(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$multiply:{reflected:"nb$reflected_multiply"},nb$divide:{reflected:"nb$reflected_divide",slot:function(e){return e instanceof this.constructor?e.nb$divide(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$floor_divide:{reflected:"nb$reflected_floor_divide",slot:function(e){return e instanceof this.constructor?e.nb$floor_divide(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$remainder:{reflected:"nb$reflected_remainder",slot:function(e){return e instanceof this.constructor?e.nb$remainder(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$divmod:{reflected:"nb$reflected_divmod",slot:function(e){return e instanceof this.constructor?e.nb$divmod(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$power:{reflected:"nb$reflected_power",slot:function(e,t){return e instanceof this.constructor?e.nb$power(this,t):Sk.builtin.NotImplemented.NotImplemented$}},nb$and:{reflected:"nb$reflected_and"},nb$or:{reflected:"nb$reflected_or"},nb$xor:{reflected:"nb$reflected_xor"},nb$lshift:{reflected:"nb$reflected_lshift",slot:function(e){return e instanceof this.constructor?e.nb$lshift(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$rshift:{reflected:"nb$reflected_rshift",slot:function(e){return e instanceof this.constructor?e.nb$rshift(this):Sk.builtin.NotImplemented.NotImplemented$}},nb$matrix_multiply:{reflected:"nb$reflexted_matrix_multiply",slot:function(e){return e instanceof this.constructor?e.nb$matrix_multiply(this):Sk.builtin.NotImplemented.NotImplemented$}}},Sk.sequenceAndMappingSlots={sq$concat:["nb$add"],sq$repeat:["nb$multiply","nb$reflected_multiply"],mp$length:["sq$length"],sq$inplace_repeat:["nb$inplace_multiply"],sq$inplace_concat:["nb$inplace_add"]},Sk.dunderToSkulpt={__repr__:"$r",__str__:"tp$str",__init__:"tp$init",__new__:"tp$new",__hash__:"tp$hash",__call__:"tp$call",__iter__:"tp$iter",__next__:"tp$iternext",__eq__:"ob$eq",__ne__:"ob$ne",__lt__:"ob$lt",__le__:"ob$le",__gt__:"ob$gt",__ge__:"ob$ge",__abs__:"nb$abs",__neg__:"nb$negative",__pos__:"nb$positive",__int__:"nb$int",__float__:"nb$float",__add__:"nb$add",__radd__:"nb$reflected_add",__iadd__:"nb$inplace_add",__sub__:"nb$subtract",__rsub__:"nb$reflected_subtract",__isub__:"nb$inplace_subtract",__mul__:"nb$multiply",__rmul__:"nb$reflected_multiply",__imul__:"nb$inplace_multiply",__truediv__:"nb$divide",__rtruediv__:"nb$reflected_divide",__itruediv__:"nb$inplace_divide",__floordiv__:"nb$floor_divide",__rfloordiv__:"nb$reflected_floor_divide",__ifloordiv__:"nb$inplace_floor_divide",__invert__:"nb$invert",__mod__:"nb$remainder",__rmod__:"nb$reflected_remainder",__imod__:"nb$inplace_remainder",__divmod__:"nb$divmod",__rdivmod__:"nb$reflected_divmod",__pow__:"nb$power",__rpow__:"nb$reflected_power",__ipow__:"nb$inplace_power",__bool__:"nb$bool",__long__:"nb$long",__lshift__:"nb$lshift",__rlshift__:"nb$reflected_lshift",__ilshift__:"nb$inplace_lshift",__rshift__:"nb$rshift",__rrshift__:"nb$reflected_rshift",__irshift__:"nb$inplace_rshift",__and__:"nb$and",__rand__:"nb$reflected_and",__iand__:"nb$inplace_and",__or__:"nb$or",__ror__:"nb$reflected_or",__ior__:"nb$inplace_or",__xor__:"nb$xor",__rxor__:"nb$reflected_xor",__ixor__:"nb$inplace_xor",__matmul__:"nb$matrix_multiply",__rmatmul__:"nb$reflected_matrix_multiply",__imatmul__:"nb$inplace_matrix_multiply",__get__:"tp$descr_get",__set__:"tp$descr_set",__delete__:"tp$descr_set",__getattribute__:"tp$getattr",__getattr__:"tp$getattr",__setattr__:"tp$setattr",__delattr__:"tp$setattr",__len__:"sq$length",__contains__:"sq$contains",__getitem__:"mp$subscript",__setitem__:"mp$ass_subscript",__delitem__:"mp$ass_subscript"},Sk.exportSymbol("Sk.setupDunderMethods",Sk.setupDunderMethods),Sk.setupDunderMethods=function(e){function t(e,t,n){for(let i=0;i<e.length;i++){const r=e[i].prototype;r.hasOwnProperty(n)||(r[n]=r[t],delete r[t])}}var n=Sk.slots;if(!e||void 0!==_){var i=Sk.abstr.built$iterators,r=[Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.float_,Sk.builtin.complex],s=Sk.subSlots.number_slots,o=Sk.subSlots.main_slots,a=o.findIndex((e=>"tp$iternext"===e[0])),l=s.findIndex((e=>"nb$bool"===e[0])),u=Sk.dunderToSkulpt;if(e){u.__bool__="nb$bool",u.__next__="tp$iternext",delete u.__nonzero__,delete u.__div__,delete u.__rdiv__,delete u.__idiv__,delete u.next;for(let e in _)n[e]=_[e];for(let e in m)delete n[e];for(e=0;e<r.length;e++)delete(n=r[e].prototype).__div__,delete n.__rdiv__;o[a][1]="__next__",s[l][1]="__bool__",t(i,"next","__next__"),t(r,"__bool__","__nonzero__")}else{void 0===_&&(n.py3$slots={__next__:n.__next__},_=n.py3$slots),u.next="tp$iternext",u.__nonzero__="nb$bool",u.__div__="nb$divide",u.__rdiv__="nb$reflected_divide",u.__idiv__="nb$inplace_divide",delete u.__bool__,delete u.__next__;for(let e in m)n[e]=m[e];for(let e in _)delete n[e];for(o[a][1]="next",s[l][1]="__nonzero__",t(i,"__next__","next"),t(r,"__nonzero__","__bool__"),i=0;i<r.length;i++)(o=(s=r[i]).prototype).hasOwnProperty("__div__")||(o.__div__=new Sk.builtin.wrapper_descriptor(s,m.__div__,o.nb$divide),o.__rdiv__=new Sk.builtin.wrapper_descriptor(s,m.__rdiv__,Sk.reflectedNumberSlots.nb$divide.slot))}}}},function(e,t){function n(e,t,n){return Sk.abstr.buildNativeClass(e,{constructor:n.constructor,slots:Object.assign({tp$getattr:Sk.generic.getAttr,$r:s},n.slots),getsets:Object.assign(n.getsets||{},o),proto:Object.assign(n.proto||{},{d$repr_name:t||e,d$check:i,d$set_check:r}),flags:{sk$acceptable_as_base_class:!1}})}function i(e){if(null==e)return this;if(!e.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(e)+"' object")}function r(e){if(!e.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(e)+"' object")}function s(){return new Sk.builtin.str("<"+this.d$repr_name+" '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects>")}const o={__doc__:{$get(){return this.d$def.$doc?new Sk.builtin.str(this.d$def.$doc):Sk.builtin.none.none$}},__objclass__:{$get(){return this.d$type}},__name__:{$get(){return new Sk.builtin.str(this.d$name)}}};e={__text_signature__:{$get(){return this.d$def.$textsig?new Sk.builtin.str(this.d$def.$textsig):Sk.builtin.none.none$}}},Sk.builtin.getset_descriptor=n("getset_descriptor",void 0,{constructor:function(e,t){this.d$def=t,this.$get=t.$get,this.$set=t.$set,this.d$type=e,this.d$name=t.$name},slots:{tp$descr_get(e,t){if(t=this.d$check(e))return t;if(void 0!==this.$get)return this.$get.call(e);throw new Sk.builtin.AttributeError("getset_descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects is not readable")},tp$descr_set(e,t){if(this.d$set_check(e),void 0!==this.$set)return this.$set.call(e,t);throw new Sk.builtin.AttributeError("attribute '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' objects is readonly")}}}),Sk.builtin.method_descriptor=n("method_descriptor","method",{constructor:function(e,t){this.d$def=t,this.$meth=t.$meth,this.d$type=e,this.d$name=t.$name||"<native JS>",this.$flags=e=t.$flags||{},e.FastCall&&e.NoKwargs?this.tp$call=this.$methodFastCallNoKwargs:e.FastCall?this.tp$call=this.$methodFastCall:e.NoArgs?this.tp$call=this.$methodCallNoArgs:e.OneArg?this.tp$call=this.$methodCallOneArg:e.NamedArgs?this.tp$call=this.$methodCallNamedArgs:void 0!==e.MinArgs?this.tp$call=this.$methodCallMinArgs:(this.func_code=t.$meth,this.tp$call=this.$defaultCall,this.$memoiseFlags=Sk.builtin.func.prototype.$memoiseFlags,this.$resolveArgs=Sk.builtin.func.prototype.$resolveArgs)},slots:{tp$call(e,t){return this.tp$call(e,t)},tp$descr_get(e,t){let n;return(n=this.d$check(e))?n:new Sk.builtin.sk_method(this.d$def,e)}},getsets:e,proto:{$methodFastCall(e,t){const n=e.shift();return this.m$checkself(n),this.$meth.call(n,e,t)},$methodFastCallNoKwargs(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkNoKwargs(this.d$name,t),this.$meth.call(n,e)},$methodCallNoArgs(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkNoArgs(this.d$name,e,t),this.$meth.call(n)},$methodCallOneArg(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkOneArg(this.d$name,e,t),this.$meth.call(n,e[0])},$methodCallNamedArgs(e,t){const n=e.shift();return this.m$checkself(n),e=Sk.abstr.copyKeywordsToNamedArgs(this.d$name,this.$flags.NamedArgs,e,t,this.$flags.Defaults),this.$meth.call(n,...e)},$methodCallMinArgs(e,t){const n=e.shift();return this.m$checkself(n),Sk.abstr.checkNoKwargs(this.d$name,t),Sk.abstr.checkArgsLen(this.d$name,e,this.$flags.MinArgs,this.$flags.MaxArgs),this.$meth.call(n,...e)},$defaultCall(e,t){return this.m$checkself(e[0]),Sk.builtin.func.prototype.tp$call.call(this,e,t)},m$checkself(e){if(void 0===e)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");this.d$check(e)}}}),Sk.builtin.wrapper_descriptor=n("wrapper_descriptor","slot wrapper",{constructor:function(e,t,n){this.d$def=t,this.d$type=e,this.d$name=n.$name=t.$name,this.d$wrapped=n},slots:{tp$descr_get(e,t){let n;return(n=this.d$check(e))?n:new Sk.builtin.method_wrapper(this,e)},tp$call(e,t){if(1>e.length)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");const n=e.shift();if(!n.ob$type.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(n)+"'");return this.raw$call(n,e,t)}},proto:{raw$call(e,t,n){return this.d$wrapped.$name=this.d$name,this.d$def.$wrapper.call(this.d$wrapped,e,t,n)}}}),Sk.builtin.method_wrapper=n("method_wrapper",void 0,{constructor:function(e,t){this.m$descr=e,this.m$self=t,this.d$def=e.d$def,this.d$name=e.d$name,this.d$type=e.d$type},slots:{tp$call(e,t){return this.m$descr.raw$call(this.m$self,e,t)},tp$richcompare(e,t){return("Eq"===t||"NotEq"===t)&&e instanceof Sk.builtin.method_wrapper?(e=this.m$self===e.m$self&&this.m$descr===e.m$descr,"Eq"===t?e:!e):Sk.builtin.NotImplemented.NotImplemented$},$r(){return new Sk.builtin.str("<method-wrapper '"+this.d$name+"' of "+Sk.abstr.typeName(this.m$self)+" object>")}},getsets:{__self__:{$get(){return this.m$self}}}}),Sk.builtin.classmethod_descriptor=n("classmethod_descriptor","method",{constructor:function(e,t){this.d$def=t,this.$meth=t.$meth,this.d$type=e,this.d$name=t.$name||"<native JS>"},slots:{tp$call(e,t){if(1>e.length)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' of '"+this.d$type.prototype.tp$name+"' object needs an argument");const n=e.shift();return this.tp$descr_get(null,n).tp$call(e,t)},tp$descr_get(e,t,n){if(void 0===t){if(null===e)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' for type '"+this.d$type.prototype.tp$name+"' needs an object or a type");t=t||e.ob$type}if(t.ob$type!==Sk.builtin.type)throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' for type '"+this.d$type.prototype.tp$name+"' needs a type not a '"+Sk.abstr.typeName(t)+"' as arg 2");if(!t.$isSubType(this.d$type))throw new Sk.builtin.TypeError("descriptor '"+this.d$name+"' requires a '"+this.d$type.prototype.tp$name+"' object but received a '"+Sk.abstr.typeName(t)+"' object");return new Sk.builtin.sk_method(this.d$def,t)}},getsets:e}),[Sk.builtin.method_descriptor,Sk.builtin.getset_descriptor,Sk.builtin.wrapper_descriptor,Sk.builtin.method_wrapper,Sk.builtin.classmethod_descriptor].forEach((e=>{Sk.abstr.setUpSlots(e),Sk.abstr.setUpMethods(e),Sk.abstr.setUpGetSets(e)}))},function(e,t){Sk.builtin.sk_method=Sk.abstr.buildNativeClass("builtin_function_or_method",{constructor:function(e,t,n){this.$meth=e.$meth.bind(t),this.$doc=e.$doc,this.$self=t||null,this.$module=n?new Sk.builtin.str(n):null,this.$name=e.$name||e.$meth.name||"<native JS>",this.m$def=e,this.$textsig=e.$textsig,this.$flags=e=e.$flags||{},e.FastCall&&e.NoKwargs?this.tp$call=this.$fastCallNoKwargs:e.FastCall?this.tp$call=this.$meth:e.NoArgs?this.tp$call=this.$callNoArgs:e.OneArg?this.tp$call=this.$callOneArg:e.NamedArgs?this.tp$call=this.$callNamedArgs:void 0!==e.MinArgs?this.tp$call=this.$callMinArgs:(this.func_code=this.$meth,this.tp$call=this.$defaultCallMethod)},proto:{$fastCallNoKwargs(e,t){return Sk.abstr.checkNoKwargs(this.$name,t),this.$meth(e)},$callNoArgs(e,t){return Sk.abstr.checkNoArgs(this.$name,e,t),this.$meth()},$callOneArg(e,t){return Sk.abstr.checkOneArg(this.$name,e,t),this.$meth(e[0])},$callNamedArgs(e,t){return e=Sk.abstr.copyKeywordsToNamedArgs(this.$name,this.$flags.NamedArgs,e,t,this.$flags.Defaults),this.$meth(...e)},$callMinArgs(e,t){return Sk.abstr.checkNoKwargs(this.$name,t),Sk.abstr.checkArgsLen(this.$name,e,this.$flags.MinArgs,this.$flags.MaxArgs),this.$meth(...e)},$defaultCallMethod(e,t){return null!==this.$self?Sk.builtin.func.prototype.tp$call.call(this,[this.$self,...e],t):Sk.builtin.func.prototype.tp$call.call(this,e,t)},$memoiseFlags(){return Sk.builtin.func.prototype.$memoiseFlags.call(this)},$resolveArgs(){return Sk.builtin.func.prototype.$resolveArgs.call(this)}},flags:{sk$acceptable_as_base_class:!1},slots:{tp$getattr:Sk.generic.getAttr,$r(){return null===this.$self?new Sk.builtin.str("<built-in function "+this.$name+">"):new Sk.builtin.str("<built-in method "+this.$name+" of "+Sk.abstr.typeName(this.$self)+" object>")},tp$call(e,t){return this.tp$call(e,t)},tp$richcompare(e,t){return("Eq"===t||"NotEq"===t)&&e instanceof Sk.builtin.sk_method?(e=this.$self===e.$self&&this.m$def.$meth===e.m$def.$meth,"Eq"===t?e:!e):Sk.builtin.NotImplemented.NotImplemented$}},getsets:{__module__:{$get(){return this.$module||Sk.builtin.none.none$},$set(e){this.$module=e=e||Sk.builtin.none.none$}},__doc__:{$get(){return this.$doc?new Sk.builtin.str(this.$doc):Sk.builtin.none.none$}},__name__:{$get(){return new Sk.builtin.str(this.$name)}},__text_signature__:{$get(){return new Sk.builtin.str(this.$textsig)}},__self__:{$get(){return this.$self||Sk.sysModules.mp$lookup(this.$module)||Sk.builtin.none.none$}}}})},function(e,t){Sk.builtin.none=Sk.abstr.buildNativeClass("NoneType",{constructor:function(){return Sk.builtin.none.none$},slots:{tp$new:(e,t)=>(Sk.abstr.checkNoArgs("NoneType",e,t),Sk.builtin.none.none$),$r:()=>new Sk.builtin.str("None"),tp$as_number:!0,nb$bool:()=>!1},flags:{sk$acceptable_as_base_class:!1}}),Sk.builtin.none.none$=Object.create(Sk.builtin.none.prototype,{v:{value:null,enumerable:!0}}),Sk.builtin.NotImplemented=Sk.abstr.buildNativeClass("NotImplementedType",{constructor:function(){return Sk.builtin.NotImplemented.NotImplemented$},slots:{$r:()=>new Sk.builtin.str("NotImplemented"),tp$new:(e,t)=>(Sk.abstr.checkNoArgs("NotImplementedType",e,t),Sk.builtin.NotImplemented.NotImplemented$)},flags:{sk$acceptable_as_base_class:!1}}),Sk.builtin.NotImplemented.NotImplemented$=Object.create(Sk.builtin.NotImplemented.prototype,{v:{value:null,enumerable:!0}})},function(e,t){const n=/^(?:(.)?([<>=\^]))?([\+\-\s])?(#)?(0)?(\d+)?(,)?(?:\.(\d+))?([bcdeEfFgGnosxX%])?$/;Sk.formatting={};let i=function(e,t,n,i){if(Sk.asserts.assert("string"==typeof t),e[6]){var r=parseInt(e[6],10);i=e[2]||(e[5]?"=":i?">":"<");let s=r-(t.length+(n?n.length:0));if(0>=s)return t;switch(r=(e[1]||(e[5]?"0":" ")).repeat(s),i){case"=":if("s"===e[9])throw new Sk.builtin.ValueError("'=' alignment not allowed in string format specifier");return n+r+t;case">":return r+n+t;case"<":return n+t+r;case"^":return e=Math.floor(s/2),r.substring(0,e)+n+t+r.substring(e)}}return n+t},r=function(e,t){return t?"-":"+"===e[3]?"+":" "===e[3]?" ":""},s=function(e,t,n){if(Sk.asserts.assert(t instanceof Sk.builtin.int_||t instanceof Sk.builtin.lng),e[8])throw new Sk.builtin.ValueError("Precision not allowed in integer format");let s=t.str$(n,!1);return t=t.nb$isnegative(),t=r(e,t),e[4]&&(16===n?t+="0x":8===n?t+="0o":2===n&&(t+="0b")),"X"===e[9]&&(s=s.toUpperCase()),"n"===e[9]?s=(+s).toLocaleString():e[7]&&((n=s.toString().split("."))[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),s=n.join(".")),i(e,s,t,!0)},o=function(e,t,o){if(!t)return e.str$(10,!0);if(!(t=t.match(n)))throw new Sk.builtin.ValueError("Invalid format specifier");var a=t[9];if(a||(a=o?"g":"d"),-1==(o?"fFeEgG%":"bcdoxXnfFeEgG%").indexOf(a))throw new Sk.builtin.ValueError("Unknown format code '"+t[9]+"' for object of type '"+Sk.abstr.typeName(e)+"'");switch(a){case"d":case"n":return s(t,e,10);case"x":case"X":return s(t,e,16);case"o":return s(t,e,8);case"b":return s(t,e,2);case"c":if(t[3])throw new Sk.builtin.ValueError("Sign not allowed with integer format specifier 'c'");if(t[4])throw new Sk.builtin.ValueError("Alternate form not allowed with integer format specifier 'c'");if(t[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");if(t[8])throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'");return i(t,String.fromCodePoint(Sk.builtin.asnum$(e)),"",!0);case"f":case"F":case"e":case"E":case"g":case"G":{if(t[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed in float format specifier");if("string"==typeof(o=Sk.builtin.asnum$(e))&&(o=Number(o)),1/0===o)return i(t,"inf","",!0);if(-1/0===o)return i(t,"inf","-",!0);if(isNaN(o))return i(t,"nan","",!0);e=!1,0>o&&(o=-o,e=!0);var l=["toExponential","toFixed","toPrecision"]["efg".indexOf(a.toLowerCase())];let n=t[8]?parseInt(t[8],10):6;if(o=o[l](n),-1!=="EFG".indexOf(a)&&(o=o.toUpperCase()),"g"===a.toLowerCase()||!t[9]){if(l=o.match(/\.(\d*[1-9])?(0+)$/)){let[,e,t]=l;o=o.slice(0,e?-t.length:-(t.length+1))}-1!=o.indexOf(".")||t[9]||(o+=".0")}return"e"===a.toLowerCase()&&(o=o.replace(/^([-+]?[0-9]*\.?[0-9]+[eE][-+]?)([0-9])?$/,"$10$2")),t[7]&&((a=o.toString().split("."))[0]=a[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=a.join(".")),i(t,o,r(t,e),!0)}case"%":if(t[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with format specifier '%'");return"string"==typeof(e=Sk.builtin.asnum$(e))&&(e=Number(e)),1/0===e?i(t,"inf%","",!0):-1/0===e?i(t,"inf%","-",!0):isNaN(e)?i(t,"nan%","",!0):(a=!1,0>e&&(e=-e,a=!0),o=t[8]?parseInt(t[8],10):6,e=(100*e).toFixed(o)+"%",i(t,e,r(t,a),!0));default:throw new Sk.builtin.ValueError("Unknown format code '"+t[9]+"'")}};Sk.formatting.mkNumber__format__=e=>function(t){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(t));return new Sk.builtin.str(o(this,t.$jsstr(),e))},Sk.formatting.format=function(e,t){t=t||[];const n={};for(let e=0;e<t.length;e+=2)n[t[e]]=t[e+1];for(let t in e)n[t]=e[t];let i=0;return e=this.v.replace(/{(((?:\d+)|(?:\w+))?((?:\.(\w+))|(?:\[((?:\d+)|(?:\w+))\])?))?(?:!([rs]))?(?::([^}]*))?}/g,(function(e,t,r,s,o,a,l,u,c,p){let h;if(void 0!==a&&""!==a?(h=(e=n[r]).constructor===Array?e[a]:/^\d+$/.test(a)?Sk.abstr.objectGetItem(e,new Sk.builtin.int_(parseInt(a,10)),!1):Sk.abstr.objectGetItem(e,new Sk.builtin.str(a),!1),i++):void 0!==o&&""!==o?h=Sk.abstr.gattr(n[r||i++],new Sk.builtin.str(o)):void 0!==r&&""!==r?h=n[r]:void 0===t||""===t?(h=n[i],i++):(t instanceof Sk.builtin.int_||t instanceof Sk.builtin.float_||t instanceof Sk.builtin.lng||/^\d+$/.test(t))&&(h=n[t],i++),"s"===l)h=new Sk.builtin.str(h);else if("r"===l)h=Sk.builtin.repr(h);else if(""!==l&&void 0!==l)throw new Sk.builtin.ValueError("Unknown conversion specifier "+l);return Sk.abstr.objectFormat(h,new Sk.builtin.str(u)).$jsstr()})),new Sk.builtin.str(e)},Sk.formatting.formatString=function(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("format() argument 2 must be str, not "+Sk.abstr.typeName(e));if((e=e.$jsstr().match(n))[9]&&"s"!==e[9])throw new Sk.builtin.ValueError("Unknown format code '"+e[9]+"' for object of type 'str'");if(e[3])throw new Sk.builtin.ValueError("Sign not allowed in string format specifier");if(e[4])throw new Sk.builtin.ValueError("Alternate form (#) not allowed with string format specifier");if(e[7])throw new Sk.builtin.ValueError("Cannot specify ',' with 's'");let t=this.v;return e[8]&&(t=t.substring(0,e[8])),new Sk.builtin.str(i(e,t,"",!1))}},function(e,t){function n(e){let t;const n=[];for(let i=0;i<e.length;i++)t=e.charAt(i),h.test(t)?n.push(t):"\\000"===t?n.push("\\000"):n.push("\\"+t);return n.join("")}function i(e,t,n){if(null!==(t=Sk.builtin.checkNone(t)?null:e.get$tgt(t))&&!t.length)throw new Sk.builtin.ValueError("empty separator");e=e.v;var i=0;if(null===t){var r=/[\s\xa0]+/g;i=e.length,i-=(e=e.replace(f,"")).length}else r=t.replace(d,"\\$1"),r=new RegExp(r,"g");const s=[];let o,a=0,l=0;for(n=0>n?1/0:n;null!=(o=r.exec(e))&&l<n&&o.index!==r.lastIndex;)s.push(a+i),s.push(o.index+i),a=r.lastIndex,l+=1;return(null!==t||e.length-a)&&(s.push(a+i),s.push(e.length+i)),s}function r(e,t){return function(i){if(void 0===i||Sk.builtin.checkNone(i))i=e;else{if(!(i instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("strip arg must be None or str");i=n(i.v),i=new RegExp(t(i),"g")}return new Sk.builtin.str(this.v.replace(i,""))}}function s(e){return function(t){t=this.get$tgt(t);const n=this.v;let i;if(e){if(i=n.lastIndexOf(t),0>i)return new Sk.builtin.tuple([new Sk.builtin.str(""),new Sk.builtin.str(""),new Sk.builtin.str(n)])}else if(i=n.indexOf(t),0>i)return new Sk.builtin.tuple([new Sk.builtin.str(n),new Sk.builtin.str(""),new Sk.builtin.str("")]);return new Sk.builtin.tuple([new Sk.builtin.str(n.substring(0,i)),new Sk.builtin.str(t),new Sk.builtin.str(n.substring(i+t.length))])}}function o(e,t){return function(n,i){if(n=Sk.misceval.asIndexSized(n,Sk.builtin.OverflowError),void 0===i)i=" ";else{if(!(i instanceof Sk.builtin.str&&1===i.sq$length()))throw new Sk.builtin.TypeError("the fill character must be a str of length 1");i=i.v}const r=this.sq$length();let s;return r>=n?new Sk.builtin.str(this.v):t?(s=i.repeat(Math.floor((n-r)/2)),s=s+this.v+s,(n-r)%2&&(s+=i),new Sk.builtin.str(s)):(s=i.repeat(n-r),new Sk.builtin.str(e?s+this.v:this.v+s))}}function a(e,t,n){if(({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(e,t,n)),e.$hasAstralCodePoints()){const i=e.codepoints[t];t=void 0===i?t+e.v.length-e.codepoints.length:i,n=void 0===(n=e.codepoints[n])?e.v.length:n}return{start:t,end:n}}function l(e){return function(t,n,i){if(t=this.get$tgt(t),({start:n,end:i}=a(this,n,i)),i<n)return-1;if(i-=t.length,t=(t=e?this.v.lastIndexOf(t,i):this.v.indexOf(t,n))>=n&&t<=i?t:-1,this.codepoints){i=this.sq$length(),n=-1;for(let e=0;e<i;e++)t==this.codepoints[e]&&(n=e)}else n=t;return n}}function u(e,t){return function(n,i,r){if(!(n instanceof Sk.builtin.str||n instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError(e+" first arg must be str or a tuple of str, not "+Sk.abstr.typeName(n));if(({start:i,end:r}=a(this,i,r)),i>r)return Sk.builtin.bool.false$;if(i=this.v.slice(i,r),n instanceof Sk.builtin.tuple){for(let r=Sk.abstr.iter(n),s=r.tp$iternext();void 0!==s;s=r.tp$iternext()){if(!(s instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("tuple for "+e+" must only contain str, not "+Sk.abstr.typeName(s));if(t(i,s.v))return Sk.builtin.bool.true$}return Sk.builtin.bool.false$}return new Sk.builtin.bool(t(i,n.v))}}var c=/^[0-9!#_]/,p=Object.create(null);Sk.builtin.str=Sk.abstr.buildNativeClass("str",{constructor:function(e){if(Sk.asserts.assert(this instanceof Sk.builtin.str,"bad call to str - use 'new'"),"string"!=typeof e)if(void 0===e)e="";else if(null===e)e="None";else{if(void 0!==e.tp$str)return e.tp$str();if("number"!=typeof e)throw new Sk.builtin.TypeError("could not convert object of type '"+Sk.abstr.typeName(e)+"' to str");e=Number.isFinite(e)?String(e):String(e).replace("Infinity","inf").replace("NaN","nan")}var t=p[e];if(void 0!==t)return t;p[e]=this,t=void 0===m[e]?e:e+"_$rw$",this.$mangled=t,this.$savedKeyHash=e.replace(c,"!$&"),this.v=e},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'.",tp$new(e,t){if(t=t||[],this!==Sk.builtin.str.prototype)return this.$subtype_new(e,t);if(1>=e.length&&!t.length)return new Sk.builtin.str(e[0]);if(Sk.__future__.python3){const[n,i,r]=Sk.abstr.copyKeywordsToNamedArgs("str",["object","encoding","errors"],e,t);if(void 0===n||void 0===i&&void 0===r)return new Sk.builtin.str(n);if(Sk.builtin.bytes.check$encodeArgs("str",i,r),!Sk.builtin.checkBytes(n))throw new Sk.builtin.TypeError("decoding to str: need a bytes-like object, "+Sk.abstr.typeName(n)+" found");return Sk.builtin.bytes.$decode.call(n,i,r)}throw new Sk.builtin.TypeError("str takes at most one argument ("+(e.length+t.length)+" given)")},$r(){let e="'";-1!==this.v.indexOf("'")&&-1===this.v.indexOf('"')&&(e='"');const t=this.v.length;let n=e;for(let s=0;s<t;s++){var i=this.v.charAt(s),r=this.v.charCodeAt(s);i===e||"\\"===i?n+="\\"+i:"\t"===i?n+="\\t":"\n"===i?n+="\\n":"\r"===i?n+="\\r":(255<r&&55296>r||57344<=r)&&!Sk.__future__.python3?n+="\\u"+("000"+r.toString(16)).slice(-4):55296<=r&&!Sk.__future__.python3?(i=this.v.codePointAt(s),s++,r="0000000"+(i=i.toString(16)).toString(16),n=4<i.length?n+"\\U"+r.slice(-8):n+"\\u"+r.slice(-4)):255<r&&!Sk.__future__.python3?n+="\\ufffd":" ">i||127<=r&&!Sk.__future__.python3?(2>(i=i.charCodeAt(0).toString(16)).length&&(i="0"+i),n+="\\x"+i):n+=i}return new Sk.builtin.str(n+e)},tp$str(){return this.constructor===Sk.builtin.str?this:new Sk.builtin.str(this.v)},tp$iter(){return new _(this)},tp$richcompare(e,t){if(!(e instanceof Sk.builtin.str))return Sk.builtin.NotImplemented.NotImplemented$;switch(t){case"Lt":return this.v<e.v;case"LtE":return this.v<=e.v;case"Eq":return this.v===e.v;case"NotEq":return this.v!==e.v;case"Gt":return this.v>e.v;case"GtE":return this.v>=e.v}},mp$subscript(e){let t;if(Sk.misceval.isIndex(e)){if(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError),t=this.sq$length(),0>e&&(e+=t),0>e||e>=t)throw new Sk.builtin.IndexError("string index out of range");return this.codepoints?new Sk.builtin.str(this.v.substring(this.codepoints[e],this.codepoints[e+1])):new Sk.builtin.str(this.v.charAt(e))}if(e instanceof Sk.builtin.slice){let n="";return t=this.sq$length(),this.codepoints?e.sssiter$(t,(e=>{n+=this.v.substring(this.codepoints[e],this.codepoints[e+1])})):e.sssiter$(t,(e=>{n+=this.v.charAt(e)})),new Sk.builtin.str(n)}throw new Sk.builtin.TypeError("string indices must be integers, not "+Sk.abstr.typeName(e))},sq$length(){return this.$hasAstralCodePoints()?this.codepoints.length:this.v.length},sq$concat(e){if(!(e instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("cannot concatenate 'str' and '"+Sk.abstr.typeName(e)+"' objects");return new Sk.builtin.str(this.v+e.v)},sq$repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");if((e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))*this.v.length>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;let t="";for(let n=0;n<e;n++)t+=this.v;return new Sk.builtin.str(t)},sq$contains(e){if(!(e instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("'in <string>' requires string as left operand not "+Sk.abstr.typeName(e));return-1!==this.v.indexOf(e.v)},tp$as_number:!0,nb$remainder:function(e){const t=this.sk$builtinBase;e.constructor===Sk.builtin.tuple||e instanceof Sk.builtin.dict||e instanceof Sk.builtin.mappingproxy||(e=new Sk.builtin.tuple([e]));var n=0,i=this.$jsstr().replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrsb%])/g,(function(i,r,s,o,a,l,u){var c,p,h,d,f;o=Sk.builtin.asnum$(o),a=Sk.builtin.asnum$(a),void 0!==r&&""!==r||"%"==u||(c=n++),""===a&&(a=void 0);var _=p=h=d=f=!1;if(s&&(-1!==s.indexOf("-")?d=!0:-1!==s.indexOf("0")&&(f=!0),-1!==s.indexOf("+")?p=!0:-1!==s.indexOf(" ")&&(h=!0),_=-1!==s.indexOf("#")),a&&(a=parseInt(a.substr(1),10)),s=function(e,t){var n;t=Sk.builtin.asnum$(t);var i=!1;if("number"==typeof e){0>e&&(e=-e,i=!0);var r=e.toString(t)}else e instanceof Sk.builtin.float_?(2<(r=e.str$(t,!1)).length&&".0"===r.substr(-2)&&(r=r.substr(0,r.length-2)),i=e.nb$isnegative()):(e instanceof Sk.builtin.int_||e instanceof Sk.builtin.lng)&&(r=e.str$(t,!1),i=e.nb$isnegative());if(Sk.asserts.assert(void 0!==r,"unhandled number format"),e=!1,a)for(n=r.length;n<a;++n)r="0"+r,e=!0;return n="",i?n="-":p?n="+"+n:h&&(n=" "+n),_&&(16===t?n+="0x":8!==t||e||"0"===r||(n+="0")),[n,r]},i=function(e){var t=e[0];if(e=e[1],o){o=parseInt(o,10);var n=e.length+t.length;if(f)for(;n<o;++n)e="0"+e;else if(d){for(;n<o;++n)e+=" ";Sk.__future__.python3&&(e+=t,t="")}else for(;n<o;++n)t=" "+t}return t+e},e.constructor===Sk.builtin.tuple)r=e.v[c];else if(void 0!==e.mp$subscript&&void 0!==r)r=r.substring(1,r.length-1),r=e.mp$subscript(new t(r));else{if(e.constructor!==Sk.builtin.dict&&e.constructor!==Sk.builtin.list)throw new Sk.builtin.AttributeError(e.tp$name+" instance has no attribute 'mp$subscript'");r=e}if("d"===u||"i"===u){var m=s(r,10);if(void 0===m[1])throw new Sk.builtin.TypeError("%"+u+" format: a number is required, not "+Sk.abstr.typeName(r));return u=m[1],m[1]=-1!==u.indexOf(".")?parseInt(u,10).toString():u,i(m)}if("o"===u)return i(s(r,8));if("x"===u)return i(s(r,16));if("X"===u)return i(s(r,16)).toUpperCase();if("f"===u||"F"===u||"e"===u||"E"===u||"g"===u||"G"===u)return"string"==typeof(m=Sk.builtin.asnum$(r))&&(m=Number(m)),1/0===m?"inf":-1/0===m?"-inf":isNaN(m)?"nan":(c=["toExponential","toFixed","toPrecision"]["efg".indexOf(u.toLowerCase())],void 0!==a&&""!==a||("e"===u||"E"===u?a=6:"f"!==u&&"F"!==u||(a=Sk.__future__.python3?6:7)),c=m[c](a),Sk.builtin.checkFloat(r)&&0===m&&-1/0==1/m&&(c="-"+c),Sk.__future__.python3&&(7<=c.length&&"0.0000"==c.slice(0,6)&&(c=parseFloat(c).toExponential()),"-"==c.charAt(c.length-2)&&(c=c.slice(0,c.length-1)+"0"+c.charAt(c.length-1))),-1!=="EFG".indexOf(u)&&(c=c.toUpperCase()),i(["",c]));if("c"===u){if("number"==typeof r)return String.fromCharCode(r);if(r instanceof Sk.builtin.int_||r instanceof Sk.builtin.float_)return String.fromCharCode(r.v);if(r instanceof Sk.builtin.lng)return String.fromCharCode(r.str$(10,!1)[0]);if(r.constructor===Sk.builtin.str)return r.v.substr(0,1);throw new Sk.builtin.TypeError("an integer is required")}if("r"===u)return u=Sk.builtin.repr(r),a?u.v.substr(0,a):u.v;if("s"===u&&t===Sk.builtin.str)return u=(u=new Sk.builtin.str(r)).$jsstr(),a?u.substr(0,a):(o&&(u=i([" ",u])),u);if("b"===u||"s"===u){if(t===Sk.builtin.str)throw new Sk.builtin.ValueError("unsupported format character 'b'");if(!(r instanceof Sk.builtin.bytes)&&void 0===(m=Sk.abstr.lookupSpecial(r,Sk.builtin.str.$bytes)))throw new Sk.builtin.TypeError("%b requires a bytes-like object, or an object that implements __bytes__, not '"+Sk.abstr.typeName(r)+"'");return void 0!==m&&(r=new Sk.builtin.bytes(r)),u=r.$jsstr(),a?u.substr(0,a):(o&&(u=i([" ",u])),u)}return"%"===u?"%":void 0}));return new t(i)}},proto:{toString(){return this.v},$subtype_new(e,t){const n=new this.constructor;return e=Sk.builtin.str.prototype.tp$new(e,t),n.$mangled=e.$mangled,n.$savedKeyHash=e.$savedKeyHash,n.v=e.v,n},$jsstr(){return this.v},$hasAstralCodePoints(){if(null===this.codepoints)return!1;if(void 0!==this.codepoints)return!0;for(var e=0;e<this.v.length;e++){let t=this.v.charCodeAt(e);if(55296<=t&&57344>t){for(this.codepoints=[],e=0;e<this.v.length;e++)this.codepoints.push(e),t=this.v.charCodeAt(e),55296<=t&&56320>t&&e++;return!0}}return this.codepoints=null,!1},sk$asarray(){const e=[];if(this.$hasAstralCodePoints()){var t=this.codepoints;for(let n=0;n<t.length;n++)e.push(new Sk.builtin.str(this.v.substring(t[n],t[n+1])))}else for(t=0;t<this.v.length;t++)e.push(new Sk.builtin.str(this.v[t]));return e},find$left:l(!1),find$right:l(!0),get$tgt(e){if(e instanceof Sk.builtin.str)return e.v;throw new Sk.builtin.TypeError("a str instance is required not '"+Sk.abstr.typeName(e)+"'")}},methods:{encode:{$meth:function(e,t){return({encoding:e,errors:t}=Sk.builtin.bytes.check$encodeArgs("encode",e,t)),e=Sk.builtin.bytes.str$encode(this,e,t),Sk.__future__.python3?e:new Sk.builtin.str(e.$jsstr())},$flags:{NamedArgs:["encoding","errors"]},$textsig:"($self, /, encoding='utf-8', errors='strict')",$doc:"Encode the string using the codec registered for encoding.\n\n encoding\n The encoding in which to encode the string.\n errors\n The error handling scheme to use for encoding errors.\n The default is 'strict' meaning that encoding errors raise a\n UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n 'xmlcharrefreplace' as well as any other name registered with\n codecs.register_error that can handle UnicodeEncodeErrors."},replace:{$meth(e,t,i){if(e=this.get$tgt(e),t=this.get$tgt(t),i=void 0===i?-1:Sk.misceval.asIndexSized(i,Sk.builtin.OverflowError),e=new RegExp(n(e),"g"),0>i)return new Sk.builtin.str(this.v.replace(e,t));let r=0;return e=this.v.replace(e,(e=>r++<i?t:e)),new Sk.builtin.str(e)},$flags:{MinArgs:2,MaxArgs:3},$textsig:"($self, old, new, count=-1, /)",$doc:"Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced."},split:{$meth:function(e,t){e=i(this,e,t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError)),t=[];for(let n=0;n<e.length;n++)t.push(new Sk.builtin.str(this.v.substring(e[n],e[++n])));return new Sk.builtin.list(t)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the words in the string, using sep as the delimiter string.\n\n sep\n The delimiter according which to split the string.\n None (the default value) means split according to any whitespace,\n and discard empty strings from the result.\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit."},rsplit:{$meth:function(e,t){t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError),e=i(this,e,-1);var n=0>t?0:2*(e.length/2-t);for(t=[],0>=n?n=0:t.push(new Sk.builtin.str(this.v.slice(0,e[n-1])));n<e.length;n++)t.push(new Sk.builtin.str(this.v.substring(e[n],e[++n])));return new Sk.builtin.list(t)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the words in the string, using sep as the delimiter string.\n\n sep\n The delimiter according which to split the string.\n None (the default value) means split according to any whitespace,\n and discard empty strings from the result.\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplits are done starting at the end of the string and working to the front."},join:{$meth(e){const t=[];return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(!(e instanceof Sk.builtin.str))throw new Sk.builtin.TypeError("sequence item "+t.length+": expected str, "+Sk.abstr.typeName(e)+" found");t.push(e.v)})),(()=>new Sk.builtin.str(t.join(this.v))))},$flags:{OneArg:!0},$textsig:"($self, iterable, /)",$doc:"Concatenate any number of strings.\n\nThe string whose method is called is inserted in between each given string.\nThe result is returned as a new string.\n\nExample: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'"},capitalize:{$meth:function(){return new Sk.builtin.str(this.v.charAt(0).toUpperCase()+this.v.slice(1).toLowerCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a capitalized version of the string.\n\nMore specifically, make the first character have upper case and the rest lower\ncase."},title:{$meth:function(){const e=this.v.replace(/[a-z][a-z]*/gi,(e=>e[0].toUpperCase()+e.substr(1).toLowerCase()));return new Sk.builtin.str(e)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a version of the string where each word is titlecased.\n\nMore specifically, words start with uppercased characters and all remaining\ncased characters have lower case."},center:{$meth:o(!1,!0),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a centered string of length width.\n\nPadding is done using the specified fill character (default is a space)."},count:{$meth:function(e,t,n){return e=this.get$tgt(e),({start:t,end:n}=a(this,t,n)),n<t?new Sk.builtin.int_(0):(e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),e=new RegExp(e,"g"),(t=this.v.slice(t,n).match(e))?new Sk.builtin.int_(t.length):new Sk.builtin.int_(0))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of substring sub in\nstring S[start:end]. Optional arguments start and end are\ninterpreted as in slice notation."},expandtabs:{$meth:function(e){if(!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError("an integer is required, got type"+Sk.abstr.typeName(e));e=Sk.builtin.asnum$(e);const t=Array(e+1).join(" "),n=this.v.replace(/([^\r\n\t]*)\t/g,((n,i)=>i+t.slice(i.length%e)));return new Sk.builtin.str(n)},$flags:{NamedArgs:["tabsize"],Defaults:[8]},$textsig:"($self, /, tabsize=8)",$doc:"Return a copy where all tab characters are expanded using spaces.\n\nIf tabsize is not given, a tab size of 8 characters is assumed."},find:{$meth:function(e,t,n){return new Sk.builtin.int_(this.find$left(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},partition:{$meth:s(!1),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original string\nand two empty strings."},index:{$meth:function(e,t,n){if(-1===(e=this.find$left(e,t,n)))throw new Sk.builtin.ValueError("substring not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found, \nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found."},ljust:{$meth:o(!1,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a left-justified string of length width.\n\nPadding is done using the specified fill character (default is a space)."},lower:{$meth(){return new Sk.builtin.str(this.v.toLowerCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a copy of the string converted to lowercase."},lstrip:{$meth:r(/^\s+/g,(e=>"^["+e+"]+")),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with leading whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead."},rfind:{$meth(e,t,n){return new Sk.builtin.int_(this.find$right(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},rindex:{$meth:function(e,t,n){if(-1===(e=this.find$right(e,t,n)))throw new Sk.builtin.ValueError("substring not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found."},rjust:{$meth:o(!0,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, width, fillchar=' ', /)",$doc:"Return a right-justified string of length width.\n\nPadding is done using the specified fill character (default is a space)."},rstrip:{$meth:r(/\s+$/g,(e=>"["+e+"]+$")),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with trailing whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead."},rpartition:{$meth:s(!0),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty strings\nand the original string."},splitlines:{$meth:function(e){e=Sk.misceval.isTrue(e);const t=this.v,n=[],i=t.length;var r=0;for(let o=0;o<i;o++){var s=t.charAt(o);"\n"===t.charAt(o+1)&&"\r"===s?(s=o+2,r=t.slice(r,s),e||(r=r.replace(/(\r|\n)/g,"")),n.push(new Sk.builtin.str(r)),r=s):("\n"===s&&"\r"!==t.charAt(o-1)||"\r"===s)&&(s=o+1,r=t.slice(r,s),e||(r=r.replace(/(\r|\n)/g,"")),n.push(new Sk.builtin.str(r)),r=s)}return r<i&&(r=t.slice(r,i),e||(r=r.replace(/(\r|\n)/g,"")),n.push(new Sk.builtin.str(r))),new Sk.builtin.list(n)},$flags:{NamedArgs:["keepends"],Defaults:[!1]},$textsig:"($self, /, keepends=False)",$doc:"Return a list of the lines in the string, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue."},strip:{$meth:r(/^\s+|\s+$/g,(e=>"^["+e+"]+|["+e+"]+$")),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, chars=None, /)",$doc:"Return a copy of the string with leading and trailing whitespace remove.\n\nIf chars is given and not None, remove characters in chars instead."},swapcase:{$meth(){const e=this.v.replace(/[a-z]/gi,(e=>{const t=e.toLowerCase();return t===e?e.toUpperCase():t}));return new Sk.builtin.str(e)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Convert uppercase characters to lowercase and lowercase characters to uppercase."},upper:{$meth(){return new Sk.builtin.str(this.v.toUpperCase())},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a copy of the string converted to uppercase."},startswith:{$meth:u("startswith",((e,t)=>0===e.indexOf(t))),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if S starts with the specified prefix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nprefix can also be a tuple of strings to try."},endswith:{$meth:u("endswith",((e,t)=>-1!==e.indexOf(t,e.length-t.length))),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"S.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if S ends with the specified suffix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nsuffix can also be a tuple of strings to try."},isascii:{$meth(){return new Sk.builtin.bool(/^[\x00-\x7F]*$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if all characters in the string are ASCII, False otherwise.\n\nASCII characters have code points in the range U+0000-U+007F.\nEmpty string is ASCII too."},islower:{$meth:function(){return new Sk.builtin.bool(this.v.length&&/[a-z]/.test(this.v)&&!/[A-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a lowercase string, False otherwise.\n\nA string is lowercase if all cased characters in the string are lowercase and\nthere is at least one cased character in the string."},isupper:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[a-z]/.test(this.v)&&/[A-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an uppercase string, False otherwise.\n\nA string is uppercase if all cased characters in the string are uppercase and\nthere is at least one cased character in the string."},istitle:{$meth:function(){const e=this.v;let t,n=!1,i=!1;for(let r=0;r<e.length;r++)if(t=e.charAt(r),!/[a-z]/.test(t)&&/[A-Z]/.test(t)){if(i)return Sk.builtin.bool.false$;n=i=!0}else if(/[a-z]/.test(t)&&!/[A-Z]/.test(t)){if(!i)return Sk.builtin.bool.false$;n=!0}else i=!1;return new Sk.builtin.bool(n)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a title-cased string, False otherwise.\n\nIn a title-cased string, upper- and title-case characters may only\nfollow uncased characters and lowercase characters only cased ones."},isspace:{$meth:function(){return new Sk.builtin.bool(/^\s+$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a whitespace string, False otherwise.\n\nA string is whitespace if all characters in the string are whitespace and there\nis at least one character in the string."},isdigit:{$meth:function(){return new Sk.builtin.bool(/^\d+$/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a digit string, False otherwise.\n\nA string is a digit string if all characters in the string are digits and there\nis at least one character in the string."},isnumeric:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^0-9]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is a numeric string, False otherwise.\n\nA string is numeric if all characters in the string are numeric and there is at\nleast one character in the string."},isalpha:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^a-zA-Z]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an alphabetic string, False otherwise.\n\nA string is alphabetic if all characters in the string are alphabetic and there\nis at least one character in the string."},isalnum:{$meth:function(){return new Sk.builtin.bool(this.v.length&&!/[^a-zA-Z0-9]/.test(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the string is an alpha-numeric string, False otherwise.\n\nA string is alpha-numeric if all characters in the string are alpha-numeric and\nthere is at least one character in the string."},zfill:{$meth:function(e){e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError);let t="";e-=this.v.length;const n="+"===this.v[0]||"-"===this.v[0]?1:0;for(let n=0;n<e;n++)t+="0";return new Sk.builtin.str(this.v.substr(0,n)+t+this.v.substr(n))},$flags:{OneArg:!0},$textsig:"($self, width, /)",$doc:"Pad a numeric string with zeros on the left, to fill a field of the given width.\n\nThe string is never truncated."},format:{$meth:Sk.formatting.format,$flags:{FastCall:!0},$textsig:null,$doc:"S.format(*args, **kwargs) -> str\n\nReturn a formatted version of S, using substitutions from args and kwargs.\nThe substitutions are identified by braces ('{' and '}')."},__format__:{$meth:Sk.formatting.formatString,$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:"Return a formatted version of the string as described by format_spec."},__getnewargs__:{$meth(){return new Sk.builtin.tuple(new Sk.builtin.str(this.v))},$flags:{NoArgs:!0},$textsig:null,$doc:null}}}),Sk.exportSymbol("Sk.builtin.str",Sk.builtin.str);var h=/^[A-Za-z0-9]+$/,d=/([.*+?=|\\\/()\[\]\{\}^$])/g,f=/^[\s\xa0]+/;Sk.builtin.str.$py2decode=new Sk.builtin.method_descriptor(Sk.builtin.str,{$name:"decode",$meth(e,t){const n=new Sk.builtin.bytes(this.v);return Sk.builtin.bytes.$decode.call(n,e,t)},$flags:{NamedArgs:["encoding","errors"]}});var _=Sk.abstr.buildIteratorClass("str_iterator",{constructor:function(e){this.$index=0,e.$hasAstralCodePoints()?(this.$seq=e.codepoints,this.tp$iternext=()=>{const t=this.$seq[this.$index];if(void 0!==t)return new Sk.builtin.str(e.v.substring(t,this.$seq[++this.$index]))}):(this.$seq=e.v,this.tp$iternext=()=>{const e=this.$seq[this.$index++];if(void 0!==e)return new Sk.builtin.str(e)})},iternext(){return this.tp$iternext()},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}}),m={abstract:!0,as:!0,boolean:!0,break:!0,byte:!0,case:!0,catch:!0,char:!0,class:!0,continue:!0,const:!0,debugger:!0,default:!0,delete:!0,do:!0,double:!0,else:!0,enum:!0,export:!0,extends:!0,false:!0,final:!0,finally:!0,float:!0,for:!0,function:!0,goto:!0,if:!0,implements:!0,import:!0,in:!0,instanceof:!0,int:!0,interface:!0,is:!0,long:!0,namespace:!0,native:!0,new:!0,null:!0,package:!0,private:!0,protected:!0,public:!0,return:!0,short:!0,static:!0,super:!0,switch:!0,synchronized:!0,this:!0,throw:!0,throws:!0,transient:!0,true:!0,try:!0,typeof:!0,use:!0,var:!0,void:!0,volatile:!0,while:!0,with:!0,constructor:!0,__defineGetter__:!0,__defineSetter__:!0,apply:!0,arguments:!0,call:!0,caller:!0,eval:!0,hasOwnProperty:!0,isPrototypeOf:!0,__lookupGetter__:!0,__lookupSetter__:!0,__noSuchMethod__:!0,propertyIsEnumerable:!0,prototype:!0,toSource:!0,toLocaleString:!0,toString:!0,unwatch:!0,valueOf:!0,watch:!0,length:!0,name:!0};Sk.builtin.str.reservedWords_=m},function(e,t){Sk.builtin.func=Sk.abstr.buildNativeClass("function",{constructor:function(e,t,n,i){if(Sk.asserts.assert(this instanceof Sk.builtin.func,"builtin func should be called as a class with `new`"),this.func_code=e,this.func_globals=t||null,this.$name=e.co_name&&e.co_name.v||e.name||"<native JS>",this.$d=Sk.builtin.dict?new Sk.builtin.dict:void 0,this.$doc=e.co_docstring||Sk.builtin.none.none$,this.$module=Sk.globals&&Sk.globals.__name__||Sk.builtin.none.none$,this.$qualname=e.co_qualname&&e.co_qualname.v||this.$name,void 0!==i)for(let e in i)n[e]=i[e];this.func_closure=n,this.$memoiseFlags(),this.memoised=e.co_fastcall||null,this.tp$call=e.co_fastcall?e.bind(this):Sk.builtin.func.prototype.tp$call.bind(this)},slots:{tp$getattr:Sk.generic.getAttr,tp$descr_get(e,t){return null===e?this:new Sk.builtin.method(this,e)},$r(){return new Sk.builtin.str("<function "+this.$qualname+">")},tp$call(e,t){if(this.memoised||(this.$memoiseFlags(),this.memoised=!0),void 0===this.co_argcount&&void 0===this.co_varnames&&!this.co_kwargs&&!this.func_closure){if(t&&0!==t.length)throw new Sk.builtin.TypeError(this.$name+"() takes no keyword arguments");return this.func_code.apply(this.func_globals,e)}return e=this.$resolveArgs(e,t),this.func_closure&&e.push(this.func_closure),this.func_code.apply(this.func_globals,e)}},getsets:{__name__:{$get(){return new Sk.builtin.str(this.$name)},$set(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__name__ must be set to a string object");this.$name=e.$jsstr()}},__qualname__:{$get(){return new Sk.builtin.str(this.$qualname)},$set(e){if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("__qualname__ must be set to a string object");this.$qualname=e.$jsstr()}},__dict__:Sk.generic.getSetDict,__defaults__:{$get(){return new Sk.builtin.tuple(this.$defaults)}},__doc__:{$get(){return this.$doc},$set(e){this.$doc=e||Sk.builtin.none.none$}}},proto:{$memoiseFlags(){this.co_varnames=this.func_code.co_varnames,this.co_argcount=this.func_code.co_argcount,void 0===this.co_argcount&&this.co_varnames&&(this.co_argcount=this.co_argcount=this.co_varnames.length),this.co_kwonlyargcount=this.func_code.co_kwonlyargcount||0,this.co_varargs=this.func_code.co_varargs,this.co_kwargs=this.func_code.co_kwargs,this.$defaults=this.func_code.$defaults||[],this.$kwdefs=this.func_code.$kwdefs||[]},$resolveArgs:function(e,t){var n=this.co_argcount;void 0===n&&(n=this.co_varnames?this.co_varnames.length:e.length);var i=this.co_varnames||[],r=this.co_kwonlyargcount||0;let s,o=n+r;if(!(0!==r||this.co_kwargs||t&&0!==t.length||this.co_varargs)){if(e.length==n)return e;if(0===e.length&&this.$defaults&&this.$defaults.length===n){for(i=0;i!=this.$defaults.length;i++)e[i]=this.$defaults[i];return e}}this.co_kwargs&&(s=[]);var a=e.length;let l=e.length<=n?e:e.slice(0,n);if(this.co_varargs)e=e.length>l.length?e.slice(l.length):[],l[o]=new Sk.builtin.tuple(e);else if(a>n)throw new Sk.builtin.TypeError(this.$name+"() takes "+n+" positional argument"+(1==n?"":"s")+" but "+a+(1==a?" was ":" were ")+" given");if(t){if(this.func_code.no_kw)throw new Sk.builtin.TypeError(this.$name+"() takes no keyword arguments");for(e=0;e<t.length;e+=2){a=t[e];var u=t[e+1],c=i.indexOf(a);if(0<=c){if(void 0!==l[c])throw new Sk.builtin.TypeError(this.$name+"() got multiple values for argument '"+a+"'");l[c]=u}else{if(!s)throw new Sk.builtin.TypeError(this.$name+"() got an unexpected keyword argument '"+a+"'");s.push(new Sk.builtin.str(a),u)}}}for(e=0,a=[],u=!1,c=n-(t=this.$defaults||[]).length;e<c;e++)void 0===l[e]&&(a.push(i[e]),void 0===i[e]&&(u=!0));if(0!=a.length&&(this.co_argcount||this.co_varnames))throw new Sk.builtin.TypeError(this.$name+"() missing "+a.length+" required argument"+(1==a.length?"":"s")+(u?"":": "+a.join(", ")));for(;e<n;e++)void 0===l[e]&&(l[e]=t[e-c]);if(0<r){for(r=[],t=this.$kwdefs,e=n;e<o;e++)void 0===l[e]&&(void 0!==t[e-n]?l[e]=t[e-n]:r.push(i[e]));if(0!==r.length)throw new Sk.builtin.TypeError(this.$name+"() missing "+r.length+" required keyword argument"+(1==r.length?"":"s")+": "+r.join(", "))}if(this.func_closure&&i)for(n=l.length;n<i.length;n++)l.push(void 0);return s&&l.unshift(s),l}}})},function(e,t){Sk.builtin.asnum$=function(e){return null==e||"number"==typeof e?e:e instanceof Sk.builtin.int_?"number"==typeof e.v?e.v:e.v.toString():e instanceof Sk.builtin.float_?e.v:e===Sk.builtin.none.none$?null:e},Sk.exportSymbol("Sk.builtin.asnum$",Sk.builtin.asnum$),Sk.builtin.assk$=function(e){return 0==e%1?new Sk.builtin.int_(e):new Sk.builtin.float_(e)},Sk.exportSymbol("Sk.builtin.assk$",Sk.builtin.assk$),Sk.builtin.asnum$nofloat=function(e){if(null==e)return e;if("number"==typeof e)e=e.toString();else if(e instanceof Sk.builtin.int_)e=e.v.toString();else{if(!(e instanceof Sk.builtin.float_))return e===Sk.builtin.none.none$?null:void 0;e=e.v.toString()}if(0>e.indexOf(".")&&0>e.indexOf("e")&&0>e.indexOf("E"))return e;var t=0;if(0<=e.indexOf("e")){var n=e.substr(0,e.indexOf("e"));t=e.substr(e.indexOf("e")+1)}else 0<=e.indexOf("E")?(n=e.substr(0,e.indexOf("e")),t=e.substr(e.indexOf("E")+1)):n=e;if(t=parseInt(t,10),0>(e=n.indexOf("."))){if(0<=t){for(;0<t--;)n+="0";return n}return n.length>-t?n.substr(0,n.length+t):0}for(n=0===e?n.substr(1):e<n.length?n.substr(0,e)+n.substr(e+1):n.substr(0,e),e+=t;e>n.length;)n+="0";return 0>=e?0:n.substr(0,e)},Sk.exportSymbol("Sk.builtin.asnum$nofloat",Sk.builtin.asnum$nofloat),Sk.builtin.round=function(e,t){if(void 0===e)throw new Sk.builtin.TypeError("a float is required");if(!Sk.__future__.dunder_round){if(!Sk.builtin.checkNumber(e))throw new Sk.builtin.TypeError("a float is required");if(e.round$)return e.round$(t);throw new Sk.builtin.AttributeError(Sk.abstr.typeName(e)+" instance has no attribute '__float__'")}if(void 0!==t&&!Sk.builtin.checkNone(t)&&!Sk.misceval.isIndex(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object cannot be interpreted as an index");if(void 0!==(e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$round)))return void 0!==t?Sk.misceval.callsimArray(e,[t]):Sk.misceval.callsimArray(e,[]);throw new Sk.builtin.TypeError("a float is required")},Sk.builtin.len=function(e){if(!e.sq$length)throw new Sk.builtin.TypeError("object of type '"+Sk.abstr.typeName(e)+"' has no len()");return e=e.sq$length(!0),Sk.misceval.chain(e,(e=>new Sk.builtin.int_(e)))},Sk.builtin.min=function(e,t){let n;const i=e.length;if(!i)throw new Sk.builtin.TypeError("min expected 1 argument, got 0");const[r,s]=Sk.abstr.copyKeywordsToNamedArgs("min",["default","key"],[],t,[null,Sk.builtin.none.none$]);if(1<i&&null!==r)throw new Sk.builtin.TypeError("Cannot specify a default for min() with multiple positional arguments");if(n=1==i?Sk.abstr.iter(e[0]):Sk.abstr.iter(new Sk.builtin.tuple(e)),!Sk.builtin.checkNone(s)&&!Sk.builtin.checkCallable(s))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(s)+"' object is not callable");let o;return Sk.misceval.chain(n.tp$iternext(!0),(e=>{if(o=e,void 0!==o)return Sk.builtin.checkNone(s)?Sk.misceval.iterFor(n,(e=>{Sk.misceval.richCompareBool(e,o,"Lt")&&(o=e)})):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[o]),(e=>Sk.misceval.iterFor(n,(t=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[t]),(n=>{Sk.misceval.richCompareBool(n,e,"Lt")&&(o=t,e=n)}))))))}),(()=>{if(void 0===o){if(null===r)throw new Sk.builtin.ValueError("min() arg is an empty sequence");o=r}return o}))},Sk.builtin.max=function(e,t){let n;const i=e.length;if(!i)throw new Sk.builtin.TypeError("max expected 1 argument, got 0");const[r,s]=Sk.abstr.copyKeywordsToNamedArgs("min",["default","key"],[],t,[null,Sk.builtin.none.none$]);if(1<i&&null!==r)throw new Sk.builtin.TypeError("Cannot specify a default for max() with multiple positional arguments");if(n=1===i?Sk.abstr.iter(e[0]):Sk.abstr.iter(new Sk.builtin.tuple(e)),!Sk.builtin.checkNone(s)&&!Sk.builtin.checkCallable(s))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(s)+"' object is not callable");let o;return Sk.misceval.chain(n.tp$iternext(!0),(e=>{if(o=e,void 0!==o)return Sk.builtin.checkNone(s)?Sk.misceval.iterFor(n,(e=>{Sk.misceval.richCompareBool(e,o,"Gt")&&(o=e)})):Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[o]),(e=>Sk.misceval.iterFor(n,(t=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(s,[t]),(n=>{Sk.misceval.richCompareBool(n,e,"Gt")&&(o=t,e=n)}))))))}),(()=>{if(void 0===o){if(null===r)throw new Sk.builtin.ValueError("min() arg is an empty sequence");o=r}return o}))},Sk.builtin.min.co_fastcall=Sk.builtin.max.co_fastcall=1,Sk.builtin.any=function(e){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(function(e){if(Sk.misceval.isTrue(e))return new Sk.misceval.Break(Sk.builtin.bool.true$)})),(e=>e||Sk.builtin.bool.false$))},Sk.builtin.all=function(e){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(function(e){if(!Sk.misceval.isTrue(e))return new Sk.misceval.Break(Sk.builtin.bool.false$)})),(e=>e||Sk.builtin.bool.true$))},Sk.builtin.sum=function(e,t){const n=Sk.abstr.iter(e);if(void 0===t)var i=new Sk.builtin.int_(0);else{if(Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]");i=t}return e=void 0===t||t.constructor===Sk.builtin.int_?Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.int_)return e.constructor===Sk.builtin.float_?(i=i.nb$float().nb$add(e),new Sk.misceval.Break("float")):(i=Sk.abstr.numberBinOp(i,e,"Add"),new Sk.misceval.Break("slow"));i=i.nb$add(e)})):t.constructor===Sk.builtin.float_?"float":"slow",Sk.misceval.chain(e,(e=>"float"===e?Sk.misceval.iterFor(n,(e=>{if(e.constructor!==Sk.builtin.float_&&e.constructor!==Sk.builtin.int_)return i=Sk.abstr.numberBinOp(i,e,"Add"),new Sk.misceval.Break("slow");i=i.nb$add(e)})):e),(e=>{if("slow"===e)return Sk.misceval.iterFor(n,(e=>{i=Sk.abstr.numberBinOp(i,e,"Add")}))}),(()=>i))},Sk.builtin.zip=function(){var e,t;if(0===arguments.length)return new Sk.builtin.list([]);var n=[];for(t=0;t<arguments.length;t++){if(!Sk.builtin.checkIterable(arguments[t]))throw new Sk.builtin.TypeError("argument "+t+" must support iteration");n.push(Sk.abstr.iter(arguments[t]))}var i=[];for(e=!1;!e;){var r=[];for(t=0;t<arguments.length;t++){var s=n[t].tp$iternext();if(void 0===s){e=!0;break}r.push(s)}e||i.push(new Sk.builtin.tuple(r))}return new Sk.builtin.list(i)},Sk.builtin.abs=function(e){if(e.nb$abs)return e.nb$abs();throw new TypeError("bad operand type for abs(): '"+Sk.abstr.typeName(e)+"'")},Sk.builtin.fabs=function(e){return Sk.builtin.abs(e)},Sk.builtin.ord=function(e){if(Sk.builtin.checkString(e)){if(1!==e.v.length&&1!==e.sq$length())throw new Sk.builtin.TypeError("ord() expected a character, but string of length "+e.v.length+" found");return new Sk.builtin.int_(e.v.codePointAt(0))}if(Sk.builtin.checkBytes(e)){if(1!==e.sq$length())throw new Sk.builtin.TypeError("ord() expected a character, but string of length "+e.v.length+" found");return new Sk.builtin.int_(e.v[0])}throw new Sk.builtin.TypeError("ord() expected a string of length 1, but "+Sk.abstr.typeName(e)+" found")},Sk.builtin.chr=function(e){if(!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError("an integer is required");if(e=Sk.builtin.asnum$(e),Sk.__future__.python3){if(0>e||1114112<=e)throw new Sk.builtin.ValueError("chr() arg not in range(0x110000)")}else if(0>e||256<=e)throw new Sk.builtin.ValueError("chr() arg not in range(256)");return new Sk.builtin.str(String.fromCodePoint(e))},Sk.builtin.unichr=function(e){if(!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError("an integer is required");e=Sk.builtin.asnum$(e);try{return new Sk.builtin.str(String.fromCodePoint(e))}catch(e){if(e instanceof RangeError)throw new Sk.builtin.ValueError(e.message);throw e}},Sk.builtin.int2str_=function(e,t,n){let i;e.constructor===Sk.builtin.int_||e instanceof Sk.builtin.int_||(e=e.nb$index()),i=e.v;let r=i.toString(t);return r=e.nb$isnegative()?"-"+n+r.slice(1):n+r,2!==t&&!Sk.__future__.python3&&(e instanceof Sk.builtin.lng||JSBI.__isBigInt(i))&&(r+="L"),new Sk.builtin.str(r)},Sk.builtin.hex=function(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("hex() argument can't be converted to hex");return Sk.builtin.int2str_(e,16,"0x")},Sk.builtin.oct=function(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("oct() argument can't be converted to hex");return Sk.__future__.octal_number_literal?Sk.builtin.int2str_(e,8,"0o"):Sk.builtin.int2str_(e,8,"0")},Sk.builtin.bin=function(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object can't be interpreted as an index");return Sk.builtin.int2str_(e,2,"0b")},Sk.builtin.dir=function(e){if(void 0!==e)return e=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$dir),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(e,[]),(e=>Sk.builtin.sorted(e)));throw new Sk.builtin.NotImplementedError("skulpt does not yet support dir with no args")},Sk.builtin.repr=function(e){return e.$r()},Sk.builtin.ascii=function(e){return Sk.misceval.chain(e.$r(),(e=>{let t,n;for(n=0;n<e.v.length;n++)if(127<=e.v.charCodeAt(n)){t=e.v.substr(0,n);break}if(!t)return e;for(;n<e.v.length;n++){var i=e.v.charAt(n),r=e.v.charCodeAt(n);127<r&&255>=r?(2>(i=r.toString(16)).length&&(i="0"+i),t+="\\x"+i):127<r&&55296>r||57344<=r?t+="\\u"+("000"+r.toString(16)).slice(-4):55296<=r?(i=e.v.codePointAt(n),n++,r="0000000"+(i=i.toString(16)).toString(16),t=4<i.length?t+"\\U"+r.slice(-8):t+"\\u"+r.slice(-4)):t+=i}return new Sk.builtin.str(t)}))},Sk.builtin.open=function(e,t,n){if(void 0===t&&(t=new Sk.builtin.str("r")),/\+/.test(t.v))throw"todo; haven't implemented read/write mode";if(("w"===t.v||"wb"===t.v||"a"===t.v||"ab"===t.v)&&!Sk.nonreadopen)throw"todo; haven't implemented non-read opens";return new Sk.builtin.file(e,t,n)},Sk.builtin.isinstance=function(e,t){if(!(Sk.builtin.checkClass(t)||t instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("isinstance() arg 2 must be a class, type, or tuple of classes and types");var n=e.ob$type;if(n===t)return Sk.builtin.bool.true$;if(!(t instanceof Sk.builtin.tuple))return n.$isSubType(t)||(e=e.tp$getattr(Sk.builtin.str.$class))!=n&&Sk.builtin.checkClass(e)&&e.$isSubType(t)?Sk.builtin.bool.true$:Sk.builtin.bool.false$;for(n=0;n<t.v.length;++n)if(Sk.misceval.isTrue(Sk.builtin.isinstance(e,t.v[n])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$},Sk.builtin.hash=function(e){return new Sk.builtin.int_(Sk.abstr.objectHash(e))},Sk.builtin.getattr=function(e,t,n){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("attribute name must be string");const i=Sk.misceval.tryCatch((()=>e.tp$getattr(t,!0)),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e}));return Sk.misceval.chain(i,(i=>{if(void 0===i){if(void 0!==n)return n;throw new Sk.builtin.AttributeError(e.sk$attrError()+" has no attribute "+Sk.misceval.objectRepr(t))}return i}))},Sk.builtin.setattr=function(e,t,n){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("attribute name must be string");return Sk.misceval.chain(e.tp$setattr(t,n,!0),(()=>Sk.builtin.none.none$))},Sk.builtin.raw_input=function(e){var t=e||"";return Sk.misceval.chain(Sk.importModule("sys",!1,!0),(function(e){return Sk.inputfunTakesPrompt?Sk.builtin.file.$readline(e.$d.stdin,null,t):Sk.misceval.chain(void 0,(function(){return Sk.misceval.callsimOrSuspendArray(e.$d.stdout.write,[e.$d.stdout,new Sk.builtin.str(t)])}),(function(){return Sk.misceval.callsimOrSuspendArray(e.$d.stdin.readline,[e.$d.stdin])}))}))},Sk.builtin.input=Sk.builtin.raw_input,Sk.builtin.jseval=function(e){return e=Sk.global.eval(Sk.ffi.remapToJs(e)),Sk.ffi.remapToPy(e)},Sk.builtin.jsmillis=function(){return console.warn("jsmillis is deprecated"),(new Date).valueOf()},Sk.builtin.eval_=function(){throw new Sk.builtin.NotImplementedError("eval is not yet implemented")},Sk.builtin.map=function(e,t){var n,i,r=[];if(Sk.builtin.pyCheckArgsLen("map",arguments.length,2),2<arguments.length){var s=[],o=Array.prototype.slice.apply(arguments).slice(1);for(i=0;i<o.length;i++){if(!Sk.builtin.checkIterable(o[i])){var a=parseInt(i,10)+2;throw new Sk.builtin.TypeError("argument "+a+" to map() must support iteration")}o[i]=Sk.abstr.iter(o[i])}for(;;){var l=[];for(i=n=0;i<o.length;i++)void 0===(a=o[i].tp$iternext())?(l.push(Sk.builtin.none.none$),n++):l.push(a);if(n===o.length)break;s.push(l)}t=new Sk.builtin.list(s)}if(!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object is not iterable");return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(t),(function(t){if(e!==Sk.builtin.none.none$)return t instanceof Array||(t=[t]),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(e,t),(function(e){r.push(e)}));t instanceof Array&&(t=new Sk.builtin.tuple(t)),r.push(t)})),(function(){return new Sk.builtin.list(r)}))},Sk.builtin.reduce=function(e,t,n){if(!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object is not iterable");if(t=Sk.abstr.iter(t),void 0===n&&void 0===(n=t.tp$iternext()))throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value");var i=n;for(n=t.tp$iternext();void 0!==n;n=t.tp$iternext())i=Sk.misceval.callsimArray(e,[i,n]);return i},Sk.builtin.sorted=function(e,t,n,i){return e=Sk.misceval.arrayFromIterable(e,!0),Sk.misceval.chain(e,(e=>((e=new Sk.builtin.list(e)).list$sort(t,n,i),e)))},Sk.builtin.filter=function(e,t){var n;if(Sk.builtin.pyCheckArgsLen("filter",arguments.length,2,2),!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(t)+"' object is not iterable");var i=function(){return[]},r=function(e,t){return e.push(t),e},s=function(e){return new Sk.builtin.list(e)};t.ob$type===Sk.builtin.str?(i=function(){return new Sk.builtin.str("")},r=function(e,t){return e.sq$concat(t)},s=function(e){return e}):t.ob$type===Sk.builtin.tuple&&(s=function(e){return new Sk.builtin.tuple(e)});var o=i(),a=Sk.abstr.iter(t);for(n=a.tp$iternext();void 0!==n;n=a.tp$iternext())i=e===Sk.builtin.none.none$?new Sk.builtin.bool(n):Sk.misceval.callsimArray(e,[n]),Sk.misceval.isTrue(i)&&(o=r(o,n));return s(o)},Sk.builtin.hasattr=function(e,t){if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError("hasattr(): attribute name must be string");const n=Sk.misceval.tryCatch((()=>e.tp$getattr(t,!0)),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e}));return Sk.misceval.chain(n,(e=>void 0===e?Sk.builtin.bool.false$:Sk.builtin.bool.true$))},Sk.builtin.pow=function(e,t,n){if(void 0===n||Sk.builtin.checkNone(n))return Sk.abstr.numberBinOp(e,t,"Pow");if(!(Sk.builtin.checkInt(e)&&Sk.builtin.checkInt(t)&&Sk.builtin.checkInt(n))){if(Sk.builtin.checkFloat(e)||Sk.builtin.checkComplex(e))return e.nb$power(t,n);throw new Sk.builtin.TypeError("unsupported operand type(s) for ** or pow(): '"+Sk.abstr.typeName(e)+"', '"+Sk.abstr.typeName(t)+"', '"+Sk.abstr.typeName(n)+"'")}return e.nb$power(t,n)},Sk.builtin.quit=function(e){throw e=new Sk.builtin.str(e).v,new Sk.builtin.SystemExit(e)},Sk.builtin.issubclass=function(e,t){if(!Sk.builtin.checkClass(e))throw new Sk.builtin.TypeError("issubclass() arg 1 must be a class");var n=Sk.builtin.checkClass(t);if(!(n||t instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("issubclass() arg 2 must be a class or tuple of classes");if(n)return e.$isSubType(t)?Sk.builtin.bool.true$:Sk.builtin.bool.false$;for(n=0;n<t.v.length;++n)if(Sk.misceval.isTrue(Sk.builtin.issubclass(e,t.v[n])))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$},Sk.builtin.globals=function(){var e,t=new Sk.builtin.dict([]);for(e in Sk.globals){var n=Sk.unfixReserved(e);t.mp$ass_subscript(new Sk.builtin.str(n),Sk.globals[e])}return t},Sk.builtin.divmod=function(e,t){return Sk.abstr.numberBinOp(e,t,"DivMod")},Sk.builtin.format=function(e,t){return void 0===t&&(t=Sk.builtin.str.$emptystr),Sk.abstr.objectFormat(e,t)};const n=new Map;let i=0;Sk.builtin.id=function(e){const t=n.get(e);return void 0!==t?new Sk.builtin.int_(t):(n.set(e,i),new Sk.builtin.int_(i++))},Sk.builtin.bytearray=function(){throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented")},Sk.builtin.callable=function(e){return Sk.builtin.checkCallable(e)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},Sk.builtin.delattr=function(e,t){return Sk.builtin.setattr(e,t,void 0)},Sk.builtin.execfile=function(){throw new Sk.builtin.NotImplementedError("execfile is not yet implemented")},Sk.builtin.help=function(){throw new Sk.builtin.NotImplementedError("help is not yet implemented")},Sk.builtin.iter=function(e,t){return 1===arguments.length?Sk.abstr.iter(e):Sk.abstr.iter(new Sk.builtin.callable_iter_(e,t))},Sk.builtin.locals=function(){throw new Sk.builtin.NotImplementedError("locals is not yet implemented")},Sk.builtin.memoryview=function(){throw new Sk.builtin.NotImplementedError("memoryview is not yet implemented")},Sk.builtin.next_=function(e,t){if(!e.tp$iternext)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not an iterator");if(void 0===(e=e.tp$iternext())){if(t)return t;throw new Sk.builtin.StopIteration}return e},Sk.builtin.reload=function(){throw new Sk.builtin.NotImplementedError("reload is not yet implemented")},Sk.builtin.vars=function(){throw new Sk.builtin.NotImplementedError("vars is not yet implemented")},Sk.builtin.apply_=function(){throw new Sk.builtin.NotImplementedError("apply is not yet implemented")},Sk.builtin.buffer=function(){throw new Sk.builtin.NotImplementedError("buffer is not yet implemented")},Sk.builtin.coerce=function(){throw new Sk.builtin.NotImplementedError("coerce is not yet implemented")},Sk.builtin.intern=function(){throw new Sk.builtin.NotImplementedError("intern is not yet implemented")}},function(e,t){Sk.builtin.BaseException=Sk.abstr.buildNativeClass("BaseException",{constructor:function(...e){Sk.asserts.assert(this instanceof Sk.builtin.BaseException,"bad call to exception constructor, use 'new'");let t=e[0];"string"==typeof t&&(t=new Sk.builtin.str(t)),this.args=new Sk.builtin.tuple(t?[t]:[]),this.traceback=[],this.$d=new Sk.builtin.dict,3<=e.length&&this.traceback.push({lineno:e[2],filename:e[1]||"<unknown>"})},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"Common base class for all exceptions",tp$new(e,t){return this.hp$type?(t=new this.constructor,Sk.builtin.BaseException.call(t)):t=new this.constructor,t.args=new Sk.builtin.tuple(e.slice()),t},tp$init(e,t){Sk.abstr.checkNoKwargs(Sk.abstr.typeName(this),t)},$r(){let e=this.tp$name;return e+="("+this.args.v.map((e=>Sk.misceval.objectRepr(e))).join(", ")+")",new Sk.builtin.str(e)},tp$str(){return 1>=this.args.v.length?new Sk.builtin.str(this.args.v[0]):this.args.$r()}},getsets:{args:{$get(){return this.args}},__dict__:Sk.generic.getSetDict},proto:{toString(){let e=this.tp$name;return e+=": "+this.tp$str().v,0!==this.traceback.length?e+" on line "+this.traceback[0].lineno:e+" at <unknown>"}}}),Sk.exportSymbol("Sk.builtin.BaseException",Sk.builtin.BaseException),Sk.builtin.Exception=Sk.abstr.buildNativeClass("Exception",{constructor:function(...e){Sk.builtin.BaseException.apply(this,e)},base:Sk.builtin.BaseException}),Sk.exportSymbol("Sk.builtin.Exception",Sk.builtin.Exception),Sk.builtin.AssertionError=Sk.abstr.buildNativeClass("AssertionError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.AssertionError",Sk.builtin.AssertionError),Sk.builtin.AttributeError=Sk.abstr.buildNativeClass("AttributeError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.ImportError=Sk.abstr.buildNativeClass("ImportError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.IndentationError=Sk.abstr.buildNativeClass("IndentationError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.IndexError=Sk.abstr.buildNativeClass("IndexError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.LookupError=Sk.abstr.buildNativeClass("LookupError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.KeyError=Sk.abstr.buildNativeClass("KeyError",{constructor:function(...e){Sk.builtin.LookupError.apply(this,e)},base:Sk.builtin.LookupError}),Sk.builtin.NameError=Sk.abstr.buildNativeClass("NameError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.UnboundLocalError=Sk.abstr.buildNativeClass("UnboundLocalError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.OverflowError=Sk.abstr.buildNativeClass("OverflowError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.SyntaxError=Sk.abstr.buildNativeClass("SyntaxError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.RuntimeError=Sk.abstr.buildNativeClass("RuntimeError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.RuntimeError",Sk.builtin.RuntimeError),Sk.builtin.SuspensionError=Sk.abstr.buildNativeClass("SuspensionError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.SuspensionError",Sk.builtin.SuspensionError),Sk.builtin.SystemExit=Sk.abstr.buildNativeClass("SystemExit",{constructor:function(...e){Sk.builtin.BaseException.apply(this,e)},base:Sk.builtin.BaseException}),Sk.exportSymbol("Sk.builtin.SystemExit",Sk.builtin.SystemExit),Sk.builtin.TypeError=Sk.abstr.buildNativeClass("TypeError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.TypeError",Sk.builtin.TypeError),Sk.builtin.ValueError=Sk.abstr.buildNativeClass("ValueError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.ValueError",Sk.builtin.ValueError),Sk.builtin.ZeroDivisionError=Sk.abstr.buildNativeClass("ZeroDivisionError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.builtin.TimeLimitError=Sk.abstr.buildNativeClass("TimeLimitError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.TimeLimitError",Sk.builtin.TimeLimitError),Sk.builtin.IOError=Sk.abstr.buildNativeClass("IOError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.IOError",Sk.builtin.IOError),Sk.builtin.NotImplementedError=Sk.abstr.buildNativeClass("NotImplementedError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.NotImplementedError",Sk.builtin.NotImplementedError),Sk.builtin.NegativePowerError=Sk.abstr.buildNativeClass("NegativePowerError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.NegativePowerError",Sk.builtin.NegativePowerError),Sk.builtin.ExternalError=Sk.abstr.buildNativeClass("ExternalError",{constructor:function(...e){if(this.nativeError=e[0],!Sk.builtin.checkString(this.nativeError)&&(e[0]=this.nativeError.toString(),e[0].startsWith("RangeError: Maximum call")))return e[0]="Maximum call stack size exceeded",new Sk.builtin.RecursionError(...e);Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.ExternalError",Sk.builtin.ExternalError),Sk.builtin.RecursionError=Sk.abstr.buildNativeClass("RecursionError",{constructor:function(...e){Sk.builtin.RuntimeError.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.RecursionError",Sk.builtin.RecursionError),Sk.builtin.OperationError=Sk.abstr.buildNativeClass("OperationError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.OperationError",Sk.builtin.OperationError),Sk.builtin.SystemError=Sk.abstr.buildNativeClass("SystemError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.SystemError",Sk.builtin.SystemError),Sk.builtin.UnicodeDecodeError=Sk.abstr.buildNativeClass("UnicodeDecodeError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.UnicodeDecodeError",Sk.builtin.UnicodeDecodeError),Sk.builtin.UnicodeEncodeError=Sk.abstr.buildNativeClass("UnicodeEncodeError",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.UnicodeEncodeError",Sk.builtin.UnicodeEncodeError),Sk.builtin.StopIteration=Sk.abstr.buildNativeClass("StopIteration",{constructor:function(...e){Sk.builtin.Exception.apply(this,e)},base:Sk.builtin.Exception}),Sk.exportSymbol("Sk.builtin.StopIteration",Sk.builtin.StopIteration),Sk.builtin.getExcInfo=function(e){return new Sk.builtin.tuple([e.ob$type||Sk.builtin.none.none$,e,Sk.builtin.none.none$])}},function(e,t){Sk.builtin.method=Sk.abstr.buildNativeClass("method",{constructor:function(e,t){Sk.asserts.assert(this instanceof Sk.builtin.method,"bad call to method constructor, use 'new'"),this.im_func=e,this.im_self=t,this.im_call=e.tp$call},slots:{$r(){let e=this.im_func.tp$getattr(Sk.builtin.str.$qualname)||this.im_func.tp$getattr(Sk.builtin.str.$name);return e=e&&e.v||"?",new Sk.builtin.str("<bound method "+e+" of "+Sk.misceval.objectRepr(this.im_self)+">")},tp$hash(){return Sk.abstr.objectHash(this.im_self)+Sk.abstr.objectHash(this.im_func)},tp$call(e,t){var n=this.im_call;if(void 0===n)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this.im_func)+"' object is not callable");return e=[this.im_self,...e],n.call(this.im_func,e,t)},tp$new(e,t){if(Sk.abstr.checkNoKwargs("method",t),Sk.abstr.checkArgsLen("method",e,2,2),t=e[0],e=e[1],!Sk.builtin.checkCallable(t))throw new Sk.builtin.TypeError("first argument must be callable");if(Sk.builtin.checkNone(e))throw new Sk.builtin.TypeError("self must not be None");return new Sk.builtin.method(t,e)},tp$richcompare(e,t){if("Eq"!=t&&"NotEq"!=t||!(e instanceof Sk.builtin.method))return Sk.builtin.NotImplemented.NotImplemented$;let n;try{n=Sk.misceval.richCompareBool(this.im_self,e.im_self,"Eq",!1)&&this.im_func==e.im_func}catch(e){n=!1}return"Eq"==t?n:!n},tp$descr_get(e,t){return this},tp$getattr(e,t){const n=Sk.abstr.lookupSpecial(this,e);return void 0!==n?n:this.im_func.tp$getattr(e,t)}},getsets:{__func__:{$get(){return this.im_func}},__self__:{$get(){return this.im_self}},__doc__:{$get(){return this.im_func.tp$getattr(Sk.builtin.str.$doc)}}},flags:{sk$suitable_as_base_class:!1}})},function(e,t){function n(e){if(null!=e){if(e.nb$index)return e.nb$index();if("number"==typeof e&&Number.isInteger(e))return e}}function i(e,t){const i=n(e);if(void 0!==i)return i;throw t=(t||"'{tp$name}' object cannot be interpreted as an integer").replace("{tp$name}",Sk.abstr.typeName(e)),new Sk.builtin.TypeError(t)}Sk.misceval={},Sk.misceval.Suspension=function(e,t,n){this.$isSuspension=!0,void 0!==e&&void 0!==t&&(this.resume=function(){return e(t.resume())}),this.child=t,this.optional=void 0!==t&&t.optional,this.data=void 0===n&&void 0!==t?t.data:n},Sk.exportSymbol("Sk.misceval.Suspension",Sk.misceval.Suspension),Sk.misceval.retryOptionalSuspensionOrThrow=function(e,t){for(;e instanceof Sk.misceval.Suspension;){if(!e.optional)throw new Sk.builtin.SuspensionError(t||"Cannot call a function that blocks or suspends here");e=e.resume()}return e},Sk.exportSymbol("Sk.misceval.retryOptionalSuspensionOrThrow",Sk.misceval.retryOptionalSuspensionOrThrow),Sk.misceval.isIndex=function(e){return null!=e&&(void 0!==e.nb$index||"number"==typeof e&&Number.isInteger(e))},Sk.exportSymbol("Sk.misceval.isIndex",Sk.misceval.isIndex),Sk.misceval.asIndex=n,Sk.misceval.asIndexSized=function(e,t,n){if("number"==typeof(n=i(e,n)))return n;if(null==t)return JSBI.lessThan(n,JSBI.__ZERO)?-Number.MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER;throw new t("cannot fit '"+Sk.abstr.typeName(e)+"' into an index-sized integer")},Sk.misceval.asIndexOrThrow=i,Sk.misceval.applySlice=function(e,t,n,i){return Sk.abstr.objectGetItem(e,new Sk.builtin.slice(t,n,null),i)},Sk.exportSymbol("Sk.misceval.applySlice",Sk.misceval.applySlice),Sk.misceval.assignSlice=function(e,t,n,i,r){return t=new Sk.builtin.slice(t,n),null===i?Sk.abstr.objectDelItem(e,t):Sk.abstr.objectSetItem(e,t,i,r)},Sk.exportSymbol("Sk.misceval.assignSlice",Sk.misceval.assignSlice),Sk.misceval.arrayFromArguments=function(e){var t;if(1!=e.length)return e;var n=e[0];if(n instanceof Sk.builtin.set?n=n.tp$iter().$obj:n instanceof Sk.builtin.dict&&(n=Sk.builtin.dict.prototype.keys.func_code(n)),n instanceof Sk.builtin.list||n instanceof Sk.builtin.tuple)return n.v;if(Sk.builtin.checkIterable(n)){for(e=[],t=(n=Sk.abstr.iter(n)).tp$iternext();void 0!==t;t=n.tp$iternext())e.push(t);return e}throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(n)+"' object is not iterable")},Sk.exportSymbol("Sk.misceval.arrayFromArguments",Sk.misceval.arrayFromArguments),Sk.misceval.iterator=Sk.abstr.buildIteratorClass("iterator",{constructor:function(e,t){this.tp$iternext=t?e:function(t){let n=e();return t||!n.$isSuspension?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)}},iternext:function(e){return this.tp$iternext(e)},flags:{sk$acceptable_as_base_class:!1}}),Sk.misceval.swappedOp_={Eq:"Eq",NotEq:"NotEq",Lt:"Gt",LtE:"GtE",Gt:"Lt",GtE:"LtE"},Sk.misceval.opSymbols={Eq:"==",NotEq:"!=",Lt:"<",LtE:"<=",Gt:">",GtE:">=",Is:"is",IsNot:"is not",In_:"in",NotIn:"not in"},Sk.misceval.richCompareBool=function(e,t,n,i){var r;Sk.asserts.assert(e.sk$object&&t.sk$object,"JS object passed to richCompareBool");var s=e.ob$type,o=t.ob$type,a=o!==s&&void 0===o.sk$baseClass&&o.$isSubType(s);if(!Sk.__future__.python3&&s!==o&&("GtE"===n||"Gt"===n||"LtE"===n||"Lt"===n)){var l=[Sk.builtin.float_,Sk.builtin.int_,Sk.builtin.lng,Sk.builtin.bool],u=[Sk.builtin.dict,Sk.builtin.enumerate,Sk.builtin.filter_,Sk.builtin.list,Sk.builtin.map_,Sk.builtin.str,Sk.builtin.tuple,Sk.builtin.zip_];const i=l.indexOf(s),r=u.indexOf(s);if(l=l.indexOf(o),u=u.indexOf(o),e===Sk.builtin.none.none$)switch(n){case"Lt":case"LtE":return!0;case"Gt":case"GtE":return!1}if(t===Sk.builtin.none.none$)switch(n){case"Lt":case"LtE":return!1;case"Gt":case"GtE":return!0}if(-1!==i&&-1!==u)switch(n){case"Lt":case"LtE":return!0;case"Gt":case"GtE":return!1}if(-1!==r&&-1!==l)switch(n){case"Lt":case"LtE":return!1;case"Gt":case"GtE":return!0}if(-1!==r&&-1!==u)switch(n){case"Lt":return r<u;case"LtE":return r<=u;case"Gt":return r>u;case"GtE":return r>=u}}if("Is"===n){if(s===o){if(e===t)return!0;if(s===Sk.builtin.float_)return e.v===t.v;if(s===Sk.builtin.int_)return"number"==typeof e.v&&"number"==typeof e.v?e.v===t.v:JSBI.equal(JSBI.BigInt(e.v),JSBI.BigInt(t.v))}return!1}if("IsNot"===n)return s!==o||(s===Sk.builtin.float_?e.v!==t.v:s===Sk.builtin.int_?"number"==typeof e.v&&"number"==typeof e.v?e.v!==t.v:JSBI.notEqual(JSBI.BigInt(e.v),JSBI.BigInt(t.v)):e!==t);if("In"===n)return Sk.misceval.chain(Sk.abstr.sequenceContains(t,e,i),Sk.misceval.isTrue);if("NotIn"===n)return Sk.misceval.chain(Sk.abstr.sequenceContains(t,e,i),(function(e){return!Sk.misceval.isTrue(e)}));if(s=(o={Eq:"ob$eq",NotEq:"ob$ne",Gt:"ob$gt",GtE:"ob$ge",Lt:"ob$lt",LtE:"ob$le"})[n],a&&(t[i=o[Sk.misceval.swappedOp_[n]]]!==e[i]&&(r=t[i](e))!==Sk.builtin.NotImplemented.NotImplemented$)||(r=e[s](t))!==Sk.builtin.NotImplemented.NotImplemented$||!a&&(r=t[i=o[Sk.misceval.swappedOp_[n]]](e))!==Sk.builtin.NotImplemented.NotImplemented$)return Sk.misceval.isTrue(r);if(!Sk.__future__.python3){if(a=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$cmp))try{if(r=Sk.misceval.callsimArray(a,[t]),Sk.builtin.checkNumber(r)){if(r=Sk.builtin.asnum$(r),"Eq"===n)return 0===r;if("NotEq"===n)return 0!==r;if("Lt"===n)return 0>r;if("Gt"===n)return 0<r;if("LtE"===n)return 0>=r;if("GtE"===n)return 0<=r}if(r!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int")}catch(e){throw new Sk.builtin.TypeError("comparison did not return an int")}if(a=Sk.abstr.lookupSpecial(t,Sk.builtin.str.$cmp))try{if(r=Sk.misceval.callsimArray(a,[e]),Sk.builtin.checkNumber(r)){if(r=Sk.builtin.asnum$(r),"Eq"===n)return 0===r;if("NotEq"===n)return 0!==r;if("Lt"===n)return 0<r;if("Gt"===n)return 0>r;if("LtE"===n)return 0<=r;if("GtE"===n)return 0>=r}if(r!==Sk.builtin.NotImplemented.NotImplemented$)throw new Sk.builtin.TypeError("comparison did not return an int")}catch(e){throw new Sk.builtin.TypeError("comparison did not return an int")}if(e===Sk.builtin.none.none$&&t===Sk.builtin.none.none$){if("Eq"===n)return e.v===t.v;if("NotEq"===n)return e.v!==t.v;if("Gt"===n)return e.v>t.v;if("GtE"===n)return e.v>=t.v;if("Lt"===n)return e.v<t.v;if("LtE"===n)return e.v<=t.v}}if("Eq"===n)return e===t;if("NotEq"===n)return e!==t;throw e=Sk.abstr.typeName(e),t=Sk.abstr.typeName(t),new Sk.builtin.TypeError("'"+Sk.misceval.opSymbols[n]+"' not supported between instances of '"+e+"' and '"+t+"'")},Sk.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool),Sk.misceval.objectRepr=function(e){if(Sk.asserts.assert(void 0!==e,"trying to repr undefined"),null!==e&&e.$r)return e.$r().v;try{return new Sk.builtin.str(e).v}catch(e){if(e instanceof Sk.builtin.TypeError)return"<unknown>";throw e}},Sk.exportSymbol("Sk.misceval.objectRepr",Sk.misceval.objectRepr),Sk.misceval.opAllowsEquality=function(e){switch(e){case"LtE":case"Eq":case"GtE":return!0}return!1},Sk.exportSymbol("Sk.misceval.opAllowsEquality",Sk.misceval.opAllowsEquality),Sk.misceval.isTrue=function(e){return!0===e||e===Sk.builtin.bool.true$||!1!==e&&e!==Sk.builtin.bool.false$&&null!=e&&(e.nb$bool?e.nb$bool():e.sq$length?0!==e.sq$length():!!e)},Sk.exportSymbol("Sk.misceval.isTrue",Sk.misceval.isTrue),Sk.misceval.softspace_=!1,Sk.misceval.print_=function(e){Sk.misceval.softspace_&&("\n"!==e&&Sk.output(" "),Sk.misceval.softspace_=!1);var t=new Sk.builtin.str(e);return Sk.misceval.chain(Sk.importModule("sys",!1,!0),(function(e){return Sk.misceval.apply(e.$d.stdout.write,void 0,void 0,void 0,[e.$d.stdout,t])}),(function(){var e;(e=0===t.v.length)||(e=!("\n"===(e=t.v[t.v.length-1])||"\t"===e||"\r"===e)),(e||" "===t.v[t.v.length-1])&&(Sk.misceval.softspace_=!0)}))},Sk.exportSymbol("Sk.misceval.print_",Sk.misceval.print_),Sk.misceval.loadname=function(e,t){if(void 0!==(t=t[e]))return t;if(void 0!==(t=Sk.builtins[e]))return t;throw new Sk.builtin.NameError("name '"+Sk.unfixReserved(e)+"' is not defined")},Sk.exportSymbol("Sk.misceval.loadname",Sk.misceval.loadname),Sk.misceval.call=function(e,t,n,i,r){return r=Array.prototype.slice.call(arguments,4),Sk.misceval.apply(e,t,n,i,r)},Sk.exportSymbol("Sk.misceval.call",Sk.misceval.call),Sk.misceval.callAsync=function(e,t,n,i,r,s){return s=Array.prototype.slice.call(arguments,5),Sk.misceval.applyAsync(e,t,n,i,r,s)},Sk.exportSymbol("Sk.misceval.callAsync",Sk.misceval.callAsync),Sk.misceval.callOrSuspend=function(e,t,n,i,r){return r=Array.prototype.slice.call(arguments,4),Sk.misceval.applyOrSuspend(e,t,n,i,r)},Sk.exportSymbol("Sk.misceval.callOrSuspend",Sk.misceval.callOrSuspend),Sk.misceval.callsim=function(e,t){return t=Array.prototype.slice.call(arguments,1),Sk.misceval.apply(e,void 0,void 0,void 0,t)},Sk.exportSymbol("Sk.misceval.callsim",Sk.misceval.callsim),Sk.misceval.callsimArray=function(e,t,n){return t=t||[],Sk.misceval.retryOptionalSuspensionOrThrow(Sk.misceval.callsimOrSuspendArray(e,t,n))},Sk.exportSymbol("Sk.misceval.callsimArray",Sk.misceval.callsimArray),Sk.misceval.callsimAsync=function(e,t,n){return n=Array.prototype.slice.call(arguments,2),Sk.misceval.applyAsync(e,t,void 0,void 0,void 0,n)},Sk.exportSymbol("Sk.misceval.callsimAsync",Sk.misceval.callsimAsync),Sk.misceval.callsimOrSuspend=function(e,t){return t=Array.prototype.slice.call(arguments,1),Sk.misceval.applyOrSuspend(e,void 0,void 0,void 0,t)},Sk.exportSymbol("Sk.misceval.callsimOrSuspend",Sk.misceval.callsimOrSuspend),Sk.misceval.callsimOrSuspendArray=function(e,t,n){return t=t||[],void 0!==e&&e.tp$call?e.tp$call(t,n):Sk.misceval.applyOrSuspend(e,void 0,void 0,n,t)},Sk.exportSymbol("Sk.misceval.callsimOrSuspendArray",Sk.misceval.callsimOrSuspendArray),Sk.misceval.apply=function(e,t,n,i,r){return(e=Sk.misceval.applyOrSuspend(e,t,n,i,r))instanceof Sk.misceval.Suspension?Sk.misceval.retryOptionalSuspensionOrThrow(e):e},Sk.exportSymbol("Sk.misceval.apply",Sk.misceval.apply),Sk.misceval.asyncToPromise=function(e,t){return new Promise((function(n,i){try{!function e(r){try{for(var s=function(){try{e(r.resume())}catch(e){i(e)}},o=function(e){try{r.data.result=e,s()}catch(e){i(e)}},a=function(e){try{r.data.error=e,s()}catch(e){i(e)}};r instanceof Sk.misceval.Suspension;){var l=t&&(t[r.data.type]||t["*"]);if(l){var u=l(r);if(u)return void u.then(e,i)}if("Sk.promise"==r.data.type)return void r.data.promise.then(o,a);if("Sk.yield"==r.data.type)return void Sk.global.setImmediate(s);if("Sk.delay"==r.data.type)return void Sk.global.setImmediate(s);if(!r.optional)throw new Sk.builtin.SuspensionError("Unhandled non-optional suspension of type '"+r.data.type+"'");r=r.resume()}n(r)}catch(e){i(e)}}(e())}catch(e){i(e)}}))},Sk.exportSymbol("Sk.misceval.asyncToPromise",Sk.misceval.asyncToPromise),Sk.misceval.applyAsync=function(e,t,n,i,r,s){return Sk.misceval.asyncToPromise((function(){return Sk.misceval.applyOrSuspend(t,n,i,r,s)}),e)},Sk.exportSymbol("Sk.misceval.applyAsync",Sk.misceval.applyAsync),Sk.misceval.chain=function(e,t){for(var n,i,r=1,s=e;;){if(r==arguments.length)return s;if(s&&s.$isSuspension)break;s=arguments[r](s),r++}for(i=Array(arguments.length-r),n=0;n<arguments.length-r;n++)i[n]=arguments[r+n];return n=0,function e(t){for(;n<i.length;){if(t instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(e,t);t=i[n](t),n++}return t}(s)},Sk.exportSymbol("Sk.misceval.chain",Sk.misceval.chain),Sk.misceval.tryCatch=function(e,t){try{var n=e()}catch(e){return t(e)}return n instanceof Sk.misceval.Suspension?((e=new Sk.misceval.Suspension(void 0,n)).resume=function(){return Sk.misceval.tryCatch(n.resume,t)},e):n},Sk.exportSymbol("Sk.misceval.tryCatch",Sk.misceval.tryCatch),Sk.misceval.iterFor=function(e,t,n){var i=n,r=function(t){return i=t,t instanceof Sk.misceval.Break?t:e.tp$iternext(!0)};return function e(n){for(;void 0!==n;){if(n instanceof Sk.misceval.Suspension)return new Sk.misceval.Suspension(e,n);if(n===Sk.misceval.Break||n instanceof Sk.misceval.Break)return n.brValue;n=Sk.misceval.chain(t(n,i),r)}return i}(e.tp$iternext(!0))},Sk.exportSymbol("Sk.misceval.iterFor",Sk.misceval.iterFor),Sk.misceval.iterArray=function(e,t,n){Sk.asserts.assert(Array.isArray(e),"iterArgs requires an array");let i=0;return Sk.misceval.iterFor({tp$iternext:()=>e[i++]},t,n)},Sk.misceval.arrayFromIterable=function(e,t){if(void 0===e)return[];if(void 0===e.hp$type&&void 0!==e.sk$asarray)return e.sk$asarray();const n=[];return e=Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{n.push(e)})),(()=>n)),t?e:Sk.misceval.retryOptionalSuspensionOrThrow(e)},Sk.misceval.Break=function(e){if(!(this instanceof Sk.misceval.Break))return new Sk.misceval.Break(e);this.brValue=e},Sk.exportSymbol("Sk.misceval.Break",Sk.misceval.Break),Sk.misceval.applyOrSuspend=function(e,t,n,i,r){var s;if(null==e||e===Sk.builtin.none.none$)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not callable");"function"==typeof e&&void 0===e.tp$call&&(e=new Sk.builtin.func(e));var o=e.tp$call;if(void 0!==o){if(n)for(s=(n=n.tp$iter()).tp$iternext();void 0!==s;s=n.tp$iternext())r.push(s);if(t)for(s=(n=Sk.abstr.iter(t)).tp$iternext();void 0!==s;s=n.tp$iternext()){if(!Sk.builtin.checkString(s))throw new Sk.builtin.TypeError("Function keywords must be strings");i.push(s.v),i.push(Sk.abstr.objectGetItem(t,s,!1))}return o.call(e,r,i,t)}if(void 0!==(o=e.__call__))return r.unshift(e),Sk.misceval.apply(o,t,n,i,r);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not callable")},Sk.exportSymbol("Sk.misceval.applyOrSuspend",Sk.misceval.applyOrSuspend),Sk.misceval.promiseToSuspension=function(e){var t=new Sk.misceval.Suspension;return t.resume=function(){if(t.data.error)throw t.data.error;return t.data.result},t.data={type:"Sk.promise",promise:e},t},Sk.exportSymbol("Sk.misceval.promiseToSuspension",Sk.misceval.promiseToSuspension),Sk.misceval.buildClass=function(e,t,n,i,r){var s=Sk.builtin.type,o={};for(var a in t(e,o,void 0===r?{}:r),e.__name__&&(o.__module__=e.__name__),e=new Sk.builtin.str(n),i=new Sk.builtin.tuple(i),t=[],o)o.hasOwnProperty(a)&&(t.push(new Sk.builtin.str(a)),t.push(o[a]));return t=new Sk.builtin.dict(t),Sk.misceval.callsimArray(s,[e,i,t])},Sk.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass)},function(e,t){Sk.builtin.callable_iter_=Sk.abstr.buildIteratorClass("callable_iterator",{constructor:function(e,t){if(!Sk.builtin.checkCallable(e))throw new Sk.builtin.TypeError("iter(v, w): v must be callable");this.$callable=e,this.$sentinel=t,this.$flag=!1},iternext(e){if(!0!==this.$flag){if(e)return e=Sk.misceval.callsimOrSuspendArray(this.$callable,[]),Sk.misceval.chain(e,(e=>{if(!Sk.misceval.richCompareBool(e,this.$sentinel,"Eq",!0))return e;this.$flag=!0}));if(e=Sk.misceval.callsimArray(this.$callable,[]),!Sk.misceval.richCompareBool(e,this.$sentinel,"Eq",!1))return e;this.$flag=!0}},flags:{sk$acceptable_as_base_class:!1}}),Sk.builtin.seq_iter_=Sk.abstr.buildIteratorClass("iterator",{constructor:function(e){this.$index=0,this.$seq=e},iternext(e){let t;return t=Sk.misceval.tryCatch((()=>this.$seq.mp$subscript(new Sk.builtin.int_(this.$index++),e)),(e=>{if(!(e instanceof Sk.builtin.IndexError||e instanceof Sk.builtin.StopIteration))throw e})),e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)},methods:{__length_hint__:{$flags:{NoArgs:!0},$meth(){if(this.$seq.sq$length)return this.$seq.sq$length()-this.$index;throw new Sk.builtin.NotImplementedError("len is not implemented for "+Sk.abstr.typeName(this.$seq))}}},flags:{sk$acceptable_as_base_class:!1}}),Sk.exportSymbol("Sk.builtin.callable_iter_",Sk.builtin.callable_iter_)},function(e,t){Sk.builtin.list=Sk.abstr.buildNativeClass("list",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.list,"bad call to list, use 'new' with an Array of python objects"),this.v=e,this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified.",tp$new:Sk.generic.new,tp$init(e,t){return Sk.abstr.checkNoKwargs("list",t),Sk.abstr.checkArgsLen("list",e,0,1),Sk.misceval.chain(Sk.misceval.arrayFromIterable(e[0],!0),(e=>{this.v=e}))},$r(){if(this.in$repr)return new Sk.builtin.str("[...]");this.in$repr=!0;const e=this.v.map((e=>Sk.misceval.objectRepr(e)));return this.in$repr=!1,new Sk.builtin.str("["+e.join(", ")+"]")},tp$richcompare:Sk.generic.seqCompare,tp$iter(){return new n(this)},sq$length(){return this.v.length},sq$concat(e){if(!(e instanceof Sk.builtin.list))throw new Sk.builtin.TypeError("can only concatenate list to list");return new Sk.builtin.list(this.v.concat(e.v))},sq$contains(e){for(let t=this.tp$iter(),n=t.tp$iternext();void 0!==n;n=t.tp$iternext())if(n===e||Sk.misceval.richCompareBool(n,e,"Eq"))return!0;return!1},sq$repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");if((e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))*this.v.length>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;const t=[];for(let n=0;n<e;n++)for(let e=0;e<this.v.length;e++)t.push(this.v[e]);return new Sk.builtin.list(t)},mp$subscript(e){if(Sk.misceval.isIndex(e))return e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError),e=this.list$inRange(e,"list index out of range"),this.v[e];if(e instanceof Sk.builtin.slice){const t=[];return e.sssiter$(this.v.length,(e=>{t.push(this.v[e])})),new Sk.builtin.list(t)}throw new Sk.builtin.TypeError("list indices must be integers or slices, not "+Sk.abstr.typeName(e))},mp$ass_subscript(e,t){void 0===t?this.del$subscript(e):this.ass$subscript(e,t)},sq$inplace_concat(e){return e===this?(this.v.push(...this.v),this):Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.v.push(e)})),(()=>this))},sq$inplace_repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError);const t=this.v.length;if(0>=e)this.v.length=0;else if(e*t>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;for(let n=1;n<e;n++)for(let e=0;e<t;e++)this.v.push(this.v[e]);return this}},methods:{__reversed__:{$meth(){return new i(this)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a reverse iterator over the list."},clear:{$meth(){return this.v.length=0,Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Remove all items from list."},copy:{$meth(){return new Sk.builtin.list(this.v.slice(0))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return a shallow copy of the list."},append:{$meth(e){return this.v.push(e),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:"($self, object, /)",$doc:"Append object to the end of the list."},insert:{$meth(e,t){return e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError),({start:e}=Sk.builtin.slice.startEnd$wrt(this,e)),this.v.splice(e,0,t),Sk.builtin.none.none$},$flags:{MinArgs:2,MaxArgs:2},$textsig:"($self, index, object, /)",$doc:"Insert object before index."},extend:{$meth(e){return e===this?(this.v.push(...this.v),Sk.builtin.none.none$):Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.v.push(e)})),(()=>Sk.builtin.none.none$))},$flags:{OneArg:!0},$textsig:"($self, iterable, /)",$doc:"Extend list by appending elements from the iterable."},pop:{$meth(e){e=void 0===e?this.v.length-1:Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError),e=this.list$inRange(e,"pop index out of range");const t=this.v[e];return this.v.splice(e,1),t},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, index=-1, /)",$doc:"Remove and return item at index (default last).\n\nRaises IndexError if list is empty or index is out of range."},remove:{$meth(e){if(-1===(e=this.list$indexOf(e)))throw new Sk.builtin.ValueError("list.remove(x): x not in list");return this.v.splice(e,1),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Remove first occurrence of value.\n\nRaises ValueError if the value is not present."},sort:{$meth(e,t){if(e.length)throw new Sk.builtin.TypeError("sort() takes no positional arguments");const[n,i]=Sk.abstr.copyKeywordsToNamedArgs("sort",["key","reverse"],e,t,[Sk.builtin.none.none$,Sk.builtin.bool.false$]);return this.list$sort(void 0,n,i)},$flags:{FastCall:!0},$textsig:"($self, /, *, key=None, reverse=False)",$doc:"Stable sort *IN PLACE*."},index:{$meth(e,t,n){if(void 0!==t&&!Sk.misceval.isIndex(t)||void 0!==n&&!Sk.misceval.isIndex(n))throw new Sk.builtin.TypeError("slice indices must be integers or have an __index__ method");if(-1===(t=this.list$indexOf(e,t,n)))throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(e)+" is not in list");return new Sk.builtin.int_(t)},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($self, value, start=0, stop=sys.maxsize, /)",$doc:"Return first index of value.\n\nRaises ValueError if the value is not present."},count:{$meth(e){let t=0;const n=this.v.length;for(let i=0;i<n;i++)(this.v[i]===e||Sk.misceval.richCompareBool(this.v[i],e,"Eq"))&&(t+=1);return new Sk.builtin.int_(t)},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Return number of occurrences of value."},reverse:{$meth(){return this.list$reverse(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Reverse *IN PLACE*."}},proto:{sk$asarray(){return this.v.slice(0)},list$sort:function(e,t,n){const i=null!=t&&t!==Sk.builtin.none.none$;var r=null!=e&&e!==Sk.builtin.none.none$;let s;if(void 0===n)s=!1;else{if(!Sk.builtin.checkInt(n))throw new Sk.builtin.TypeError("an integer is required");s=Sk.misceval.isTrue(n)}n=new Sk.builtin.timSort(this),this.v=[];const o=new Sk.builtin.int_(0);if(i){n.lt=r?function(t,n){return t=Sk.misceval.callsimArray(e,[t[0],n[0]]),Sk.misceval.richCompareBool(t,o,"Lt")}:function(e,t){return Sk.misceval.richCompareBool(e[0],t[0],"Lt")};for(let e=0;e<n.listlength;e++){r=n.list.v[e];const i=Sk.misceval.callsimArray(t,[r]);n.list.v[e]=[i,r]}}else r&&(n.lt=function(t,n){return t=Sk.misceval.callsimArray(e,[t,n]),Sk.misceval.richCompareBool(t,o,"Lt")});if(s&&n.list.list$reverse(),n.sort(),s&&n.list.list$reverse(),i)for(t=0;t<n.listlength;t++)r=n.list.v[t][1],n.list.v[t]=r;if(t=0<this.sq$length(),this.v=n.list.v,t)throw new Sk.builtin.ValueError("list modified during sort");return Sk.builtin.none.none$},list$inRange(e,t){if(0>e&&(e+=this.v.length),0<=e&&e<this.v.length)return e;throw new Sk.builtin.IndexError(t)},list$indexOf(e,t,n){for(({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(this,t,n));t<n&&t<this.v.length;t++)if(this.v[t]===e||Sk.misceval.richCompareBool(this.v[t],e,"Eq"))return t;return-1},list$reverse(){this.v.reverse()},ass$subscript(e,t){if(Sk.misceval.isIndex(e))this.ass$index(e,t);else{if(!(e instanceof Sk.builtin.slice))throw new Sk.builtin.TypeError("list indices must be integers or slices, not "+Sk.abstr.typeName(e));{const{start:n,stop:i,step:r}=e.slice$indices(this.v.length);1===r?this.ass$slice(n,i,t):this.ass$ext_slice(e,t)}}},ass$index(e,t){e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError),e=this.list$inRange(e,"list assignment index out of range"),this.v[e]=t},ass$slice(e,t,n){if(!Sk.builtin.checkIterable(n))throw new Sk.builtin.TypeError("can only assign an iterable");n=Sk.misceval.arrayFromIterable(n),this.v.splice(e,t-e,...n)},ass$ext_slice(e,t){const n=[];if(e.sssiter$(this.v.length,(e=>{n.push(e)})),!Sk.builtin.checkIterable(t))throw new Sk.builtin.TypeError("must assign iterable to extended slice");if(e=Sk.misceval.arrayFromIterable(t),n.length!==e.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+e.length+" to extended slice of size "+n.length);for(t=0;t<n.length;t++)this.v.splice(n[t],1,e[t])},del$subscript(e){if(Sk.misceval.isIndex(e))this.del$index(e);else{if(!(e instanceof Sk.builtin.slice))throw new Sk.builtin.TypeError("list indices must be integers, not "+Sk.abstr.typeName(e));{const{start:t,stop:n,step:i}=e.slice$indices(this.v.length);1===i?this.del$slice(t,n):this.del$ext_slice(e,0<i?1:0)}}},del$index(e){e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError),e=this.list$inRange(e,"list assignment index out of range"),this.v.splice(e,1)},del$slice(e,t){this.v.splice(e,t-e)},del$ext_slice(e,t){let n=0;e.sssiter$(this.v.length,(e=>{this.v.splice(e-n,1),n+=t}))}}}),Sk.exportSymbol("Sk.builtin.list",Sk.builtin.list),Sk.builtin.list.py2$methods={sort:{$name:"sort",$meth(e,t){const[n,i,r]=Sk.abstr.copyKeywordsToNamedArgs("sort",["cmp","key","reverse"],e,t,[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$]);return this.list$sort(n,i,r)},$flags:{FastCall:!0},$textsig:"($self, cmp=None, key=None, reverse=False)",$doc:"Stable sort *IN PLACE*."}};var n=Sk.abstr.buildIteratorClass("list_iterator",{constructor:function(e){this.$index=0,this.$seq=e.v},iternext:Sk.generic.iterNextWithArray,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}}),i=Sk.abstr.buildIteratorClass("list_reverseiterator",{constructor:function(e){this.$index=e.v.length-1,this.$seq=e.v},iternext(){const e=this.$seq[this.$index--];if(void 0!==e)return e;this.tp$iternext=()=>{}},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef},flags:{sk$acceptable_as_base_class:!1}})},function(e,t,n){function i(e){var t=e.replace(y,"").replace(v,"_").toLowerCase();return void 0===(t=k[t])?e:t}function r(e,t,n){if(void 0===t)t="utf-8";else{if(!Sk.builtin.checkString(t))throw new Sk.builtin.TypeError(e+"() argument "+("bytesstr".includes(e)?2:1)+" must be str not "+Sk.abstr.typeName(t));t=t.$jsstr()}if(void 0===n)n="strict";else{if(!Sk.builtin.checkString(n))throw new Sk.builtin.TypeError(e+"() argument "+("bytesstr".includes(e)?3:2)+" must be str not "+Sk.abstr.typeName(n));n=n.$jsstr()}return{encoding:t,errors:n}}function s(e,t,n){if(e=e.$jsstr(),t=i(t),"strict"!==n&&"ignore"!==n&&"replace"!==n)throw new Sk.builtin.NotImplementedError("'"+n+"' error handling not implemented in Skulpt");if("ascii"===t){for(r in t=[],e){const i=e.charCodeAt(r);if(127<i){if("strict"===n)throw n=o(i),new Sk.builtin.UnicodeEncodeError("'ascii' codec can't encode character '"+n+"' in position "+r+": ordinal not in range(128)");"replace"===n&&t.push(63)}else t.push(i)}var r=new Uint8Array(t)}else{if("utf-8"!==t)throw new Sk.builtin.LookupError("unknown encoding: "+t);r=T.encode(e)}return new Sk.builtin.bytes(r)}function o(e){var t=265>=e?"\\x":"\\u";return 3===(e=e.toString(16)).length&&(e=e.slice(1,3)),1===e.length?t+"0"+e:t+e}function a(e,t){if(({encoding:e,errors:t}=r("decode",e,t)),e=i(e),"strict"!==t&&"ignore"!==t&&"replace"!==t)throw new Sk.builtin.NotImplementedError("'"+t+"' error handling not implemented in Skulpt");if("ascii"===e){e=this.v;var n="";for(let i=0;i<e.length;i++){const r=e[i];if(127<r){if("strict"===t)throw new Sk.builtin.UnicodeDecodeError("'ascii' codec can't decode byte 0x"+r.toString(16)+" in position "+i+": ordinal not in range(128)");"replace"===t&&(n+=String.fromCharCode(65533))}else n+=String.fromCharCode(r)}e=n}else{if("utf-8"!==e)throw new Sk.builtin.LookupError("unknown encoding: "+e);e:if(e=this.v,n=t,t=E.decode(e),"replace"===n)e=t;else{if("strict"===n){if(-1===(n=t.indexOf("<22>"))){e=t;break e}throw new Sk.builtin.UnicodeDecodeError("'utf-8' codec can't decode byte 0x"+e[n].toString(16)+" in position "+n+": invalid start byte")}e=t.replace(/\ufffd/g,"")}}return new Sk.builtin.str(e)}function l(e,t){return function(n,i,r){if(!(n instanceof Sk.builtin.bytes||n instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError(e+" first arg must be bytes or a tuple of bytes, not "+Sk.abstr.typeName(n));if(({start:i,end:r}=Sk.builtin.slice.startEnd$wrt(this,i,r)),r<i)return Sk.builtin.bool.false$;if(i=this.v.subarray(i,r),n instanceof Sk.builtin.tuple){for(let e=Sk.abstr.iter(n),r=e.tp$iternext();void 0!==r;r=e.tp$iternext())if(r=this.get$raw(r),t(i,r))return Sk.builtin.bool.true$;return Sk.builtin.bool.false$}return t(i,n.v)?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function u(e){return function(t,n,i){return t=this.get$tgt(t),({start:n,end:i}=Sk.builtin.slice.startEnd$wrt(this,n,i)),i<n?-1:"number"==typeof t?(t=e?this.v.lastIndexOf(t,i-1):this.v.indexOf(t,n))>=n&&t<i?t:-1:e?this.find$subright(t,n,i):this.find$subleft(t,n,i)}}function c(e){return function(t){let n;if(t=this.get$raw(t),e){if(n=this.find$subright(t,0,this.v.length),0>n)return new Sk.builtin.tuple([new Sk.builtin.bytes,new Sk.builtin.bytes,this])}else if(n=this.find$subleft(t,0,this.v.length),0>n)return new Sk.builtin.tuple([this,new Sk.builtin.bytes,new Sk.builtin.bytes]);return new Sk.builtin.tuple([new Sk.builtin.bytes(this.v.subarray(0,n)),new Sk.builtin.bytes(t),new Sk.builtin.bytes(this.v.subarray(n+t.length))])}}function p(e,t){return function(n){var i=void 0===n||n===Sk.builtin.none.none$?new Uint8Array([9,10,11,12,13,32,133]):this.get$raw(n);n=0;var r=this.v.length;if(e)for(;n<r&&i.includes(this.v[n]);)n++;if(t)for(;r>n&&i.includes(this.v[r-1]);)r--;for(i=new Uint8Array(r-n),r=0;r<i.length;r++)i[r]=this.v[r+n];return new Sk.builtin.bytes(i)}}function h(e,t,n){return function(i,r){if(void 0===r)r=32;else{if(!(r instanceof Sk.builtin.bytes&&1==r.v.length))throw new Sk.builtin.TypeError(e+"() argument 2 must be a byte string of length 1, not "+Sk.abstr.typeName(r));r=r.v[0]}const s=this.v.length;if((i=Sk.misceval.asIndexSized(i,Sk.builtin.OverflowError))<=s)return new Sk.builtin.bytes(this.v);const o=new Uint8Array(i);let a,l;n?(a=Math.floor((i-s)/2),l=(i-s)%2?a+1:a):t?(a=i-s,l=0):(a=0,l=i-s),o.fill(r,0,a);for(let e=0;e<s;e++)o[e+a]=this.v[e];return o.fill(r,i-l),new Sk.builtin.bytes(o)}}function d(e){return 9<=e&&13>=e||32===e}function f(e){return 97<=e&&122>=e}function _(e){return 65<=e&&90>=e}function m(e){return 48<=e&&57>=e}function b(e,t){return function(){return 0===this.v.length?t?Sk.builtin.bool.true$:Sk.builtin.bool.false$:this.v.every((t=>e(t)))?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function g(e,t){return function(){let n=!1;for(let i=0;i<this.v.length;i++){if(t(this.v[i]))return Sk.builtin.bool.false$;!n&&e(this.v[i])&&(n=!0)}return n?Sk.builtin.bool.true$:Sk.builtin.bool.false$}}function S(e){return function(){const t=new Uint8Array(this.v.length);for(let n=0;n<this.v.length;n++)t[n]=e(this.v[n]);return new Sk.builtin.bytes(t)}}n(30);const k={utf:"utf-8",utf8:"utf-8",utf_8:"utf-8",ascii:"ascii"};var y=/\s+/g,v=/[_-]+/g;const T=new TextEncoder,E=new TextDecoder;Sk.builtin.bytes=Sk.abstr.buildNativeClass("bytes",{constructor:function(e){if(!(this instanceof Sk.builtin.bytes))throw new TypeError("bytes is a constructor use 'new'");if(void 0===e)this.v=new Uint8Array;else if(e instanceof Uint8Array)this.v=e;else if(Array.isArray(e))Sk.asserts.assert(e.every((e=>0<=e&&255>=e)),"bad internal call to bytes with array"),this.v=new Uint8Array(e);else if("string"==typeof e){let t;const n=new Uint8Array(e.length),i=e.length;for(let r=0;r<i;r++){if(t=e.charCodeAt(r),255<t)throw new Sk.builtin.UnicodeDecodeError("invalid string at index "+r+" (possibly contains a unicode character)");n[r]=t}this.v=n}else{if("number"!=typeof e)throw new Sk.builtin.TypeError("bad argument to bytes constructor");this.v=new Uint8Array(e)}},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer",tp$new(e,t){if(this!==Sk.builtin.bytes.prototype)return this.$subtype_new(e,t);if(t=t||[],!(1>=e.length&&0==+t.length)){if([e,n,t]=Sk.abstr.copyKeywordsToNamedArgs("bytes",[null,"pySource","errors"],e,t),({encoding:n,errors:t}=r("bytes",n,t)),!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("encoding or errors without a string argument");return s(e,n,t)}if(void 0===(e=e[0]))return new Sk.builtin.bytes;if(void 0!==(t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$bytes))){var n=Sk.misceval.callsimOrSuspendArray(t,[]);return Sk.misceval.chain(n,(e=>{if(!Sk.builtin.checkBytes(e))throw new Sk.builtin.TypeError("__bytes__ returned non-bytes (type "+Sk.abstr.typeName(e)+")");return e}))}if(Sk.misceval.isIndex(e)){if(0>(n=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError)))throw new Sk.builtin.ValueError("negative count");return new Sk.builtin.bytes(n)}if(Sk.builtin.checkBytes(e))return new Sk.builtin.bytes(e.v);if(Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("string argument without an encoding");if(Sk.builtin.checkIterable(e)){let t=[];return n=Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(0>(e=Sk.misceval.asIndexSized(e))||255<e)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)");t.push(e)})),Sk.misceval.chain(n,(()=>new Sk.builtin.bytes(t)))}throw new Sk.builtin.TypeError("cannot convert '"+Sk.abstr.typeName(n)+"' object into bytes")},$r(){let e,t="'";const n=-1!==this.v.indexOf(34);let i="";for(let r=0;r<this.v.length;r++)if(e=this.v[r],9>e||10<e&&13>e||13<e&&32>e||126<e)i+=o(e);else if(9===e||10===e||13===e||39===e||92===e)switch(e){case 9:i+="\\t";break;case 10:i+="\\n";break;case 13:i+="\\r";break;case 39:n?i+="\\'":(i+="'",t='"');break;case 92:i+="\\\\"}else i+=String.fromCharCode(e);return new Sk.builtin.str("b"+t+i+t)},tp$str(){return this.$r()},tp$iter(){return new I(this)},tp$richcompare(e,t){if(this===e&&Sk.misceval.opAllowsEquality(t))return!0;if(!(e instanceof Sk.builtin.bytes))return Sk.builtin.NotImplemented.NotImplemented$;const n=this.v;if(e=e.v,n.length!==e.length&&("Eq"===t||"NotEq"===t))return"Eq"!==t;let i;const r=Math.min(n.length,e.length);for(i=0;i<r&&n[i]===e[i];i++);switch(t){case"Lt":return i===r&&n.length<e.length||n[i]<e[i];case"LtE":return i===r&&n.length<=e.length||n[i]<=e[i];case"Eq":return i===r;case"NotEq":return i<r;case"Gt":return i===r&&n.length>e.length||n[i]>e[i];case"GtE":return i===r&&n.length>=e.length||n[i]>=e[i]}},tp$hash(){return new Sk.builtin.str(this.$jsstr()).tp$hash()},tp$as_sequence_or_mapping:!0,mp$subscript(e){if(Sk.misceval.isIndex(e)){let t=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError);if(void 0!==t){if(0>t&&(t=this.v.length+t),0>t||t>=this.v.length)throw new Sk.builtin.IndexError("index out of range");return new Sk.builtin.int_(this.v[t])}}else if(e instanceof Sk.builtin.slice){const t=[];return e.sssiter$(this.v.length,(e=>{t.push(this.v[e])})),new Sk.builtin.bytes(new Uint8Array(t))}throw new Sk.builtin.TypeError("byte indices must be integers or slices, not "+Sk.abstr.typeName(e))},sq$length(){return this.v.length},sq$concat(e){if(!(e instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("can't concat "+Sk.abstr.typeName(e)+" to bytes");const t=new Uint8Array(this.v.length+e.v.length);let n;for(n=0;n<this.v.length;n++)t[n]=this.v[n];for(let i=0;i<e.v.length;i++,n++)t[n]=e.v[i];return new Sk.builtin.bytes(t)},sq$repeat(e){if(!Sk.misceval.isIndex(e))throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+Sk.abstr.typeName(e)+"'");const t=(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))*this.v.length;if(t>Number.MAX_SAFE_INTEGER)throw new Sk.builtin.OverflowError;if(0>=e)return new Sk.builtin.bytes;e=new Uint8Array(t);let n=0;for(;n<t;)for(let t=0;t<this.v.length;t++)e[n++]=this.v[t];return new Sk.builtin.bytes(e)},sq$contains(e){return-1!==this.find$left(e)},tp$as_number:!0,nb$remainder:Sk.builtin.str.prototype.nb$remainder},proto:{$jsstr(){let e="";for(let t=0;t<this.v.length;t++)e+=String.fromCharCode(this.v[t]);return e},get$tgt(e){if(e instanceof Sk.builtin.bytes)return e.v;if(0>(e=Sk.misceval.asIndexOrThrow(e,"argument should be integer or bytes-like object, not {tp$name}"))||255<e)throw new Sk.builtin.ValueError("bytes must be in range(0, 256)");return e},get$raw(e){if(e instanceof Sk.builtin.bytes)return e.v;throw new Sk.builtin.TypeError("a bytes-like object is required, not '"+Sk.abstr.typeName(e)+"'")},get$splitArgs:function(e,t){if(t=0>(t=Sk.misceval.asIndexSized(t,Sk.builtin.OverflowError))?1/0:t,null!==(e=Sk.builtin.checkNone(e)?null:this.get$raw(e))&&!e.length)throw new Sk.builtin.ValueError("empty separator");return{sep:e,maxsplit:t}},find$left:u(!1),find$right:u(!0),find$subleft:function(e,t,n){n=n-e.length+1;let i=t;for(;i<n;){if(e.every(((e,t)=>e===this.v[i+t])))return i;i++}return-1},find$subright(e,t,n){let i=n-e.length;for(;i>=t;){if(e.every(((e,t)=>e===this.v[i+t])))return i;i--}return-1},$subtype_new(e,t){const n=new this.constructor;return e=Sk.builtin.bytes.prototype.tp$new(e,t),n.v=e.v,n},sk$asarray(){const e=[];return this.v.forEach((t=>{e.push(new Sk.builtin.int_(t))})),e}},flags:{str$encode:s,$decode:a,check$encodeArgs:r},methods:{__getnewargs__:{$meth(){return new Sk.builtin.tuple(new Sk.builtin.bytes(this.v))},$flags:{NoArgs:!0},$textsig:null,$doc:null},capitalize:{$meth(){const e=this.v.length;if(0===e)return new Sk.builtin.bytes(this.v);const t=new Uint8Array(e);let n=this.v[0];t[0]=f(n)?n-32:n;for(let i=1;i<e;i++)n=this.v[i],t[i]=_(n)?n+32:n;return new Sk.builtin.bytes(t)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.capitalize() -> copy of B\n\nReturn a copy of B with only its first character capitalized (ASCII)\nand the rest lower-cased."},center:{$meth:h("center",!1,!0),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.center(width[, fillchar]) -> copy of B\n\nReturn B centered in a string of length width. Padding is\ndone using the specified fill character (default is a space)."},count:{$meth(e,t,n){e=this.get$tgt(e),({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(this,t,n));let i=0;if("number"==typeof e)for(;t<n;t++)this.v[t]===e&&i++;else{n=n-e.length+1;for(let r=t;r<n;r++)e.every(((e,t)=>e===this.v[r+t]))&&(i++,r+=e.length-1)}return new Sk.builtin.int_(i)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of subsection sub in\nbytes B[start:end]. Optional arguments start and end are interpreted\nas in slice notation."},decode:{$meth:a,$flags:{NamedArgs:["encoding","errors"]},$textsig:"($self, /, encoding='utf-8', errors='strict')",$doc:"Decode the bytes using the codec registered for encoding.\n\n encoding\n The encoding with which to decode the bytes.\n errors\n The error handling scheme to use for the handling of decoding errors.\n The default is 'strict' meaning that decoding errors raise a\n UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n as well as any other name registered with codecs.register_error that\n can handle UnicodeDecodeErrors."},endswith:{$meth:l("endswith",((e,t)=>{const n=e.length-t.length;return 0<=n&&t.every(((t,i)=>t===e[n+i]))})),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if B ends with the specified suffix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nsuffix can also be a tuple of bytes to try."},expandtabs:{$meth(e){e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError,"an integer is required (got type {tp$nam})");const t=[];let n=0;for(let r=0;r<this.v.length;r++){var i=this.v[r];9===i?(i=e-n%e,t.push(...Array(i).fill(32)),n+=i):10===i||13===i?(t.push(i),n=0):(t.push(i),n++)}return new Sk.builtin.bytes(new Uint8Array(t))},$flags:{NamedArgs:["tabsize"],Defaults:[8]},$textsig:null,$doc:"B.expandtabs(tabsize=8) -> copy of B\n\nReturn a copy of B where all tab characters are expanded using spaces.\nIf tabsize is not given, a tab size of 8 characters is assumed."},find:{$meth:function(e,t,n){return new Sk.builtin.int_(this.find$left(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},hex:{$meth(){let e="";for(let t=0;t<this.v.length;t++)e+=this.v[t].toString(16).padStart(2,"0");return new Sk.builtin.str(e)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.hex() -> string\n\nCreate a string of hexadecimal numbers from a bytes object.\nExample: b'\\xb9\\x01\\xef'.hex() -> 'b901ef'."},index:{$meth:function(e,t,n){if(-1===(e=this.find$left(e,t,n)))throw new Sk.builtin.ValueError("subsection not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the subsection is not found."},isalnum:{$meth:b((e=>m(e)||f(e)||_(e))),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isalnum() -> bool\n\nReturn True if all characters in B are alphanumeric\nand there is at least one character in B, False otherwise."},isalpha:{$meth:b((e=>65<=e&&90>=e||97<=e&&122>=e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isalpha() -> bool\n\nReturn True if all characters in B are alphabetic\nand there is at least one character in B, False otherwise."},isascii:{$meth:b((e=>0<=e&&127>=e),!0),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isascii() -> bool\n\nReturn True if B is empty or all characters in B are ASCII,\nFalse otherwise."},isdigit:{$meth:b(m),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isdigit() -> bool\n\nReturn True if all characters in B are digits\nand there is at least one character in B, False otherwise."},islower:{$meth:g(f,_),$flags:{NoArgs:!0},$textsig:null,$doc:"B.islower() -> bool\n\nReturn True if all cased characters in B are lowercase and there is\nat least one cased character in B, False otherwise."},isspace:{$meth:b(d),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isspace() -> bool\n\nReturn True if all characters in B are whitespace\nand there is at least one character in B, False otherwise."},istitle:{$meth:function(){let e=!1,t=!1;for(let n=0;n<this.v.length;n++){const i=this.v[n];if(_(i)){if(e)return Sk.builtin.bool.false$;t=e=!0}else if(f(i)){if(!e)return Sk.builtin.bool.false$;t=!0}else e=!1}return t?Sk.builtin.bool.true$:Sk.builtin.bool.false$},$flags:{NoArgs:!0},$textsig:null,$doc:"B.istitle() -> bool\n\nReturn True if B is a titlecased string and there is at least one\ncharacter in B, i.e. uppercase characters may only follow uncased\ncharacters and lowercase characters only cased ones. Return False\notherwise."},isupper:{$meth:g(_,f),$flags:{NoArgs:!0},$textsig:null,$doc:"B.isupper() -> bool\n\nReturn True if all cased characters in B are uppercase and there is\nat least one cased character in B, False otherwise."},join:{$meth(e){const t=[];let n=0;return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(!(e instanceof Sk.builtin.bytes))throw new Sk.builtin.TypeError("sequence item "+n+": expected a bytes-like object, "+Sk.abstr.typeName(e)+" found");n++,t.length&&t.push(...this.v),t.push(...e.v)})),(()=>new Sk.builtin.bytes(new Uint8Array(t))))},$flags:{OneArg:!0},$textsig:"($self, iterable_of_bytes, /)",$doc:"Concatenate any number of bytes objects.\n\nThe bytes whose method is called is inserted in between each pair.\n\nThe result is returned as a new bytes object.\n\nExample: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'."},ljust:{$meth:h("ljust",!1,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.ljust(width[, fillchar]) -> copy of B\n\nReturn B left justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)."},lower:{$meth:S((e=>_(e)?e+32:e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.lower() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to lowercase."},lstrip:{$meth:p(!0,!1),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip leading bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading ASCII whitespace."},partition:{$meth:c(!1),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original bytes\nobject and two empty bytes objects."},replace:{$meth(e,t,n){e=this.get$raw(e),t=this.get$raw(t),n=0>(n=void 0===n?-1:Sk.misceval.asIndexSized(n,Sk.builtin.OverflowError))?1/0:n;const i=[];let r=0;for(var s=0;s<this.v.length&&r<n;){const n=this.find$subleft(e,s,this.v.length);if(-1===n)break;for(;s<n;s++)i.push(this.v[s]);i.push(...t),s=n+e.length,r++}for(;s<this.v.length;s++)i.push(this.v[s]);return new Sk.builtin.bytes(new Uint8Array(i))},$flags:{MinArgs:2,MaxArgs:3},$textsig:"($self, old, new, count=-1, /)",$doc:"Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced."},rfind:{$meth(e,t,n){return new Sk.builtin.int_(this.find$right(e,t,n))},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure."},rindex:{$meth:function(e,t,n){if(-1===(e=this.find$right(e,t,n)))throw new Sk.builtin.ValueError("subsection not found");return new Sk.builtin.int_(e)},$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaise ValueError when the subsection is not found."},rjust:{$meth:h("rjust",!0,!1),$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"B.rjust(width[, fillchar]) -> copy of B\n\nReturn B right justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)"},rpartition:{$meth:c(!0),$flags:{OneArg:!0},$textsig:"($self, sep, /)",$doc:"Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty bytes\nobjects and the original bytes object."},rsplit:{$meth:function(e,t){({sep:e,maxsplit:t}=this.get$splitArgs(e,t));const n=[];let i=0,r=this.v.length;if(null!==e){for(;0<=r&&i<t;){const t=this.find$subright(e,0,r);if(-1===t)break;n.push(new Sk.builtin.bytes(this.v.subarray(t+e.length,r))),r=t,i++}n.push(new Sk.builtin.bytes(this.v.subarray(0,r)))}else{for(r--;i<t;){for(;d(this.v[r]);)r--;if(0>r)break;for(e=r+1,r--;0<=r&&!d(this.v[r]);)r--;n.push(new Sk.builtin.bytes(this.v.subarray(r+1,e))),i++}if(0<=r){for(;d(this.v[r]);)r--;0<=r&&n.push(new Sk.builtin.bytes(this.v.subarray(0,r+1)))}}return new Sk.builtin.list(n.reverse())},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the sections in the bytes, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytes.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplitting is done starting at the end of the bytes and working to the front."},rstrip:{$meth:p(!1,!0),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip trailing ASCII whitespace."},split:{$meth:function(e,t){({sep:e,maxsplit:t}=this.get$splitArgs(e,t));const n=[],i=this.v.length;let r=0,s=0;if(null!==e){for(;s<i&&r<t;){const t=this.find$subleft(e,s,i);if(-1===t)break;n.push(new Sk.builtin.bytes(this.v.subarray(s,t))),s=t+e.length,r++}n.push(new Sk.builtin.bytes(this.v.subarray(s,i)))}else{for(;r<t;){for(;d(this.v[s]);)s++;if(s===i)break;for(e=s,s++;s<i&&!d(this.v[s]);)s++;n.push(new Sk.builtin.bytes(this.v.subarray(e,s))),r++}if(s<i){for(;d(this.v[s]);)s++;s<i&&n.push(new Sk.builtin.bytes(this.v.subarray(s,i)))}}return new Sk.builtin.list(n)},$flags:{NamedArgs:["sep","maxsplit"],Defaults:[Sk.builtin.none.none$,-1]},$textsig:"($self, /, sep=None, maxsplit=-1)",$doc:"Return a list of the sections in the bytes, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytes.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit."},splitlines:{$meth(e){e=Sk.misceval.isTrue(e);const t=[];let n=0,i=0;const r=this.v.length;for(;i<r;){var s=this.v[i];if(13===s){const r=10===this.v[i+1];s=e?r?i+2:i+1:i,t.push(new Sk.builtin.bytes(this.v.subarray(n,s))),i=n=r?i+2:i+1}else 10===s?(s=e?i+1:i,t.push(new Sk.builtin.bytes(this.v.subarray(n,s))),i=n=i+1):i++}return n<r&&t.push(new Sk.builtin.bytes(this.v.subarray(n,r))),new Sk.builtin.list(t)},$flags:{NamedArgs:["keepends"],Defaults:[!1]},$textsig:"($self, /, keepends=False)",$doc:"Return a list of the lines in the bytes, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue."},startswith:{$meth:l("startswith",((e,t)=>t.length<=e.length&&t.every(((t,n)=>t===e[n])))),$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"B.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if B starts with the specified prefix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nprefix can also be a tuple of bytes to try."},strip:{$meth:p(!0,!0),$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, bytes=None, /)",$doc:"Strip leading and trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading and trailing ASCII whitespace."},swapcase:{$meth:S((e=>_(e)?e+32:f(e)?e-32:e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.swapcase() -> copy of B\n\nReturn a copy of B with uppercase ASCII characters converted\nto lowercase ASCII and vice versa."},title:{$meth(){const e=this.v.length,t=new Uint8Array(e);let n=!1;for(let i=0;i<e;i++){const e=this.v[i];_(e)?(t[i]=n?e+32:e,n=!0):f(e)?(t[i]=n?e:e-32,n=!0):(t[i]=e,n=!1)}return new Sk.builtin.bytes(t)},$flags:{NoArgs:!0},$textsig:null,$doc:"B.title() -> copy of B\n\nReturn a titlecased version of B, i.e. ASCII words start with uppercase\ncharacters, all remaining cased characters have lowercase."},upper:{$meth:S((e=>f(e)?e-32:e)),$flags:{NoArgs:!0},$textsig:null,$doc:"B.upper() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to uppercase."},zfill:{$meth(e){const t=(e=Sk.misceval.asIndexSized(e,Sk.builtin.IndexError))-this.v.length;if(0>=t)return new Sk.builtin.bytes(this.v);const n=new Uint8Array(e);let i,r=0;for(43!==this.v[0]&&45!==this.v[0]||(n[0]=this.v[0],r++),n.fill(48,r,r+t),i=r,r+=t;r<e;r++,i++)n[r]=this.v[i];return new Sk.builtin.bytes(n)},$flags:{OneArg:!0},$textsig:null,$doc:"B.zfill(width) -> copy of B\n\nPad a numeric string B with zeros on the left, to fill a field\nof the specified width. B is never truncated."}},classmethods:{fromhex:{$meth:function(e){function t(t){for(let n=o;n<t;n+=2){let t=e.substr(n,2);if(!i.test(t))throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position "+(n+1));r.push(parseInt(t,16))}}if(!Sk.builtin.checkString(e))throw new Sk.builtin.TypeError("fromhex() argument must be str, not "+Sk.abstr.typeName(e));e=e.$jsstr();const n=/\s+/g,i=/^[abcdefABCDEF0123456789]{2}$/,r=[];let s,o=0;for(;null!==(s=n.exec(e));)t(s.index),o=n.lastIndex;return t(e.length),new this(r)},$flags:{OneArg:!0},$textsig:"($type, string, /)",$doc:"Create a bytes object from a string of hexadecimal numbers.\n\nSpaces between two numbers are accepted.\nExample: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'."}}});var I=Sk.abstr.buildIteratorClass("bytes_iterator",{constructor:function(e){this.$index=0,this.$seq=e.v},iternext(){const e=this.$seq[this.$index++];if(void 0!==e)return new Sk.builtin.int_(e)},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}});Sk.exportSymbol("Sk.builtin.bytes",Sk.builtin.bytes)},function(e,t,n){(function(e){!function(e){function t(){}function n(){}var i=String.fromCharCode,r={}.toString,s=r.call(e.SharedArrayBuffer),o=r(),a=e.Uint8Array,l=a||Array,u=a?ArrayBuffer:l,c=u.isView||function(e){return e&&"length"in e},p=r.call(u.prototype);u=n.prototype;var h=e.TextEncoder,d=new(a?Uint16Array:l)(32);t.prototype.decode=function(e){if(!c(e)){var t=r.call(e);if(t!==p&&t!==s&&t!==o)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");e=a?new l(e):e||[]}for(var n,u,h,f=t="",_=0,m=0|e.length,b=m-32|0,g=0,S=0,k=0,y=-1;_<m;){for(n=_<=b?32:m-_|0;k<n;_=_+1|0,k=k+1|0){switch((u=255&e[_])>>4){case 15:if(2!=(h=255&e[_=_+1|0])>>6||247<u){_=_-1|0;break}g=(7&u)<<6|63&h,S=5,u=256;case 14:g<<=6,g|=(15&u)<<6|63&(h=255&e[_=_+1|0]),S=2==h>>6?S+4|0:24,u=u+256&768;case 13:case 12:g<<=6,g|=(31&u)<<6|63&(h=255&e[_=_+1|0]),S=S+7|0,_<m&&2==h>>6&&g>>S&&1114112>g?(u=g,0<=(g=g-65536|0)&&(y=55296+(g>>10)|0,u=56320+(1023&g)|0,31>k?(d[k]=y,k=k+1|0,y=-1):(h=y,y=u,u=h))):(_=_-(u>>=8)-1|0,u=65533),g=S=0,n=_<=b?32:m-_|0;default:d[k]=u;continue;case 11:case 10:case 9:case 8:}d[k]=65533}if(f+=i(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15],d[16],d[17],d[18],d[19],d[20],d[21],d[22],d[23],d[24],d[25],d[26],d[27],d[28],d[29],d[30],d[31]),32>k&&(f=f.slice(0,k-32|0)),_<m){if(d[0]=y,k=~y>>>31,y=-1,f.length<t.length)continue}else-1!==y&&(f+=i(y));t+=f,f=""}return t},u.encode=function(e){var t,n=0|(e=void 0===e?"":""+e).length,i=new l(8+(n<<1)|0),r=0,s=!a;for(t=0;t<n;t=t+1|0,r=r+1|0){var o=0|e.charCodeAt(t);if(127>=o)i[r]=o;else{if(2047>=o)i[r]=192|o>>6;else{e:{if(55296<=o)if(56319>=o){var u=0|e.charCodeAt(t=t+1|0);if(56320<=u&&57343>=u){if(65535<(o=(o<<10)+u-56613888|0)){i[r]=240|o>>18,i[r=r+1|0]=128|o>>12&63,i[r=r+1|0]=128|o>>6&63,i[r=r+1|0]=128|63&o;continue}break e}o=65533}else 57343>=o&&(o=65533);!s&&t<<1<r&&t<<1<(r-7|0)&&(s=!0,(u=new l(3*n)).set(i),i=u)}i[r]=224|o>>12,i[r=r+1|0]=128|o>>6&63}i[r=r+1|0]=128|63&o}}return a?i.subarray(0,r):i.slice(0,r)},h||(e.TextDecoder=t,e.TextEncoder=n)}(void 0===e?"undefined"==typeof self?this:self:e)}).call(this,n(0))},function(e,t){Sk.builtin.tuple=Sk.abstr.buildNativeClass("tuple",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.tuple,"bad call to tuple, use 'new' with an Array of python objects"),this.v=e,this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object.",$r(){if(this.in$repr)return new Sk.builtin.str("(...)");this.in$repr=!0;let e=this.v.map((e=>Sk.misceval.objectRepr(e)));return this.in$repr=!1,e=e.join(", "),1===this.v.length&&(e+=","),new Sk.builtin.str("("+e+")")},tp$new(e,t){return this!==Sk.builtin.tuple.prototype?this.$subtype_new(e,t):(Sk.abstr.checkNoKwargs("tuple",t),Sk.abstr.checkArgsLen("tuple",e,0,1),void 0===(e=e[0])?new Sk.builtin.tuple([]):e.constructor===Sk.builtin.tuple?e:Sk.misceval.chain(Sk.misceval.arrayFromIterable(e,!0),(e=>new Sk.builtin.tuple(e))))},tp$hash(){let e,t=3430008,n=1000003;const i=this.v.length;for(let r=0;r<i;++r){if(e=Sk.abstr.objectHash(this.v[r]),-1===e)return-1;t=(t^e)*n,n+=82520+i+i}return t+=97531,-1===t&&(t=-2),0|t},tp$richcompare:Sk.generic.seqCompare,tp$iter(){return new n(this)},mp$subscript(e){if(Sk.misceval.isIndex(e)){if(0>(e=Sk.misceval.asIndexSized(e))&&(e=this.v.length+e),0>e||e>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[e]}if(e instanceof Sk.builtin.slice){const t=[];return e.sssiter$(this.v.length,(e=>{t.push(this.v[e])})),new Sk.builtin.tuple(t)}throw new Sk.builtin.TypeError("tuple indices must be integers or slices, not "+Sk.abstr.typeName(e))},sq$length(){return this.v.length},sq$repeat(e){if(1===(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError))&&this.constructor===Sk.builtin.tuple)return this;const t=[];for(let n=0;n<e;n++)for(let e=0;e<this.v.length;e++)t.push(this.v[e]);return new Sk.builtin.tuple(t)},sq$concat(e){if(!(e instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("can only concatenate tuple (not '"+Sk.abstr.typeName(e)+"') to tuple");return new Sk.builtin.tuple(this.v.concat(e.v))},sq$contains(e){for(let t=this.tp$iter(),n=t.tp$iternext();void 0!==n;n=t.tp$iternext())if(n===e||Sk.misceval.richCompareBool(n,e,"Eq"))return!0;return!1}},proto:{$subtype_new(e,t){return t=new this.constructor,e=Sk.builtin.tuple.prototype.tp$new(e),t.v=e.v,t},sk$asarray(){return this.v.slice(0)}},methods:{__getnewargs__:{$meth(){return new Sk.builtin.tuple(this.v.slice(0))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:null},index:{$meth(e,t,n){if(void 0!==t&&!Sk.misceval.isIndex(t)||void 0!==n&&!Sk.misceval.isIndex(n))throw new Sk.builtin.TypeError("slice indices must be integers or have an __index__ method");({start:t,end:n}=Sk.builtin.slice.startEnd$wrt(this,t,n));const i=this.v;for(;t<n;t++)if(i[t]===e||Sk.misceval.richCompareBool(i[t],e,"Eq"))return new Sk.builtin.int_(t);throw new Sk.builtin.ValueError("tuple.index(x): x not in tuple")},$flags:{MinArgs:1,MaxArgs:3},$textsig:"($self, value, start=0, stop=sys.maxsize, /)",$doc:"Return first index of value.\n\nRaises ValueError if the value is not present."},count:{$meth(e){const t=this.v.length,n=this.v;let i=0;for(let r=0;r<t;++r)(n[r]===e||Sk.misceval.richCompareBool(n[r],e,"Eq"))&&(i+=1);return new Sk.builtin.int_(i)},$flags:{OneArg:!0},$textsig:"($self, value, /)",$doc:"Return number of occurrences of value."}}}),Sk.exportSymbol("Sk.builtin.tuple",Sk.builtin.tuple);var n=Sk.abstr.buildIteratorClass("tuple_iterator",{constructor:function(e){this.$index=0,this.$seq=e.sk$asarray()},iternext:Sk.generic.iterNextWithArray,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}})},function(e,t){function n(e){let t=e.$savedKeyHash;return void 0!==t?t:t=Sk.abstr.objectHash(e)}function i(e){return new Sk.builtin.set(Sk.misceval.arrayFromIterable(e))}function r(e,t){for(let n=Sk.abstr.iter(e),i=n.tp$iternext();void 0!==i;i=n.tp$iternext())if(!Sk.abstr.sequenceContains(t,i))return!1;return!0}function s(e,t,n){const r={constructor:function(e){if(1!==arguments.length)throw new Sk.builtin.TypeError("cannot create '"+Sk.abstr.typeName(this)+"' instances");this.dict=e,this.in$repr=!1}};return r.slots=Object.assign(t,l),r.methods={isdisjoint:{$meth(e){const t=i(this);return t.isdisjoint.$meth.call(t,e)},$flags:{OneArg:!0},$textsig:null,$doc:"Return True if the view and the given iterable have a null intersection."},__reversed__:{$meth:n,$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator over the dict keys."}},r.flags={sk$acceptable_as_base:!1},"dict_values"===e&&(delete r.slots.tp$as_number,delete r.slots.tp$richcompare),Sk.abstr.buildNativeClass(e,r)}function o(e,t,n){return Sk.abstr.buildIteratorClass(e,{constructor:function(e){this.$index=0,this.$orig=e,this.tp$iternext=()=>(this.$seq=e.$items(),this.$version=e.$version,n&&(this.$seq=this.$seq.reverse()),this.tp$iternext=this.constructor.prototype.tp$iternext,this.tp$iternext())},iternext:t,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1},proto:{next$item:a}})}function a(){if(this.$version!==this.$orig.$version){if(this.$len!==this.$orig.get$size())throw new Sk.builtin.RuntimeError("dict changed size during iteration");throw new Sk.builtin.RuntimeError("dictionary keys changed during iteration")}return this.$seq[this.$index++]}Sk.builtin.dict=Sk.abstr.buildNativeClass("dict",{constructor:function(e){void 0===e&&(e=[]),Sk.asserts.assert(Array.isArray(e)&&0==e.length%2&&this instanceof Sk.builtin.dict,"bad call to dict constructor"),this.size=0,this.entries=Object.create(null),this.buckets={};for(let t=0;t<e.length;t+=2)this.set$item(e[t],e[t+1]);this.in$repr=!1,this.$version=0},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$as_number:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)",$r(){if(this.in$repr)return new Sk.builtin.str("{...}");this.in$repr=!0;const e=this.$items().map((([e,t])=>Sk.misceval.objectRepr(e)+": "+Sk.misceval.objectRepr(t)));return this.in$repr=!1,new Sk.builtin.str("{"+e.join(", ")+"}")},tp$new:Sk.generic.new,tp$init(e,t){return this.update$common(e,t,"dict")},tp$iter(){return new h(this)},tp$richcompare(e,t){let n;if(!(e instanceof Sk.builtin.dict)||"Eq"!==t&&"NotEq"!==t)return Sk.builtin.NotImplemented.NotImplemented$;if(e===this)n=!0;else if(this.size!==e.size)n=!1;else{let t;n=this.$items().every((([n,i])=>(t=e.mp$lookup(n),void 0!==t&&(t===i||Sk.misceval.richCompareBool(i,t,"Eq")))))}return"Eq"===t?n:!n},nb$or(e){if(!(e instanceof Sk.builtin.dict))return Sk.builtin.NotImplemented.NotImplemented$;const t=this.dict$copy();return t.dict$merge(e),t},nb$reflected_or(e){return e instanceof Sk.builtin.dict?((e=e.dict$copy()).dict$merge(this),e):Sk.builtin.NotImplemented.NotImplemented$},nb$inplace_or(e){return Sk.misceval.chain(this.update$onearg(e),(()=>this))},sq$length(){return this.get$size()},sq$contains(e){return void 0!==this.mp$lookup(e)},mp$subscript(e,t){var n=this.mp$lookup(e);if(void 0!==n)return n;if(void 0!==(n=Sk.abstr.lookupSpecial(this,Sk.builtin.str.$missing)))return e=Sk.misceval.callsimOrSuspendArray(n,[e]),t?e:Sk.misceval.retryOptionalSuspensionOrThrow(e);throw new Sk.builtin.KeyError(e)},mp$ass_subscript(e,t){if(void 0===t){if(void 0===this.pop$item(e))throw new Sk.builtin.KeyError(e)}else this.set$item(e,t)}},methods:{__reversed__:{$meth(){return new _(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator over the dict keys."},get:{$meth(e,t){return this.mp$lookup(e)||t||Sk.builtin.none.none$},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, key, default=None, /)",$doc:"Return the value for key if key is in the dictionary, else default."},setdefault:{$meth(e,t){let i;const r=n(e);return i="string"==typeof r?this.entries[r]:this.get$bucket_item(e,r),void 0!==i?i[1]:(t=t||Sk.builtin.none.none$,"string"==typeof r?this.entries[r]=[e,t]:this.set$bucket_item(e,t,r),this.size++,this.$version++,t)},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($self, key, default=None, /)",$doc:"Insert key with a value of default if key is not in the dictionary.\n\nReturn the value for key if key is in the dictionary, else default."},pop:{$meth(e,t){const n=this.pop$item(e);if(void 0!==n)return n[1];if(void 0!==t)return t;throw new Sk.builtin.KeyError(e)},$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\nIf key is not found, d is returned if given, otherwise KeyError is raised"},popitem:{$meth(){const e=this.get$size();if(0===e)throw new Sk.builtin.KeyError("popitem(): dictionary is empty");const[t,n]=this.$items()[e-1];return this.pop$item(t),new Sk.builtin.tuple([t,n])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.popitem() -> (k, v), remove and return some (key, value) pair as a\n2-tuple; but raise KeyError if D is empty."},keys:{$meth(){return new u(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$meth(){return new p(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$meth(){return new c(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> an object providing a view on D's values"},update:{$meth(e,t){return Sk.misceval.chain(this.update$common(e,t,"update"),(()=>Sk.builtin.none.none$))},$flags:{FastCall:!0},$textsig:null,$doc:"D.update([E, ]**F) -> None. Update D from dict/iterable E and F.\nIf E is present and has a .keys() method, then does: for k in E: D[k] = E[k]\nIf E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v\nIn either case, this is followed by: for k in F: D[k] = F[k]"},clear:{$meth(){this.size=0,this.$version++,this.entries=Object.create(null),this.buckets={}},$flags:{NoArgs:!0},$textsig:null,$doc:"D.clear() -> None. Remove all items from D."},copy:{$meth(){return this.dict$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"D.copy() -> a shallow copy of D"}},classmethods:{fromkeys:{$meth:function(e,t){t=t||Sk.builtin.none.none$;let n=this===Sk.builtin.dict?new this:this.tp$call([],[]);return Sk.misceval.chain(n,(i=>(n=i,Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>n.mp$ass_subscript(e,t,!0))))),(()=>n))},$flags:{MinArgs:1,MaxArgs:2},$textsig:"($type, iterable, value=None, /)",$doc:"Create a new dictionary with keys from iterable and values set to value."}},proto:{quick$lookup:function(e){if(void 0!==(e=this.entries[e.$savedKeyHash]))return e[1]},mp$lookup:function(e){const t=n(e);if(void 0!==(e="string"==typeof t?this.entries[t]:this.get$bucket_item(e,t)))return e[1]},get$size(){return this.size},sk$asarray(){return Object.values(this.entries).map((e=>e[0]))},update$common:function(e,t,n){let i;return Sk.abstr.checkArgsLen(n,e,0,1),void 0!==(e=e[0])&&(i=this.update$onearg(e)),Sk.misceval.chain(i,(()=>{if(t)for(let e=0;e<t.length;e+=2)this.set$item(new Sk.builtin.str(t[e]),t[e+1])}))},update$onearg(e){return e instanceof Sk.builtin.dict||void 0!==Sk.abstr.lookupSpecial(e,Sk.builtin.str.$keys)?this.dict$merge(e):this.dict$merge_seq(e)},dict$copy(){const e=new Sk.builtin.dict([]);e.size=this.size;var t=Object.entries(this.entries);for(var n in t){var i=t[n][1];e.entries[t[n][0]]=[i[0],i[1]]}for(let r in this.buckets)for(n=this.buckets[r],e.buckets[r]=t=[],i=0;i<n.length;i++)t.push(e.entries["#"+r+"_"+i]);return e},$items(){return Object.values(this.entries)},set$item:function(e,t){const i=n(e);let r;"string"==typeof i?(r=this.entries[i],void 0===r?(this.entries[i]=[e,t],this.size++,this.$version++):r[1]=t):(r=this.get$bucket_item(e,i),void 0===r?(this.set$bucket_item(e,t,i),this.size++,this.$version++):r[1]=t)},get$bucket_item:function(e,t){if(void 0!==(t=this.buckets[t]))for(let i=0;i<t.length;i++){var n=t[i];if(void 0!==n&&(n[0]===e||Sk.misceval.richCompareBool(e,n[0],"Eq")))return n}},pop$bucket_item:function(e,t){const n=this.buckets[t];let i;if(void 0!==n)for(let r=0;r<n.length;r++)if(i=n[r],void 0!==i&&(i[0]===e||Sk.misceval.richCompareBool(e,i[0],"Eq")))return delete this.entries["#"+t+"_"+r],n[r]=void 0,n.every((e=>void 0===e))&&delete this.buckets[t],i},set$bucket_item:function(e,t,n){let i=this.buckets[n];e=[e,t],void 0===i?(this.buckets[n]=[e],n="#"+n+"_0"):-1!==(t=i.indexOf(void 0))?(n="#"+n+"_"+t,i[t]=e):(n="#"+n+"_"+i.length,i.push(e)),this.entries[n]=e},pop$item:function(e){const t=n(e);if("string"==typeof t?(e=this.entries[t],delete this.entries[t]):e=this.pop$bucket_item(e,t),void 0!==e)return this.size--,this.$version++,e},dict$merge:function(e){if(e.tp$iter!==Sk.builtin.dict.prototype.tp$iter)return t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$keys),Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(t,[]),(t=>Sk.misceval.iterFor(Sk.abstr.iter(t),(t=>Sk.misceval.chain(e.mp$subscript(t,!0),(e=>{this.set$item(t,e)}))))));var t=e.tp$iter();for(let n=t.tp$iternext();void 0!==n;n=t.tp$iternext()){const t=e.mp$subscript(n);this.set$item(n,t)}},dict$merge_seq:function(e){let t=0;return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(!Sk.builtin.checkIterable(e))throw new Sk.builtin.TypeError("cannot convert dictionary update sequence element #"+t+" to a sequence");if(2!==(e=Sk.misceval.arrayFromIterable(e)).length)throw new Sk.builtin.ValueError("dictionary update sequence element #"+t+" has length "+e.length+"; 2 is required");this.set$item(e[0],e[1]),t++}))}}});const l={tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,$r(){if(this.in$repr)return new Sk.builtin.str("...");this.in$repr=!0;let e=Sk.misceval.arrayFromIterable(this);return e=e.map((e=>Sk.misceval.objectRepr(e))),this.in$repr=!1,new Sk.builtin.str(Sk.abstr.typeName(this)+"(["+e.join(", ")+"])")},tp$richcompare(e,t){if(!(Sk.builtin.checkAnySet(e)||e instanceof u||e instanceof p))return Sk.builtin.NotImplemented.NotImplemented$;const n=this.sq$length(),i=e.sq$length();switch(t){case"NotEq":case"Eq":let s;return this===e?s=!0:n===i&&(s=r(this,e)),"NotEq"===t?!s:s;case"Lt":return n<i&&r(this,e);case"LtE":return n<=i&&r(this,e);case"Gt":return n>i&&r(e,this);case"GtE":return n>=i&&r(e,this)}},nb$subtract(e){const t=i(this);return t.difference.$meth.call(t,e)},nb$and(e){const t=i(this);return t.intersection.$meth.call(t,e)},nb$or(e){const t=i(this);return t.union.$meth.call(t,e)},nb$xor(e){const t=i(this);return t.symmetric_difference.$meth.call(t,e)},sq$length(){return this.dict.get$size()}};var u=s("dict_keys",{sq$contains(e){return void 0!==this.dict.mp$lookup(e)},tp$iter(){return new h(this.dict)}},(function(){return new _(this.dict)})),c=s("dict_values",{tp$iter(){return new f(this.dict)}},(function(){return new b(this.dict)})),p=s("dict_items",{sq$contains(e){if(!(e instanceof Sk.builtin.tuple&&2===e.sq$length()))return!1;var t=e.mp$subscript(new Sk.builtin.int_(0));return e=e.mp$subscript(new Sk.builtin.int_(1)),void 0!==(t=this.dict.mp$lookup(t))&&(t===e||Sk.misceval.richCompareBool(t,e,"Eq"))},tp$iter(){return new d(this.dict)}},(function(){return new m(this.dict)})),h=o("dict_keyiterator",(function(){const e=this.next$item();return e&&e[0]})),d=o("dict_itemiterator",(function(){const e=this.next$item();return e&&new Sk.builtin.tuple([e[0],e[1]])})),f=o("dict_valueiterator",(function(){const e=this.next$item();return e&&e[1]})),_=o("dict_reversekeyiterator",h.prototype.tp$iternext,!0),m=o("dict_reverseitemiterator",d.prototype.tp$iternext,!0),b=o("dict_reversevalueiterator",f.prototype.tp$iternext,!0);Sk.builtin.dict.py2$methods={has_key:{$name:"has_key",$flags:{OneArg:!0},$meth(e){return new Sk.builtin.bool(this.sq$contains(e))},$doc:"D.has_key(k) -> True if D has a key k, else False"},keys:{$name:"keys",$meth(){return new Sk.builtin.list(this.sk$asarray())},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$name:"items",$meth(){return new Sk.builtin.list(this.$items().map((([e,t])=>new Sk.builtin.tuple([e,t]))))},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$name:"values",$meth(){return new Sk.builtin.list(this.$items().map((([,e])=>e)))},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> an object providing a view on D's values"}}},function(e,t){Sk.builtin.mappingproxy=Sk.abstr.buildNativeClass("mappingproxy",{constructor:function(e){Sk.asserts.assert(this instanceof Sk.builtin.mappingproxy,"bad call to mapping proxy, use 'new'"),this.mapping=new Sk.builtin.dict([]),void 0!==e&&function(e,t){Object.defineProperties(e,{entries:{get:()=>{const e=Object.create(null);return Object.entries(t).forEach((([t,n])=>{(t=Sk.unfixReserved(t)).includes("$")||(t=new Sk.builtin.str(t),e[t.$savedKeyHash]=[t,n])})),e},configurable:!0},size:{get:()=>Object.keys(t).map((e=>Sk.unfixReserved(e))).filter((e=>!e.includes("$"))).length,configurable:!0}})}(this.mapping,e)},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$new(e,t){if(Sk.abstr.checkNoKwargs("mappingproxy",t),Sk.abstr.checkOneArg("mappingproxy",e,t),e=e[0],!Sk.builtin.checkMapping(e))throw new Sk.builtin.TypeError("mappingproxy() argument must be a mapping, not "+Sk.abstr.typeName(e));return(t=new Sk.builtin.mappingproxy).mapping=e,t},tp$richcompare(e,t){return Sk.misceval.richCompareBool(this.mapping,e,t)},tp$str(){return this.mapping.tp$str()},$r(){return new Sk.builtin.str("mappingproxy("+Sk.misceval.objectRepr(this.mapping)+")")},mp$subscript(e,t){return this.mapping.mp$subscript(e,t)},sq$contains(e){return this.mapping.sq$contains(e)},sq$length(){return this.mapping.sq$length()},tp$iter(){return this.mapping.tp$iter()},tp$as_number:!0,nb$or(e){return e instanceof Sk.builtin.mappingproxy&&(e=e.mapping),Sk.abstr.numberBinOp(this.mapping,e,"BitOr")},nb$reflected_or(e){return e instanceof Sk.builtin.mappingproxy&&(e=e.mapping),Sk.abstr.numberBinOp(e,this.mapping,"BitOr")},nb$inplace_or(e){throw new Sk.builtin.TypeError("'|=' is not supported by "+Sk.abstr.typeName(this)+"; use '|' instead")}},methods:{get:{$meth(e,t){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$get),e,t)},$flags:{FastCall:!0},$textsig:null,$doc:"D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."},keys:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$keys),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.keys() -> a set-like object providing a view on D's keys"},items:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$items),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.items() -> a set-like object providing a view on D's items"},values:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$values),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.values() -> a set-like object providing a view on D's values"},copy:{$meth(){return Sk.misceval.callsimArray(this.mapping.tp$getattr(this.str$copy),[])},$flags:{NoArgs:!0},$textsig:null,$doc:"D.copy() -> a shallow copy of D"}},proto:{str$get:new Sk.builtin.str("get"),str$copy:new Sk.builtin.str("copy"),str$keys:new Sk.builtin.str("keys"),str$items:new Sk.builtin.str("items"),str$values:new Sk.builtin.str("values"),mp$lookup(e){return this.mapping.mp$lookup(e)}},flags:{sk$acceptable_as_base_class:!1}})},function(e,t){Sk.builtin.property=Sk.abstr.buildNativeClass("property",{constructor:function(e,t,n,i){this.prop$get=e||Sk.builtin.none.none$,this.prop$set=t||Sk.builtin.none.none$,this.prop$del=n||Sk.builtin.none.none$,this.prop$doc=i||e&&e.$doc||Sk.builtin.none.none$},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(e,t){e=Sk.abstr.copyKeywordsToNamedArgs("property",["fget","fset","fdel","doc"],e,t,Array(4).fill(Sk.builtin.none.none$)),this.prop$get=e[0],this.prop$set=e[1],this.prop$del=e[2],Sk.builtin.checkNone(e[3])?Sk.builtin.checkNone(e[0])||(this.prop$doc=e[0].$doc||e[3]):this.prop$doc=e[3]},tp$doc:"Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, 'I'm the 'x' property.')\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n 'I am the 'x' property.'\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x",tp$descr_get(e,t){if(null===e)return this;if(void 0===this.prop$get)throw new Sk.builtin.AttributeError("unreadable attribute");return Sk.misceval.callsimOrSuspendArray(this.prop$get,[e])},tp$descr_set(e,t){let n;if(n=null==t?this.prop$del:this.prop$set,Sk.builtin.checkNone(n))throw new Sk.builtin.AttributeError("can't "+(null==t?"delete":"set")+" attribute");if(!n.tp$call)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(n)+"' is not callable");return null==t?n.tp$call([e]):n.tp$call([e,t])}},methods:{getter:{$meth(e){return new Sk.builtin.property(e,this.prop$set,this.prop$del,this.prop$doc)},$flags:{OneArg:!0}},setter:{$meth(e){return new Sk.builtin.property(this.prop$get,e,this.prop$del,this.prop$doc)},$flags:{OneArg:!0}},deleter:{$meth(e){return new Sk.builtin.property(this.prop$get,this.prop$set,e,this.prop$doc)},$flags:{OneArg:!0}}},getsets:{fget:{$get(){return this.prop$get}},fset:{$get(){return this.prop$set}},fdel:{$get(){return this.prop$del}},__doc__:{$get(){return this.prop$doc},$set(e){this.prop$doc=e=e||Sk.builtin.none.none$}}}}),Sk.builtin.classmethod=Sk.abstr.buildNativeClass("classmethod",{constructor:function(e){this.cm$callable=e,this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(e,t){Sk.abstr.checkNoKwargs("classmethod",t),Sk.abstr.checkArgsLen("classmethod",e,1,1),this.cm$callable=e[0]},tp$doc:"classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin.",tp$descr_get(e,t){const n=this.cm$callable;if(void 0===n)throw new Sk.builtin.RuntimeError("uninitialized classmethod object");return void 0===t&&(t=e.ob$type),(e=n.tp$descr_get)?e.call(n,t):new Sk.builtin.method(n,t)}},getsets:{__func__:{$get(){return this.cm$callable}},__dict__:Sk.generic.getSetDict}}),Sk.builtin.staticmethod=Sk.abstr.buildNativeClass("staticmethod",{constructor:function(e){this.sm$callable=e,this.$d=new Sk.builtin.dict},slots:{tp$getattr:Sk.generic.getAttr,tp$new:Sk.generic.new,tp$init(e,t){Sk.abstr.checkNoKwargs("staticmethod",t),Sk.abstr.checkArgsLen("staticmethod",e,1,1),this.sm$callable=e[0]},tp$doc:"staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin.",tp$descr_get(e,t){if(void 0===this.sm$callable)throw new Sk.builtin.RuntimeError("uninitialized staticmethod object");return this.sm$callable}},getsets:{__func__:{$get(){return this.sm$callable}},__dict__:Sk.generic.getSetDict}})},function(e,t){function n(e,t){return function(n){if(n instanceof Sk.builtin.int_){let i=this.v;if(n=n.v,"number"==typeof i&&"number"==typeof n){const t=e(i,n);if(u(t))return new Sk.builtin.int_(t)}return i=p(i),n=p(n),new Sk.builtin.int_(t(i,n))}return Sk.builtin.NotImplemented.NotImplemented$}}function i(e,t){return function(n){if(n instanceof Sk.builtin.int_){let i=this.v;return n=n.v,"number"==typeof i&&"number"==typeof n?e(i,n):(i=p(i),n=p(n),t(i,n))}return Sk.builtin.NotImplemented.NotImplemented$}}function r(e,t){return function(){const n=this.v;return"number"==typeof n?new Sk.builtin.int_(e(n)):new Sk.builtin.int_(t(n))}}function s(){return new Sk.builtin.int_(this.v)}function o(e,t){return function(n){if(n instanceof Sk.builtin.int_){let i=this.v;if(0===(n=n.v))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return"number"==typeof i&&"number"==typeof n?new Sk.builtin.int_(e(i,n)):(i=p(i),n=p(n),new Sk.builtin.int_(JSBI.numberIfSafe(t(i,n))))}return Sk.builtin.NotImplemented.NotImplemented$}}function a(e,t){return function(n){if(n instanceof Sk.builtin.int_){let i=this.v;if(n=n.v,0===i)return new Sk.builtin.int_(this.v);if("number"==typeof n){if(0>n)throw new Sk.builtin.ValueError("negative shift count");if("number"==typeof i){const t=e(i,n);if(void 0!==t)return new Sk.builtin.int_(t)}n=JSBI.BigInt(n)}else if(JSBI.lessThan(JSBI.BigInt(0)))throw new Sk.builtin.ValueError("negative shift count");return i=p(i),new Sk.builtin.int_(t(i,n))}return Sk.builtin.NotImplemented.NotImplemented$}}function l(e,t){return function(n){if(n instanceof Sk.builtin.int_){var i=this.v;return n=n.v,"number"==typeof i&&"number"==typeof n?(0>(i=e(i,n))&&(i+=4294967296),new Sk.builtin.int_(i)):(i=p(i),n=p(n),new Sk.builtin.int_(JSBI.numberIfSafe(t(i,n))))}return Sk.builtin.NotImplemented.NotImplemented$}}function u(e){return e<=Number.MAX_SAFE_INTEGER&&e>=-Number.MAX_SAFE_INTEGER}function c(e){return e<=Number.MAX_SAFE_INTEGER&&e>=-Number.MAX_SAFE_INTEGER?+e:JSBI.BigInt(e)}function p(e){return"number"==typeof e?JSBI.BigInt(e):e}Sk.builtin.int_=Sk.abstr.buildNativeClass("int",{constructor:function(e){let t;if(Sk.asserts.assert(this instanceof Sk.builtin.int_,"bad call to int use 'new'"),"number"==typeof e||JSBI.__isBigInt(e))t=e;else if(void 0===e)t=0;else if("string"==typeof e)t=c(e);else{if(e.nb$int)return e.nb$int();Sk.asserts.fail("bad argument to int constructor")}this.v=t},slots:{tp$as_number:!0,tp$doc:"int(x=0) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4",$r(){return new Sk.builtin.str(this.v.toString())},tp$hash(){const e=this.v;return"number"==typeof e?e:JSBI.toNumber(JSBI.remainder(e,JSBI.__MAX_SAFE))},tp$new(e,t){if(1===e.length+(t?t.length:0)?(t=e[0],e=Sk.builtin.none.none$):(t=(e=Sk.abstr.copyKeywordsToNamedArgs("int",[null,"base"],e,t,[new Sk.builtin.int_(0),Sk.builtin.none.none$]))[0],e=e[1]),e=e!==Sk.builtin.none.none$?Sk.misceval.asIndexOrThrow(e):null,t instanceof Sk.builtin.str)null===e&&(e=10),t=new Sk.builtin.int_(Sk.str2number(t.v,e));else{if(null!==e)throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base");if(t.nb$int)t=t.nb$int();else{if(!(e=Sk.abstr.lookupSpecial(t,Sk.builtin.str.$trunc)))throw new Sk.builtin.TypeError("int() argument must be a string, a bytes-like object or a number, not '"+Sk.abstr.typeName(t)+"'");if(e=Sk.misceval.callsimArray(e,[]),!Sk.builtin.checkInt(e))throw new Sk.builtin.TypeError(Sk.builtin.str.$trunc.$jsstr()+" returned non-Integral (type "+Sk.abstr.typeName(t)+")");t=new Sk.builtin.int_(e.v)}}return this===Sk.builtin.int_.prototype?t:((e=new this.constructor).v=t.v,e)},tp$getattr:Sk.generic.getAttr,ob$eq:i(((e,t)=>e==t),JSBI.equal),ob$ne:i(((e,t)=>e!=t),JSBI.notEqual),ob$gt:i(((e,t)=>e>t),JSBI.greaterThan),ob$ge:i(((e,t)=>e>=t),JSBI.greaterThanOrEqual),ob$lt:i(((e,t)=>e<t),JSBI.lessThan),ob$le:i(((e,t)=>e<=t),JSBI.lessThanOrEqual),nb$int:s,nb$index(){return this.v},nb$float(){var e=this.v;if("number"==typeof e)return new Sk.builtin.float_(e);if(1/0===(e=parseFloat(JSBI.toNumber(e)))||-1/0===e)throw new Sk.builtin.OverflowError("int too large to convert to float");return new Sk.builtin.float_(e)},nb$isnegative(){const e=this.v;return"number"==typeof e?0>e:JSBI.lessThan(e,JSBI.__ZERO)},nb$ispositive(){const e=this.v;return"number"==typeof e?0>e:JSBI.greaterThanOrEqual(e,JSBI.__ZERO)},nb$bool(){return 0!==this.v},nb$positive:s,nb$negative:r((e=>-e),JSBI.unaryMinus),nb$add:n(((e,t)=>e+t),((e,t)=>JSBI.numberIfSafe(JSBI.add(e,t)))),nb$subtract:n(((e,t)=>e-t),((e,t)=>JSBI.numberIfSafe(JSBI.subtract(e,t)))),nb$multiply:n(((e,t)=>e*t),JSBI.multiply),nb$divide(e){return Sk.__future__.division?this.nb$float().nb$divide(e):this.nb$floor_divide(e)},nb$floor_divide:o(((e,t)=>Math.floor(e/t)),JSBI.divide),nb$remainder:o(((e,t)=>e-Math.floor(e/t)*t),JSBI.remainder),nb$divmod(e){const t=this.nb$floor_divide(e);return e=this.nb$remainder(e),t===Sk.builtin.NotImplemented.NotImplemented$||e===Sk.builtin.NotImplemented.NotImplemented$?Sk.builtin.NotImplemented.NotImplemented$:new Sk.builtin.tuple([t,e])},nb$and:l(((e,t)=>e&t),JSBI.bitwiseAnd),nb$or:l(((e,t)=>e|t),JSBI.bitwiseOr),nb$xor:l(((e,t)=>e^t),JSBI.bitwiseXor),nb$abs:r(Math.abs,(e=>JSBI.lessThan(e,JSBI.__ZERO)?JSBI.unaryMinus(e):e)),nb$lshift:a(((e,t)=>{if(53>t&&u(e=2*e*d[t]))return e}),JSBI.leftShift),nb$rshift:a(((e,t)=>{const n=e>>t;return 0<e&&0>n?n&Math.pow(2,32-t)-1:n}),((e,t)=>JSBI.numberIfSafe(JSBI.signedRightShift(e,t)))),nb$invert:r((e=>~e),JSBI.bitwiseNot),nb$power(e,t){let n;if(void 0!==t&&Sk.builtin.checkNone(t)&&(t=void 0),e instanceof Sk.builtin.int_&&(void 0===t||t instanceof Sk.builtin.int_)){let i=this.v,r=e.v;if("number"==typeof i&&"number"==typeof r){const e=Math.pow(i,r);if(u(e)&&(n=0>r?new Sk.builtin.float_(e):new Sk.builtin.int_(e),void 0===t))return n}if(void 0!==t){if(e.nb$isnegative())throw new Sk.builtin.ValueError("pow() 2nd argument cannot be negative when 3rd argument specified");if(0===t.v)throw new Sk.builtin.ValueError("pow() 3rd argument cannot be 0");return void 0!==n?n.nb$remainder(t):new Sk.builtin.int_(JSBI.powermod(p(i),p(r),p(t.v)))}return new Sk.builtin.int_(JSBI.exponentiate(p(i),p(r)))}return Sk.builtin.NotImplemented.NotImplemented$},nb$long(){return new Sk.builtin.lng(this.v)}},getsets:{real:{$get:s,$doc:"the real part of a complex number"},imag:{$get:()=>new Sk.builtin.int_(0),$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Returns self, the complex conjugate of any int."},bit_length:{$meth(){return new Sk.builtin.int_(Sk.builtin.bin(this).sq$length()-2)},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Number of bits necessary to represent self in binary.\n\n>>> bin(37)\n'0b100101'\n>>> (37).bit_length()\n6"},to_bytes:{$meth(){throw new Sk.builtin.NotImplementedError("Not yet implemented in Skulpt")},$flags:{FastCall:!0},$textsig:"($self, /, length, byteorder, *, signed=False)",$doc:"Return an array of bytes representing an integer.\n\n length\n Length of bytes object to use. An OverflowError is raised if the\n integer is not representable with the given number of bytes.\n byteorder\n The byte order used to represent the integer. If byteorder is 'big',\n the most significant byte is at the beginning of the byte array. If\n byteorder is 'little', the most significant byte is at the end of the\n byte array. To request the native byte order of the host system, use\n `sys.byteorder' as the byte order value.\n signed\n Determines whether two's complement is used to represent the integer.\n If signed is False and a negative integer is given, an OverflowError\n is raised."},__trunc__:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Truncating an Integral returns itself."},__floor__:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Flooring an Integral returns itself."},__ceil__:{$meth:s,$flags:{NoArgs:!0},$textsig:null,$doc:"Ceiling of an Integral returns itself."},__round__:{$meth(e){return this.round$(e)},$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"Rounding an Integral returns itself.\nRounding with an ndigits argument also returns an integer."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([new Sk.builtin.int_(this.v)])},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:Sk.builtin.none.none$},__format__:{$meth:Sk.formatting.mkNumber__format__(!1),$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:Sk.builtin.none.none$}},proto:{str$(e,t){return e=void 0===e||10===e?this.v.toString():this.v.toString(e),t||void 0===t||"-"===e[0]&&(e=e.substring(1)),e},round$(e){e=void 0===e?0:Sk.misceval.asIndexSized(e);var t=this.v,n=Math.pow(10,-e);if(0<e)return new Sk.builtin.int_(t);if("number"==typeof t&&Sk.__future__.bankers_rounding)return e=t/n,t=Math.round(e),new Sk.builtin.int_((.5==(0<e?e:-e)%1?0==t%2?t:t-1:t)*n);if("number"==typeof t)return new Sk.builtin.int_(Math.round(t/n)*n);{n=JSBI.BigInt(10*n),e=JSBI.BigInt(10),t=JSBI.divide(t,n);const i=JSBI.divide(t,e),r=JSBI.subtract(t,JSBI.multiply(e,i));return 5>JSBI.toNumber(r)?t=JSBI.multiply(JSBI.multiply(i,e),n):JSBI.multiply(JSBI.multiply(JSBI.add(i,JSBI.BigInt(1),e),n)),new Sk.builtin.int_(t)}}}}),Sk.exportSymbol("Sk.builtin.int_",Sk.builtin.int_);const h=/_(?=[^_])/g;Sk.str2number=function(e,t){var n,i=e,r=!1;if("-"===(e=e.replace(/^\s+|\s+$/g,"")).charAt(0)&&(r=!0,e=e.substring(1)),"+"===e.charAt(0)&&(e=e.substring(1)),null==t&&(t=10),(2>t||36<t)&&0!==t)throw new Sk.builtin.ValueError("int() base must be >= 2 and <= 36");if("string"==typeof t&&(t=Number(t)),"0x"===e.substring(0,2).toLowerCase()){if(16===t||0===t)e=e.substring(2),t=16;else if(34>t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}else if("0b"===e.substring(0,2).toLowerCase()){if(2===t||0===t)e=e.substring(2),t=2;else if(12>t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}else if("0o"===e.substring(0,2).toLowerCase()){if(8===t||0===t)e=e.substring(2),t=8;else if(25>t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}else if("0"===e.charAt(0)){if("0"===e)return 0;8!==t&&0!==t||(t=8)}if(0===t&&(t=10),-1!==e.indexOf("_")){if(-1!==e.indexOf("__"))throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'");e=10!==t?e.replace(h,""):e.charAt(0)+e.substring(1).replace(h,"")}if(0===e.length)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'");for(n=0;n<e.length;n+=1){var s=e.charCodeAt(n),o=t;if(48<=s&&57>=s?o=s-48:65<=s&&90>=s?o=s-65+10:97<=s&&122>=s&&(o=s-97+10),o>=t)throw new Sk.builtin.ValueError("invalid literal for int() with base "+t+": '"+i+"'")}if(r&&(e="-"+e),u(o=parseInt(e,t)))return o;for(i=!1,"-"===e[0]&&(i=!0,e=e.substring(1)),t=JSBI.BigInt(t),r=JSBI.BigInt(1),n=JSBI.BigInt(0),s=e.length-1;0<=s;s--)48<=(o=e.charCodeAt(s))&&57>=o?o-=48:65<=o&&90>=o?o=o-65+10:97<=o&&122>=o&&(o=o-97+10),o=JSBI.multiply(JSBI.BigInt(o),r),n=JSBI.add(n,o),r=JSBI.multiply(r,t);return i&&(n=JSBI.multiply(n,JSBI.BigInt(-1))),n},Sk.builtin.int_.py2$methods={},Sk.longFromStr=function(e,t){return Sk.__future__.python3?new Sk.builtin.int_(c(e)):(e=Sk.str2number(e,t),new Sk.builtin.lng(e))},Sk.exportSymbol("Sk.longFromStr",Sk.longFromStr),Sk.builtin.int_.withinThreshold=u,Sk.builtin.int_.stringToNumberOrBig=c;const d=[.5,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592,17179869184,34359738368,68719476736,137438953472,274877906944,549755813888,1099511627776,2199023255552,4398046511104,8796093022208,17592186044416,35184372088832,70368744177664,0x800000000000,281474976710656,562949953421312,0x4000000000000,0x8000000000000,4503599627370496,9007199254740992];Sk.builtin.lng=Sk.abstr.buildNativeClass("long",{base:Sk.builtin.int_,constructor:function(e){Sk.builtin.int_.call(this,e)},slots:{$r(){return new Sk.builtin.str(this.v.toString()+"L")},tp$as_number:!0,nb$negative(){return new Sk.builtin.lng(f.nb$negative.call(this).v)},nb$positive(){return new Sk.builtin.lng(f.nb$positive.call(this).v)}}});const f=Sk.builtin.int_.prototype},function(e,t){const n=Sk.builtin.int_.prototype;Sk.builtin.bool=Sk.abstr.buildNativeClass("bool",{constructor:function(e){return Sk.misceval.isTrue(e)?Sk.builtin.bool.true$:Sk.builtin.bool.false$},base:Sk.builtin.int_,slots:{tp$doc:"bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed.",tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("bool",t),Sk.abstr.checkArgsLen("bool",e,0,1),new Sk.builtin.bool(e[0])),$r(){return this.v?this.str$True:this.str$False},tp$as_number:!0,nb$and(e){return e.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v&e.v):n.nb$and.call(this,e)},nb$or(e){return e.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v|e.v):n.nb$or.call(this,e)},nb$xor(e){return e.ob$type===Sk.builtin.bool?new Sk.builtin.bool(this.v^e.v):n.nb$xor.call(this,e)}},flags:{sk$acceptable_as_base_class:!1},methods:{__format__:{$meth(){return this.$r()},$flags:{OneArg:!0}}},proto:{str$False:new Sk.builtin.str("False"),str$True:new Sk.builtin.str("True")}}),Sk.exportSymbol("Sk.builtin.bool",Sk.builtin.bool),Sk.builtin.bool.true$=Object.create(Sk.builtin.bool.prototype,{v:{value:1,enumerable:!0}}),Sk.builtin.bool.false$=Object.create(Sk.builtin.bool.prototype,{v:{value:0,enumerable:!0}})},function(e,t){function n(){return new Sk.builtin.float_(this.v)}function i(e){return function(t){const n=this.v;if("number"!=typeof(t=t.v)){if(!JSBI.__isBigInt(t))return Sk.builtin.NotImplemented.NotImplemented$;if(1/0==(t=parseFloat(JSBI.toNumber(t)))||-1/0==t)throw new Sk.builtin.OverflowError("int too large to convert to float")}return e(n,t)}}function r(e){const t=i(e);return function(e,n){if(void 0!==n&&!Sk.builtin.checkNone(n))throw new Sk.builtin.TypeError("pow() 3rd argument not allowed unless all arguments are integers");return t.call(this,e)}}function s(e,t){if(0===t)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return 1/0===e?1/0===t||-1/0===e?new Sk.builtin.float_(NaN):0>t?new Sk.builtin.float_(-1/0):new Sk.builtin.float_(1/0):-1/0===e?1/0===t||-1/0===e?new Sk.builtin.float_(NaN):0>t?new Sk.builtin.float_(1/0):new Sk.builtin.float_(-1/0):new Sk.builtin.float_(e/t)}function o(e,t){if(1/0===e||-1/0===e)return new Sk.builtin.float_(NaN);if(0===t)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return 1/0===t?0>e?new Sk.builtin.float_(-1):new Sk.builtin.float_(0):-1/0===t?0>e||0!==e?new Sk.builtin.float_(0):new Sk.builtin.float_(-1):new Sk.builtin.float_(Math.floor(e/t))}function a(e,t){if(0===t)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0===e)return new Sk.builtin.float_(0);if(1/0===t)return 1/0===e||-1/0===this.v?new Sk.builtin.float_(NaN):0<e?new Sk.builtin.float_(e):new Sk.builtin.float_(1/0);let n=e%t;return 0>e?0<t&&0>n&&(n+=t):0>t&&0!==n&&(n+=t),0===n&&(0>t?n=-0:-1/0==1/0/n&&(n=0)),new Sk.builtin.float_(n)}function l(e,t){if(0>e&&0!=t%1)throw new Sk.builtin.ValueError("negative number cannot be raised to a fractional power");if(0===e&&0>t)throw new Sk.builtin.ZeroDivisionError("0.0 cannot be raised to a negative power");const n=Math.pow(e,t);if(1/0===Math.abs(n)&&1/0!==Math.abs(e)&&1/0!==Math.abs(t))throw new Sk.builtin.OverflowError("Numerical result out of range");return new Sk.builtin.float_(n)}const u=Object.create(null,{Infinity:{value:314159},"-Infinity":{value:-314159},NaN:{value:0}});Sk.builtin.float_=Sk.abstr.buildNativeClass("float",{constructor:function(e){if(Sk.asserts.assert(this instanceof Sk.builtin.float_,"bad call to float use 'new'"),"number"==typeof e)this.v=e;else if(void 0===e)this.v=0;else if("string"==typeof e)this.v=parseFloat(e);else{if(e.nb$float)return e.nb$float();Sk.asserts.fail("bad argument to float constructor")}},slots:{tp$gettattr:Sk.generic.getAttr,tp$as_number:!0,tp$doc:"Convert a string or number to a floating point number, if possible.",tp$hash(){const e=this.v;let t=u[e];return void 0!==t?t:(t=Number.isInteger(e)?this.nb$int().tp$hash():Math.floor(Math.random()*Number.MAX_SAFE_INTEGER-Number.MAX_SAFE_INTEGER/2),u[this.v]=t)},$r(){return new Sk.builtin.str(this.str$(10,!0))},tp$new(e,t){if(t&&t.length)throw new Sk.builtin.TypeError("float() takes no keyword arguments");if(e&&1<e.length)throw new Sk.builtin.TypeError("float expected at most 1 arguments, got "+e.length);if(void 0===(e=e[0]))var n=new Sk.builtin.float_(0);else if(e.nb$float)n=e.nb$float();else if(Sk.builtin.checkString(e)){if(e=n=e.v,-1!==n.indexOf("_")){if(c.test(n))throw new Sk.builtin.ValueError("could not convert string to float: '"+n+"'");e=n.charAt(0)+n.substring(1).replace(p,"")}if(n.match(/^-inf$/i))var i=-1/0;else n.match(/^[+]?inf$/i)?i=1/0:n.match(/^[-+]?nan$/i)?i=NaN:isNaN(e)||(i=parseFloat(e),Number.isNaN(i)&&(i=void 0));if(void 0===i)throw new Sk.builtin.ValueError("could not convert string to float: "+Sk.misceval.objectRepr(new Sk.builtin.str(n)));n=new Sk.builtin.float_(i)}if(void 0===n)throw new Sk.builtin.TypeError("float() argument must be a string or a number");return this===Sk.builtin.float_.prototype?n:((i=new this.constructor).v=n.v,i)},nb$int(){let e=this.v;if(e=0>e?Math.ceil(e):Math.floor(e),!Number.isInteger(e))throw new Sk.builtin.ValueError("cannot convert float "+Sk.misceval.objectRepr(this)+" to integer");return Sk.builtin.int_.withinThreshold(e)?new Sk.builtin.int_(e):new Sk.builtin.int_(JSBI.BigInt(e))},nb$float:n,nb$long(){return new Sk.builtin.lng(this.nb$int().v)},nb$add:i(((e,t)=>new Sk.builtin.float_(e+t))),nb$subtract:i(((e,t)=>new Sk.builtin.float_(e-t))),nb$reflected_subtract:i(((e,t)=>new Sk.builtin.float_(t-e))),nb$multiply:i(((e,t)=>new Sk.builtin.float_(e*t))),nb$divide:i(s),nb$reflected_divide:i(((e,t)=>s(t,e))),nb$floor_divide:i(o),nb$reflected_floor_divide:i(((e,t)=>o(t,e))),nb$remainder:i(a),nb$reflected_remainder:i(((e,t)=>a(t,e))),nb$divmod:i(((e,t)=>new Sk.builtin.tuple([o(e,t),a(e,t)]))),nb$reflected_divmod:i(((e,t)=>new Sk.builtin.tuple([o(t,e),a(t,e)]))),nb$power:r(l),nb$reflected_power:r(((e,t)=>l(t,e))),nb$abs(){return new Sk.builtin.float_(Math.abs(this.v))},nb$negative(){return new Sk.builtin.float_(-this.v)},nb$positive(){return new Sk.builtin.float_(this.v)},nb$bool(){return 0!==this.v},nb$isnegative(){return 0>this.v},nb$ispositive(){return 0<=this.v},ob$eq:i(((e,t)=>e==t)),ob$ne:i(((e,t)=>e!=t)),ob$gt:i(((e,t)=>e>t)),ob$ge:i(((e,t)=>e>=t)),ob$lt:i(((e,t)=>e<t)),ob$le:i(((e,t)=>e<=t))},getsets:{real:{$get:n,$doc:"the real part of a complex number"},imag:{$get:()=>new Sk.builtin.float_(0),$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth:n,$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return self, the complex conjugate of any float."},__trunc__:{$meth(){return this.nb$int()},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return the Integral closest to x between 0 and x."},__round__:{$meth(e){return this.round$(e)},$flags:{MinArgs:0,MaxArgs:1},$textsig:"($self, ndigits=None, /)",$doc:"Return the Integral closest to x, rounding half toward even.\n\nWhen an argument is passed, work like built-in round(x, ndigits)."},is_integer:{$meth(){return new Sk.builtin.bool(Number.isInteger(this.v))},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:"Return True if the float is an integer."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([this])},$flags:{NoArgs:!0},$textsig:"($self, /)",$doc:Sk.builtin.none.none$},__format__:{$meth:Sk.formatting.mkNumber__format__(!0),$flags:{OneArg:!0},$textsig:"($self, format_spec, /)",$doc:Sk.builtin.none.none$}}});const c=/_[eE]|[eE]_|\._|_\.|[+-]_|__/,p=/_(?=[^_])/g;Sk.builtin.float_.PyFloat_Check=function(e){return void 0!==e&&!!(Sk.builtin.checkNumber(e)||Sk.builtin.checkFloat(e)||e.ob$type.$isSubType(Sk.builtin.float_))},Sk.builtin.float_.prototype.toFixed=function(e){return e=Sk.builtin.asnum$(e),this.v.toFixed(e)},Sk.builtin.float_.prototype.round$=function(e){var t=Sk.builtin.asnum$(this),n=void 0===e?0:Sk.misceval.asIndexSized(e);if(Sk.__future__.bankers_rounding){t*=Math.pow(10,n);var i=Math.round(t);return n=(.5==(0<t?t:-t)%1?0==i%2?i:i-1:i)/Math.pow(10,n),void 0===e?new Sk.builtin.int_(n):new Sk.builtin.float_(n)}return e=Math.pow(10,n),n=Math.round(t*e)/e,new Sk.builtin.float_(n)},Sk.builtin.float_.prototype.str$=function(e,t){if(isNaN(this.v))return"nan";if(void 0===t&&(t=!0),1/0==this.v)return"inf";if(-1/0==this.v&&t)return"-inf";if(-1/0==this.v&&!t)return"inf";if(t=t?this.v:Math.abs(this.v),void 0===e||10===e){var n=Sk.__future__.python3?t.toPrecision(16):t.toPrecision(12),i=n.indexOf(".");if(e=t.toString().slice(0,i),i=t.toString().slice(i),e.match(/^-?0$/)&&i.slice(1).match(/^0{4,}/)&&(n=12>n.length?t.toExponential():t.toExponential(11)),0>n.indexOf("e")&&0<=n.indexOf(".")){for(;"0"==n.charAt(n.length-1);)n=n.substring(0,n.length-1);"."==n.charAt(n.length-1)&&(n+="0")}n=(n=(n=n.replace(/\.0+e/,"e","i")).replace(/(e[-+])([1-9])$/,"$10$2")).replace(/0+(e.*)/,"$1")}else n=t.toString(e);return 0===this.v&&-1/0==1/this.v&&(n="-"+n),0>n.indexOf(".")&&0>n.indexOf("E")&&0>n.indexOf("e")&&(n+=".0"),n},Sk.builtin.float_.py2$methods={}},function(e,t){function n(e){let t=e.v;if("number"==typeof t)return t;if(e.nb$float&&(t=e.nb$float()),void 0===t)throw new Sk.builtin.TypeError("a float is required");return t.v}function i(e,t,n){return n===Sk.builtin.complex.prototype?new Sk.builtin.complex(e,t):(n=new n.constructor,Sk.builtin.complex.call(n,e,t),n)}function r(e,t){return function(n){const i=this.real,r=this.imag;var s=n.real;const o=n.v;if("number"==typeof s)n=n.imag;else if("number"==typeof o)s=o,n=0;else{if(!JSBI.__isBigInt(o))return Sk.builtin.NotImplemented.NotImplemented$;if(void 0===t){if(1/0==(s=parseFloat(JSBI.toNumber(o)))||-1/0==s)throw new Sk.builtin.OverflowError("int too large to convert to float")}else s=o.toString();n=0}return e(i,r,s,n)}}function s(e,t,n,i){var r=Math.abs(n);const s=Math.abs(i);if(r>=s){if(0===r)throw new Sk.builtin.ZeroDivisionError("complex division by zero");i=(e+t*(r=i/n))/(n+=i*r),e=(t-e*r)/n}else s>=r?(n=n*(r=n/i)+i,Sk.asserts.assert(0!==i),i=(e*r+t)/n,e=(t*r-e)/n):e=i=NaN;return new Sk.builtin.complex(i,e)}function o(e,t,n,i){if(0===n&&0===i){i=1;var r=0}else if(0===e&&0===t){if(0!==i||0>n)throw new Sk.builtin.ZeroDivisionError("complex division by zero");r=i=0}else{const s=Math.hypot(e,t);r=Math.pow(s,n),n*=e=Math.atan2(t,e),0!==i&&(r/=Math.exp(e*i),n+=i*Math.log(s)),i=r*Math.cos(n),r*=Math.sin(n)}return new Sk.builtin.complex(i,r)}function a(e,t,n){let i=1;var r=new Sk.builtin.complex(1,0);for(e=new Sk.builtin.complex(e,t);0<i&&n>=i;)n&i&&(r=new Sk.builtin.complex(r.real*e.real-r.imag*e.imag,r.real*e.imag+e.real*r.imag)),i<<=1,e=new Sk.builtin.complex(e.real*e.real-e.imag*e.imag,2*e.real*e.imag);return r}function l(e,t,n,i,r){switch(r=!1,t){case"e":case"f":case"g":break;case"E":r=!0,t="e";break;case"F":r=!0,t="f";break;case"r":if(0!==n)throw Error("Bad internall call");n=17,t="g";break;default:throw Error("Bad internall call")}if(isNaN(e))e="nan";else if(1/0===e)e="inf";else if(-1/0===e)e="-inf";else{i&l.Py_DTSF_ADD_DOT_0&&(t="g");var s="%"+(i&l.Py_DTSF_ALT?"#":"");null!=n&&(s=s+"."+n),e=(e=(s=new Sk.builtin.str(s+t)).nb$remainder(new Sk.builtin.float_(e))).v}return i&l.Py_DTSF_SIGN&&"-"!==e[0]&&(e="+"+e),r&&(e=e.toUpperCase()),e}Sk.builtin.complex=Sk.abstr.buildNativeClass("complex",{constructor:function(e,t){Sk.asserts.assert(this instanceof Sk.builtin.complex,"bad call to complex constructor, use 'new'"),this.real=e,this.imag=t},slots:{tp$as_number:!0,tp$doc:"Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0.",tp$hash(){var e=new Sk.builtin.float_(this.real).tp$hash();return e=1003*new Sk.builtin.float_(this.imag).tp$hash()+e,Sk.builtin.int_.withinThreshold(e)?e:new Sk.builtin.int_(JSBI.BigInt(e)).tp$hash()},tp$getattr:Sk.generic.getAttr,tp$new(e,t){{var r,s=(e=Sk.abstr.copyKeywordsToNamedArgs("complex",["real","imag"],e,t,[null,null]))[1];let a=t=!1;var o=e[0];if(null!=o&&o.constructor===Sk.builtin.complex&&null==s)t=o;else if(Sk.builtin.checkString(o)){if(null!=s)throw new Sk.builtin.TypeError("complex() can't take second arg if first is a string");t=Sk.builtin.complex.complex_subtype_from_string(o,this)}else{if(null!=s&&Sk.builtin.checkString(s))throw new Sk.builtin.TypeError("complex() second arg can't be a string");if(null==o?e=null:e=void 0!==(e=Sk.abstr.lookupSpecial(o,Sk.builtin.str.$complex))?Sk.misceval.callsimArray(e,[]):null,null!=e&&e!==Sk.builtin.NotImplemented.NotImplemented$){if(!u(e))throw new Sk.builtin.TypeError("__complex__ should return a complex object");o=e}if(null!=o&&void 0===o.nb$float)throw new Sk.builtin.TypeError("complex() first argument must be a string or a number, not '"+Sk.abstr.typeName(o)+"'");if(null!=s&&void 0===s.nb$float)throw new Sk.builtin.TypeError("complex() second argument must be a number, not '"+Sk.abstr.typeName(o)+"'");null==o?o=e=0:u(o)?(e=o.real,o=o.imag,t=!0):(e=n(o),o=0),null==s?s=r=0:u(s)?(r=s.real,s=s.imag,a=!0):(r=n(s),s=0),!0===a&&(e-=s),!0===t&&(r+=o),t=i(e,r,this)}}return t},tp$richcompare(e,t){if("Eq"!==t&&"NotEq"!==t){if(Sk.builtin.checkNumber(e)||u(e))throw new Sk.builtin.TypeError("no ordering relation is defined for complex numbers");return Sk.builtin.NotImplemented.NotImplemented$}return r((function(e,n,i,r){return e=e==i&&n==r,"Eq"===t?e:!e}),!0).call(this,e)},$r(){{var e,t;let r=e="";var n=this.real,i=this.imag;(t=0===n)&&(t=1==(n?0>n?-1:1:0>1/n?-1:1)),t?(n="",t=l(i,"g",null,0,null)):(n=e=l(n,"g",null,0,null),t=l(i,"g",null,l.Py_DTSF_SIGN,null),0===i&&-1/0==1/i&&t&&"-"!==t[0]&&(t="-"+t),e="(",r=")"),i=new Sk.builtin.str(""+e+n+t+"j"+r)}return i},nb$int(){throw new Sk.builtin.TypeError("can't convert complex to int")},nb$long(){throw new Sk.builtin.TypeError("can't convert complex to long")},nb$float(){throw new Sk.builtin.TypeError("can't convert complex to float")},nb$positive(){return new Sk.builtin.complex(this.real,this.imag)},nb$negative(){return new Sk.builtin.complex(-this.real,-this.imag)},nb$bool(){return this.real||this.imag},nb$add:r(((e,t,n,i)=>new Sk.builtin.complex(e+n,t+i))),nb$subtract:r(((e,t,n,i)=>new Sk.builtin.complex(e-n,t-i))),nb$reflected_subtract:r(((e,t,n,i)=>new Sk.builtin.complex(n-e,i-t))),nb$multiply:r(((e,t,n,i)=>new Sk.builtin.complex(n*e-i*t,e*i+t*n))),nb$divide:r(s),nb$reflected_divide:r(((e,t,n,i)=>s(n,i,e,t))),nb$floor_divide(e){throw new Sk.builtin.TypeError("can't take floor of complex number.")},nb$reflected_floor_divide(e){throw new Sk.builtin.TypeError("can't take floor of complex number.")},nb$remainder(e){throw new Sk.builtin.TypeError("can't mod complex numbers.")},nb$reflected_remainder(e){throw new Sk.builtin.TypeError("can't mod complex numbers.")},nb$divmod(e){throw new Sk.builtin.TypeError("can't take floor or mod of complex number.")},nb$power(e,t){if(null!=t&&!Sk.builtin.checkNone(t))throw new Sk.builtin.ValueError("complex modulo");return h.call(this,e)},nb$abs(){var e=this.real;const t=this.imag;if(!Number.isFinite(e)||!Number.isFinite(t))return 1/0===e||-1/0===e?new Sk.builtin.float_(Math.abs(e)):1/0===t||-1/0===t?new Sk.builtin.float_(Math.abs(t)):new Sk.builtin.float_(NaN);if(e=Math.hypot(e,t),!Number.isFinite(e))throw new Sk.builtin.OverflowError("absolute value too large");return new Sk.builtin.float_(e)}},getsets:{real:{$get(){return new Sk.builtin.float_(this.real)},$doc:"the real part of a complex number"},imag:{$get(){return new Sk.builtin.float_(this.imag)},$doc:"the imaginary part of a complex number"}},methods:{conjugate:{$meth(){return new Sk.builtin.complex(this.real,-this.imag)},$flags:{NoArgs:!0},$textsig:null,$doc:"complex.conjugate() -> complex\n\nReturn the complex conjugate of its argument. (3-4j).conjugate() == 3+4j."},__getnewargs__:{$meth(){return new Sk.builtin.tuple([new Sk.builtin.float_(this.real),new Sk.builtin.float_(this.imag)])},$flags:{NoArgs:!0},$textsig:null,$doc:Sk.builtin.none.none$},__format__:{$meth(e){if(Sk.builtin.checkString(e))throw new Sk.builtin.NotImplementedError("__format__ is not implemented for complex type.");throw new Sk.builtin.TypeError("__format__ requires str")},$flags:{OneArg:!0},$textsig:null,$doc:"complex.__format__() -> str\n\nConvert to a string according to format_spec."}}}),Sk.exportSymbol("Sk.builtin.complex",Sk.builtin.complex);const u=Sk.builtin.checkComplex,c=/_[eE]|[eE]_|\._|_\.|[+-]_|_j|j_/,p=/_(?=[^_])/g;Sk.builtin.complex.complex_subtype_from_string=function(e,t){t=t||Sk.builtin.complex.prototype;var n=0,r=0,s=!1;if(Sk.builtin.checkString(e))e=Sk.ffi.remapToJs(e);else if("string"!=typeof e)throw new TypeError("provided unsupported string-alike argument");if(-1!==e.indexOf("\0")||0===e.length||""===e)throw new Sk.builtin.ValueError("complex() arg is a malformed string");var o=0;for(e=(e=e.replace(/inf|infinity/gi,"Infinity")).replace(/nan/gi,"NaN");" "===e[o];)o++;if("("===e[o])for(s=!0,o++;" "===e[o];)o++;if(-1!==e.indexOf("_")){if(c.test(e))throw new Sk.builtin.ValueError("could not convert string to complex: '"+e+"'");e=e.charAt(0)+e.substring(1).replace(p,"")}var a=/^(?:[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+\.?))(?:[eE][+-]?\d+)?|NaN|Infinity))/,l=e.substr(o),u=l.match(a);if(null!==u)if("j"===e[o+=u[0].length]||"J"===e[o])r=parseFloat(u[0]),o++;else if("+"===e[o]||"-"===e[o]){if(n=parseFloat(u[0]),null!==(u=e.substr(o).match(a))?(r=parseFloat(u[0]),o+=u[0].length):(r="+"===e[o]?1:-1,o++),"j"!==e[o]&&"J"!==e[o])throw new Sk.builtin.ValueError("complex() arg is malformed string");o++}else n=parseFloat(u[0]);else null!==(u=u=l.match(/^([+-]?[jJ])/))&&(r=1===u[0].length||"+"===u[0][0]?1:-1,o+=u[0].length);for(;" "===e[o];)o++;if(s){if(")"!==e[o])throw new Sk.builtin.ValueError("complex() arg is malformed string");for(o++;" "===e[o];)o++}if(e.length!==o)throw new Sk.builtin.ValueError("complex() arg is malformed string");return i(n,r,t)};const h=r(((e,t,n,i)=>{const r=0|n;return 0===i&&n===r?(100<r||-100>r?e=o(e,t,r,0):0<r?e=a(e,t,r):e=s(1,0,(e=a(e,t,-r)).real,e.imag),e):o(e,t,n,i)}));l.Py_DTSF_SIGN=1,l.Py_DTSF_ADD_DOT_0=2,l.Py_DTSF_ALT=4,l.Py_DTST_FINITE=0,l.Py_DTST_INFINITE=1,l.Py_DTST_NAN=2},function(e,t){Sk.builtin.slice=Sk.abstr.buildNativeClass("slice",{constructor:function(e,t,n){void 0===t&&void 0===n&&(t=e,e=Sk.builtin.none.none$),void 0===t&&(t=Sk.builtin.none.none$),void 0===n&&(n=Sk.builtin.none.none$),this.start=e,this.stop=t,this.step=n},slots:{tp$getattr:Sk.generic.getAttr,tp$doc:"slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object. This is used for extended slicing (e.g. a[0:10:2]).",tp$hash:Sk.builtin.none.none$,tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("slice",t),Sk.abstr.checkArgsLen("slice",e,1,3),new Sk.builtin.slice(...e)),$r(){const e=Sk.misceval.objectRepr(this.start),t=Sk.misceval.objectRepr(this.stop),n=Sk.misceval.objectRepr(this.step);return new Sk.builtin.str("slice("+e+", "+t+", "+n+")")},tp$richcompare(e,t){if(e.ob$type!==Sk.builtin.slice)return Sk.builtin.NotImplemented.NotImplemented$;const n=new Sk.builtin.tuple([this.start,this.stop,this.step]);return e=new Sk.builtin.tuple([e.start,e.stop,e.step]),n.tp$richcompare(e,t)}},getsets:{start:{$get(){return this.start}},step:{$get(){return this.step}},stop:{$get(){return this.stop}}},methods:{indices:{$meth:function(e){if(0>(e=Sk.misceval.asIndexSized(e,Sk.builtin.OverflowError)))throw new Sk.builtin.TypeError("length should not be negative");const{start:t,stop:n,step:i}=this.slice$indices(e);return new Sk.builtin.tuple([new Sk.builtin.int_(t),new Sk.builtin.int_(n),new Sk.builtin.int_(i)])},$doc:"S.indices(len) -> (start, stop, stride)\n\nAssuming a sequence of length len, calculate the start and stop\nindices, and the stride length of the extended slice described by\nS. Out of bounds indices are clipped in a manner consistent with the\nhandling of normal slices.",$textsig:null,$flags:{OneArg:!0}}},proto:{slice$as_indices(e){let t;var n=e?e=>Sk.misceval.asIndexSized(e,null,"slice indices must be integers or None or have an __index__ method"):e=>Sk.misceval.asIndexOrThrow(e,"slice indices must be integers or None or have an __index__ method");if(Sk.builtin.checkNone(this.step))t=1;else if(t=n(this.step),0===t)throw new Sk.builtin.ValueError("slice step cannot be zero");return{start:e=Sk.builtin.checkNone(this.start)?null:n(this.start),stop:n=Sk.builtin.checkNone(this.stop)?null:n(this.stop),step:t}},$wrt:(e,t,n,i,r)=>(r=r?t=>JSBI.__isBigInt(t)?JSBI.add(t,JSBI.BigInt(e)):t+e:t=>t+e,0<i?(null===t?t=0:0>t&&(0>(t=r(t))&&(t=0)),null===n||n>e?n=e:0>n&&(n=r(n))):(null===t||t>=e?t=e-1:0>t&&(t=r(t)),null===n?n=-1:0>n&&(0>(n=r(n))&&(n=-1))),{start:t,stop:n,step:i}),slice$indices(e,t){let{start:n,stop:i,step:r}=this.slice$as_indices(!0,t);return this.$wrt(e,n,i,r,t)},sssiter$(e,t){let{start:n,stop:i,step:r}=this.slice$indices(e,!0);if(0<r)for(e=n;e<i;e+=r)t(e);else for(e=n;e>i;e+=r)t(e)}},flags:{sk$acceptable_as_base_class:!1}}),Sk.builtin.slice.startEnd$wrt=function(e,t,n){return e=e.sq$length(),void 0===t||Sk.builtin.checkNone(t)?t=0:0>(t=Sk.misceval.asIndexSized(t,null,"slice indices must be integers or have an __index__ method"))&&(0>(t+=e)&&(t=0)),void 0===n||Sk.builtin.checkNone(n)?n=e:0>(n=Sk.misceval.asIndexSized(n,null,"slice indices must be integers or have an __index__ method"))?0>(n+=e)&&(n=0):n>e&&(n=e),{start:t,end:n}}},function(e,t){function n(e){return function(t){return Sk.builtin.checkAnySet(t)?e.call(this,t):Sk.builtin.NotImplemented.NotImplemented$}}function i(e){return e instanceof Sk.builtin.set&&e.tp$hash===Sk.builtin.none.none$&&(e=new Sk.builtin.frozenset(Sk.misceval.arrayFromIterable(e))),e}e={},Sk.builtin.set=Sk.abstr.buildNativeClass("set",{constructor:function(e){void 0===e?e=[]:Array.isArray(e)||(e=Sk.misceval.arrayFromIterable(e)),Sk.asserts.assert(this instanceof Sk.builtin.set,"Bad call to set - must be called with an Array and 'new'");const t=[];for(let n=0;n<e.length;n++)t.push(e[n]),t.push(!0);this.v=new Sk.builtin.dict(t),this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$hash:Sk.builtin.none.none$,tp$doc:"set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements.",tp$init(e,t){return Sk.abstr.checkNoKwargs("set",t),Sk.abstr.checkArgsLen("set",e,0,1),this.set$clear(),(e=e[0])&&this.set$update(e)},tp$new:Sk.generic.new,$r(){if(this.in$repr)return new Sk.builtin.str(Sk.abstr.typeName(this)+"(...)");this.in$repr=!0;const e=this.sk$asarray().map((e=>Sk.misceval.objectRepr(e)));return this.in$repr=!1,Sk.__future__.python3?0===e.length?new Sk.builtin.str(Sk.abstr.typeName(this)+"()"):this.ob$type!==Sk.builtin.set?new Sk.builtin.str(Sk.abstr.typeName(this)+"({"+e.join(", ")+"})"):new Sk.builtin.str("{"+e.join(", ")+"}"):new Sk.builtin.str(Sk.abstr.typeName(this)+"(["+e.join(", ")+"])")},tp$iter(){return new r(this)},tp$richcompare(e,t){if(!Sk.builtin.checkAnySet(e))return Sk.builtin.NotImplemented.NotImplemented$;switch(t){case"NotEq":case"Eq":return e=this===e||this.get$size()===e.get$size()&&Sk.misceval.isTrue(this.set$issubset(e)),"Eq"===t?e:!e;case"LtE":return this===e||Sk.misceval.isTrue(this.set$issubset(e));case"GtE":return this===e||Sk.misceval.isTrue(e.set$issubset(this));case"Lt":return this.get$size()<e.get$size()&&Sk.misceval.isTrue(this.set$issubset(e));case"Gt":return this.get$size()>e.get$size()&&Sk.misceval.isTrue(e.set$issubset(this))}},nb$subtract:n((function(e){return this.difference.$meth.call(this,e)})),nb$and:n((function(e){return this.intersection.$meth.call(this,e)})),nb$or:n((function(e){return this.union.$meth.call(this,e)})),nb$xor:n((function(e){return this.symmetric_difference.$meth.call(this,e)})),nb$inplace_subtract:n((function(e){return e===this&&(e=e.set$copy()),Sk.misceval.chain(this.difference_update.$meth.call(this,e),(()=>this))})),nb$inplace_and:n((function(e){return Sk.misceval.chain(this.intersection_update.$meth.call(this,e),(()=>this))})),nb$inplace_or:n((function(e){return Sk.misceval.chain(this.update.$meth.call(this,e),(()=>this))})),nb$inplace_xor:n((function(e){return e===this&&(e=e.set$copy()),Sk.misceval.chain(this.symmetric_difference_update.$meth.call(this,e),(()=>this))})),sq$length(){return this.get$size()},sq$contains(e){return e=i(e),this.v.sq$contains(e)}},methods:{add:{$meth(e){return this.set$add(e),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Add an element to a set.\n\nThis has no effect if the element is already present."},clear:{$meth(){return this.set$clear(),Sk.builtin.none.none$},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove all elements from this set."},copy:{$meth(){return this.set$copy()},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a shallow copy of a set."},discard:{$meth(e){return e=i(e),this.set$discard(e),Sk.builtin.none.none$},$flags:{OneArg:!0},$textsig:null,$doc:"Remove an element from a set if it is a member.\n\nIf the element is not a member, do nothing."},difference:{$meth(...e){const t=this.set$copy();return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>t.set$difference_update(e))),(()=>t))},$flags:{MinArgs:0},$textsig:null,$doc:"Return the difference of two or more sets as a new set.\n\n(i.e. all elements that are in this set but not the others.)"},difference_update:{$meth(...e){return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>this.set$difference_update(e))),(()=>Sk.builtin.none.none$))},$flags:{MinArgs:0},$textsig:null,$doc:"Remove all elements of another set from this set."},intersection:{$meth(...e){return this.set$intersection_multi(...e)},$flags:{MinArgs:0},$textsig:null,$doc:"Return the intersection of two sets as a new set.\n\n(i.e. all elements that are in both sets.)"},intersection_update:{$meth(...e){return Sk.misceval.chain(this.set$intersection_multi(...e),(e=>(this.swap$bodies(e),Sk.builtin.none.none$)))},$flags:{MinArgs:0},$textsig:null,$doc:"Update a set with the intersection of itself and another."},isdisjoint:{$meth(e){return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{if(this.sq$contains(e))return new Sk.misceval.Break(Sk.builtin.bool.false$)})),(e=>e||Sk.builtin.bool.true$))},$flags:{OneArg:!0},$textsig:null,$doc:"Return True if two sets have a null intersection."},issubset:{$meth(e){return Sk.builtin.checkAnySet(e)||(e=this.set$make_basetype(e)),Sk.misceval.chain(e,(e=>this.set$issubset(e)))},$flags:{OneArg:!0},$textsig:null,$doc:"Report whether another set contains this set."},issuperset:{$meth(e){return Sk.builtin.checkAnySet(e)||(e=this.set$make_basetype(e)),Sk.misceval.chain(e,(e=>e.set$issubset(this)))},$flags:{OneArg:!0},$textsig:null,$doc:"Report whether this set contains another set."},pop:{$meth(){if(0===this.get$size())throw new Sk.builtin.KeyError("pop from an empty set");return Sk.misceval.callsimArray(this.v.popitem,[this.v]).v[0]},$flags:{NoArgs:!0},$textsig:null,$doc:"Remove and return an arbitrary set element.\nRaises KeyError if the set is empty."},remove:{$meth(e){const t=i(e);if(this.v.mp$lookup(t))return this.v.mp$ass_subscript(t),Sk.builtin.none.none$;throw new Sk.builtin.KeyError(e)},$flags:{OneArg:!0},$textsig:null,$doc:"Remove an element from a set; it must be a member.\n\nIf the element is not a member, raise a KeyError."},symmetric_difference:{$meth(e){let t;return Sk.misceval.chain(this.set$make_basetype(e),(e=>(t=e,t.set$symmetric_diff_update(this))),(()=>t))},$flags:{OneArg:!0},$textsig:null,$doc:"Return the symmetric difference of two sets as a new set.\n\n(i.e. all elements that are in exactly one of the sets.)"},symmetric_difference_update:{$meth(e){return Sk.builtin.checkAnySet(e)||(e=this.set$make_basetype(e)),Sk.misceval.chain(e,(e=>this.set$symmetric_diff_update(e)),(()=>Sk.builtin.none.none$))},$flags:{OneArg:!0},$textsig:null,$doc:"Update a set with the symmetric difference of itself and another."},union:{$meth(...e){const t=this.set$copy();return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>t.set$update(e))),(()=>t))},$flags:{MinArgs:0},$textsig:null,$doc:"Return the union of sets as a new set.\n\n(i.e. all elements that are in either set.)"},update:{$meth(...e){return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>this.set$update(e))),(()=>Sk.builtin.none.none$))},$flags:{MinArgs:0},$textsig:null,$doc:"Update a set with the union of itself and others."}},proto:Object.assign(e,{sk$asarray(){return this.v.sk$asarray()},get$size(){return this.v.sq$length()},set$add(e){this.v.mp$ass_subscript(e,!0)},set$make_basetype(e){return Sk.misceval.chain(Sk.misceval.arrayFromIterable(e,!0),(e=>new this.sk$builtinBase(e)))},set$discard(e){return this.v.pop$item(e)},set$clear(){this.v=new Sk.builtin.dict([])},set$copy(){const e=new this.sk$builtinBase;return e.v=this.v.dict$copy(),e},set$difference_update(e){return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.set$discard(e)}))},set$intersection(e){const t=new this.sk$builtinBase;return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.sq$contains(e)&&t.set$add(e)})),(()=>t))},set$intersection_multi(...e){if(!e.length)return this.set$copy();let t=this;return Sk.misceval.chain(Sk.misceval.iterArray(e,(e=>Sk.misceval.chain(t.set$intersection(e),(e=>{t=e})))),(()=>t))},set$issubset(e){if(this.get$size()>e.get$size())return Sk.builtin.bool.false$;for(let t=this.tp$iter(),n=t.tp$iternext();void 0!==n;n=t.tp$iternext())if(!e.sq$contains(n))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$},set$symmetric_diff_update(e){return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{void 0===this.set$discard(e)&&this.set$add(e)}))},set$update(e){return Sk.misceval.iterFor(Sk.abstr.iter(e),(e=>{this.set$add(e)}))},swap$bodies(e){this.v=e.v}})}),Sk.exportSymbol("Sk.builtin.set",Sk.builtin.set),t=Sk.builtin.set.prototype,Sk.builtin.frozenset=Sk.abstr.buildNativeClass("frozenset",{constructor:function(e){void 0===e&&(e=[]),Sk.asserts.assert(Array.isArray(e)&&this instanceof Sk.builtin.frozenset,"bad call to frozen set - must be called with an Array and 'new'");const t=[];for(let n=0;n<e.length;n++)t.push(e[n]),t.push(!0);this.v=new Sk.builtin.dict(t),this.in$repr=!1},slots:{tp$getattr:Sk.generic.getAttr,tp$as_number:!0,tp$as_sequence_or_mapping:!0,tp$doc:"frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements.",tp$hash(){let e=1927868237;const t=this.sk$asarray();e*=t.length+1;for(let n=0;n<t.length;n++){const i=Sk.abstr.objectHash(t[n]);e^=3644798167*(i^i<<16^89869747)}return 69069*e+907133923},tp$new(e,t){return this!==Sk.builtin.frozenset.prototype?this.$subtype_new(e,t):(Sk.abstr.checkNoKwargs("frozenset",t),Sk.abstr.checkArgsLen("frozenset",e,0,1),void 0!==(e=e[0])&&e.ob$type===Sk.builtin.frozenset?e:Sk.misceval.chain(Sk.misceval.arrayFromIterable(e,!0),(e=>e.length?new Sk.builtin.frozenset(e):Sk.builtin.frozenset.$emptyset)))},$r:t.$r,tp$iter:t.tp$iter,tp$richcompare:t.tp$richcompare,nb$subtract:t.nb$subtract,nb$and:t.nb$and,nb$or:t.nb$or,nb$xor:t.nb$xor,sq$length:t.sq$length,sq$contains:t.sq$contains},methods:{copy:Object.assign({},t.copy.d$def,{$meth(){return this.constructor===this.sk$builtinBase?this:new Sk.builtin.frozenset(this.sk$asarray())}}),difference:t.difference.d$def,intersection:t.intersection.d$def,isdisjoint:t.isdisjoint.d$def,issubset:t.issubset.d$def,issuperset:t.issuperset.d$def,symmetric_difference:t.symmetric_difference.d$def,union:t.union.d$def},proto:Object.assign({$subtype_new(e,t){const n=new this.constructor;return Sk.misceval.chain(Sk.builtin.frozenset.prototype.tp$new(e),(e=>(n.v=e.v,n)))}},e)}),Sk.builtin.frozenset.$emptyset=Object.create(Sk.builtin.frozenset.prototype,{v:{value:new Sk.builtin.dict([]),enumerable:!0},in$repr:{value:!1,enumerable:!0}}),Sk.exportSymbol("Sk.builtin.frozenset",Sk.builtin.frozenset);var r=Sk.abstr.buildIteratorClass("set_iterator",{constructor:function(e){this.$index=0,this.$seq=e.sk$asarray(),this.$orig=e},iternext:Sk.generic.iterNextWithArrayCheckSize,methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}})},function(e,t){Sk.builtin.print=function(e,t){let n,[i,r,s]=Sk.abstr.copyKeywordsToNamedArgs("print",["sep","end","file","flush"],[],t);if(void 0===i||Sk.builtin.checkNone(i))i=" ";else{if(!Sk.builtin.checkString(i))throw new Sk.builtin.TypeError("sep must be None or a string, not "+Sk.abstr.typeName(i));i=i.$jsstr()}if(void 0===r||Sk.builtin.checkNone(r))r="\n";else{if(!Sk.builtin.checkString(r))throw new Sk.builtin.TypeError("end must be None or a string, not "+Sk.abstr.typeName(r));r=r.$jsstr()}if(void 0!==s&&!Sk.builtin.checkNone(s)&&(n=Sk.abstr.lookupSpecial(s,Sk.builtin.str.$write),void 0===n))throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(s)+"' object has no attribute 'write'");const o=new Sk.builtin.str(e.map((e=>new Sk.builtin.str(e).toString())).join(i)+r);if(void 0===n)return Sk.misceval.chain(Sk.importModule("sys",!1,!0),(e=>(n=Sk.abstr.lookupSpecial(e.$d.stdout,Sk.builtin.str.$write))&&Sk.misceval.callsimOrSuspendArray(n,[o])));Sk.misceval.callsimArray(n,[o])},Sk.builtin.print.co_fastcall=1},function(e,t){Sk.builtin.module=Sk.abstr.buildNativeClass("module",{constructor:function(){this.$d={}},slots:{tp$doc:"Create a module object.\n\nThe name must be a string; the optional doc argument can have any type.",tp$getattr(e,t){var n=this.$d[e.$mangled];if(void 0!==n)return n;if(void 0!==(n=this.ob$type.$typeLookup(e))){const e=n.tp$descr_get;return e?e.call(n,this,this.ob$type,t):n}const i=this.$d.__getattr__;return void 0!==i?(n=Sk.misceval.tryCatch((()=>Sk.misceval.callsimOrSuspendArray(i,[e])),(e=>{if(!(e instanceof Sk.builtin.AttributeError))throw e})),t?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)):void 0},tp$setattr:Sk.generic.setAttr,tp$new:Sk.generic.new,tp$init(e,t){const[n,i]=Sk.abstr.copyKeywordsToNamedArgs("module",["name","doc"],e,t,[Sk.builtin.none.none$]);Sk.builtin.pyCheckType("module","string",n),this.init$dict(n,i)},$r(){let e=this.get$name();if(void 0!==e){var t=this.get$mod_reprf();if(void 0!==t)return Sk.misceval.callsimOrSuspendArray(t,[this])}return e=void 0===e?"'?'":e,t=void 0===(t=this.from$file())?this.empty_or$loader():t,new Sk.builtin.str("<module "+e+t+">")}},getsets:{__dict__:{$get(){return new Sk.builtin.mappingproxy(this.$d)}}},methods:{__dir__:{$meth(){const e=this.tp$getattr(Sk.builtin.str.$dict);if(!Sk.builtin.checkMapping(e))throw new Sk.builtin.TypeError("__dict__ is not a dictionary");const t=e.mp$lookup(Sk.builtin.str.$dir);return void 0!==t?Sk.misceval.callsimOrSuspendArray(t,[]):new Sk.builtin.list(Sk.misceval.arrayFromIterable(e))},$flags:{NoArgs:!0},$doc:"__dir__() -> list\nspecialized dir() implementation"}},proto:{init$dict(e,t){this.$d.__name__=e,this.$d.__doc__=t,this.$d.__package__=Sk.builtin.none.none$,this.$d.__spec__=Sk.builtin.none.none$,this.$d.__loader__=Sk.builtin.none.none$},sk$attrError(){const e=this.get$name();return void 0===e?"module":"module "+e},get$name(){const e=this.tp$getattr(Sk.builtin.str.$name);return e&&Sk.misceval.objectRepr(e)},from$file(){const e=this.tp$getattr(Sk.builtin.str.$file);return e&&" from "+Sk.misceval.objectRepr(e)},empty_or$loader(){if(this.$js&&this.$js.includes("$builtinmodule"))return" (built-in)";const e=this.tp$getattr(Sk.builtin.str.$loader);return void 0===e||Sk.builtin.checkNone(e)?"":" ("+Sk.misceval.objectRepr(e)+")"},get$mod_reprf(){const e=this.tp$getattr(Sk.builtin.str.$loader);return e&&e.tp$getattr(this.str$mod_repr)},str$mod_repr:new Sk.builtin.str("module_repr")}}),Sk.exportSymbol("Sk.builtin.module",Sk.builtin.module)},function(e,t){Sk.builtin.structseq_types={},Sk.builtin.make_structseq=function(e,t,n,i){const r=e+"."+t,s=[];e=[];for(let t in n)s.push(t),e.push(n[t]);n={};for(let t=0;t<s.length;t++)n[s[t]]={$get(){return this.v[t]},$doc:e[t]};var o=Sk.abstr.buildNativeClass(r,{constructor:function(e){Sk.asserts.assert((Array.isArray(e)||void 0===e)&&this instanceof o),Sk.builtin.tuple.call(this,e)},base:Sk.builtin.tuple,slots:{tp$new(e,t){Sk.abstr.checkOneArg(r,e,t),t=[],e=e[0];for(let n=Sk.abstr.iter(e),i=n.tp$iternext();void 0!==i;i=n.tp$iternext())t.push(i);if(t.length!=s.length)throw new Sk.builtin.TypeError(r+"() takes a "+s.length+"-sequence ("+t.length+"-sequence given)");return new o(t)},tp$doc:i||Sk.builtin.none.none$,$r(){var e;if(0===this.v.length)return new Sk.builtin.str(r+"()");var t=[];for(e=0;e<this.v.length;++e)t[e]=s[e]+"="+Sk.misceval.objectRepr(this.v[e]);return e=t.join(", "),1===this.v.length&&(e+=","),new Sk.builtin.str(r+"("+e+")")}},methods:{__reduce__:{$meth(){throw new Sk.builtin.NotImplementedError("__reduce__ is not implemented")},$flags:{NoArgs:!0}}},getsets:n,proto:{num_sequence_fields:new Sk.builtin.int_(s.length)}});return o},Sk.exportSymbol("Sk.builtin.make_structseq",Sk.builtin.make_structseq)},function(e,t){Sk.builtin.generator=Sk.abstr.buildIteratorClass("generator",{constructor:function(e,t,n,i,r){var s;if(e){if(!(this instanceof Sk.builtin.generator))throw new TypeError("bad internal call to generator, use 'new'");if(this.func_code=e,this.func_globals=t||null,this.gi$running=!1,this.gi$resumeat=0,this.gi$sentvalue=void 0,this.gi$locals={},this.gi$cells={},0<n.length)for(t=0;t<e.co_varnames.length;++t)this.gi$locals[e.co_varnames[t]]=n[t];if(void 0!==r)for(s in r)i[s]=r[s];this.func_closure=i}},slots:{$r(){return new Sk.builtin.str("<generator object "+this.func_code.co_name.v+">")}},iternext(e,t){var n=this;return this.gi$running=!0,void 0===t&&(t=Sk.builtin.none.none$),this.gi$sentvalue=t,t=[this],this.func_closure&&t.push(this.func_closure),function t(i){if(i instanceof Sk.misceval.Suspension){if(e)return new Sk.misceval.Suspension(t,i);i=Sk.misceval.retryOptionalSuspensionOrThrow(i)}if(n.gi$running=!1,Sk.asserts.assert(void 0!==i),i!==Sk.builtin.none.none$)return n.gi$resumeat=i[0],i[1]}(this.func_code.apply(this.func_globals,t))},methods:{send:{$meth(e){return this.tp$iternext(!0,e)},$flags:{OneArg:!0},$doc:"send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration."}}}),Sk.exportSymbol("Sk.builtin.generator",Sk.builtin.generator),Sk.builtin.makeGenerator=function(e,t){var n,i=new Sk.builtin.generator(null,null,null);for(n in i.tp$iternext=e,t)t.hasOwnProperty(n)&&(i[n]=t[n]);return i},Sk.exportSymbol("Sk.builtin.makeGenerator",Sk.builtin.makeGenerator)},function(e,t){Sk.builtin.file=function(e,t,n){var i;if(!(this instanceof Sk.builtin.file))return new Sk.builtin.file(e,t,n);if(this.mode=t,this.name=Sk.ffi.remapToJs(e),this.closed=!1,"/dev/stdout"===this.name)this.data$=Sk.builtin.none.none$,this.fileno=1;else if("/dev/stdin"===this.name)this.fileno=0;else if("/dev/stderr"===this.name)this.fileno=2;else{if(Sk.inBrowser)if(this.fileno=10,null==(n=document.getElementById(e.v))){if("w"!=t.v&&"a"!=t.v)throw new Sk.builtin.IOError("[Errno 2] No such file or directory: '"+e.v+"'");this.data$=""}else"textarea"==n.nodeName.toLowerCase()?this.data$=n.value:this.data$=n.textContent;else this.fileno=11,this.data$=Sk.read(e.v);for(i in this.lineList=this.data$.split("\n"),this.lineList=this.lineList.slice(0,-1),this.lineList)this.lineList[i]+="\n";this.currentLine=0}return this.pos$=0,Sk.fileopen&&10<=this.fileno&&Sk.fileopen(this),this},Sk.abstr.setUpInheritance("file",Sk.builtin.file,Sk.builtin.object),Sk.abstr.setUpBuiltinMro(Sk.builtin.file),Sk.builtin.file.prototype.$r=function(){return new Sk.builtin.str("<"+(this.closed?"closed":"open")+"file '"+this.name+"', mode '"+Sk.ffi.remapToJs(this.mode)+"'>")},Sk.builtin.file.prototype.tp$iter=function(){var e={tp$iter:function(){return e},$obj:this,$index:this.currentLine,$lines:this.lineList,tp$iternext:function(){if(!(e.$index>=e.$lines.length))return new Sk.builtin.str(e.$lines[e.$index++])}};return e},Sk.abstr.setUpSlots(Sk.builtin.file),Sk.builtin.file.prototype.__enter__=new Sk.builtin.func((function(e){return e})),Sk.builtin.file.prototype.__exit__=new Sk.builtin.func((function(e){return Sk.misceval.callsimArray(Sk.builtin.file.prototype.close,[e])})),Sk.builtin.file.prototype.close=new Sk.builtin.func((function(e){return e.closed=!0,Sk.builtin.none.none$})),Sk.builtin.file.prototype.flush=new Sk.builtin.func((function(e){})),Sk.builtin.file.prototype.fileno=new Sk.builtin.func((function(e){return this.fileno})),Sk.builtin.file.prototype.isatty=new Sk.builtin.func((function(e){return!1})),Sk.builtin.file.prototype.read=new Sk.builtin.func((function(e,t){var n=e.data$.length;if(e.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var i=void 0===t?n:Sk.ffi.remapToJs(t);return i=new Sk.builtin.str(e.data$.substr(e.pos$,i)),e.pos$=void 0===t?n:e.pos$+Sk.ffi.remapToJs(t),e.pos$>=n&&(e.pos$=n),i})),Sk.builtin.file.$readline=function(e,t,n){if(0===e.fileno){if(e=Sk.ffi.remapToJs(n),(e=Sk.inputfun(e||""))instanceof Promise||e&&"function"==typeof e.then){var i=new Sk.misceval.Suspension;return i.resume=function(){if(i.data.error)throw i.data.error;return new Sk.builtin.str(i.data.result)},i.data={type:"Sk.promise",promise:e},i}return new Sk.builtin.str(e)}return t="",e.currentLine<e.lineList.length&&(t=e.lineList[e.currentLine],e.currentLine++),new Sk.builtin.str(t)},Sk.builtin.file.prototype.readline=new Sk.builtin.func((function(e,t){return Sk.builtin.file.$readline(e,t,void 0)})),Sk.builtin.file.prototype.readlines=new Sk.builtin.func((function(e,t){if(0===e.fileno)return new Sk.builtin.NotImplementedError("readlines ins't implemented because the web doesn't support Ctrl+D");var n=[];for(t=e.currentLine;t<e.lineList.length;t++)n.push(new Sk.builtin.str(e.lineList[t]));return new Sk.builtin.list(n)})),Sk.builtin.file.prototype.seek=new Sk.builtin.func((function(e,t,n){return t=Sk.ffi.remapToJs(t),void 0===n&&(n=0),0===n?e.pos$=t:(1==n||2==n)&&(e.pos$=e.data$.length+t),Sk.builtin.none.none$})),Sk.builtin.file.prototype.tell=new Sk.builtin.func((function(e){return Sk.ffi.remapToPy(e.pos$)})),Sk.builtin.file.prototype.truncate=new Sk.builtin.func((function(e,t){Sk.asserts.fail()})),Sk.builtin.file.prototype.write=new Sk.builtin.func((function(e,t){var n=Sk.ffi.remapToJs(e.mode);if("w"!==n&&"wb"!==n&&"a"!==n&&"ab"!==n)throw new Sk.builtin.IOError("File not open for writing");if(Sk.filewrite){if(e.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");1===e.fileno?Sk.output(Sk.ffi.remapToJs(t)):Sk.filewrite(e,t)}else 1===e.fileno?Sk.output(Sk.ffi.remapToJs(t)):Sk.asserts.fail();return Sk.builtin.none.none$})),Sk.exportSymbol("Sk.builtin.file",Sk.builtin.file)},function(e,t){Sk.ffi=Sk.ffi||{},Sk.ffi.remapToPy=function(e){var t;if(null==e)return Sk.builtin.none.none$;if(e.ob$type||e instanceof Sk.misceval.Suspension)return e;if("[object Array]"===Object.prototype.toString.call(e)){var n=[];for(t=0;t<e.length;++t)n.push(Sk.ffi.remapToPy(e[t]));return new Sk.builtin.list(n)}if("object"==typeof e){for(t in n=[],e)n.push(Sk.ffi.remapToPy(t)),n.push(Sk.ffi.remapToPy(e[t]));return new Sk.builtin.dict(n)}return"string"==typeof e?new Sk.builtin.str(e):"number"==typeof e?Sk.builtin.assk$(e):"boolean"==typeof e?new Sk.builtin.bool(e):void 0===e?Sk.builtin.none.none$:"function"==typeof e?new Sk.builtin.func(e):void Sk.asserts.fail("unhandled remap type "+typeof e)},Sk.exportSymbol("Sk.ffi.remapToPy",Sk.ffi.remapToPy),Sk.ffi.remapToJs=function(e){var t,n;if(e instanceof Sk.builtin.dict){var i={};return e.$items().forEach((([e,t])=>{n=Sk.ffi.remapToJs(e),i[n]=Sk.ffi.remapToJs(t)})),i}if(e instanceof Sk.builtin.list||e instanceof Sk.builtin.tuple){for(i=[],t=0;t<e.v.length;++t)i.push(Sk.ffi.remapToJs(e.v[t]));return i}return e instanceof Sk.builtin.bool?!!e.v:e instanceof Sk.builtin.int_||e instanceof Sk.builtin.float_||e instanceof Sk.builtin.lng?Sk.builtin.asnum$(e):"number"==typeof e||"boolean"==typeof e||"string"==typeof e?e:void 0!==e?e.v:void 0},Sk.exportSymbol("Sk.ffi.remapToJs",Sk.ffi.remapToJs),Sk.ffi.callback=function(e){return void 0===e?e:function(){return Sk.misceval.apply(e,void 0,void 0,void 0,Array.prototype.slice.call(arguments,0))}},Sk.exportSymbol("Sk.ffi.callback",Sk.ffi.callback),Sk.ffi.stdwrap=function(e,t){return(e=new e).v=t,e},Sk.exportSymbol("Sk.ffi.stdwrap",Sk.ffi.stdwrap),Sk.ffi.basicwrap=function(e){return e instanceof Sk.builtin.int_||e instanceof Sk.builtin.float_||e instanceof Sk.builtin.lng?Sk.builtin.asnum$(e):"number"==typeof e||"boolean"==typeof e?e:"string"==typeof e?new Sk.builtin.str(e):void Sk.asserts.fail("unexpected type for basicwrap")},Sk.exportSymbol("Sk.ffi.basicwrap",Sk.ffi.basicwrap),Sk.ffi.unwrapo=function(e){if(void 0!==e)return e.v},Sk.exportSymbol("Sk.ffi.unwrapo",Sk.ffi.unwrapo),Sk.ffi.unwrapn=function(e){return null===e?null:e.v},Sk.exportSymbol("Sk.ffi.unwrapn",Sk.ffi.unwrapn)},function(e,t){function n(e,t,n){if(e=void 0===e?e:Sk.misceval.asIndexOrThrow(e),t=void 0===t?t:Sk.misceval.asIndexOrThrow(t),n=void 0===n?n:Sk.misceval.asIndexOrThrow(n),void 0===t&&void 0===n)t=e,e=0,n=1;else if(void 0===n)n=1;else if(0===n)throw new Sk.builtin.ValueError("range() step argument must not be zero");const r=[];if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)if(0<n)for(var s=e;s<t;s+=n)r.push(new Sk.builtin.int_(s));else for(s=e;s>t;s+=n)r.push(new Sk.builtin.int_(s));else{if(e=s=JSBI.BigInt(e),n=JSBI.BigInt(n),t=JSBI.BigInt(t),JSBI.greaterThan(n,JSBI.__ZERO))for(;JSBI.lessThan(s,t);)r.push(new Sk.builtin.int_(i(s))),s=JSBI.add(s,n);else for(;JSBI.greaterThan(s,t);)r.push(new Sk.builtin.int_(i(s))),s=JSBI.add(s,n);e=i(e),n=i(n),t=i(t)}return new Sk.builtin.range_(e,t,n,r)}function i(e){return JSBI.lessThan(e,JSBI.__MAX_SAFE)&&JSBI.greaterThan(e,JSBI.__MIN_SAFE)?JSBI.toNumber(e):e}Sk.builtin.range_=Sk.abstr.buildNativeClass("range",{constructor:function(e,t,n,i){this.start=e,this.stop=t,this.step=n,this.v=i},slots:{tp$getattr:Sk.generic.getAttr,tp$as_sequence_or_mapping:!0,tp$doc:"range(stop) -> range object\nrange(start, stop[, step]) -> range object\n\nReturn an object that produces a sequence of integers from start (inclusive)\nto stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1.\nstart defaults to 0, and stop is omitted! range(4) produces 0, 1, 2, 3.\nThese are exactly the valid indices for a list of 4 elements.\nWhen step is given, it specifies the increment (or decrement).",tp$new:(e,t)=>(Sk.abstr.checkNoKwargs("range",t),Sk.abstr.checkArgsLen("range",e,1,3),n(e[0],e[1],e[2])),$r(){let e="range("+this.start+", "+this.stop;return 1!=this.step&&(e+=", "+this.step),new Sk.builtin.str(e+")")},tp$richcompare(e,t){return"Eq"!==t&&"NotEq"!==t||e.ob$type!==Sk.builtin.range_?Sk.builtin.NotImplemented.NotImplemented$:(e=new Sk.builtin.list(e.v),new Sk.builtin.list(this.v).tp$richcompare(e,t))},tp$iter(){return new r(this)},nb$bool(){return 0!==this.v.length},sq$contains(e){const t=this.v;for(let n=0;n<t.length;n++)if(Sk.misceval.richCompareBool(e,t[n],"Eq"))return!0;return!1},sq$length(){return this.v.length},mp$subscript(e){if(Sk.misceval.isIndex(e)){if(0>(e=Sk.misceval.asIndexSized(e))&&(e=this.v.length+e),0>e||e>=this.v.length)throw new Sk.builtin.IndexError("range object index out of range");return this.v[e]}if(e.constructor===Sk.builtin.slice){const t=[],n=this.v;e.sssiter$(n.length,(e=>{t.push(n[e])}));let{start:i,stop:r,step:s}=e.slice$indices(n.length);return i=Sk.misceval.asIndex(n[i])||this.start,r=Sk.misceval.asIndex(n[r])||this.stop,s="number"==typeof this.step?s*this.step:JSBI.multiply(this.step,JSBI.BigInt(s)),new Sk.builtin.range_(i,r,s,t)}throw new Sk.builtin.TypeError("range indices must be integers or slices, not "+Sk.abstr.typeName(e))}},getsets:{start:{$get(){return new Sk.builtin.int_(this.start)}},step:{$get(){return new Sk.builtin.int_(this.step)}},stop:{$get(){return new Sk.builtin.int_(this.stop)}}},methods:{__reversed__:{$meth(){return new s(this)},$flags:{NoArgs:!0},$textsig:null,$doc:"Return a reverse iterator."},count:{$meth(e){let t=0;for(let n=0;n<this.v.length;n++)Sk.misceval.richCompareBool(e,this.v[n],"Eq")&&t++;return new Sk.builtin.int_(t)},$flags:{OneArg:!0},$textsig:null,$doc:"rangeobject.count(value) -> integer -- return number of occurrences of value"},index:{$meth(e){for(let t=0;t<this.v.length;t++)if(Sk.misceval.richCompareBool(e,this.v[t],"Eq"))return new Sk.builtin.int_(t);throw new Sk.builtin.ValueError(Sk.misceval.objectRepr(e)+"is not in range")},$flags:{OneArg:!0},$textsig:null,$doc:"rangeobject.index(value, [start, [stop]]) -> integer -- return index of value.\nRaise ValueError if the value is not present."}},proto:{sk$asarray(){return this.v.slice(0)}},flags:{sk$acceptable_as_base_class:!1}});var r=Sk.abstr.buildIteratorClass("range_iterator",{constructor:function(e){this.$index=0,this.$seq=e.v},iternext(){return this.$seq[this.$index++]},methods:{__length_hint__:Sk.generic.iterLengthHintWithArrayMethodDef},flags:{sk$acceptable_as_base_class:!1}}),s=Sk.abstr.buildIteratorClass("range_reverseiterator",{constructor:function(e){this.$seq=e.v,this.$index=this.$seq.length-1},iternext(){return this.$seq[this.$index--]},methods:{__length_hint__:Sk.generic.iterReverseLengthHintMethodDef},flags:{sk$acceptable_as_base_class:!1}});Sk.builtin.range=Sk.builtin.xrange=function(e,t,i){return e=n(e,t,i),new Sk.builtin.list(e.v)}},function(e,t){Sk.builtin.enumerate=Sk.abstr.buildIteratorClass("enumerate",{constructor:function(e,t){if(!(this instanceof Sk.builtin.enumerate))throw TypeError("Failed to construct 'enumerate': Please use the 'new' operator");return this.$iterable=e,this.$index=t,this},iternext(e){const t=Sk.misceval.chain(this.$iterable.tp$iternext(e),(e=>{if(void 0!==e)return new Sk.builtin.tuple([new Sk.builtin.int_(this.$index++),e])}));return e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)},slots:{tp$doc:"Return an enumerate object.\n\n iterable\n an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ...",tp$new(e,t){let[n,i]=Sk.abstr.copyKeywordsToNamedArgs("enumerate",["iterable","start"],e,t,[new Sk.builtin.int_(0)]);return n=Sk.abstr.iter(n),i=Sk.misceval.asIndexOrThrow(i),this===Sk.builtin.enumerate.prototype?new Sk.builtin.enumerate(n,i):(e=new this.constructor,Sk.builtin.enumerate.call(e,n,i),e)}}}),Sk.exportSymbol("Sk.builtin.enumerate",Sk.builtin.enumerate)},function(e,t){Sk.builtin.filter_=Sk.abstr.buildIteratorClass("filter",{constructor:function(e,t){this.$func=e,this.$iterable=t},iternext(e){const t=Sk.misceval.iterFor(this.$iterable,(e=>Sk.misceval.chain(this.check$filter(e),(e=>e?new Sk.misceval.Break(e):void 0))));return e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)},slots:{tp$doc:"Return an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true.",tp$new(e,t){let[n,i]=Sk.abstr.copyKeywordsToNamedArgs("filter",["predicate","iterable"],e,t,[]);return n=Sk.builtin.checkNone(n)?null:n,i=Sk.abstr.iter(i),this===Sk.builtin.filter_.prototype?new Sk.builtin.filter_(n,i):(e=new this.constructor,Sk.builtin.filter_.call(e,n,i),e)}},proto:{check$filter(e){let t;return t=null===this.$func?e:Sk.misceval.callsimOrSuspendArray(this.$func,[e]),Sk.misceval.chain(t,(t=>Sk.misceval.isTrue(t)?e:void 0))}}}),Sk.exportSymbol("Sk.builtin.filter_",Sk.builtin.filter_)},function(e,t){Sk.builtin.map_=Sk.abstr.buildIteratorClass("map",{constructor:function(e,t){this.$func=e,this.$iters=t},iternext(e){const t=[],n=Sk.misceval.chain(Sk.misceval.iterArray(this.$iters,(n=>Sk.misceval.chain(n.tp$iternext(e),(e=>{if(void 0===e)return new Sk.misceval.Break(!0);t.push(e)})))),(e=>e?void 0:Sk.misceval.callsimOrSuspendArray(this.$func,t)));return e?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)},slots:{tp$doc:"map(func, *iterables) --\x3e map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables. Stops when the shortest iterable is exhausted.",tp$new(e,t){this===Sk.builtin.map_.prototype&&Sk.abstr.checkNoKwargs("map",t),Sk.abstr.checkArgsLen("map",e,2),t=e[0];const n=[];for(let t=1;t<e.length;t++)n.push(Sk.abstr.iter(e[t]));return this===Sk.builtin.map_.prototype?new Sk.builtin.map_(t,n):(e=new this.constructor,Sk.builtin.map_.call(e,t,n),e)}}}),Sk.exportSymbol("Sk.builtin.map_",Sk.builtin.map_)},function(e,t){Sk.builtin.reversed=Sk.abstr.buildIteratorClass("reversed",{constructor:function(e){return this.$idx=e.sq$length()-1,this.$seq=e,this},iternext(e){if(!(0>this.$idx)){var t=Sk.misceval.tryCatch((()=>Sk.abstr.objectGetItem(this.$seq,new Sk.builtin.int_(this.$idx--),e)),(e=>{if(!(e instanceof Sk.builtin.IndexError))throw e;this.$idx=-1}));return e?t:Sk.misceval.retryOptionalSuspensionOrThrow(t)}},slots:{tp$doc:"Return a reverse iterator over the values of the given sequence.",tp$new(e,t){if(this===Sk.builtin.reversed.prototype&&Sk.abstr.checkNoKwargs("reversed",t),Sk.abstr.checkArgsLen("reversed",e,1,1),e=e[0],void 0!==(t=Sk.abstr.lookupSpecial(e,Sk.builtin.str.$reversed)))return Sk.misceval.callsimArray(t,[]);if(!Sk.builtin.checkSequence(e)||void 0===Sk.abstr.lookupSpecial(e,Sk.builtin.str.$len))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(e)+"' object is not a sequence");return this===Sk.builtin.reversed.prototype?new Sk.builtin.reversed(e):(t=new this.constructor,Sk.builtin.reversed.call(t,e),t)}},methods:{__length_hint__:{$meth:function(){return 0<=this.$idx?new Sk.builtin.int_(this.$idx):new Sk.builtin.int_(0)},$flags:{NoArgs:!0}}}})},function(e,t){Sk.builtin.zip_=Sk.abstr.buildIteratorClass("zip",{constructor:function(e){this.$iters=e,0===e.length&&(this.tp$iternext=()=>{})},iternext(e){const t=[],n=Sk.misceval.chain(Sk.misceval.iterArray(this.$iters,(n=>Sk.misceval.chain(n.tp$iternext(e),(e=>{if(void 0===e)return new Sk.misceval.Break(!0);t.push(e)})))),(e=>e?void 0:new Sk.builtin.tuple(t)));return e?n:Sk.misceval.retryOptionalSuspensionOrThrow(n)},slots:{tp$doc:"zip(iter1 [,iter2 [...]]) --\x3e zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument. The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration.",tp$new(e,t){this===Sk.builtin.zip_.prototype&&Sk.abstr.checkNoKwargs("zip",t),t=[];for(let n=0;n<e.length;n++)try{t.push(Sk.abstr.iter(e[n]))}catch(e){if(e instanceof Sk.builtin.TypeError)throw new Sk.builtin.TypeError("zip argument #"+(n+1)+" must support iteration");throw e}return this===Sk.builtin.zip_.prototype?new Sk.builtin.zip_(t):(e=new this.constructor,Sk.builtin.zip_.call(e,t),e)}}}),Sk.exportSymbol("Sk.builtin.zip_",Sk.builtin.zip_)},function(e,t){var n={T_ENDMARKER:0,T_NAME:1,T_NUMBER:2,T_STRING:3,T_NEWLINE:4,T_INDENT:5,T_DEDENT:6,T_LPAR:7,T_RPAR:8,T_LSQB:9,T_RSQB:10,T_COLON:11,T_COMMA:12,T_SEMI:13,T_PLUS:14,T_MINUS:15,T_STAR:16,T_SLASH:17,T_VBAR:18,T_AMPER:19,T_LESS:20,T_GREATER:21,T_EQUAL:22,T_DOT:23,T_PERCENT:24,T_LBRACE:25,T_RBRACE:26,T_EQEQUAL:27,T_NOTEQUAL:28,T_LESSEQUAL:29,T_GREATEREQUAL:30,T_TILDE:31,T_CIRCUMFLEX:32,T_LEFTSHIFT:33,T_RIGHTSHIFT:34,T_DOUBLESTAR:35,T_PLUSEQUAL:36,T_MINEQUAL:37,T_STAREQUAL:38,T_SLASHEQUAL:39,T_PERCENTEQUAL:40,T_AMPEREQUAL:41,T_VBAREQUAL:42,T_CIRCUMFLEXEQUAL:43,T_LEFTSHIFTEQUAL:44,T_RIGHTSHIFTEQUAL:45,T_DOUBLESTAREQUAL:46,T_DOUBLESLASH:47,T_DOUBLESLASHEQUAL:48,T_AT:49,T_ATEQUAL:50,T_RARROW:51,T_ELLIPSIS:52,T_OP:53,T_AWAIT:54,T_ASYNC:55,T_ERRORTOKEN:56,T_NT_OFFSET:256,T_N_TOKENS:60,T_COMMENT:57,T_NL:58,T_ENCODING:59};e={"!=":n.T_NOTEQUAL,"%":n.T_PERCENT,"%=":n.T_PERCENTEQUAL,"&":n.T_AMPER,"&=":n.T_AMPEREQUAL,"(":n.T_LPAR,")":n.T_RPAR,"*":n.T_STAR,"**":n.T_DOUBLESTAR,"**=":n.T_DOUBLESTAREQUAL,"*=":n.T_STAREQUAL,"+":n.T_PLUS,"+=":n.T_PLUSEQUAL,",":n.T_COMMA,"-":n.T_MINUS,"-=":n.T_MINEQUAL,"->":n.T_RARROW,".":n.T_DOT,"...":n.T_ELLIPSIS,"/":n.T_SLASH,"//":n.T_DOUBLESLASH,"//=":n.T_DOUBLESLASHEQUAL,"/=":n.T_SLASHEQUAL,":":n.T_COLON,";":n.T_SEMI,"<":n.T_LESS,"<<":n.T_LEFTSHIFT,"<<=":n.T_LEFTSHIFTEQUAL,"<=":n.T_LESSEQUAL,"=":n.T_EQUAL,"==":n.T_EQEQUAL,">":n.T_GREATER,">=":n.T_GREATEREQUAL,">>":n.T_RIGHTSHIFT,">>=":n.T_RIGHTSHIFTEQUAL,"@":n.T_AT,"@=":n.T_ATEQUAL,"[":n.T_LSQB,"]":n.T_RSQB,"^":n.T_CIRCUMFLEX,"^=":n.T_CIRCUMFLEXEQUAL,"{":n.T_LBRACE,"|":n.T_VBAR,"|=":n.T_VBAREQUAL,"}":n.T_RBRACE,"~":n.T_TILDE};var i={};!function(){for(var e in n)i[n[e]]=e}(),["tok_name","ISTERMINAL","ISNONTERMINAL","ISEOF"].concat(Object.keys(i).map((function(e){return i[e]}))),Sk.token={},Sk.token.tokens=n,Sk.token.tok_name=i,Sk.token.EXACT_TOKEN_TYPES=e,Sk.token.ISTERMINAL=function(e){return e<n.T_NT_OFFSET},Sk.token.ISNONTERMINAL=function(e){return e>=n.T_NT_OFFSET},Sk.token.ISEOF=function(e){return e==n.T_ENDMARKER},Sk.exportSymbol("Sk.token",Sk.token),Sk.exportSymbol("Sk.token.tokens",Sk.token.tokens),Sk.exportSymbol("Sk.token.tok_name",Sk.token.tok_name),Sk.exportSymbol("Sk.token.EXACT_TOKEN_TYPES"),Sk.exportSymbol("Sk.token.ISTERMINAL",Sk.token.ISTERMINAL),Sk.exportSymbol("Sk.token.ISNONTERMINAL",Sk.token.ISNONTERMINAL),Sk.exportSymbol("Sk.token.ISEOF",Sk.token.ISEOF)},function(e,t){function n(e,t,n,i,r){this.type=e,this.string=t,this.start=n,this.end=i,this.line=r}function i(e){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function r(e){return i.apply(null,arguments)+"?"}function s(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1}function o(){return" FR RF Br BR Fr r B R b bR f rb rB F Rf U rF u RB br fR fr rf Rb".split(" ")}function a(e){e?delete Sk.token.EXACT_TOKEN_TYPES["<>"]:Sk.token.EXACT_TOKEN_TYPES["<>"]=Sk.token.tokens.T_NOTEQUAL,f=Object.keys(Sk.token.EXACT_TOKEN_TYPES).sort(),_=i.apply(this,f.reverse().map((function(e){return e&&h.test(e)?e.replace(p,"\\$&"):e}))),m=i("\\r?\\n",_)}var l=Sk.token.tokens;const u=Sk.builtin.SyntaxError,c=Sk.builtin.SyntaxError;n.prototype.exact_type=function(){return this.type==l.T_OP&&this.string in Sk.token.EXACT_TOKEN_TYPES?Sk.token.EXACT_TOKEN_TYPES[this.string]:this.type};var p=/[\\^$.*+?()[\]{}|]/g,h=RegExp(p.source);const d=function(){var e=i("[A-Z]","[a-z]","[\\u{10B99}-\\u{10B9C}\\u{112A9}\\u{115DC}-\\u{115DD}\\u034F\\u115F-\\u1160\\u17B4-\\u17B5\\u2065\\u3164\\uFFA0\\uFFF0-\\uFFF8\\u{E0000}\\u{E0002}-\\u{E001F}\\u{E0080}-\\u{E00FF}\\u{E01F0}-\\u{E0FFF}\\u{112A9}\\u00D7]","[\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u06E5-\\u06E6\\u07F4-\\u07F5\\u0971\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1DFD-\\u1DFF\\u2E2F\\u30FC\\uA67F\\uA69C-\\uA69D\\uA717-\\uA71F\\uA788\\uA7F8-\\uA7F9\\uAB5C-\\uAB5F\\uFF70\\uFF9E-\\uFF9F\\u{16F93}-\\u{16F9F}\\u02D0-\\u02D1\\u0640\\u07FA\\u0E46\\u0EC6\\u1843\\u1AA7\\u1C7B\\u3005\\u3031-\\u3035\\u309D-\\u309E\\u30FC-\\u30FE\\uA015\\uA60C\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3-\\uAAF4\\uFF70\\u{16B42}-\\u{16B43}\\u{16FE0}-\\u{16FE1}\\u02B0-\\u02B8\\u02C0-\\u02C1\\u02E0-\\u02E4\\u037A\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C-\\u2C7D\\uA69C-\\uA69D\\uA770\\uA7F8-\\uA7F9\\uAB5C-\\uAB5F\\uFF9E-\\uFF9F\\u02B2\\u1D62\\u1DA4\\u1DA8\\u2071\\u2C7C\\u2E18-\\u2E19\\u2E2F]","[\\u2135-\\u2138\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u3006\\u3400-\\u4DB5\\u4E00-\\u9FEF\\uF900-\\uFA6D\\uFA70-\\uFAD9\\u{17000}-\\u{187F1}\\u{18800}-\\u{18AF2}\\u{1B170}-\\u{1B2FB}\\u{20000}-\\u{2A6D6}\\u{2A700}-\\u{2B734}\\u{2B740}-\\u{2B81D}\\u{2B820}-\\u{2CEA1}\\u{2CEB0}-\\u{2EBE0}\\u{2F800}-\\u{2FA1D}\\uAAC0\\uAAC2\\uFE20-\\uFE2F\\u{10D22}-\\u{10D23}\\u{1135D}\\u00AA\\u00BA\\u3400-\\u4DB5\\u4E00-\\u9FEF\\uFA0E-\\uFA0F\\uFA11\\uFA13-\\uFA14\\uFA1F\\uFA21\\uFA23-\\uFA24\\uFA27-\\uFA29\\u{20000}-\\u{2A6D6}\\u{2A700}-\\u{2B734}\\u{2B740}-\\u{2B81D}\\u{2B820}-\\u{2CEA1}\\u{2CEB0}-\\u{2EBE0}\\u115F-\\u1160\\u3164\\uFFA0\\u0673\\u17A3-\\u17A4\\u0E40-\\u0E44\\u0EC0-\\u0EC4\\u19B5-\\u19B7\\u19BA\\uAAB5-\\uAAB6\\uAAB9\\uAABB-\\uAABC]","[\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u2170-\\u217F\\u2160-\\u216F]","_","[\\u1885-\\u1886\\u2118\\u212E\\u309B-\\u309C]"),t=i(e,"[\\u104A-\\u104B\\u102B-\\u102C\\u102D-\\u1030\\u1031\\u1032-\\u1036\\u1038\\u103B-\\u103C\\u103D-\\u103E\\u1056-\\u1057\\u1058-\\u1059\\u105E-\\u1060\\u1062\\u1067-\\u1068\\u1071-\\u1074\\u1082\\u1083-\\u1084\\u1085-\\u1086\\u109C\\u109D\\u1037\\u1039-\\u103A\\u1087-\\u108C\\u108D\\u108F\\u109A-\\u109B\\uA9E5\\uAA7B\\uAA7C\\uAA7D\\uA9E6\\uAA70\\u104A-\\u104B]","[\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E-\\u094F\\u0982-\\u0983\\u09BE-\\u09C0\\u09C7-\\u09C8\\u09CB-\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB-\\u0ACC\\u0B02-\\u0B03\\u0B3E\\u0B40\\u0B47-\\u0B48\\u0B4B-\\u0B4C\\u0B57\\u0BBE-\\u0BBF\\u0BC1-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82-\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7-\\u0CC8\\u0CCA-\\u0CCB\\u0CD5-\\u0CD6\\u0D02-\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82-\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2-\\u0DF3\\u0F7F\\u102B-\\u102C\\u1031\\u1038\\u103B-\\u103C\\u1056-\\u1057\\u1062\\u1067-\\u1068\\u1083-\\u1084\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7-\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930-\\u1931\\u1933-\\u1938\\u1A19-\\u1A1A\\u1A55\\u1A57\\u1A61\\u1A63-\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B82\\u1BA1\\u1BA6-\\u1BA7\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1C24-\\u1C2B\\u1C34-\\u1C35\\u1CF2-\\u1CF3\\uA823-\\uA824\\uA827\\uA880-\\uA881\\uA8B4-\\uA8C3\\uA952\\uA983\\uA9B4-\\uA9B5\\uA9BA-\\uA9BB\\uA9BD-\\uA9BF\\uAA2F-\\uAA30\\uAA33-\\uAA34\\uAA4D\\uAAEB\\uAAEE-\\uAAEF\\uAAF5\\uABE3-\\uABE4\\uABE6-\\uABE7\\uABE9-\\uABEA\\u{11000}\\u{11002}\\u{11082}\\u{110B0}-\\u{110B2}\\u{110B7}-\\u{110B8}\\u{1112C}\\u{11145}-\\u{11146}\\u{11182}\\u{111B3}-\\u{111B5}\\u{111BF}\\u{1122C}-\\u{1122E}\\u{11232}-\\u{11233}\\u{112E0}-\\u{112E2}\\u{11302}-\\u{11303}\\u{1133E}-\\u{1133F}\\u{11341}-\\u{11344}\\u{11347}-\\u{11348}\\u{1134B}-\\u{1134C}\\u{11357}\\u{11362}-\\u{11363}\\u{11435}-\\u{11437}\\u{11440}-\\u{11441}\\u{11445}\\u{114B0}-\\u{114B2}\\u{114B9}\\u{114BB}-\\u{114BE}\\u{114C1}\\u{115AF}-\\u{115B1}\\u{115B8}-\\u{115BB}\\u{115BE}\\u{11630}-\\u{11632}\\u{1163B}-\\u{1163C}\\u{1163E}\\u{116AC}\\u{116AE}-\\u{116AF}\\u{11720}-\\u{11721}\\u{11726}\\u{1182C}-\\u{1182E}\\u{11838}\\u{11A39}\\u{11A57}-\\u{11A58}\\u{11A97}\\u{11C2F}\\u{11C3E}\\u{11CA9}\\u{11CB1}\\u{11CB4}\\u{11D8A}-\\u{11D8E}\\u{11D93}-\\u{11D94}\\u{11D96}\\u{11EF5}-\\u{11EF6}\\u{16F51}-\\u{16F7E}\\u0F3E-\\u0F3F\\u1087-\\u108C\\u108F\\u109A-\\u109B\\u1B44\\u1BAA\\u1CE1\\u1CF7\\u302E-\\u302F\\uA953\\uA9C0\\uAA7B\\uAA7D\\uABEC\\u{111C0}\\u{11235}\\u{1134D}\\u{116B6}\\u{1D16D}-\\u{1D172}\\u09BE\\u09D7\\u0B3E\\u0B57\\u0BBE\\u0BD7\\u0CC2\\u0CD5-\\u0CD6\\u0D3E\\u0D57\\u0DCF\\u0DDF\\u302E-\\u302F\\u{1133E}\\u{11357}\\u{114B0}\\u{114BD}\\u{115AF}\\u{1D165}\\u{1D16E}-\\u{1D172}]","[\\u{1D7CE}-\\u{1D7FF}\\uFF10-\\uFF19]","\\u2040","[\\u00B7\\u0387\\u1369-\\u1371\\u19DA]");return!1===RegExp().unicode?new RegExp("^"+e+"+"+t+"*$","u"):(e=i("[A-Z]","[a-z]","_"),t=i(e,"[0-9]"),new RegExp("^"+e+"+"+t+"*$"))}();!function(e){i.apply(null,arguments)}("\\\\\\r?\\n[ \\f\\t]*"),r("#[^\\r\\n]*"),e=i("[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?","\\.[0-9](?:_?[0-9])*")+r("[eE][-+]?[0-9](?:_?[0-9])*");var f,_,m,b=i(e,"[0-9](?:_?[0-9])*[eE][-+]?[0-9](?:_?[0-9])*"),g=i("[0-9](?:_?[0-9])*[jJ]",b+"[jJ]");e=i.apply(null,o()),t=i(e+"'''",e+'"""'),i(e+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",e+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"'),a(!0),Sk.token.setupTokens=a;var S=i(e+"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+i("'","\\\\\\r?\\n"),e+'"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+i('"',"\\\\\\r?\\n")),k=i("\\\\\\r?\\n|$","#[^\\r\\n]*",t),y={};e=o();for(let t of e)y[t+"'"]="^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'",y[t+'"']='^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',y[t+"'''"]="^[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",y[t+'"""']='^[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""';let v=[],T=[];for(let t of e)v.push(t+'"'),v.push(t+"'"),T.push(t+'"""'),T.push(t+"'''");Sk._tokenize=function(e,t,r,o){var a=Sk.__future__.python3?"":"(?:L?)";a=i("0[xX](?:_?[0-9a-fA-F])+"+a,"0[bB](?:_?[01])+"+a,Sk.__future__.silent_octal_literal?"0([oO]?)(?:_?[0-7])+"+a:"0([oO])(?:_?[0-7])+"+a,"(?:0(?:_?0)*|[1-9](?:_?[0-9])*)"+a),a=i(g,b,a),a="[ \\f\\t]*"+i(k,a,m,S,"\\w+"),a=new RegExp(a);var p,h,f,_=0,E=0,I=0,w="",x=0,A=null,$=[0],O=void 0,M=void 0;void 0!==r&&("utf-8-sig"==r&&(r="utf-8"),o(new n(l.T_ENCODING,r,[0,0],[0,0],"")));for(var C=r="";;){try{r=C,C=t()}catch(e){C=""}_+=1;var R=0,N=C.length;if(w){if(!C)throw new u("EOF in multi-line string",e,M[0],M[1]);O.lastIndex=0;var L=O.exec(C);if(!L){x&&"\\\n"!==C.substring(C.length-2)&&"\\\r\n"!==C.substring(C.length-3)?(o(new n(l.T_ERRORTOKEN,w+C,M,[_,C.length],A)),w="",A=null):(w+=C,A+=C);continue}R=h=L[0].length,o(new n(l.T_STRING,w+C.substring(0,h),M,[_,h],A+C)),w="",x=0,A=null}else if(0!=E||I){if(!C)throw new u("EOF in multi-line statement",e,_,0);I=0}else{if(!C)break;for(p=0;R<N;){if(" "==C[R])p+=1;else if("\t"==C[R])p=8*Math.floor(p/8+1);else{if("\f"!=C[R])break;p=0}R+=1}if(R==N)break;if(s("#\r\n",C[R])){if("#"==C[R]){for(N=(p=C.substring(R)).length;0<N&&-1!=="\r\n".indexOf(p.charAt(N-1));--N);N=p.substring(0,N),o(new n(l.T_COMMENT,N,[_,R],[_,R+N.length],C)),R+=N.length}o(new n(l.T_NL,C.substring(R),[_,R],[_,C.length],C));continue}for(p>$[$.length-1]&&($.push(p),o(new n(l.T_INDENT,C.substring(R),[_,0],[_,R],C)));p<$[$.length-1];){if(!s($,p))throw new c("unindent does not match any outer indentation level",e,_,R);$=$.slice(0,-1),o(new n(l.T_DEDENT,"",[_,R],[_,R],C))}}for(;R<N;){for(p=C.charAt(R);" "===p||"\f"===p||"\t"===p;)R+=1,p=C.charAt(R);if(f=a.exec(C.substring(R))){if(h=(p=R)+f[1].length,f=[_,p],L=[_,h],R=h,p!=h){h=C.substring(p,h);var D=C[p];if(s("0123456789",D)||"."==D&&"."!=h&&"..."!=h)o(new n(l.T_NUMBER,h,f,L,C));else if(s("\r\n",D))o(new n(0<E?l.T_NL:l.T_NEWLINE,h,f,L,C));else if("#"==D)o(new n(l.T_COMMENT,h,f,L,C));else if(s(T,h)){if(!(L=(O=RegExp(y[h])).exec(C.substring(R)))){M=[_,p],w=C.substring(p),A=C;break}R=L[0].length+R,h=C.substring(p,R),o(new n(l.T_STRING,h,f,[_,R],C))}else if(s(v,D)||s(v,h.substring(0,2))||s(v,h.substring(0,3))){if("\n"==h[h.length-1]){M=[_,p],O=RegExp(y[D]||y[h[1]]||y[h[2]]),w=C.substring(p),x=1,A=C;break}o(new n(l.T_STRING,h,f,L,C))}else p=D.normalize("NFKC"),d.test(p)?o(new n(l.T_NAME,h,f,L,C)):"\\"==D?I=1:(s("([{",D)?E+=1:s(")]}",D)&&--E,o(new n(l.T_OP,h,f,L,C)))}}else o(new n(l.T_ERRORTOKEN,C[R],[_,R],[_,R+1],C)),R+=1}}for(var P in r&&!s("\r\n",r[r.length-1])&&o(new n(l.T_NEWLINE,"",[_-1,r.length],[_-1,r.length+1],"")),$.slice(1))o(new n(l.T_DEDENT,"",[_,0],[_,0],""));o(new n(l.T_ENDMARKER,"",[_,0],[_,0],""))},Sk.exportSymbol("Sk._tokenize",Sk._tokenize)},function(e,t){Sk.OpMap={"(":Sk.token.tokens.T_LPAR,")":Sk.token.tokens.T_RPAR,"[":Sk.token.tokens.T_LSQB,"]":Sk.token.tokens.T_RSQB,":":Sk.token.tokens.T_COLON,",":Sk.token.tokens.T_COMMA,";":Sk.token.tokens.T_SEMI,"+":Sk.token.tokens.T_PLUS,"-":Sk.token.tokens.T_MINUS,"*":Sk.token.tokens.T_STAR,"/":Sk.token.tokens.T_SLASH,"|":Sk.token.tokens.T_VBAR,"&":Sk.token.tokens.T_AMPER,"<":Sk.token.tokens.T_LESS,">":Sk.token.tokens.T_GREATER,"=":Sk.token.tokens.T_EQUAL,".":Sk.token.tokens.T_DOT,"%":Sk.token.tokens.T_PERCENT,"`":Sk.token.tokens.T_BACKQUOTE,"{":Sk.token.tokens.T_LBRACE,"}":Sk.token.tokens.T_RBRACE,"@":Sk.token.tokens.T_AT,"@=":Sk.token.tokens.T_ATEQUAL,"==":Sk.token.tokens.T_EQEQUAL,"!=":Sk.token.tokens.T_NOTEQUAL,"<>":Sk.token.tokens.T_NOTEQUAL,"<=":Sk.token.tokens.T_LESSEQUAL,">=":Sk.token.tokens.T_GREATEREQUAL,"~":Sk.token.tokens.T_TILDE,"^":Sk.token.tokens.T_CIRCUMFLEX,"<<":Sk.token.tokens.T_LEFTSHIFT,">>":Sk.token.tokens.T_RIGHTSHIFT,"**":Sk.token.tokens.T_DOUBLESTAR,"+=":Sk.token.tokens.T_PLUSEQUAL,"-=":Sk.token.tokens.T_MINEQUAL,"*=":Sk.token.tokens.T_STAREQUAL,"/=":Sk.token.tokens.T_SLASHEQUAL,"%=":Sk.token.tokens.T_PERCENTEQUAL,"&=":Sk.token.tokens.T_AMPEREQUAL,"|=":Sk.token.tokens.T_VBAREQUAL,"^=":Sk.token.tokens.T_CIRCUMFLEXEQUAL,"<<=":Sk.token.tokens.T_LEFTSHIFTEQUAL,">>=":Sk.token.tokens.T_RIGHTSHIFTEQUAL,"**=":Sk.token.tokens.T_DOUBLESTAREQUAL,"//":Sk.token.tokens.T_DOUBLESLASH,"//=":Sk.token.tokens.T_DOUBLESLASHEQUAL,"->":Sk.token.tokens.T_RARROW,"...":Sk.token.tokens.T_ELLIPSIS},Sk.ParseTables={sym:{and_expr:257,and_test:258,annassign:259,arglist:260,argument:261,arith_expr:262,assert_stmt:263,async_funcdef:264,async_stmt:265,atom:266,atom_expr:267,augassign:268,break_stmt:269,classdef:270,comp_for:271,comp_if:272,comp_iter:273,comp_op:274,comparison:275,compound_stmt:276,continue_stmt:277,debugger_stmt:278,decorated:279,decorator:280,decorators:281,del_stmt:282,dictorsetmaker:283,dotted_as_name:284,dotted_as_names:285,dotted_name:286,encoding_decl:287,eval_input:288,except_clause:289,expr:290,expr_stmt:291,exprlist:292,factor:293,file_input:294,flow_stmt:295,for_stmt:296,funcdef:297,global_stmt:298,if_stmt:299,import_as_name:300,import_as_names:301,import_from:302,import_name:303,import_stmt:304,lambdef:305,lambdef_nocond:306,nonlocal_stmt:307,not_test:308,or_test:309,parameters:310,pass_stmt:311,power:312,print_stmt:313,raise_stmt:314,return_stmt:315,shift_expr:316,simple_stmt:317,single_input:256,sliceop:318,small_stmt:319,star_expr:320,stmt:321,subscript:322,subscriptlist:323,suite:324,term:325,test:326,test_nocond:327,testlist:328,testlist_comp:329,testlist_star_expr:330,tfpdef:331,trailer:332,try_stmt:333,typedargslist:334,varargslist:335,vfpdef:336,while_stmt:337,with_item:338,with_stmt:339,xor_expr:340,yield_arg:341,yield_expr:342,yield_stmt:343},number2symbol:{256:"single_input",257:"and_expr",258:"and_test",259:"annassign",260:"arglist",261:"argument",262:"arith_expr",263:"assert_stmt",264:"async_funcdef",265:"async_stmt",266:"atom",267:"atom_expr",268:"augassign",269:"break_stmt",270:"classdef",271:"comp_for",272:"comp_if",273:"comp_iter",274:"comp_op",275:"comparison",276:"compound_stmt",277:"continue_stmt",278:"debugger_stmt",279:"decorated",280:"decorator",281:"decorators",282:"del_stmt",283:"dictorsetmaker",284:"dotted_as_name",285:"dotted_as_names",286:"dotted_name",287:"encoding_decl",288:"eval_input",289:"except_clause",290:"expr",291:"expr_stmt",292:"exprlist",293:"factor",294:"file_input",295:"flow_stmt",296:"for_stmt",297:"funcdef",298:"global_stmt",299:"if_stmt",300:"import_as_name",301:"import_as_names",302:"import_from",303:"import_name",304:"import_stmt",305:"lambdef",306:"lambdef_nocond",307:"nonlocal_stmt",308:"not_test",309:"or_test",310:"parameters",311:"pass_stmt",312:"power",313:"print_stmt",314:"raise_stmt",315:"return_stmt",316:"shift_expr",317:"simple_stmt",318:"sliceop",319:"small_stmt",320:"star_expr",321:"stmt",322:"subscript",323:"subscriptlist",324:"suite",325:"term",326:"test",327:"test_nocond",328:"testlist",329:"testlist_comp",330:"testlist_star_expr",331:"tfpdef",332:"trailer",333:"try_stmt",334:"typedargslist",335:"varargslist",336:"vfpdef",337:"while_stmt",338:"with_item",339:"with_stmt",340:"xor_expr",341:"yield_arg",342:"yield_expr",343:"yield_stmt"},dfas:{256:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1}],257:[[[[44,1]],[[45,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],258:[[[[46,1]],[[47,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],259:[[[[48,1]],[[49,2]],[[50,3],[0,2]],[[49,4]],[[0,4]]],{48:1}],260:[[[[51,1]],[[52,2],[0,1]],[[51,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],261:[[[[49,1],[15,2],[53,2]],[[50,2],[54,3],[0,1]],[[49,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],262:[[[[55,1]],[[30,0],[43,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],263:[[[[24,1]],[[49,2]],[[52,3],[0,2]],[[49,4]],[[0,4]]],{24:1}],264:[[[[10,1]],[[56,2]],[[0,2]]],{10:1}],265:[[[[10,1]],[[57,2],[56,2],[58,2]],[[0,2]]],{10:1}],266:[[[[6,1],[25,1],[33,1],[9,1],[11,1],[12,2],[35,3],[38,4],[19,1],[7,5]],[[0,1]],[[59,1],[60,6]],[[61,1],[62,7],[63,7]],[[64,1],[63,8]],[[7,5],[0,5]],[[59,1]],[[61,1]],[[64,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,33:1,35:1,38:1}],267:[[[[29,1],[65,2]],[[65,2]],[[66,2],[0,2]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,29:1,33:1,35:1,38:1}],268:[[[[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1]],[[0,1]]],{67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:1,75:1,76:1,77:1,78:1,79:1}],269:[[[[39,1]],[[0,1]]],{39:1}],270:[[[[13,1]],[[25,2]],[[48,3],[35,4]],[[80,5]],[[61,6],[81,7]],[[0,5]],[[48,3]],[[61,6]]],{13:1}],271:[[[[10,1],[34,2]],[[34,2]],[[82,3]],[[83,4]],[[84,5]],[[85,6],[0,5]],[[0,6]]],{10:1,34:1}],272:[[[[37,1]],[[86,2]],[[85,3],[0,2]],[[0,3]]],{37:1}],273:[[[[87,1],[54,1]],[[0,1]]],{10:1,34:1,37:1}],274:[[[[88,1],[89,1],[8,2],[90,1],[88,1],[83,1],[91,1],[92,3],[93,1],[94,1]],[[0,1]],[[83,1]],[[8,1],[0,3]]],{8:1,83:1,88:1,89:1,90:1,91:1,92:1,93:1,94:1}],275:[[[[95,1]],[[96,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],276:[[[[97,1],[98,1],[58,1],[99,1],[57,1],[100,1],[56,1],[101,1],[102,1]],[[0,1]]],{4:1,10:1,13:1,20:1,21:1,34:1,37:1,41:1,42:1}],277:[[[[40,1]],[[0,1]]],{40:1}],278:[[[[17,1]],[[0,1]]],{17:1}],279:[[[[103,1]],[[56,2],[104,2],[99,2]],[[0,2]]],{41:1}],280:[[[[41,1]],[[105,2]],[[2,4],[35,3]],[[61,5],[81,6]],[[0,4]],[[2,4]],[[61,5]]],{41:1}],281:[[[[106,1]],[[106,1],[0,1]]],{41:1}],282:[[[[27,1]],[[82,2]],[[0,2]]],{27:1}],283:[[[[49,1],[107,2],[53,3]],[[48,4],[54,5],[52,6],[0,1]],[[54,5],[52,6],[0,2]],[[95,7]],[[49,7]],[[0,5]],[[49,8],[107,8],[0,6]],[[54,5],[52,9],[0,7]],[[52,6],[0,8]],[[49,10],[53,11],[0,9]],[[48,12]],[[95,13]],[[49,13]],[[52,9],[0,13]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,53:1}],284:[[[[105,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],{25:1}],285:[[[[109,1]],[[52,0],[0,1]]],{25:1}],286:[[[[25,1]],[[110,0],[0,1]]],{25:1}],287:[[[[25,1]],[[0,1]]],{25:1}],288:[[[[111,1]],[[2,1],[112,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],289:[[[[113,1]],[[49,2],[0,1]],[[108,3],[52,3],[0,2]],[[49,4]],[[0,4]]],{113:1}],290:[[[[114,1]],[[115,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],291:[[[[116,1]],[[117,2],[50,3],[118,4],[0,1]],[[111,4],[62,4]],[[116,5],[62,5]],[[0,4]],[[50,3],[0,5]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],292:[[[[95,1],[107,1]],[[52,2],[0,1]],[[95,1],[107,1],[0,2]]],{6:1,7:1,9:1,11:1,12:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],293:[[[[119,2],[30,1],[22,1],[43,1]],[[120,2]],[[0,2]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],294:[[[[2,0],[112,1],[121,0]],[[0,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1,112:1}],295:[[[[122,1],[123,1],[124,1],[125,1],[126,1]],[[0,1]]],{5:1,23:1,31:1,39:1,40:1}],296:[[[[34,1]],[[82,2]],[[83,3]],[[111,4]],[[48,5]],[[80,6]],[[127,7],[0,6]],[[48,8]],[[80,9]],[[0,9]]],{34:1}],297:[[[[4,1]],[[25,2]],[[128,3]],[[48,4],[129,5]],[[80,6]],[[49,7]],[[0,6]],[[48,4]]],{4:1}],298:[[[[26,1]],[[25,2]],[[52,1],[0,2]]],{26:1}],299:[[[[37,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[130,1],[0,4]],[[48,6]],[[80,7]],[[0,7]]],{37:1}],300:[[[[25,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],{25:1}],301:[[[[131,1]],[[52,2],[0,1]],[[131,1],[0,2]]],{25:1}],302:[[[[36,1]],[[105,2],[19,3],[110,3]],[[32,4]],[[105,2],[19,3],[32,4],[110,3]],[[132,5],[15,5],[35,6]],[[0,5]],[[132,7]],[[61,5]]],{36:1}],303:[[[[32,1]],[[133,2]],[[0,2]]],{32:1}],304:[[[[134,1],[135,1]],[[0,1]]],{32:1,36:1}],305:[[[[14,1]],[[48,2],[136,3]],[[49,4]],[[48,2]],[[0,4]]],{14:1}],306:[[[[14,1]],[[48,2],[136,3]],[[86,4]],[[48,2]],[[0,4]]],{14:1}],307:[[[[18,1]],[[25,2]],[[52,1],[0,2]]],{18:1}],308:[[[[8,1],[137,2]],[[46,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],309:[[[[138,1]],[[139,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],310:[[[[35,1]],[[61,2],[140,3]],[[0,2]],[[61,2]]],{35:1}],311:[[[[28,1]],[[0,1]]],{28:1}],312:[[[[141,1]],[[53,2],[0,1]],[[120,3]],[[0,3]]],{6:1,7:1,9:1,11:1,12:1,19:1,25:1,29:1,33:1,35:1,38:1}],313:[[[[16,1]],[[49,2],[142,3],[0,1]],[[52,4],[0,2]],[[49,5]],[[49,2],[0,4]],[[52,6],[0,5]],[[49,7]],[[52,8],[0,7]],[[49,7],[0,8]]],{16:1}],314:[[[[5,1]],[[49,2],[0,1]],[[36,3],[52,3],[0,2]],[[49,4]],[[52,5],[0,4]],[[49,6]],[[0,6]]],{5:1}],315:[[[[23,1]],[[111,2],[0,1]],[[0,2]]],{23:1}],316:[[[[143,1]],[[144,0],[142,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],317:[[[[145,1]],[[2,2],[146,3]],[[0,2]],[[145,1],[2,2]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,35:1,36:1,38:1,39:1,40:1,43:1}],318:[[[[48,1]],[[49,2],[0,1]],[[0,2]]],{48:1}],319:[[[[147,1],[148,1],[149,1],[150,1],[151,1],[152,1],[153,1],[154,1],[155,1],[156,1]],[[0,1]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,35:1,36:1,38:1,39:1,40:1,43:1}],320:[[[[15,1]],[[95,2]],[[0,2]]],{15:1}],321:[[[[1,1],[3,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1}],322:[[[[49,1],[48,2]],[[48,2],[0,1]],[[49,3],[157,4],[0,2]],[[157,4],[0,3]],[[0,4]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,48:1}],323:[[[[158,1]],[[52,2],[0,1]],[[158,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1,48:1}],324:[[[[1,1],[2,2]],[[0,1]],[[159,3]],[[121,4]],[[160,1],[121,4]]],{2:1,5:1,6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,16:1,17:1,18:1,19:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,35:1,36:1,38:1,39:1,40:1,43:1}],325:[[[[120,1]],[[161,0],[15,0],[162,0],[41,0],[163,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],326:[[[[84,1],[164,2]],[[37,3],[0,1]],[[0,2]],[[84,4]],[[127,5]],[[49,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],327:[[[[165,1],[84,1]],[[0,1]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],328:[[[[49,1]],[[52,2],[0,1]],[[49,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],329:[[[[49,1],[107,1]],[[54,2],[52,3],[0,1]],[[0,2]],[[49,4],[107,4],[0,3]],[[52,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],330:[[[[49,1],[107,1]],[[52,2],[0,1]],[[49,1],[107,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,15:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],331:[[[[25,1]],[[48,2],[0,1]],[[49,3]],[[0,3]]],{25:1}],332:[[[[35,1],[110,2],[38,3]],[[61,4],[81,5]],[[25,4]],[[166,6]],[[0,4]],[[61,4]],[[64,4]]],{35:1,38:1,110:1}],333:[[[[20,1]],[[48,2]],[[80,3]],[[167,4],[168,5]],[[48,6]],[[48,7]],[[80,8]],[[80,9]],[[167,4],[127,10],[168,5],[0,8]],[[0,9]],[[48,11]],[[80,12]],[[168,5],[0,12]]],{20:1}],334:[[[[15,1],[169,2],[53,3]],[[169,4],[52,5],[0,1]],[[50,6],[52,7],[0,2]],[[169,8]],[[52,5],[0,4]],[[169,9],[53,3],[0,5]],[[49,10]],[[15,11],[169,2],[53,3],[0,7]],[[52,12],[0,8]],[[50,13],[52,5],[0,9]],[[52,7],[0,10]],[[169,14],[52,15],[0,11]],[[0,12]],[[49,4]],[[52,15],[0,14]],[[169,16],[53,3],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],{15:1,25:1,53:1}],335:[[[[15,1],[53,2],[170,3]],[[170,5],[52,4],[0,1]],[[170,6]],[[50,7],[52,8],[0,3]],[[53,2],[170,9],[0,4]],[[52,4],[0,5]],[[52,10],[0,6]],[[49,11]],[[15,12],[53,2],[170,3],[0,8]],[[50,13],[52,4],[0,9]],[[0,10]],[[52,8],[0,11]],[[52,15],[170,14],[0,12]],[[49,5]],[[52,15],[0,14]],[[53,2],[170,16],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],{15:1,25:1,53:1}],336:[[[[25,1]],[[0,1]]],{25:1}],337:[[[[21,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[0,4]],[[48,6]],[[80,7]],[[0,7]]],{21:1}],338:[[[[49,1]],[[108,2],[0,1]],[[95,3]],[[0,3]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],339:[[[[42,1]],[[171,2]],[[48,3],[52,1]],[[80,4]],[[0,4]]],{42:1}],340:[[[[172,1]],[[173,0],[0,1]]],{6:1,7:1,9:1,11:1,12:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,38:1,43:1}],341:[[[[111,2],[36,1]],[[49,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,12:1,14:1,19:1,22:1,25:1,29:1,30:1,33:1,35:1,36:1,38:1,43:1}],342:[[[[31,1]],[[174,2],[0,1]],[[0,2]]],{31:1}],343:[[[[62,1]],[[0,1]]],{31:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],[[[44,1]],[[45,0],[0,1]]],[[[46,1]],[[47,0],[0,1]]],[[[48,1]],[[49,2]],[[50,3],[0,2]],[[49,4]],[[0,4]]],[[[51,1]],[[52,2],[0,1]],[[51,1],[0,2]]],[[[49,1],[15,2],[53,2]],[[50,2],[54,3],[0,1]],[[49,3]],[[0,3]]],[[[55,1]],[[30,0],[43,0],[0,1]]],[[[24,1]],[[49,2]],[[52,3],[0,2]],[[49,4]],[[0,4]]],[[[10,1]],[[56,2]],[[0,2]]],[[[10,1]],[[57,2],[56,2],[58,2]],[[0,2]]],[[[6,1],[25,1],[33,1],[9,1],[11,1],[12,2],[35,3],[38,4],[19,1],[7,5]],[[0,1]],[[59,1],[60,6]],[[61,1],[62,7],[63,7]],[[64,1],[63,8]],[[7,5],[0,5]],[[59,1]],[[61,1]],[[64,1]]],[[[29,1],[65,2]],[[65,2]],[[66,2],[0,2]]],[[[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1]],[[0,1]]],[[[39,1]],[[0,1]]],[[[13,1]],[[25,2]],[[48,3],[35,4]],[[80,5]],[[61,6],[81,7]],[[0,5]],[[48,3]],[[61,6]]],[[[10,1],[34,2]],[[34,2]],[[82,3]],[[83,4]],[[84,5]],[[85,6],[0,5]],[[0,6]]],[[[37,1]],[[86,2]],[[85,3],[0,2]],[[0,3]]],[[[87,1],[54,1]],[[0,1]]],[[[88,1],[89,1],[8,2],[90,1],[88,1],[83,1],[91,1],[92,3],[93,1],[94,1]],[[0,1]],[[83,1]],[[8,1],[0,3]]],[[[95,1]],[[96,0],[0,1]]],[[[97,1],[98,1],[58,1],[99,1],[57,1],[100,1],[56,1],[101,1],[102,1]],[[0,1]]],[[[40,1]],[[0,1]]],[[[17,1]],[[0,1]]],[[[103,1]],[[56,2],[104,2],[99,2]],[[0,2]]],[[[41,1]],[[105,2]],[[2,4],[35,3]],[[61,5],[81,6]],[[0,4]],[[2,4]],[[61,5]]],[[[106,1]],[[106,1],[0,1]]],[[[27,1]],[[82,2]],[[0,2]]],[[[49,1],[107,2],[53,3]],[[48,4],[54,5],[52,6],[0,1]],[[54,5],[52,6],[0,2]],[[95,7]],[[49,7]],[[0,5]],[[49,8],[107,8],[0,6]],[[54,5],[52,9],[0,7]],[[52,6],[0,8]],[[49,10],[53,11],[0,9]],[[48,12]],[[95,13]],[[49,13]],[[52,9],[0,13]]],[[[105,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],[[[109,1]],[[52,0],[0,1]]],[[[25,1]],[[110,0],[0,1]]],[[[25,1]],[[0,1]]],[[[111,1]],[[2,1],[112,2]],[[0,2]]],[[[113,1]],[[49,2],[0,1]],[[108,3],[52,3],[0,2]],[[49,4]],[[0,4]]],[[[114,1]],[[115,0],[0,1]]],[[[116,1]],[[117,2],[50,3],[118,4],[0,1]],[[111,4],[62,4]],[[116,5],[62,5]],[[0,4]],[[50,3],[0,5]]],[[[95,1],[107,1]],[[52,2],[0,1]],[[95,1],[107,1],[0,2]]],[[[119,2],[30,1],[22,1],[43,1]],[[120,2]],[[0,2]]],[[[2,0],[112,1],[121,0]],[[0,1]]],[[[122,1],[123,1],[124,1],[125,1],[126,1]],[[0,1]]],[[[34,1]],[[82,2]],[[83,3]],[[111,4]],[[48,5]],[[80,6]],[[127,7],[0,6]],[[48,8]],[[80,9]],[[0,9]]],[[[4,1]],[[25,2]],[[128,3]],[[48,4],[129,5]],[[80,6]],[[49,7]],[[0,6]],[[48,4]]],[[[26,1]],[[25,2]],[[52,1],[0,2]]],[[[37,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[130,1],[0,4]],[[48,6]],[[80,7]],[[0,7]]],[[[25,1]],[[108,2],[0,1]],[[25,3]],[[0,3]]],[[[131,1]],[[52,2],[0,1]],[[131,1],[0,2]]],[[[36,1]],[[105,2],[19,3],[110,3]],[[32,4]],[[105,2],[19,3],[32,4],[110,3]],[[132,5],[15,5],[35,6]],[[0,5]],[[132,7]],[[61,5]]],[[[32,1]],[[133,2]],[[0,2]]],[[[134,1],[135,1]],[[0,1]]],[[[14,1]],[[48,2],[136,3]],[[49,4]],[[48,2]],[[0,4]]],[[[14,1]],[[48,2],[136,3]],[[86,4]],[[48,2]],[[0,4]]],[[[18,1]],[[25,2]],[[52,1],[0,2]]],[[[8,1],[137,2]],[[46,2]],[[0,2]]],[[[138,1]],[[139,0],[0,1]]],[[[35,1]],[[61,2],[140,3]],[[0,2]],[[61,2]]],[[[28,1]],[[0,1]]],[[[141,1]],[[53,2],[0,1]],[[120,3]],[[0,3]]],[[[16,1]],[[49,2],[142,3],[0,1]],[[52,4],[0,2]],[[49,5]],[[49,2],[0,4]],[[52,6],[0,5]],[[49,7]],[[52,8],[0,7]],[[49,7],[0,8]]],[[[5,1]],[[49,2],[0,1]],[[36,3],[52,3],[0,2]],[[49,4]],[[52,5],[0,4]],[[49,6]],[[0,6]]],[[[23,1]],[[111,2],[0,1]],[[0,2]]],[[[143,1]],[[144,0],[142,0],[0,1]]],[[[145,1]],[[2,2],[146,3]],[[0,2]],[[145,1],[2,2]]],[[[48,1]],[[49,2],[0,1]],[[0,2]]],[[[147,1],[148,1],[149,1],[150,1],[151,1],[152,1],[153,1],[154,1],[155,1],[156,1]],[[0,1]]],[[[15,1]],[[95,2]],[[0,2]]],[[[1,1],[3,1]],[[0,1]]],[[[49,1],[48,2]],[[48,2],[0,1]],[[49,3],[157,4],[0,2]],[[157,4],[0,3]],[[0,4]]],[[[158,1]],[[52,2],[0,1]],[[158,1],[0,2]]],[[[1,1],[2,2]],[[0,1]],[[159,3]],[[121,4]],[[160,1],[121,4]]],[[[120,1]],[[161,0],[15,0],[162,0],[41,0],[163,0],[0,1]]],[[[84,1],[164,2]],[[37,3],[0,1]],[[0,2]],[[84,4]],[[127,5]],[[49,2]]],[[[165,1],[84,1]],[[0,1]]],[[[49,1]],[[52,2],[0,1]],[[49,1],[0,2]]],[[[49,1],[107,1]],[[54,2],[52,3],[0,1]],[[0,2]],[[49,4],[107,4],[0,3]],[[52,3],[0,4]]],[[[49,1],[107,1]],[[52,2],[0,1]],[[49,1],[107,1],[0,2]]],[[[25,1]],[[48,2],[0,1]],[[49,3]],[[0,3]]],[[[35,1],[110,2],[38,3]],[[61,4],[81,5]],[[25,4]],[[166,6]],[[0,4]],[[61,4]],[[64,4]]],[[[20,1]],[[48,2]],[[80,3]],[[167,4],[168,5]],[[48,6]],[[48,7]],[[80,8]],[[80,9]],[[167,4],[127,10],[168,5],[0,8]],[[0,9]],[[48,11]],[[80,12]],[[168,5],[0,12]]],[[[15,1],[169,2],[53,3]],[[169,4],[52,5],[0,1]],[[50,6],[52,7],[0,2]],[[169,8]],[[52,5],[0,4]],[[169,9],[53,3],[0,5]],[[49,10]],[[15,11],[169,2],[53,3],[0,7]],[[52,12],[0,8]],[[50,13],[52,5],[0,9]],[[52,7],[0,10]],[[169,14],[52,15],[0,11]],[[0,12]],[[49,4]],[[52,15],[0,14]],[[169,16],[53,3],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],[[[15,1],[53,2],[170,3]],[[170,5],[52,4],[0,1]],[[170,6]],[[50,7],[52,8],[0,3]],[[53,2],[170,9],[0,4]],[[52,4],[0,5]],[[52,10],[0,6]],[[49,11]],[[15,12],[53,2],[170,3],[0,8]],[[50,13],[52,4],[0,9]],[[0,10]],[[52,8],[0,11]],[[52,15],[170,14],[0,12]],[[49,5]],[[52,15],[0,14]],[[53,2],[170,16],[0,15]],[[50,17],[52,15],[0,16]],[[49,14]]],[[[25,1]],[[0,1]]],[[[21,1]],[[49,2]],[[48,3]],[[80,4]],[[127,5],[0,4]],[[48,6]],[[80,7]],[[0,7]]],[[[49,1]],[[108,2],[0,1]],[[95,3]],[[0,3]]],[[[42,1]],[[171,2]],[[48,3],[52,1]],[[80,4]],[[0,4]]],[[[172,1]],[[173,0],[0,1]]],[[[111,2],[36,1]],[[49,2]],[[0,2]]],[[[31,1]],[[174,2],[0,1]],[[0,2]]],[[[62,1]],[[0,1]]]],labels:[[0,"EMPTY"],[317,null],[4,null],[276,null],[1,"def"],[1,"raise"],[1,"True"],[3,null],[1,"not"],[1,"null"],[55,null],[2,null],[25,null],[1,"class"],[1,"lambda"],[16,null],[1,"print"],[1,"debugger"],[1,"nonlocal"],[52,null],[1,"try"],[1,"while"],[31,null],[1,"return"],[1,"assert"],[1,null],[1,"global"],[1,"del"],[1,"pass"],[54,null],[15,null],[1,"yield"],[1,"import"],[1,"False"],[1,"for"],[7,null],[1,"from"],[1,"if"],[9,null],[1,"break"],[1,"continue"],[49,null],[1,"with"],[14,null],[316,null],[19,null],[308,null],[1,"and"],[11,null],[326,null],[22,null],[261,null],[12,null],[35,null],[271,null],[325,null],[297,null],[339,null],[296,null],[26,null],[283,null],[8,null],[342,null],[329,null],[10,null],[266,null],[332,null],[45,null],[38,null],[40,null],[50,null],[46,null],[41,null],[42,null],[36,null],[43,null],[48,null],[44,null],[37,null],[39,null],[324,null],[260,null],[292,null],[1,"in"],[309,null],[273,null],[327,null],[272,null],[28,null],[21,null],[27,null],[29,null],[1,"is"],[30,null],[20,null],[290,null],[274,null],[333,null],[299,null],[270,null],[337,null],[279,null],[265,null],[281,null],[264,null],[286,null],[280,null],[320,null],[1,"as"],[284,null],[23,null],[328,null],[0,null],[1,"except"],[340,null],[18,null],[330,null],[268,null],[259,null],[312,null],[293,null],[321,null],[269,null],[277,null],[314,null],[315,null],[343,null],[1,"else"],[310,null],[51,null],[1,"elif"],[300,null],[301,null],[285,null],[303,null],[302,null],[335,null],[275,null],[258,null],[1,"or"],[334,null],[267,null],[34,null],[262,null],[33,null],[319,null],[13,null],[295,null],[263,null],[291,null],[311,null],[307,null],[313,null],[282,null],[298,null],[304,null],[278,null],[318,null],[322,null],[5,null],[6,null],[47,null],[17,null],[24,null],[305,null],[306,null],[323,null],[289,null],[1,"finally"],[331,null],[336,null],[338,null],[257,null],[32,null],[341,null]],keywords:{False:33,null:9,True:6,and:47,as:108,assert:24,break:39,class:13,continue:40,debugger:17,def:4,del:27,elif:130,else:127,except:113,finally:168,for:34,from:36,global:26,if:37,import:32,in:83,is:92,lambda:14,nonlocal:18,not:8,or:139,pass:28,print:16,raise:5,return:23,try:20,while:21,with:42,yield:31},tokens:{0:112,1:25,2:11,3:7,4:2,5:159,6:160,7:35,8:61,9:38,10:64,11:48,12:52,13:146,14:43,15:30,16:15,17:162,18:115,19:45,20:94,21:89,22:50,23:110,24:163,25:12,26:59,27:90,28:88,29:91,30:93,31:22,32:173,33:144,34:142,35:53,36:74,37:78,38:68,39:79,40:69,41:72,42:73,43:75,44:77,45:67,46:71,47:161,48:76,49:41,50:70,51:129,52:19,54:29,55:10},start:256}},function(e,t){function n(e,t){return this.filename=e,this.grammar=t,this.p_flags=0,this}function i(e,t){return void 0===t&&(t="file_input"),e=new n(e,Sk.ParseTables),"file_input"===t?e.setup(Sk.ParseTables.sym.file_input):Sk.asserts.fail("todo;"),e}n.FUTURE_PRINT_FUNCTION="print_function",n.FUTURE_UNICODE_LITERALS="unicode_literals",n.FUTURE_DIVISION="division",n.FUTURE_ABSOLUTE_IMPORT="absolute_import",n.FUTURE_WITH_STATEMENT="with_statement",n.FUTURE_NESTED_SCOPES="nested_scopes",n.FUTURE_GENERATORS="generators",n.CO_FUTURE_PRINT_FUNCTION=65536,n.CO_FUTURE_UNICODE_LITERALS=131072,n.CO_FUTURE_DIVISON=8192,n.CO_FUTURE_ABSOLUTE_IMPORT=16384,n.CO_FUTURE_WITH_STATEMENT=32768,n.prototype.setup=function(e){e=e||this.grammar.start,this.stack=[{dfa:this.grammar.dfas[e],state:0,node:{type:e,value:null,context:null,children:[]}}],this.used_names={}},n.prototype.addtoken=function(e,t,n){var i,r=this.classify(e,t,n);e:for(;;){var s=this.stack[this.stack.length-1],o=s.dfa[0],a=o[s.state];for(i=0;i<a.length;++i){var l=a[i][0],u=a[i][1],c=this.grammar.labels[l][0];if(r===l){for(Sk.asserts.assert(256>c),this.shift(e,t,u,n),n=u;1===o[n].length&&0===o[n][0][0]&&o[n][0][1]===n;){if(this.pop(),0===this.stack.length)return!0;n=(s=this.stack[this.stack.length-1]).state,o=s.dfa[0]}return!1}if(256<=c&&(l=(l=this.grammar.dfas[c])[1]).hasOwnProperty(r)){this.push(c,this.grammar.dfas[c],u,n);continue e}}t:{for(o=[0,s.state],s=a.length;s--;)if(a[s][0]===o[0]&&a[s][1]===o[1]){a=!0;break t}a=!1}if(!a)throw e=n[0][0],new Sk.builtin.SyntaxError("bad input",this.filename,e,n);if(this.pop(),0===this.stack.length)throw new Sk.builtin.SyntaxError("too much input",this.filename)}},n.prototype.classify=function(e,t,i){if(e===Sk.token.tokens.T_NAME){this.used_names[t]=!0;var r=this.grammar.keywords.hasOwnProperty(t)&&this.grammar.keywords[t];if("print"===t&&(this.p_flags&n.CO_FUTURE_PRINT_FUNCTION||!0===Sk.__future__.print_function)&&(r=!1),r)return r}if(!(r=this.grammar.tokens.hasOwnProperty(e)&&this.grammar.tokens[e])){t="#"+e;for(let n in Sk.token.tokens)if(Sk.token.tokens[n]==e){t=n;break}throw new Sk.builtin.SyntaxError("bad token "+t,this.filename,i[0][0],i)}return r},n.prototype.shift=function(e,t,n,i){var r=this.stack[this.stack.length-1].dfa,s=this.stack[this.stack.length-1].node;s.children.push({type:e,value:t,lineno:i[0][0],col_offset:i[0][1],children:null}),this.stack[this.stack.length-1]={dfa:r,state:n,node:s}},n.prototype.push=function(e,t,n,i){e={type:e,value:null,lineno:i[0][0],col_offset:i[0][1],children:[]},this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:n,node:this.stack[this.stack.length-1].node},this.stack.push({dfa:t,state:0,node:e})},n.prototype.pop=function(){var e=this.stack.pop().node;if(e)if(0!==this.stack.length){this.stack[this.stack.length-1].node.children.push(e)}else this.rootnode=e,this.rootnode.used_names=this.used_names},Sk.parse=function(e,t){var n=Sk.token.tokens.T_COMMENT,r=Sk.token.tokens.T_NL,s=Sk.token.tokens.T_OP,o=Sk.token.tokens.T_ENDMARKER,a=Sk.token.tokens.T_ENCODING,l=!1,u=i(e);if(Sk._tokenize(e,function(e){var t=e.split("\n").reverse().map((function(e){return e+"\n"}));return function(){if(0===t.length)throw new Sk.builtin.Exception("EOF");return t.pop()}}(t),"utf-8",(function(e){var t=null;e.type!==n&&e.type!==r&&e.type!==a&&(e.type===s&&(t=Sk.OpMap[e.string]),u.addtoken(t||e.type,e.string,[e.start,e.end,e.line]),e.type===o&&(l=!0))})),!l)throw new Sk.builtin.SyntaxError("incomplete input",this.filename);return{cst:u.rootnode,flags:u.p_flags}},Sk.parseTreeDump=function(e,t){var n,i=""+(t=t||"");if(256<=e.type)for(i+=Sk.ParseTables.number2symbol[e.type]+"\n",n=0;n<e.children.length;++n)i+=Sk.parseTreeDump(e.children[n],t+" ");else i+=Sk.token.tok_name[e.type]+": "+new Sk.builtin.str(e.value).$r().v+"\n";return i},Sk.exportSymbol("Sk.Parser",n),Sk.exportSymbol("Sk.parse",Sk.parse),Sk.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump)},function(e,t){Sk.astnodes={},Sk.astnodes.Load=function(){},Sk.astnodes.Store=function(){},Sk.astnodes.Del=function(){},Sk.astnodes.AugLoad=function(){},Sk.astnodes.AugStore=function(){},Sk.astnodes.Param=function(){},Sk.astnodes.And=function(){},Sk.astnodes.Or=function(){},Sk.astnodes.Add=function(){},Sk.astnodes.Sub=function(){},Sk.astnodes.Mult=function(){},Sk.astnodes.MatMult=function(){},Sk.astnodes.Div=function(){},Sk.astnodes.Mod=function(){},Sk.astnodes.Pow=function(){},Sk.astnodes.LShift=function(){},Sk.astnodes.RShift=function(){},Sk.astnodes.BitOr=function(){},Sk.astnodes.BitXor=function(){},Sk.astnodes.BitAnd=function(){},Sk.astnodes.FloorDiv=function(){},Sk.astnodes.Invert=function(){},Sk.astnodes.Not=function(){},Sk.astnodes.UAdd=function(){},Sk.astnodes.USub=function(){},Sk.astnodes.Eq=function(){},Sk.astnodes.NotEq=function(){},Sk.astnodes.Lt=function(){},Sk.astnodes.LtE=function(){},Sk.astnodes.Gt=function(){},Sk.astnodes.GtE=function(){},Sk.astnodes.Is=function(){},Sk.astnodes.IsNot=function(){},Sk.astnodes.In=function(){},Sk.astnodes.NotIn=function(){},Sk.astnodes.Module=function(e,t){return this.body=e,this.docstring=t,this},Sk.astnodes.Interactive=function(e){return this.body=e,this},Sk.astnodes.Expression=function(e){return this.body=e,this},Sk.astnodes.Suite=function(e){return this.body=e,this},Sk.astnodes.FunctionDef=function(e,t,n,i,r,s,o,a){return Sk.asserts.assert(null!=o),Sk.asserts.assert(null!=a),this.name=e,this.args=t,this.body=n,this.decorator_list=i,this.returns=r,this.docstring=s,this.lineno=o,this.col_offset=a,this},Sk.astnodes.AsyncFunctionDef=function(e,t,n,i,r,s,o,a){return Sk.asserts.assert(null!=o),Sk.asserts.assert(null!=a),this.name=e,this.args=t,this.body=n,this.decorator_list=i,this.returns=r,this.docstring=s,this.lineno=o,this.col_offset=a,this},Sk.astnodes.ClassDef=function(e,t,n,i,r,s,o,a){return Sk.asserts.assert(null!=o),Sk.asserts.assert(null!=a),this.name=e,this.bases=t,this.keywords=n,this.body=i,this.decorator_list=r,this.docstring=s,this.lineno=o,this.col_offset=a,this},Sk.astnodes.Return=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Delete=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.targets=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Assign=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.targets=e,this.value=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.AugAssign=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.target=e,this.op=t,this.value=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.AnnAssign=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.target=e,this.annotation=t,this.value=n,this.simple=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.For=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.target=e,this.iter=t,this.body=n,this.orelse=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.AsyncFor=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.target=e,this.iter=t,this.body=n,this.orelse=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.While=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.test=e,this.body=t,this.orelse=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.If=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.test=e,this.body=t,this.orelse=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.With=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.items=e,this.body=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.AsyncWith=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.items=e,this.body=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Raise=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.exc=e,this.cause=t,this.inst=n,this.tback=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.Try=function(e,t,n,i,r,s){return Sk.asserts.assert(null!=r),Sk.asserts.assert(null!=s),this.body=e,this.handlers=t,this.orelse=n,this.finalbody=i,this.lineno=r,this.col_offset=s,this},Sk.astnodes.Assert=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.test=e,this.msg=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Import=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.names=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.ImportFrom=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.module=e,this.names=t,this.level=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Global=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.names=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Nonlocal=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.names=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Expr=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Pass=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Break=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Continue=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Print=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.dest=e,this.values=t,this.nl=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Debugger=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.BoolOp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.op=e,this.values=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.BinOp=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.left=e,this.op=t,this.right=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.UnaryOp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.op=e,this.operand=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Lambda=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.args=e,this.body=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.IfExp=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.test=e,this.body=t,this.orelse=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Dict=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.keys=e,this.values=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Set=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.elts=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.ListComp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elt=e,this.generators=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.SetComp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elt=e,this.generators=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.DictComp=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.key=e,this.value=t,this.generators=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.GeneratorExp=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elt=e,this.generators=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Await=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Yield=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.YieldFrom=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Compare=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.left=e,this.ops=t,this.comparators=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Call=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.func=e,this.args=t,this.keywords=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Num=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.n=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Str=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.s=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.FormattedValue=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.value=e,this.conversion=t,this.format_spec=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.JoinedStr=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.values=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Bytes=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.s=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.NameConstant=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Ellipsis=function(e,t){return Sk.asserts.assert(null!=e),Sk.asserts.assert(null!=t),this.lineno=e,this.col_offset=t,this},Sk.astnodes.Constant=function(e,t,n){return Sk.asserts.assert(null!=t),Sk.asserts.assert(null!=n),this.value=e,this.lineno=t,this.col_offset=n,this},Sk.astnodes.Attribute=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.value=e,this.attr=t,this.ctx=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Subscript=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.value=e,this.slice=t,this.ctx=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.Starred=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.value=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Name=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.id=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.List=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elts=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Tuple=function(e,t,n,i){return Sk.asserts.assert(null!=n),Sk.asserts.assert(null!=i),this.elts=e,this.ctx=t,this.lineno=n,this.col_offset=i,this},Sk.astnodes.Slice=function(e,t,n){return this.lower=e,this.upper=t,this.step=n,this},Sk.astnodes.ExtSlice=function(e){return this.dims=e,this},Sk.astnodes.Index=function(e){return this.value=e,this},Sk.astnodes.comprehension=function(e,t,n,i){return this.target=e,this.iter=t,this.ifs=n,this.is_async=i,this},Sk.astnodes.ExceptHandler=function(e,t,n,i,r){return Sk.asserts.assert(null!=i),Sk.asserts.assert(null!=r),this.type=e,this.name=t,this.body=n,this.lineno=i,this.col_offset=r,this},Sk.astnodes.arguments_=function(e,t,n,i,r,s){return this.args=e,this.vararg=t,this.kwonlyargs=n,this.kw_defaults=i,this.kwarg=r,this.defaults=s,this},Sk.astnodes.arg=function(e,t){return this.arg=e,this.annotation=t,this},Sk.astnodes.keyword=function(e,t){return this.arg=e,this.value=t,this},Sk.astnodes.alias=function(e,t){return this.name=e,this.asname=t,this},Sk.astnodes.withitem=function(e,t){return this.context_expr=e,this.optional_vars=t,this},Sk.astnodes.Module.prototype._astname="Module",Sk.astnodes.Module.prototype._fields=["body",function(e){return e.body},"docstring",function(e){return e.docstring}],Sk.astnodes.Interactive.prototype._astname="Interactive",Sk.astnodes.Interactive.prototype._fields=["body",function(e){return e.body}],Sk.astnodes.Expression.prototype._astname="Expression",Sk.astnodes.Expression.prototype._fields=["body",function(e){return e.body}],Sk.astnodes.Suite.prototype._astname="Suite",Sk.astnodes.Suite.prototype._fields=["body",function(e){return e.body}],Sk.astnodes.FunctionDef.prototype._astname="FunctionDef",Sk.astnodes.FunctionDef.prototype._fields=["name",function(e){return e.name},"args",function(e){return e.args},"body",function(e){return e.body},"decorator_list",function(e){return e.decorator_list},"returns",function(e){return e.returns},"docstring",function(e){return e.docstring}],Sk.astnodes.AsyncFunctionDef.prototype._astname="AsyncFunctionDef",Sk.astnodes.AsyncFunctionDef.prototype._fields=["name",function(e){return e.name},"args",function(e){return e.args},"body",function(e){return e.body},"decorator_list",function(e){return e.decorator_list},"returns",function(e){return e.returns},"docstring",function(e){return e.docstring}],Sk.astnodes.ClassDef.prototype._astname="ClassDef",Sk.astnodes.ClassDef.prototype._fields=["name",function(e){return e.name},"bases",function(e){return e.bases},"keywords",function(e){return e.keywords},"body",function(e){return e.body},"decorator_list",function(e){return e.decorator_list},"docstring",function(e){return e.docstring}],Sk.astnodes.Return.prototype._astname="Return",Sk.astnodes.Return.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Delete.prototype._astname="Delete",Sk.astnodes.Delete.prototype._fields=["targets",function(e){return e.targets}],Sk.astnodes.Assign.prototype._astname="Assign",Sk.astnodes.Assign.prototype._fields=["targets",function(e){return e.targets},"value",function(e){return e.value}],Sk.astnodes.AugAssign.prototype._astname="AugAssign",Sk.astnodes.AugAssign.prototype._fields=["target",function(e){return e.target},"op",function(e){return e.op},"value",function(e){return e.value}],Sk.astnodes.AnnAssign.prototype._astname="AnnAssign",Sk.astnodes.AnnAssign.prototype._fields=["target",function(e){return e.target},"annotation",function(e){return e.annotation},"value",function(e){return e.value},"simple",function(e){return e.simple}],Sk.astnodes.For.prototype._astname="For",Sk.astnodes.For.prototype._fields=["target",function(e){return e.target},"iter",function(e){return e.iter},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.AsyncFor.prototype._astname="AsyncFor",Sk.astnodes.AsyncFor.prototype._fields=["target",function(e){return e.target},"iter",function(e){return e.iter},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.While.prototype._astname="While",Sk.astnodes.While.prototype._fields=["test",function(e){return e.test},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.If.prototype._astname="If",Sk.astnodes.If.prototype._fields=["test",function(e){return e.test},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.With.prototype._astname="With",Sk.astnodes.With.prototype._fields=["items",function(e){return e.items},"body",function(e){return e.body}],Sk.astnodes.AsyncWith.prototype._astname="AsyncWith",Sk.astnodes.AsyncWith.prototype._fields=["items",function(e){return e.items},"body",function(e){return e.body}],Sk.astnodes.Raise.prototype._astname="Raise",Sk.astnodes.Raise.prototype._fields=["exc",function(e){return e.exc},"cause",function(e){return e.cause},"inst",function(e){return e.inst},"tback",function(e){return e.tback}],Sk.astnodes.Try.prototype._astname="Try",Sk.astnodes.Try.prototype._fields=["body",function(e){return e.body},"handlers",function(e){return e.handlers},"orelse",function(e){return e.orelse},"finalbody",function(e){return e.finalbody}],Sk.astnodes.Assert.prototype._astname="Assert",Sk.astnodes.Assert.prototype._fields=["test",function(e){return e.test},"msg",function(e){return e.msg}],Sk.astnodes.Import.prototype._astname="Import",Sk.astnodes.Import.prototype._fields=["names",function(e){return e.names}],Sk.astnodes.ImportFrom.prototype._astname="ImportFrom",Sk.astnodes.ImportFrom.prototype._fields=["module",function(e){return e.module},"names",function(e){return e.names},"level",function(e){return e.level}],Sk.astnodes.Global.prototype._astname="Global",Sk.astnodes.Global.prototype._fields=["names",function(e){return e.names}],Sk.astnodes.Nonlocal.prototype._astname="Nonlocal",Sk.astnodes.Nonlocal.prototype._fields=["names",function(e){return e.names}],Sk.astnodes.Expr.prototype._astname="Expr",Sk.astnodes.Expr.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Pass.prototype._astname="Pass",Sk.astnodes.Pass.prototype._fields=[],Sk.astnodes.Break.prototype._astname="Break",Sk.astnodes.Break.prototype._fields=[],Sk.astnodes.Continue.prototype._astname="Continue",Sk.astnodes.Continue.prototype._fields=[],Sk.astnodes.Print.prototype._astname="Print",Sk.astnodes.Print.prototype._fields=["dest",function(e){return e.dest},"values",function(e){return e.values},"nl",function(e){return e.nl}],Sk.astnodes.Debugger.prototype._astname="Debugger",Sk.astnodes.Debugger.prototype._fields=[],Sk.astnodes.BoolOp.prototype._astname="BoolOp",Sk.astnodes.BoolOp.prototype._fields=["op",function(e){return e.op},"values",function(e){return e.values}],Sk.astnodes.BinOp.prototype._astname="BinOp",Sk.astnodes.BinOp.prototype._fields=["left",function(e){return e.left},"op",function(e){return e.op},"right",function(e){return e.right}],Sk.astnodes.UnaryOp.prototype._astname="UnaryOp",Sk.astnodes.UnaryOp.prototype._fields=["op",function(e){return e.op},"operand",function(e){return e.operand}],Sk.astnodes.Lambda.prototype._astname="Lambda",Sk.astnodes.Lambda.prototype._fields=["args",function(e){return e.args},"body",function(e){return e.body}],Sk.astnodes.IfExp.prototype._astname="IfExp",Sk.astnodes.IfExp.prototype._fields=["test",function(e){return e.test},"body",function(e){return e.body},"orelse",function(e){return e.orelse}],Sk.astnodes.Dict.prototype._astname="Dict",Sk.astnodes.Dict.prototype._fields=["keys",function(e){return e.keys},"values",function(e){return e.values}],Sk.astnodes.Set.prototype._astname="Set",Sk.astnodes.Set.prototype._fields=["elts",function(e){return e.elts}],Sk.astnodes.ListComp.prototype._astname="ListComp",Sk.astnodes.ListComp.prototype._fields=["elt",function(e){return e.elt},"generators",function(e){return e.generators}],Sk.astnodes.SetComp.prototype._astname="SetComp",Sk.astnodes.SetComp.prototype._fields=["elt",function(e){return e.elt},"generators",function(e){return e.generators}],Sk.astnodes.DictComp.prototype._astname="DictComp",Sk.astnodes.DictComp.prototype._fields=["key",function(e){return e.key},"value",function(e){return e.value},"generators",function(e){return e.generators}],Sk.astnodes.GeneratorExp.prototype._astname="GeneratorExp",Sk.astnodes.GeneratorExp.prototype._fields=["elt",function(e){return e.elt},"generators",function(e){return e.generators}],Sk.astnodes.Await.prototype._astname="Await",Sk.astnodes.Await.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Yield.prototype._astname="Yield",Sk.astnodes.Yield.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.YieldFrom.prototype._astname="YieldFrom",Sk.astnodes.YieldFrom.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Compare.prototype._astname="Compare",Sk.astnodes.Compare.prototype._fields=["left",function(e){return e.left},"ops",function(e){return e.ops},"comparators",function(e){return e.comparators}],Sk.astnodes.Call.prototype._astname="Call",Sk.astnodes.Call.prototype._fields=["func",function(e){return e.func},"args",function(e){return e.args},"keywords",function(e){return e.keywords}],Sk.astnodes.Num.prototype._astname="Num",Sk.astnodes.Num.prototype._fields=["n",function(e){return e.n}],Sk.astnodes.Str.prototype._astname="Str",Sk.astnodes.Str.prototype._fields=["s",function(e){return e.s}],Sk.astnodes.FormattedValue.prototype._astname="FormattedValue",Sk.astnodes.FormattedValue.prototype._fields=["value",function(e){return e.value},"conversion",function(e){return e.conversion},"format_spec",function(e){return e.format_spec}],Sk.astnodes.JoinedStr.prototype._astname="JoinedStr",Sk.astnodes.JoinedStr.prototype._fields=["values",function(e){return e.values}],Sk.astnodes.Bytes.prototype._astname="Bytes",Sk.astnodes.Bytes.prototype._fields=["s",function(e){return e.s}],Sk.astnodes.NameConstant.prototype._astname="NameConstant",Sk.astnodes.NameConstant.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Ellipsis.prototype._astname="Ellipsis",Sk.astnodes.Ellipsis.prototype._fields=[],Sk.astnodes.Constant.prototype._astname="Constant",Sk.astnodes.Constant.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.Attribute.prototype._astname="Attribute",Sk.astnodes.Attribute.prototype._fields=["value",function(e){return e.value},"attr",function(e){return e.attr},"ctx",function(e){return e.ctx}],Sk.astnodes.Subscript.prototype._astname="Subscript",Sk.astnodes.Subscript.prototype._fields=["value",function(e){return e.value},"slice",function(e){return e.slice},"ctx",function(e){return e.ctx}],Sk.astnodes.Starred.prototype._astname="Starred",Sk.astnodes.Starred.prototype._fields=["value",function(e){return e.value},"ctx",function(e){return e.ctx}],Sk.astnodes.Name.prototype._astname="Name",Sk.astnodes.Name.prototype._fields=["id",function(e){return e.id},"ctx",function(e){return e.ctx}],Sk.astnodes.List.prototype._astname="List",Sk.astnodes.List.prototype._fields=["elts",function(e){return e.elts},"ctx",function(e){return e.ctx}],Sk.astnodes.Tuple.prototype._astname="Tuple",Sk.astnodes.Tuple.prototype._fields=["elts",function(e){return e.elts},"ctx",function(e){return e.ctx}],Sk.astnodes.Load.prototype._astname="Load",Sk.astnodes.Load.prototype._isenum=!0,Sk.astnodes.Store.prototype._astname="Store",Sk.astnodes.Store.prototype._isenum=!0,Sk.astnodes.Del.prototype._astname="Del",Sk.astnodes.Del.prototype._isenum=!0,Sk.astnodes.AugLoad.prototype._astname="AugLoad",Sk.astnodes.AugLoad.prototype._isenum=!0,Sk.astnodes.AugStore.prototype._astname="AugStore",Sk.astnodes.AugStore.prototype._isenum=!0,Sk.astnodes.Param.prototype._astname="Param",Sk.astnodes.Param.prototype._isenum=!0,Sk.astnodes.Slice.prototype._astname="Slice",Sk.astnodes.Slice.prototype._fields=["lower",function(e){return e.lower},"upper",function(e){return e.upper},"step",function(e){return e.step}],Sk.astnodes.ExtSlice.prototype._astname="ExtSlice",Sk.astnodes.ExtSlice.prototype._fields=["dims",function(e){return e.dims}],Sk.astnodes.Index.prototype._astname="Index",Sk.astnodes.Index.prototype._fields=["value",function(e){return e.value}],Sk.astnodes.And.prototype._astname="And",Sk.astnodes.And.prototype._isenum=!0,Sk.astnodes.Or.prototype._astname="Or",Sk.astnodes.Or.prototype._isenum=!0,Sk.astnodes.Add.prototype._astname="Add",Sk.astnodes.Add.prototype._isenum=!0,Sk.astnodes.Sub.prototype._astname="Sub",Sk.astnodes.Sub.prototype._isenum=!0,Sk.astnodes.Mult.prototype._astname="Mult",Sk.astnodes.Mult.prototype._isenum=!0,Sk.astnodes.MatMult.prototype._astname="MatMult",Sk.astnodes.MatMult.prototype._isenum=!0,Sk.astnodes.Div.prototype._astname="Div",Sk.astnodes.Div.prototype._isenum=!0,Sk.astnodes.Mod.prototype._astname="Mod",Sk.astnodes.Mod.prototype._isenum=!0,Sk.astnodes.Pow.prototype._astname="Pow",Sk.astnodes.Pow.prototype._isenum=!0,Sk.astnodes.LShift.prototype._astname="LShift",Sk.astnodes.LShift.prototype._isenum=!0,Sk.astnodes.RShift.prototype._astname="RShift",Sk.astnodes.RShift.prototype._isenum=!0,Sk.astnodes.BitOr.prototype._astname="BitOr",Sk.astnodes.BitOr.prototype._isenum=!0,Sk.astnodes.BitXor.prototype._astname="BitXor",Sk.astnodes.BitXor.prototype._isenum=!0,Sk.astnodes.BitAnd.prototype._astname="BitAnd",Sk.astnodes.BitAnd.prototype._isenum=!0,Sk.astnodes.FloorDiv.prototype._astname="FloorDiv",Sk.astnodes.FloorDiv.prototype._isenum=!0,Sk.astnodes.Invert.prototype._astname="Invert",Sk.astnodes.Invert.prototype._isenum=!0,Sk.astnodes.Not.prototype._astname="Not",Sk.astnodes.Not.prototype._isenum=!0,Sk.astnodes.UAdd.prototype._astname="UAdd",Sk.astnodes.UAdd.prototype._isenum=!0,Sk.astnodes.USub.prototype._astname="USub",Sk.astnodes.USub.prototype._isenum=!0,Sk.astnodes.Eq.prototype._astname="Eq",Sk.astnodes.Eq.prototype._isenum=!0,Sk.astnodes.NotEq.prototype._astname="NotEq",Sk.astnodes.NotEq.prototype._isenum=!0,Sk.astnodes.Lt.prototype._astname="Lt",Sk.astnodes.Lt.prototype._isenum=!0,Sk.astnodes.LtE.prototype._astname="LtE",Sk.astnodes.LtE.prototype._isenum=!0,Sk.astnodes.Gt.prototype._astname="Gt",Sk.astnodes.Gt.prototype._isenum=!0,Sk.astnodes.GtE.prototype._astname="GtE",Sk.astnodes.GtE.prototype._isenum=!0,Sk.astnodes.Is.prototype._astname="Is",Sk.astnodes.Is.prototype._isenum=!0,Sk.astnodes.IsNot.prototype._astname="IsNot",Sk.astnodes.IsNot.prototype._isenum=!0,Sk.astnodes.In.prototype._astname="In",Sk.astnodes.In.prototype._isenum=!0,Sk.astnodes.NotIn.prototype._astname="NotIn",Sk.astnodes.NotIn.prototype._isenum=!0,Sk.astnodes.comprehension.prototype._astname="comprehension",Sk.astnodes.comprehension.prototype._fields=["target",function(e){return e.target},"iter",function(e){return e.iter},"ifs",function(e){return e.ifs},"is_async",function(e){return e.is_async}],Sk.astnodes.ExceptHandler.prototype._astname="ExceptHandler",Sk.astnodes.ExceptHandler.prototype._fields=["type",function(e){return e.type},"name",function(e){return e.name},"body",function(e){return e.body}],Sk.astnodes.arguments_.prototype._astname="arguments",Sk.astnodes.arguments_.prototype._fields=["args",function(e){return e.args},"vararg",function(e){return e.vararg},"kwonlyargs",function(e){return e.kwonlyargs},"kw_defaults",function(e){return e.kw_defaults},"kwarg",function(e){return e.kwarg},"defaults",function(e){return e.defaults}],Sk.astnodes.arg.prototype._astname="arg",Sk.astnodes.arg.prototype._fields=["arg",function(e){return e.arg},"annotation",function(e){return e.annotation}],Sk.astnodes.keyword.prototype._astname="keyword",Sk.astnodes.keyword.prototype._fields=["arg",function(e){return e.arg},"value",function(e){return e.value}],Sk.astnodes.alias.prototype._astname="alias",Sk.astnodes.alias.prototype._fields=["name",function(e){return e.name},"asname",function(e){return e.asname}],Sk.astnodes.withitem.prototype._astname="withitem",Sk.astnodes.withitem.prototype._fields=["context_expr",function(e){return e.context_expr},"optional_vars",function(e){return e.optional_vars}],Sk.exportSymbol("Sk.astnodes",Sk.astnodes)},function(e,t){function n(e,t,n){this.c_encoding=e,this.c_filename=t,this.c_flags=n||0}function i(e){return Sk.asserts.assert(void 0!==e,"node must be defined"),null===e.children?0:e.children.length}function r(e,t){return Sk.asserts.assert(void 0!==e,"node must be defined"),Sk.asserts.assert(void 0!==t,"index of child must be specified"),e.children[t]}function s(e,t){Sk.asserts.assert(e.type===t,"node wasn't expected type")}function o(e,t,n){throw new Sk.builtin.SyntaxError(n,e.c_filename,t.lineno)}function a(e){return Sk.asserts.assert("string"==typeof e,"expecting string, got "+typeof e),new Sk.builtin.str(e)}function l(e){var t,n;switch(e.type){case j.single_input:if(r(e,0).type===V.T_NEWLINE)break;return l(r(e,0));case j.file_input:for(t=n=0;t<i(e);++t){var s=r(e,t);s.type===j.stmt&&(n+=l(s))}return n;case j.stmt:return l(r(e,0));case j.compound_stmt:return 1;case j.simple_stmt:return Math.floor(i(e)/2);case j.suite:if(1===i(e))return l(r(e,0));for(n=0,t=2;t<i(e)-1;++t)n+=l(r(e,t));return n;default:Sk.asserts.fail("Non-statement found")}return 0}function u(e,t,n,i){if(n instanceof Sk.builtin.str&&(n=n.v),"None"===n)throw new Sk.builtin.SyntaxError("assignment to None",e.c_filename,i);if("True"===n||"False"===n)throw new Sk.builtin.SyntaxError("assignment to True or False is forbidden",e.c_filename,i)}function c(e,t,n,i){var r;Sk.asserts.assert(n!==Sk.astnodes.AugStore&&n!==Sk.astnodes.AugLoad,"context not AugStore or AugLoad");var s=r=null;switch(t.constructor){case Sk.astnodes.Attribute:case Sk.astnodes.Name:n===Sk.astnodes.Store&&u(e,0,t.attr,i.lineno),t.ctx=n;break;case Sk.astnodes.Starred:t.ctx=n,c(e,t.value,n,i);break;case Sk.astnodes.Subscript:t.ctx=n;break;case Sk.astnodes.List:t.ctx=n,r=t.elts;break;case Sk.astnodes.Tuple:if(0===t.elts.length)throw new Sk.builtin.SyntaxError("can't assign to ()",e.c_filename,i.lineno);t.ctx=n,r=t.elts;break;case Sk.astnodes.Lambda:s="lambda";break;case Sk.astnodes.Call:s="function call";break;case Sk.astnodes.BoolOp:case Sk.astnodes.BinOp:case Sk.astnodes.UnaryOp:s="operator";break;case Sk.astnodes.GeneratorExp:s="generator expression";break;case Sk.astnodes.Yield:s="yield expression";break;case Sk.astnodes.ListComp:s="list comprehension";break;case Sk.astnodes.SetComp:s="set comprehension";break;case Sk.astnodes.DictComp:s="dict comprehension";break;case Sk.astnodes.Dict:case Sk.astnodes.Set:case Sk.astnodes.Num:case Sk.astnodes.Str:s="literal";break;case Sk.astnodes.NameConstant:s="True, False or None";break;case Sk.astnodes.Compare:s="comparison";break;case Sk.astnodes.Repr:s="repr";break;case Sk.astnodes.IfExp:s="conditional expression";break;default:Sk.asserts.fail("unhandled expression in assignment")}if(s)throw new Sk.builtin.SyntaxError("can't "+(n===Sk.astnodes.Store?"assign to":"delete")+" "+s,e.c_filename,i.lineno);if(r)for(t=0;t<r.length;++t)c(e,r[t],n,i)}function p(e){if(void 0===Y[e.type])throw new Sk.builtin.SyntaxError("invalid syntax",e.type,e.lineno);return Y[e.type]}function h(e,t){return e.value?new Sk.builtin.str(e.value):new Sk.builtin.str(e)}function d(e,t){if(s(t,j.comp_op),1===i(t))switch(t=r(t,0),t.type){case V.T_LESS:return Sk.astnodes.Lt;case V.T_GREATER:return Sk.astnodes.Gt;case V.T_EQEQUAL:return Sk.astnodes.Eq;case V.T_LESSEQUAL:return Sk.astnodes.LtE;case V.T_GREATEREQUAL:return Sk.astnodes.GtE;case V.T_NOTEQUAL:return Sk.astnodes.NotEq;case V.T_NAME:if("in"===t.value)return Sk.astnodes.In;if("is"===t.value)return Sk.astnodes.Is}else if(2===i(t)&&r(t,0).type===V.T_NAME){if("in"===r(t,1).value)return Sk.astnodes.NotIn;if("is"===r(t,0).value)return Sk.astnodes.IsNot}Sk.asserts.fail("invalid comp_op")}function f(e,t){return e&&(e.lineno=t.lineno,e.col_offset=t.col_offset,e.end_lineno=t.end_lineno,e.end_col_offset=t.end_col_offset),e}function _(e,t){var n,s=[];for(Sk.asserts.assert(t.type===j.testlist||t.type===j.testlist_star_expr||t.type===j.listmaker||t.type===j.testlist_comp||t.type===j.testlist_safe||t.type===j.testlist1,"node type must be listlike"),n=0;n<i(t);n+=2)Sk.asserts.assert(r(t,n).type===j.test||r(t,n).type===j.old_test||r(t,n).type===j.star_expr),s[n/2]=F(e,r(t,n));return s}function m(e,t){var n;s(t,j.suite);var o=[],a=0;if(r(t,0).type===j.simple_stmt){var u=i(t=r(t,0))-1;for(r(t,u-1).type===V.T_SEMI&&--u,n=0;n<u;n+=2)o[a++]=B(e,r(t,n))}else for(n=2;n<i(t)-1;++n){s(u=r(t,n),j.stmt);var c=l(u);if(1===c)o[a++]=B(e,u);else for(s(u=r(u,0),j.simple_stmt),c=0;c<i(u);c+=2){if(0===i(r(u,c))){Sk.asserts.assert(c+1===i(u));break}o[a++]=B(e,r(u,c))}}return Sk.asserts.assert(a===l(t)),o}function b(e,t,n){var o;s(t,j.exprlist);var a=[];for(o=0;o<i(t);o+=2){var l=F(e,r(t,o));a[o/2]=l,n&&c(e,l,n,r(t,o))}return a}function g(e,t){e:for(;;)switch(t.type){case j.import_as_name:e=null;var n=a(r(t,0).value);return 3===i(t)&&(e=r(t,2).value),new Sk.astnodes.alias(n,null==e?null:a(e));case j.dotted_as_name:if(1===i(t)){t=r(t,0);continue e}return e=g(e,r(t,0)),Sk.asserts.assert(!e.asname),e.asname=a(r(t,2).value),e;case j.dotted_name:if(1===i(t))return new Sk.astnodes.alias(a(r(t,0).value),null);for(e="",n=0;n<i(t);n+=2)e+=r(t,n).value+".";return new Sk.astnodes.alias(a(e.substr(0,e.length-1)),null);case V.T_STAR:return new Sk.astnodes.alias(a("*"),null);default:throw new Sk.builtin.SyntaxError("unexpected import name",e.c_filename,t.lineno)}}function S(e,t){return Sk.asserts.assert(t.type==j.testlist_comp||t.type==j.argument),O(e,t,0)}function k(e,t){if(r(t,0).type===V.T_MINUS&&2===i(t)){var n=r(t,1);if(n.type===j.factor&&1===i(n)&&((n=r(n,0)).type===j.power&&1===i(n))){var s=r(n,0);if(s.type===j.atom&&(n=r(s,0)).type===V.T_NUMBER)return n.value="-"+n.value,D(e,s)}}switch(e=F(e,r(t,1)),r(t,0).type){case V.T_PLUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.UAdd,e,t.lineno,t.col_offset);case V.T_MINUS:return new Sk.astnodes.UnaryOp(Sk.astnodes.USub,e,t.lineno,t.col_offset);case V.T_TILDE:return new Sk.astnodes.UnaryOp(Sk.astnodes.Invert,e,t.lineno,t.col_offset)}Sk.asserts.fail("unhandled factor")}function y(e,t,n,a){var l,c,p;for(s(t,j.arglist),l=p=c=0;l<i(t);l++){var h=r(t,l);h.type==j.argument&&(1==i(h)?c++:r(h,1).type==j.comp_for?(c++,a||o(e,h,"invalid syntax"),1<i(t)&&o(e,h,"Generator expression must be parenthesized")):r(h,0).type==V.T_STAR?c++:p++)}var d=[],f=[];for(l=a=p=c=0;l<i(t);l++)if((h=r(t,l)).type==j.argument){var _=r(h,0);if(1==i(h)){p&&o(e,_,a?"positional argument follows keyword argument unpacking":"positional argument follows keyword argument");var m=F(e,_);if(!m)return null;d[c++]=m}else if(_.type==V.T_STAR){if(a)return o(e,_,"iterable argument unpacking follows keyword argument unpacking"),null;if(!(m=F(e,r(h,1))))return null;h=new Sk.astnodes.Starred(m,Sk.astnodes.Load,_.lineno,_.col_offset),d[c++]=h}else if(_.type==V.T_DOUBLESTAR){if(l++,!(m=F(e,r(h,1))))return null;h=new Sk.astnodes.keyword(null,m),f[p++]=h,a++}else if(r(h,1).type==j.comp_for){if(!(m=S(e,h)))return null;d[c++]=m}else{var b;if(!(m=F(e,_)))return null;if(m.constructor===Sk.astnodes.Lambda)return o(e,_,"lambda cannot contain assignment"),null;if(m.constructor!==Sk.astnodes.Name)return o(e,_,"keyword can't be an expression"),null;if(u(e,m.id,h,1))return null;var g=m.id;for(b=0;b<p;b++)if((m=f[b].arg)&&m===g)return o(e,_,"keyword argument repeated"),null;if(!(m=F(e,r(h,2))))return null;h=new Sk.astnodes.keyword(g,m),f[p++]=h}}return new Sk.astnodes.Call(n,d,f,n.lineno,n.col_offset)}function v(e,t,n){if(s(t,j.trailer),r(t,0).type==V.T_LPAR)return 2==i(t)?new Sk.astnodes.Call(n,null,null,t.lineno,t.col_offset):y(e,r(t,1),n,!0);if(r(t,0).type==V.T_DOT){var o=h(r(t,1));return o?new Sk.astnodes.Attribute(n,o,Sk.astnodes.Load,t.lineno,t.col_offset):null}if(s(r(t,0),V.T_LSQB),s(r(t,2),V.T_RSQB),1==i(t=r(t,1)))return(o=L(e,r(t,0)))?new Sk.astnodes.Subscript(n,o,Sk.astnodes.Load,t.lineno,t.col_offset):null;var a,l=1,u=[];for(a=0;a<i(t);a+=2){if(!(o=L(e,r(t,a))))return null;o.kind!=U.Index_kind&&(l=0),u[a/2]=o}if(!l)return new Sk.astnodes.Subscript(n,new Sk.astnodes.ExtSlice(u),Sk.astnodes.Load,t.lineno,t.col_offset);for(e=[],a=0;a<u.length;++a)o=u[a],Sk.asserts.assert(o.kind==U.Index_kind&&o.v.Index.value),e[a]=o.v.Index.value;return o=new Sk.astnodes.Tuple(e,Sk.astnodes.Load,t.lineno,t.col_offset),new Sk.astnodes.Subscript(n,new Sk.astnodes.Index(o),Sk.astnodes.Load,t.lineno,t.col_offset)}function T(e,t){var n=null;Sk.asserts.assert(t.type===j.tfpdef||t.type===j.vfpdef);var s=r(t,0);return u(e,0,s.value,s.lineno),s=a(s.value),3==i(t)&&r(t,1).type===V.T_COLON&&(n=F(e,r(t,2))),new Sk.astnodes.arg(s,n,t.lineno,t.col_offset)}function E(e,t,n,s,l){var c=n,p=0;for(s||o(e,r(t,n),"named arguments must follow bare *"),Sk.asserts.assert(l);c<i(t);){var h=r(t,c);switch(h.type){case j.vfpdef:case j.tfpdef:c+1<i(t)&&r(t,c+1).type==V.T_EQUAL?(l[p]=F(e,r(t,c+2)),c+=2):l[p]=null;var d=3==i(h)?F(e,r(h,2)):null;u(e,0,(h=r(h,0)).value,h.lineno),n=a(h.value),s[p++]=new Sk.astnodes.arg(n,d,h.lineno,h.col_offset),c+=2;break;case V.T_DOUBLESTAR:return c;default:o(e,h,"unexpected node")}}return c}function I(e,t){var n,s,o,a=[],l=[],u=[],c=[],p=null,h=null;if(t.type===j.parameters){if(2===i(t))return new Sk.astnodes.arguments_([],null,[],[],null,[]);t=r(t,1)}for(Sk.asserts.assert(t.type===j.varargslist||t.type===j.typedargslist),n=s=o=0;o<i(t);){var d=r(t,o);switch(d.type){case j.tfpdef:case j.vfpdef:if(o+1<i(t)&&r(t,o+1).type==V.T_EQUAL){l[s++]=F(e,r(t,o+2)),o+=2;var f=1}else if(f)throw new Sk.builtin.SyntaxError("non-default argument follows default argument",e.c_filename,t.lineno);a[n++]=T(e,d),o+=2;break;case V.T_STAR:if(o+1>=i(t)||o+2==i(t)&&r(t,o+1).type==V.T_COMMA)throw new Sk.builtin.SyntaxError("named arguments must follow bare *",e.c_filename,t.lineno);(d=r(t,o+1)).type==V.T_COMMA?o=E(e,t,o+=2,u,c):(p=T(e,d),(o+=3)<i(t)&&(r(t,o).type==j.tfpdef||r(t,o).type==j.vfpdef)&&(o=E(e,t,o,u,c)));break;case V.T_DOUBLESTAR:d=r(t,o+1),Sk.asserts.assert(d.type==j.tfpdef||d.type==j.vfpdef),h=T(e,d),o+=3;break;default:return void Sk.asserts.fail("unexpected node in varargslist")}}return new Sk.astnodes.arguments_(a,p,u,c,h,l)}function w(e,t,n,a){var l=a?r(t,1):t,c=null,p=1,d=null;if(a&&5>e.c_feature_version)return o(e,l,"Async functions are only supported in Python 3.5 and greater"),null;s(l,j.funcdef);var f=h(r(l,p));if(u(e,0,r(l,p),0))return null;var _=I(e,r(l,p+1));if(!_)return null;if(r(l,p+2).type==V.T_RARROW){if(!(c=F(e,r(l,p+3))))return null;p+=2}if(r(l,p+3).type==V.T_TYPE_COMMENT){if(!(d=V.T_NEW_TYPE_COMMENT(r(l,p+3))))return null;p+=1}var b=m(e,r(l,p+3));if(!b)return null;if(1<i(r(l,p+3))&&(p=r(r(l,p+3),1)).type==V.T_TYPE_COMMENT){if(null!=d)return o(e,l,"Cannot have two type comments on def"),null;if(!(d=V.T_NEW_TYPE_COMMENT(p)))return null}return a?new Sk.astnodes.AsyncFunctionDef(f,_,b,n,c,d,t.lineno,t.col_offset,void 0,void 0):new Sk.astnodes.FunctionDef(f,_,b,n,c,d,l.lineno,l.col_offset,void 0,void 0)}function x(e,t,n){if(s(t,j.classdef),4==i(t)){var o=m(e,r(t,3)),a=h(r(t,1).value);return u(e,r(t,3),a,t.lineno),new Sk.astnodes.ClassDef(a,[],[],o,n,null,t.lineno,t.col_offset)}if(r(t,3).type===V.T_RPAR)return o=m(e,r(t,5)),a=h(r(t,1).value),u(e,r(t,3),a,r(t,3).lineno),new Sk.astnodes.ClassDef(a,[],[],o,n,null,t.lineno,t.col_offset);a=h(r(t,1)),a=new Sk.astnodes.Name(a,Sk.astnodes.Load,t.lineno,t.col_offset);var l=y(e,r(t,3),a,!1);return o=m(e,r(t,6)),a=h(r(t,1).value),u(e,r(t,1),a,r(t,1).lineno),new Sk.astnodes.ClassDef(a,l.args,l.keywords,o,n,null,t.lineno,t.col_offset)}function A(e,t){function n(e,t){for(e=0;;){if(s(t,j.comp_iter),r(t,0).type===j.comp_for)return e;if(s(t=r(t,0),j.comp_if),e++,2===i(t))return e;t=r(t,2)}}var o,a=function(e,t){e=0;e:for(;;){if(e++,s(t,j.comp_for),5!==i(t))return e;t=r(t,4);t:for(;;){if(s(t,j.comp_iter),(t=r(t,0)).type===j.comp_for)continue e;if(t.type===j.comp_if){if(3===i(t)){t=r(t,2);continue t}return e}break}break}Sk.asserts.fail("logic error in countCompFors")}(e,t),l=[];for(o=0;o<a;++o){s(t,j.comp_for);var u=r(t,1),c=b(e,u,Sk.astnodes.Store),p=F(e,r(t,3)),h=1===i(u)?new Sk.astnodes.comprehension(c[0],p,[]):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(c,Sk.astnodes.Store,t.lineno,t.col_offset),p,[]);if(5===i(t)){var d=n(e,t=r(t,4));for(u=[],c=0;c<d;++c)s(t,j.comp_iter),s(t=r(t,0),j.comp_if),p=F(e,r(t,1)),u[c]=p,3===i(t)&&(t=r(t,2));t.type===j.comp_iter&&(t=r(t,0)),h.ifs=u}l[o]=h}return l}function $(e,t){var n=[];e:{var o=t,a=0;t:for(;;){var l=0;if(a++,s(o,j.comp_for),r(o,0).type==V.T_ASYNC&&(l=1),i(o)!=5+l)break e;o=r(o,4+l);n:for(;;){if(s(o,j.comp_iter),(o=r(o,0)).type===j.comp_for)continue t;if(o.type===j.comp_if){if(3===i(o)){o=r(o,2);continue n}break e}break}break}a=void 0}for(o=0;o<a;o++){var u=0;r(t,0).type==V.T_ASYNC&&(u=1);var c=r(t,1+u),p=b(e,c,Sk.astnodes.Store);if(!p)return null;if(!(l=F(e,r(t,3+u))))return null;var h=p[0];if(p=1==i(c)?new Sk.astnodes.comprehension(h,l,null,u):new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(p,Sk.astnodes.Store,h.lineno,h.col_offset,c.end_lineno,c.end_col_offset),l,null,u),i(t)==5+u){h=[];e:for(l=t=r(t,4+u),u=0;;){if(s(l,j.comp_iter),r(l,0).type==j.comp_for){c=u;break e}if(s(l=r(l,0),j.comp_if),u++,2==i(l)){c=u;break e}l=r(l,2)}if(-1==c)return null;for(u=0;u<c;u++){if(s(t,j.comp_iter),s(t=r(t,0),j.comp_if),!(l=F(e,r(t,1))))return null;h[u]=l,3==i(t)&&(t=r(t,2))}t.type==j.comp_iter&&(t=r(t,0)),p.ifs=h}n[o]=p}return n}function O(e,t,n){Sk.asserts.assert(1<i(t));var s=r(t,0),a=F(e,s);return a.constructor===Sk.astnodes.Starred?(o(e,s,"iterable unpacking cannot be used in comprehension"),null):(e=$(e,r(t,1)),0==n?new Sk.astnodes.GeneratorExp(a,e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):1==n?new Sk.astnodes.ListComp(a,e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):2==n?new Sk.astnodes.SetComp(a,e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null)}function M(e,t){return Sk.asserts.assert(0<i(t)),t.type===j.testlist_comp?1<i(t)&&Sk.asserts.assert(r(t,1).type!==j.comp_for):Sk.asserts.assert(t.type===j.testlist||t.type===j.testlist_star_expr),1===i(t)?F(e,r(t,0)):new Sk.astnodes.Tuple(_(e,t),Sk.astnodes.Load,t.lineno,t.col_offset)}function C(e,t){if(s(t,j.expr_stmt),1===i(t))return new Sk.astnodes.Expr(M(e,r(t,0)),t.lineno,t.col_offset);if(r(t,1).type===j.augassign){var n=r(t,0),o=M(e,n);switch(c(e,o,Sk.astnodes.Store,n),o.constructor){case Sk.astnodes.Name:var a=o.id;u(e,0,a,t.lineno);break;case Sk.astnodes.Attribute:case Sk.astnodes.Subscript:break;case Sk.astnodes.GeneratorExp:throw new Sk.builtin.SyntaxError("augmented assignment to generator expression not possible",e.c_filename,t.lineno);case Sk.astnodes.Yield:throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",e.c_filename,t.lineno);default:throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",e.c_filename,t.lineno)}return a=(n=r(t,2)).type===j.testlist?M(e,n):F(e,n),new Sk.astnodes.AugAssign(o,function(e,t){switch(s(t,j.augassign),(t=r(t,0)).value.charAt(0)){case"+":return Sk.astnodes.Add;case"-":return Sk.astnodes.Sub;case"/":return"/"===t.value.charAt(1)?Sk.astnodes.FloorDiv:Sk.astnodes.Div;case"%":return Sk.astnodes.Mod;case"<":return Sk.astnodes.LShift;case">":return Sk.astnodes.RShift;case"&":return Sk.astnodes.BitAnd;case"^":return Sk.astnodes.BitXor;case"|":return Sk.astnodes.BitOr;case"*":return"*"===t.value.charAt(1)?Sk.astnodes.Pow:Sk.astnodes.Mult;case"@":if(Sk.__future__.python3)return Sk.astnodes.MatMult;default:Sk.asserts.fail("invalid augassign")}}(0,r(t,1)),a,t.lineno,t.col_offset)}if(r(t,1).type===j.annassign){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("Annotated assignment is not supported in Python 2",e.c_filename,t.lineno);n=r(t,0);var l=r(t,1),p=1;for(o=n;1==i(o);)o=r(o,0);switch(0<i(o)&&r(o,0).type==V.T_LPAR&&(p=0),(o=M(e,n)).constructor){case Sk.astnodes.Name:u(e,0,a=o.id,t.lineno),c(e,o,Sk.astnodes.Store,n);break;case Sk.astnodes.Attribute:u(e,0,a=o.attr,t.lineno),c(e,o,Sk.astnodes.Store,n);break;case Sk.astnodes.Subscript:c(e,o,Sk.astnodes.Store,n);break;case Sk.astnodes.List:throw new Sk.builtin.SyntaxError("only single target (not list) can be annotated",e.c_filename,t.lineno);case Sk.astnodes.Tuple:throw new Sk.builtin.SyntaxError("only single target (not tuple) can be annotated",e.c_filename,t.lineno);default:throw new Sk.builtin.SyntaxError("illegal target for annotation",e.c_filename,t.lineno)}return o.constructor!=Sk.astnodes.Name&&(p=0),a=F(e,n=r(l,1)),2==i(l)?new Sk.astnodes.AnnAssign(o,a,null,p,t.lineno,t.col_offset):(e=F(e,n=r(l,3)),new Sk.astnodes.AnnAssign(o,a,e,p,t.lineno,t.col_offset))}for(s(r(t,1),V.T_EQUAL),p=[],o=0;o<i(t)-2;o+=2){if((n=r(t,o)).type===j.yield_expr)throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",e.c_filename,t.lineno);c(e,n=M(e,n),Sk.astnodes.Store,r(t,o)),p[o/2]=n}return e=(n=r(t,i(t)-1)).type===j.testlist_star_expr?M(e,n):F(e,n),new Sk.astnodes.Assign(p,e,t.lineno,t.col_offset)}function R(e,t,n,i,r,s,a){Sk.asserts.assert("{"==e.charAt(t));var l=++t;let u,c,p=null,h=0,d=0,f=()=>o(s,a,"f-string: expecting '}'");for(Sk.asserts.assert(t<=n);t<n;t++){let i=e.charAt(t);if("\\"==i&&o(s,a,"f-string expression part cannot include a backslash"),p)i==p&&(3==h?t+2<n&&e.charAt(t+1)==i&&e.charAt(t+2)==i&&(t+=2,p=h=0):h=p=0);else if("'"==i||'"'==i)t+2<n&&e.charAt(t+1)==i&&e.charAt(t+2)==i?(h=3,t+=2):h=1,p=i;else if("["==i||"{"==i||"("==i)d++;else if(0==d||"]"!=i&&"}"!=i&&")"!=i){if("#"==i)o(s,a,"f-string expression part cannot include '#'");else if(!(0!=d||"!"!=i&&":"!=i&&"}"!=i||"!"==i&&t+1<n&&"="==e.charAt(t+1)))break}else d--}return p&&o(s,a,"f-string: unterminated string"),d&&o(s,a,"f-string: mismatched '(', '{', or '['"),l=function(e,t,n,i,r){Sk.asserts.assert(n>=t),Sk.asserts.assert("{"==e.charAt(t-1)),Sk.asserts.assert("}"==e.charAt(n)||"!"==e.charAt(n)||":"==e.charAt(n)),e=e.substring(t,n),/^\s*$/.test(e)&&o(i,r,"f-string: empty expression not allowed");try{let t=Sk.parse("<fstring>","("+e+")");var s=Sk.astFromParse(t.cst,"<fstring>",t.flags)}catch(e){throw e.traceback&&e.traceback[0]&&((s=e.traceback[0]).lineno=(s.lineno||1)-1+r.lineno,s.filename=i.c_filename),e}return Sk.asserts.assert(1==s.body.length&&s.body[0].constructor===Sk.astnodes.Expr),s.body[0].value}(e,l,t,s,a),"!"==e.charAt(t)&&(++t>=n&&f(),c=e.charAt(t),t++,"s"!=c&&"r"!=c&&"a"!=c&&o(s,a,"f-string: invalid conversion character: expected 's', 'r', or 'a'")),t>=n&&f(),":"==e.charAt(t)&&(++t>=n&&f(),[u,t]=N(e,t,n,i,r+1,s,a)),(t>=n||"}"!=e.charAt(t))&&f(),t++,[new Sk.astnodes.FormattedValue(l,c,u,a.lineno,a.col_offset),t]}function N(e,t,n,i,r,s,o){let a=[],l=e=>{if(-1!==e.indexOf("}")){if(/(^|[^}])}(}})*($|[^}])/.test(e))throw new SyntaxError("f-string: single '}' is not allowed",o.lineno,o.col_offset);e=e.replace(/}}/g,"}")}a.push(new Sk.astnodes.Str(new Sk.builtin.str(e),o.lineno,o.col_offset,s.end_lineno,o.end_col_offset))};for(;t<n;){let u=e.indexOf("{",t);if(0!==r){let i=e.indexOf("}",t);-1!==i&&(-1===u?n=i:u>i&&(u=-1,n=i))}if(-1===u){l(e.substring(t,n)),t=n;break}if(u+1<n&&"{"===e.charAt(u+1))l(e.substring(t,u+1)),t=u+2;else{l(e.substring(t,u)),t=u;let[c,p]=R(e,u,n,i,r,s,o);a.push(c),t=p}}return[new Sk.astnodes.JoinedStr(a,o.lineno,o.col_offset),t]}function L(e,t){var n,o;s(t,j.subscript);var a=r(t,0),l=n=o=null;return a.type===V.T_DOT?new Sk.astnodes.Ellipsis:1===i(t)&&a.type===j.test?new Sk.astnodes.Index(F(e,a)):(a.type===j.test&&(o=F(e,a)),a.type===V.T_COLON?1<i(t)&&((a=r(t,1)).type===j.test&&(n=F(e,a))):2<i(t)&&((a=r(t,2)).type===j.test&&(n=F(e,a))),(a=r(t,i(t)-1)).type===j.sliceop&&(1===i(a)?(a=r(a,0),l=new Sk.astnodes.NameConstant(Sk.builtin.none.none$,Sk.astnodes.Load,a.lineno,a.col_offset)):(a=r(a,1)).type===j.test&&(l=F(e,a))),new Sk.astnodes.Slice(o,n,l))}function D(e,t){var n=r(t,0);switch(n.type){case V.T_NAME:var l=n.value;if(4<=l.length&&5>=l.length){if("None"===l)return new Sk.astnodes.NameConstant(Sk.builtin.none.none$,t.lineno,t.col_offset);if("True"===l)return new Sk.astnodes.NameConstant(Sk.builtin.bool.true$,t.lineno,t.col_offset);if("False"===l)return new Sk.astnodes.NameConstant(Sk.builtin.bool.false$,t.lineno,t.col_offset)}return e=h(l),new Sk.astnodes.Name(e,Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case V.T_STRING:n=[];for(var u=0;u<i(t);++u){for(var c=r(t,u).value,p=e,d=r(t,u),m=c,b=m.charAt(0),g=!1,k=c=!1;;){if("u"!==b&&"U"!==b)if("r"===b||"R"===b)g=!0;else if("b"===b||"B"===b)k=!0;else{if("f"!==b&&"F"!==b)break;c=!0}b=(m=m.substr(1)).charAt(0)}if(Sk.asserts.assert("'"===b||'"'===b&&m.charAt(m.length-1)===b),4<=(m=m.substr(1,m.length-2)).length&&m.charAt(0)===b&&m.charAt(1)===b&&(Sk.asserts.assert(m.charAt(m.length-1)===b&&m.charAt(m.length-2)===b),m=m.substr(2,m.length-4)),g||-1===m.indexOf("\\")){if(k)for(b=0;b<m.length;b++)127<m.charCodeAt(b)&&o(p,d,"bytes can only contain ASCII literal characters");p=[a(m),c,k]}else{var y=(g=m).length,v="";for(m=0;m<y;++m)"\\"===(b=g.charAt(m))?(++m,"n"===(b=g.charAt(m))?v+="\n":"\\"===b?v+="\\":"t"===b?v+="\t":"r"===b?v+="\r":"b"===b?v+="\b":"f"===b?v+="\f":"v"===b?v+="\v":"0"===b?v+="\0":'"'===b?v+='"':"'"===b?v+="'":"\n"!==b&&("x"===b?(m+2>=y&&o(p,d,"Truncated \\xNN escape"),v+=String.fromCharCode(parseInt(g.substr(m+1,2),16)),m+=2):k||"u"!==b?k||"U"!==b?v+="\\"+b:(m+8>=y&&o(p,d,"Truncated \\UXXXXXXXX escape"),v+=String.fromCodePoint(parseInt(g.substr(m+1,8),16)),m+=8):(m+4>=y&&o(p,d,"Truncated \\uXXXX escape"),v+=String.fromCharCode(parseInt(g.substr(m+1,4),16)),m+=4))):k&&127<b.charCodeAt(0)?o(p,d,"bytes can only contain ASCII literal characters"):v+=b;p=[a(p=v),c,k]}if(p=(c=p)[0],d=c[1],c=c[2],0!=u&&l!==c&&o(e,t,"cannot mix bytes and nonbytes literals"),l=c,d){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("invalid string (f-strings are not supported in Python 2)",e.c_filename,r(t,u).lineno);var T=p.$jsstr();[T]=N(T,0,T.length,!1,0,e,r(t,u)),n.push.apply(n,T.values),T=null}else T?T.s=T.s.sq$concat(p):(T=new(l?Sk.astnodes.Bytes:Sk.astnodes.Str)(p,t.lineno,t.col_offset,e.end_lineno,t.end_col_offset),n.push(T))}return t=1===n.length&&n[0].constructor===Sk.astnodes.Str?n[0]:new Sk.astnodes.JoinedStr(n,t.lineno,t.col_offset,e.end_lineno,t.end_col_offset);case V.T_NUMBER:return new Sk.astnodes.Num(function(e,t,n){var i=t.charAt(t.length-1);if(-1!==t.indexOf("_")){if(G.test(t))throw new Sk.builtin.SyntaxError("invalid syntax",e.c_filename,n);if(X.test(t))throw new Sk.builtin.SyntaxError("invalid decimal literal",e.c_filename,n);t=t.replace(H,"")}if("j"===i||"J"===i)return Sk.builtin.complex.complex_subtype_from_string(t);if("l"===i||"L"===i)return Sk.longFromStr(t.substr(0,t.length-1),0);if(-1!==t.indexOf("."))return new Sk.builtin.float_(parseFloat(t));if(n=t,e=!1,"-"===t.charAt(0)&&(n=t.substr(1),e=!0),"0"!==n.charAt(0)||"x"!==n.charAt(1)&&"X"!==n.charAt(1)){if(-1!==t.indexOf("e")||-1!==t.indexOf("E"))return new Sk.builtin.float_(parseFloat(t));"0"!==n.charAt(0)||"b"!==n.charAt(1)&&"B"!==n.charAt(1)?"0"===n.charAt(0)?"0"===n?n=0:("o"!==(n=n.substring(1)).charAt(0)&&"O"!==n.charAt(0)||(n=n.substring(1)),n=parseInt(n,8)):n=parseInt(n,10):(n=n.substring(2),n=parseInt(n,2))}else n=n.substring(2),n=parseInt(n,16);return n>Number.MAX_SAFE_INTEGER&&Math.floor(n)===n&&-1===t.indexOf("e")&&-1===t.indexOf("E")?Sk.longFromStr(t,0):e?new Sk.builtin.int_(-n):new Sk.builtin.int_(n)}(e,n.value,t.lineno),t.lineno,t.col_offset);case V.T_ELLIPSIS:return new Sk.astnodes.Ellipsis(t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case V.T_LPAR:return(n=r(t,1)).type==V.T_RPAR?new Sk.astnodes.Tuple([],Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):n.type==j.yield_expr?F(e,n):1==i(n)?M(e,n):r(n,1).type==j.comp_for?f(S(e,n),t):f(M(e,n),t);case V.T_LSQB:return(n=r(t,1)).type==V.T_RSQB?new Sk.astnodes.List([],Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):(s(n,j.testlist_comp),1==i(n)||r(n,1).type==V.T_COMMA?(e=_(e,n))?new Sk.astnodes.List(e,Sk.astnodes.Load,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null:(l=n,Sk.asserts.assert(l.type==j.testlist_comp),f(e=O(e,l,1),t)));case V.T_LBRACE:if((n=r(t,1)).type==V.T_RBRACE)return new Sk.astnodes.Dict(null,null,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);if(l=r(n,0).type==V.T_DOUBLESTAR,1==i(n)||1<i(n)&&r(n,1).type==V.T_COMMA){for(l=n,u=[],Sk.asserts.assert(l.type===j.dictorsetmaker),n=0;n<i(l);n+=2)T=F(e,r(l,n)),u[n/2]=T;e=new Sk.astnodes.Set(u,l.lineno,l.col_offset)}else if(1<i(n)&&r(n,1).type==j.comp_for)l=n,Sk.asserts.assert(l.type===j.dictorsetmaker),Sk.asserts.assert(1<i(l)),n=F(e,r(l,0)),e=A(e,r(l,1)),e=new Sk.astnodes.SetComp(n,e,l.lineno,l.col_offset);else if(i(n)>3-l&&r(n,3-l).type==j.comp_for){if(l)return o(e,t,"dict unpacking cannot be used in dict comprehension"),null;l=n,Sk.asserts.assert(3<i(l)),s(r(l,1),V.T_COLON),n=F(e,r(l,0)),u=F(e,r(l,2)),e=A(e,r(l,3)),e=new Sk.astnodes.DictComp(n,u,e,l.lineno,l.col_offset)}else{for(l=n,u=[],T=[],c=n=0;c<i(l);c++)p=e,r(d=l,k=c).type==V.T_DOUBLESTAR?(Sk.asserts.assert(2<=i(d)-k),p={key:null,value:c=F(p,r(d,k+1)),i:k+2}):(Sk.asserts.assert(3<=i(d)-k),(c=F(p,r(d,k)))?(m=c,s(r(d,k+1),V.T_COLON),p=!!(c=F(p,r(d,k+2)))&&{key:m,value:c,i:k+3}):p=0),c=p.i,u[n]=p.key,T[n]=p.value,n++;e=new Sk.astnodes.Dict(u,T,l.lineno,l.col_offset,l.end_lineno,l.end_col_offset)}return f(e,t);default:return Sk.asserts.fail("unhandled atom "+n.type),null}}function P(e,t){var n,o=0;s(t,j.atom_expr);var a=i(t);r(t,0).type===V.T_AWAIT&&(o=1,Sk.asserts.assert(1<a));var l=D(e,r(t,o));if(!l)return null;if(1===a)return l;if(o&&2===a)return new Sk.astnodes.Await(l,t.lineno,t.col_offset);for(n=o+1;n<a;n++){var u=r(t,n);if(u.type!==j.trailer)break;if(!(u=v(e,u,l)))return null;u.lineno=l.lineno,u.col_offset=l.col_offset,l=u}return o?new Sk.astnodes.Await(l,t.line,t.col_offset):l}function F(e,t){e:for(;;){switch(t.type){case j.test:case j.test_nocond:if(r(t,0).type===j.lambdef||r(t,0).type===j.lambdef_nocond){var n=r(t,0);return 3===i(n)?(t=new Sk.astnodes.arguments_([],null,null,[]),e=F(e,r(n,2))):(t=I(e,r(n,1)),e=F(e,r(n,3))),new Sk.astnodes.Lambda(t,e,n.lineno,n.col_offset)}if(1<i(t))return Sk.asserts.assert(5===i(t)),new Sk.astnodes.IfExp(F(e,r(t,2)),F(e,r(t,0)),F(e,r(t,4)),t.lineno,t.col_offset);case j.or_test:case j.and_test:if(1===i(t)){t=r(t,0);continue e}var o=[];for(n=0;n<i(t);n+=2)o[n/2]=F(e,r(t,n));return"and"===r(t,1).value?new Sk.astnodes.BoolOp(Sk.astnodes.And,o,t.lineno,t.col_offset):(Sk.asserts.assert("or"===r(t,1).value),new Sk.astnodes.BoolOp(Sk.astnodes.Or,o,t.lineno,t.col_offset));case j.not_test:if(1===i(t)){t=r(t,0);continue e}return new Sk.astnodes.UnaryOp(Sk.astnodes.Not,F(e,r(t,1)),t.lineno,t.col_offset);case j.comparison:if(1===i(t)){t=r(t,0);continue e}var a=[];for(o=[],n=1;n<i(t);n+=2)a[(n-1)/2]=d(0,r(t,n)),o[(n-1)/2]=F(e,r(t,n+1));return new Sk.astnodes.Compare(F(e,r(t,0)),a,o,t.lineno,t.col_offset);case j.star_expr:return s(t,j.star_expr),new Sk.astnodes.Starred(F(e,r(t,1)),Sk.astnodes.Load,t.lineno,t.col_offset);case j.expr:case j.xor_expr:case j.and_expr:case j.shift_expr:case j.arith_expr:case j.term:if(1===i(t)){t=r(t,0);continue e}var l=t,u=new Sk.astnodes.BinOp(F(e,r(l,0)),p(r(l,1)),F(e,r(l,2)),l.lineno,l.col_offset),c=(i(l)-1)/2;for(t=1;t<c;++t)o=p(n=r(l,2*t+1)),a=F(e,r(l,2*t+2)),u=new Sk.astnodes.BinOp(u,o,a,n.lineno,n.col_offset);return u;case j.yield_expr:return o=!1,a=null,1<i(t)&&(n=r(t,1)),n&&(a=r(n,i(n)-1),2==i(n)?(o=!0,a=F(e,a)):a=M(e,a)),o?new Sk.astnodes.YieldFrom(a,t.lineno,t.col_offset):new Sk.astnodes.Yield(a,t.lineno,t.col_offset);case j.factor:if(1===i(t)){t=r(t,0);continue e}return k(e,t);case j.power:return s(n=t,j.power),t=P(e,r(n,0)),1!==i(n)&&r(n,i(n)-1).type===j.factor&&(e=F(e,r(n,i(n)-1)),t=new Sk.astnodes.BinOp(t,Sk.astnodes.Pow,e,n.lineno,n.col_offset)),t;default:Sk.asserts.fail("unhandled expr","n.type: %d",t.type)}break}}function B(e,t){if(t.type===j.stmt&&(Sk.asserts.assert(1===i(t)),t=r(t,0)),t.type===j.simple_stmt&&(Sk.asserts.assert(1===l(t)),t=r(t,0)),t.type===j.small_stmt)switch(t=r(t,0),t.type){case j.expr_stmt:return C(e,t);case j.del_stmt:var n=t;return s(n,j.del_stmt),new Sk.astnodes.Delete(b(e,r(n,1),Sk.astnodes.Del),n.lineno,n.col_offset);case j.pass_stmt:return new Sk.astnodes.Pass(t.lineno,t.col_offset);case j.flow_stmt:return function(e,t){s(t,j.flow_stmt);var n=r(t,0);switch(n.type){case j.break_stmt:return new Sk.astnodes.Break(t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case j.continue_stmt:return new Sk.astnodes.Continue(t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);case j.yield_stmt:return(e=F(e,r(n,0)))?new Sk.astnodes.Expr(e,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null;case j.return_stmt:if(1==i(n))return new Sk.astnodes.Return(null,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);var a=M(e,r(n,1));return a?new Sk.astnodes.Return(a,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset):null;case j.raise_stmt:if(1==i(n))return new Sk.astnodes.Raise(null,null,null,null,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset);if(2<=i(n)){var l=null;a=F(e,r(n,1));var u=null,c=null;return 4==i(n)&&"from"==r(n,2).value?(Sk.__future__.python3||o(e,r(n,2),"raise ... from ... is not available in Python 2"),l=F(e,r(n,3))):4<=i(n)&&","==r(n,2).value&&(Sk.__future__.python3&&o(e,t,"Old raise syntax is not available in Python 3"),u=F(e,r(n,3)),6==i(n)&&(c=F(e,r(n,5)))),new Sk.astnodes.Raise(a,l,u,c,t.lineno,t.col_offset,t.end_lineno,t.end_col_offset)}default:return Sk.asserts.fail("unexpected flow_stmt: ",n.type),null}}(e,t);case j.import_stmt:var u,p=t;s(p,j.import_stmt);var h=p.lineno;if(t=p.col_offset,(p=r(p,0)).type===j.import_name){s(p=r(p,1),j.dotted_as_names);var d=[];for(u=0;u<i(p);u+=2)d[u/2]=g(e,r(p,u));e=new Sk.astnodes.Import(d,h,t)}else{if(p.type!==j.import_from)throw new Sk.builtin.SyntaxError("unknown import statement",e.c_filename,p.lineno);var f=null;for(n=0,d=1;d<i(p);++d){if(r(p,d).type===j.dotted_name){f=g(e,r(p,d)),d++;break}if(r(p,d).type===V.T_DOT)n++;else{if(r(p,d).type!==V.T_ELLIPSIS)break;n+=3}}switch(r(p,++d).type){case V.T_STAR:p=r(p,d);break;case V.T_LPAR:i(p=r(p,d+1));break;case j.import_as_names:if(0==(d=i(p=r(p,d)))%2)throw new Sk.builtin.SyntaxError("trailing comma not allowed without surrounding parentheses",e.c_filename,p.lineno);break;default:throw new Sk.builtin.SyntaxError("Unexpected node-type in from-import",e.c_filename,p.lineno)}if(d=[],p.type===V.T_STAR)d[0]=g(e,p);else for(u=0;u<i(p);u+=2)d[u/2]=g(e,r(p,u));e=f?f.name.v:"",e=new Sk.astnodes.ImportFrom(a(e),d,n,h,t)}return e;case j.global_stmt:for(e=t,t=[],s(e,j.global_stmt),n=1;n<i(e);n+=2)t[(n-1)/2]=a(r(e,n).value);return new Sk.astnodes.Global(t,e.lineno,e.col_offset);case j.nonlocal_stmt:o(e,t,"Not implemented: nonlocal");break;case j.assert_stmt:return s(n=t,j.assert_stmt),2===i(n)?e=new Sk.astnodes.Assert(F(e,r(n,1)),null,n.lineno,n.col_offset):4===i(n)?e=new Sk.astnodes.Assert(F(e,r(n,1)),F(e,r(n,3)),n.lineno,n.col_offset):(Sk.asserts.fail("improper number of parts to assert stmt"),e=void 0),e;case j.print_stmt:for(n=t,Sk.__future__.print_function&&o(e,n,"Missing parentheses in call to 'print'"),p=1,h=null,s(n,j.print_stmt),2<=i(n)&&r(n,1).type===V.T_RIGHTSHIFT&&(h=F(e,r(n,2)),p=4),t=[],f=0;p<i(n);p+=2,++f)t[f]=F(e,r(n,p));return e=r(n,i(n)-1).type!==V.T_COMMA,new Sk.astnodes.Print(h,t,e,n.lineno,n.col_offset);case j.debugger_stmt:return new Sk.astnodes.Debugger(t.lineno,t.col_offset);default:Sk.asserts.fail("unhandled small_stmt")}else switch(n=r(t,0),s(t,j.compound_stmt),n.type){case j.if_stmt:if(s(n,j.if_stmt),4===i(n))e=new Sk.astnodes.If(F(e,r(n,1)),m(e,r(n,3)),[],n.lineno,n.col_offset);else if("s"===(t=r(n,4).value.charAt(2)))e=new Sk.astnodes.If(F(e,r(n,1)),m(e,r(n,3)),m(e,r(n,6)),n.lineno,n.col_offset);else if("i"===t){for(p=!1,t=[],r(n,(h=i(n)-4)+1).type===V.T_NAME&&"s"===r(n,h+1).value.charAt(2)&&(p=!0,h-=3),h/=4,p&&(t=[new Sk.astnodes.If(F(e,r(n,i(n)-6)),m(e,r(n,i(n)-4)),m(e,r(n,i(n)-1)),r(n,i(n)-6).lineno,r(n,i(n)-6).col_offset)],h--),f=0;f<h;++f)p=5+4*(h-f-1),t=[new Sk.astnodes.If(F(e,r(n,p)),m(e,r(n,p+2)),t,r(n,p).lineno,r(n,p).col_offset)];e=new Sk.astnodes.If(F(e,r(n,1)),m(e,r(n,3)),t,n.lineno,n.col_offset)}else Sk.asserts.fail("unexpected token in 'if' statement"),e=void 0;return e;case j.while_stmt:return s(n,j.while_stmt),4===i(n)?e=new Sk.astnodes.While(F(e,r(n,1)),m(e,r(n,3)),[],n.lineno,n.col_offset):7===i(n)?e=new Sk.astnodes.While(F(e,r(n,1)),m(e,r(n,3)),m(e,r(n,6)),n.lineno,n.col_offset):(Sk.asserts.fail("wrong number of tokens for 'while' stmt"),e=void 0),e;case j.for_stmt:return t=[],s(n,j.for_stmt),9===i(n)&&(t=m(e,r(n,8))),h=b(e,p=r(n,1),Sk.astnodes.Store),h=1===i(p)?h[0]:new Sk.astnodes.Tuple(h,Sk.astnodes.Store,n.lineno,n.col_offset),new Sk.astnodes.For(h,M(e,r(n,3)),m(e,r(n,5)),t,n.lineno,n.col_offset);case j.try_stmt:if(t=[],h=((u=i(n))-3)/3,f=[],d=null,s(n,j.try_stmt),p=m(e,r(n,2)),r(n,u-3).type===V.T_NAME)"finally"===r(n,u-3).value?(9<=u&&r(n,u-6).type===V.T_NAME&&(f=m(e,r(n,u-4)),h--),d=m(e,r(n,u-1))):f=m(e,r(n,u-1)),h--;else if(r(n,u-3).type!==j.except_clause)throw new Sk.builtin.SyntaxError("malformed 'try' statement",e.c_filename,n.lineno);if(0<h)for(u=0;u<h;u++){var _=u,S=e,k=r(n,3+3*u),v=r(n,5+3*u);if(s(k,j.except_clause),s(v,j.suite),1===i(k))var T=new Sk.astnodes.ExceptHandler(null,null,m(S,v),k.lineno,k.col_offset);else 2===i(k)?T=new Sk.astnodes.ExceptHandler(F(S,r(k,1)),null,m(S,v),k.lineno,k.col_offset):4===i(k)?(Sk.__future__.python3&&","==r(k,2).value&&o(S,k,"Old-style 'except' clauses are not supported in Python 3"),F(S,r(k,1)),c(S,T=F(S,r(k,3)),Sk.astnodes.Store,r(k,3)),T=new Sk.astnodes.ExceptHandler(F(S,r(k,1)),T,m(S,v),k.lineno,k.col_offset)):(Sk.asserts.fail("wrong number of children for except clause"),T=void 0);t[_]=T}return Sk.asserts.assert(!!d||0!=t.length),new Sk.astnodes.Try(p,t,f,d,n.lineno,n.col_offset);case j.with_stmt:for(t=[],s(n,j.with_stmt),h=1;h<i(n)-2;h+=2)p=void 0,d=e,s(u=r(n,h),j.with_item),f=F(d,r(u,0)),3==i(u)&&c(d,p=F(d,r(u,2)),Sk.astnodes.Store,u),p=new Sk.astnodes.withitem(f,p),t[(h-1)/2]=p;return e=m(e,r(n,i(n)-1)),e=new Sk.astnodes.With(t,e,n.lineno,n.col_offset);case j.funcdef:return w(e,n,[],!1);case j.classdef:return x(e,n,[]);case j.decorated:for(h=null,s(n,j.decorated),s(p=r(n,0),j.decorators),t=[],f=0;f<i(p);++f){d=t,u=f,_=e,s(T=r(p,f),j.decorator),s(r(T,0),V.T_AT),s(r(T,i(T)-1),V.T_NEWLINE);var E,I=r(T,1);s(I,j.dotted_name),S=I.lineno,k=I.col_offset,v=a(r(I,0).value);var A=new Sk.astnodes.Name(v,Sk.astnodes.Load,S,k);for(E=2;E<i(I);E+=2)v=a(r(I,E).value),A=new Sk.astnodes.Attribute(A,v,Sk.astnodes.Load,S,k);S=A,_=3===i(T)?S:5===i(T)?new Sk.astnodes.Call(S,[],[],null,null,T.lineno,T.col_offset):y(_,r(T,3),S),d[u]=_}return Sk.asserts.assert(r(n,1).type==j.funcdef||r(n,1).type==j.async_funcdef||r(n,1).type==j.classdef),r(n,1).type==j.funcdef?h=w(e,h=r(n,1),t,!1):r(n,1).type==j.classdef?h=x(e,r(n,1),t):r(n,1).type==j.async_funcdef&&(s(h=r(n,1),j.async_funcdef),s(r(h,0),V.T_NAME),Sk.asserts.assert(("async"===r(h,0)).value),s(r(h,1),j.funcdef),h=w(e,h,t,!0)),h&&(h.lineno=n.lineno,h.col_offset=n.col_offset),h;case j.async_stmt:o(e,n,"Not implemented: async");break;default:Sk.asserts.assert("unhandled compound_stmt")}}var j=Sk.ParseTables.sym,V=Sk.token.tokens,U={Slice_kind:1,ExtSlice_kind:2,Index_kind:3},Y={};Y[V.T_VBAR]=Sk.astnodes.BitOr,Y[V.T_CIRCUMFLEX]=Sk.astnodes.BitXor,Y[V.T_AMPER]=Sk.astnodes.BitAnd,Y[V.T_LEFTSHIFT]=Sk.astnodes.LShift,Y[V.T_RIGHTSHIFT]=Sk.astnodes.RShift,Y[V.T_PLUS]=Sk.astnodes.Add,Y[V.T_MINUS]=Sk.astnodes.Sub,Y[V.T_STAR]=Sk.astnodes.Mult,Y[V.T_SLASH]=Sk.astnodes.Div,Y[V.T_DOUBLESLASH]=Sk.astnodes.FloorDiv,Y[V.T_PERCENT]=Sk.astnodes.Mod,Sk.setupOperators=function(e){e?Y[V.T_AT]=Sk.astnodes.MatMult:Y[V.T_AT]&&delete Y[V.T_AT]},Sk.exportSymbol("Sk.setupOperators",Sk.setupOperators);const G=/_[eE]|[eE]_|\._|j_/,X=/_\.|[+-]_|^0_\D|_j/,H=/_(?=[^_])/g;Sk.astFromParse=function(e,t,o){var a,u=new n("utf-8",t,o),c=[],p=0;switch(e.type){case j.file_input:for(a=0;a<i(e)-1;++a){var h=r(e,a);if(e.type!==V.T_NEWLINE)if(s(h,j.stmt),1===(o=l(h)))c[p++]=B(u,h);else for(s(h=r(h,0),j.simple_stmt),t=0;t<o;++t)c[p++]=B(u,r(h,2*t))}return new Sk.astnodes.Module(c);case j.eval_input:Sk.asserts.fail("todo;");case j.single_input:Sk.asserts.fail("todo;");default:Sk.asserts.fail("todo;")}},Sk.astDump=function(e){var t=function(e){var t,n="";for(t=0;t<e;++t)n+=" ";return n},n=function(e,i){var r;if(null===e)return i+"None";if(e.prototype&&void 0!==e.prototype._astname&&e.prototype._isenum)return i+e.prototype._astname+"()";if(void 0!==e._astname){var s=t(e._astname.length+1),o=[];for(r=0;r<e._fields.length;r+=2){var a=e._fields[r],l=e._fields[r+1](e),u=t(a.length+1);o.push([a,n(l,i+s+u)])}for(l=[],r=0;r<o.length;++r)u=o[r],l.push(u[0]+"="+u[1].replace(/^\s+/,""));return r=l.join(",\n"+i+s),i+e._astname+"("+r+")"}if(Sk.isArrayLike(e)){for(s=[],r=0;r<e.length;++r)o=e[r],s.push(n(o,i+" "));return i+"["+(e=s.join(",\n")).replace(/^\s+/,"")+"]"}return i+(e=!0===e?"True":!1===e?"False":e instanceof Sk.builtin.lng?e.tp$str().v:e instanceof Sk.builtin.str?e.$r().v:""+e)};return n(e,"")},Sk.exportSymbol("Sk.astFromParse",Sk.astFromParse),Sk.exportSymbol("Sk.astDump",Sk.astDump)},function(e,t){function n(e,t,n){this.__name=e,this.__flags=t,this.__scope=t>>11&7,this.__namespaces=n||[]}function i(e,t,n,i,r){this.symFlags={},this.name=t,this.varnames=[],this.children=[],this.blockType=n,this.returnsValue=this.varkeywords=this.varargs=this.generator=this.childHasFree=this.hasFree=this.isNested=!1,this.lineno=r,this.table=e,e.cur&&(e.cur.nested||"function"===e.cur.blockType)&&(this.isNested=!0),i.scopeId=a++,e.stss[i.scopeId]=this,this.symbols={}}function r(e){this.filename=e,this.top=this.cur=null,this.stack=[],this.curClass=this.global=null,this.tmpname=0,this.stss={}}function s(e,t){var n;for(n=0;n<t.length;n++)e(t[n])}function o(e,t){for(var n in t)e[n]=t[n]}Sk.exportSymbol("Sk.SYMTAB_CONSTS",{DEF_GLOBAL:1,DEF_LOCAL:2,DEF_PARAM:4,USE:8,DEF_STAR:16,DEF_DOUBLESTAR:32,DEF_INTUPLE:64,DEF_FREE:128,DEF_FREE_GLOBAL:256,DEF_FREE_CLASS:512,DEF_IMPORT:1024,DEF_BOUND:1030,SCOPE_OFF:11,SCOPE_MASK:7,LOCAL:1,GLOBAL_EXPLICIT:2,GLOBAL_IMPLICIT:3,FREE:4,CELL:5,OPT_IMPORT_STAR:1,OPT_EXEC:2,OPT_BARE_EXEC:4,OPT_TOPLEVEL:8,GENERATOR:2,GENERATOR_EXPRESSION:2,ModuleBlock:"module",FunctionBlock:"function",ClassBlock:"class"}),n.prototype.get_name=function(){return this.__name},n.prototype.is_referenced=function(){return!!(8&this.__flags)},n.prototype.is_parameter=function(){return!!(4&this.__flags)},n.prototype.is_global=function(){return 3===this.__scope||2==this.__scope},n.prototype.is_declared_global=function(){return 2==this.__scope},n.prototype.is_local=function(){return!!(1030&this.__flags)},n.prototype.is_free=function(){return 4==this.__scope},n.prototype.is_imported=function(){return!!(1024&this.__flags)},n.prototype.is_assigned=function(){return!!(2&this.__flags)},n.prototype.is_namespace=function(){return this.__namespaces&&0<this.__namespaces.length},n.prototype.get_namespaces=function(){return this.__namespaces};var a=0;i.prototype.get_type=function(){return this.blockType},i.prototype.get_name=function(){return this.name},i.prototype.get_lineno=function(){return this.lineno},i.prototype.is_nested=function(){return this.isNested},i.prototype.has_children=function(){return 0<this.children.length},i.prototype.get_identifiers=function(){return this._identsMatching((function(){return!0}))},i.prototype.lookup=function(e){if(this.symbols.hasOwnProperty(e))e=this.symbols[e];else{var t=this.symFlags[e],i=this.__check_children(e);e=this.symbols[e]=new n(e,t,i)}return e},i.prototype.__check_children=function(e){var t,n=[];for(t=0;t<this.children.length;++t){var i=this.children[t];i.name===e&&n.push(i)}return n},i.prototype._identsMatching=function(e){var t,n=[];for(t in this.symFlags)this.symFlags.hasOwnProperty(t)&&e(this.symFlags[t])&&n.push(t);return n.sort(),n},i.prototype.get_parameters=function(){return Sk.asserts.assert("function"==this.get_type(),"get_parameters only valid for function scopes"),this._funcParams||(this._funcParams=this._identsMatching((function(e){return 4&e}))),this._funcParams},i.prototype.get_locals=function(){return Sk.asserts.assert("function"==this.get_type(),"get_locals only valid for function scopes"),this._funcLocals||(this._funcLocals=this._identsMatching((function(e){return 1030&e}))),this._funcLocals},i.prototype.get_globals=function(){return Sk.asserts.assert("function"==this.get_type(),"get_globals only valid for function scopes"),this._funcGlobals||(this._funcGlobals=this._identsMatching((function(e){return 3==(e=e>>11&7)||2==e}))),this._funcGlobals},i.prototype.get_frees=function(){return Sk.asserts.assert("function"==this.get_type(),"get_frees only valid for function scopes"),this._funcFrees||(this._funcFrees=this._identsMatching((function(e){return 4==(e>>11&7)}))),this._funcFrees},i.prototype.get_methods=function(){var e;if(Sk.asserts.assert("class"==this.get_type(),"get_methods only valid for class scopes"),!this._classMethods){var t=[];for(e=0;e<this.children.length;++e)t.push(this.children[e].name);t.sort(),this._classMethods=t}return this._classMethods},i.prototype.getScope=function(e){return void 0===(e=this.symFlags[e])?0:e>>11&7},r.prototype.getStsForAst=function(e){return Sk.asserts.assert(void 0!==e.scopeId,"ast wasn't added to st?"),e=this.stss[e.scopeId],Sk.asserts.assert(void 0!==e,"unknown sym tab entry"),e},r.prototype.SEQStmt=function(e){var t,n;if(null!==e){Sk.asserts.assert(Sk.isArrayLike(e),"SEQ: nodes isn't array? got "+e.toString());var i=e.length;for(n=0;n<i;++n)(t=e[n])&&this.visitStmt(t)}},r.prototype.SEQExpr=function(e){var t,n;if(null!==e){Sk.asserts.assert(Sk.isArrayLike(e),"SEQ: nodes isn't array? got "+e.toString());var i=e.length;for(n=0;n<i;++n)(t=e[n])&&this.visitExpr(t)}},r.prototype.enterBlock=function(e,t,n,r){e=Sk.fixReserved(e);var s=null;this.cur&&(s=this.cur,this.stack.push(this.cur)),this.cur=new i(this,e,t,n,r),"top"===e&&(this.global=this.cur.symFlags),s&&s.children.push(this.cur)},r.prototype.exitBlock=function(){this.cur=null,0<this.stack.length&&(this.cur=this.stack.pop())},r.prototype.visitParams=function(e,t){var n;for(n=0;n<e.length;++n){if((t=e[n]).constructor!==Sk.astnodes.arg)throw new Sk.builtin.SyntaxError("invalid expression in parameter list",this.filename);this.addDef(t.arg,4,t.lineno)}},r.prototype.visitArguments=function(e,t){e.args&&this.visitParams(e.args,!0),e.kwonlyargs&&this.visitParams(e.kwonlyargs,!0),e.vararg&&(this.addDef(e.vararg.arg,4,t),this.cur.varargs=!0),e.kwarg&&(this.addDef(e.kwarg.arg,4,t),this.cur.varkeywords=!0)},r.prototype.newTmpname=function(e){this.addDef(new Sk.builtin.str("_["+ ++this.tmpname+"]"),2,e)},r.prototype.addDef=function(e,t,n){var i=Sk.mangleName(this.curClass,e).v;i=Sk.fixReserved(i);var r=this.cur.symFlags[i];if(void 0!==r){if(4&t&&4&r)throw new Sk.builtin.SyntaxError("duplicate argument '"+e.v+"' in function definition",this.filename,n);r|=t}else r=t;this.cur.symFlags[i]=r,4&t?this.cur.varnames.push(i):1&t&&(r=t,void 0!==(e=this.global[i])&&(r|=e),this.global[i]=r)},r.prototype.visitSlice=function(e){var t;switch(e.constructor){case Sk.astnodes.Slice:e.lower&&this.visitExpr(e.lower),e.upper&&this.visitExpr(e.upper),e.step&&this.visitExpr(e.step);break;case Sk.astnodes.ExtSlice:for(t=0;t<e.dims.length;++t)this.visitSlice(e.dims[t]);break;case Sk.astnodes.Index:this.visitExpr(e.value)}},r.prototype.visitStmt=function(e){var t;switch(Sk.asserts.assert(void 0!==e,"visitStmt called with undefined"),e.constructor){case Sk.astnodes.FunctionDef:this.addDef(e.name,2,e.lineno),e.args.defaults&&this.SEQExpr(e.args.defaults),e.decorator_list&&this.SEQExpr(e.decorator_list),this.enterBlock(e.name.v,"function",e,e.lineno),this.visitArguments(e.args,e.lineno),this.SEQStmt(e.body),this.exitBlock();break;case Sk.astnodes.ClassDef:this.addDef(e.name,2,e.lineno),this.SEQExpr(e.bases),e.decorator_list&&this.SEQExpr(e.decorator_list),this.enterBlock(e.name.v,"class",e,e.lineno),this.curClass=e.name,this.SEQStmt(e.body),this.exitBlock();break;case Sk.astnodes.Return:if(e.value&&(this.visitExpr(e.value),this.cur.returnsValue=!0,this.cur.generator))throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename);break;case Sk.astnodes.Delete:this.SEQExpr(e.targets);break;case Sk.astnodes.Assign:this.SEQExpr(e.targets),this.visitExpr(e.value);break;case Sk.astnodes.AnnAssign:if(e.target.constructor==Sk.astnodes.Name){var n=e.target,i=Sk.mangleName(this.curClass,n.id).v;if(i=Sk.fixReserved(i),2049&(n=this.cur.symFlags[i])&&this.global!=this.cur.symFlags&&e.simple)throw new Sk.builtin.SyntaxError("annotated name '"+i+"' can't be global",this.filename,e.lineno);e.simple?this.addDef(new Sk.builtin.str(i),4098,e.lineno):e.value&&this.addDef(new Sk.builtin.str(i),2,e.lineno)}else this.visitExpr(e.target);this.visitExpr(e.annotation),e.value&&this.visitExpr(e.value);break;case Sk.astnodes.AugAssign:this.visitExpr(e.target),this.visitExpr(e.value);break;case Sk.astnodes.Print:e.dest&&this.visitExpr(e.dest),this.SEQExpr(e.values);break;case Sk.astnodes.For:this.visitExpr(e.target),this.visitExpr(e.iter),this.SEQStmt(e.body),e.orelse&&this.SEQStmt(e.orelse);break;case Sk.astnodes.While:case Sk.astnodes.If:this.visitExpr(e.test),this.SEQStmt(e.body),e.orelse&&this.SEQStmt(e.orelse);break;case Sk.astnodes.Raise:e.exc&&(this.visitExpr(e.exc),e.inst&&(this.visitExpr(e.inst),e.tback&&this.visitExpr(e.tback)),e.cause&&this.visitExpr(e.cause));break;case Sk.astnodes.Assert:this.visitExpr(e.test),e.msg&&this.visitExpr(e.msg);break;case Sk.astnodes.Import:case Sk.astnodes.ImportFrom:this.visitAlias(e.names,e.lineno);break;case Sk.astnodes.Global:var r=e.names.length;for(t=0;t<r;++t){if(i=Sk.mangleName(this.curClass,e.names[t]).v,i=Sk.fixReserved(i),10&(n=this.cur.symFlags[i])){if(2&n)throw new Sk.builtin.SyntaxError("name '"+i+"' is assigned to before global declaration",this.filename,e.lineno);throw new Sk.builtin.SyntaxError("name '"+i+"' is used prior to global declaration",this.filename,e.lineno)}this.addDef(new Sk.builtin.str(i),1,e.lineno)}break;case Sk.astnodes.Expr:this.visitExpr(e.value);break;case Sk.astnodes.Pass:case Sk.astnodes.Break:case Sk.astnodes.Continue:case Sk.astnodes.Debugger:break;case Sk.astnodes.With:s(this.visit_withitem.bind(this),e.items),s(this.visitStmt.bind(this),e.body);break;case Sk.astnodes.Try:this.SEQStmt(e.body),this.visitExcepthandlers(e.handlers),this.SEQStmt(e.orelse),this.SEQStmt(e.finalbody);break;default:Sk.asserts.fail("Unhandled type "+e.constructor.name+" in visitStmt")}},r.prototype.visit_withitem=function(e){this.visitExpr(e.context_expr),e.optional_vars&&this.visitExpr(e.optional_vars)},r.prototype.visitExpr=function(e){switch(Sk.asserts.assert(void 0!==e,"visitExpr called with undefined"),e.constructor){case Sk.astnodes.BoolOp:this.SEQExpr(e.values);break;case Sk.astnodes.BinOp:this.visitExpr(e.left),this.visitExpr(e.right);break;case Sk.astnodes.UnaryOp:this.visitExpr(e.operand);break;case Sk.astnodes.Lambda:this.addDef(new Sk.builtin.str("lambda"),2,e.lineno),e.args.defaults&&this.SEQExpr(e.args.defaults),this.enterBlock("lambda","function",e,e.lineno),this.visitArguments(e.args,e.lineno),this.visitExpr(e.body),this.exitBlock();break;case Sk.astnodes.IfExp:this.visitExpr(e.test),this.visitExpr(e.body),this.visitExpr(e.orelse);break;case Sk.astnodes.Dict:this.SEQExpr(e.keys),this.SEQExpr(e.values);break;case Sk.astnodes.DictComp:case Sk.astnodes.SetComp:this.visitComprehension(e.generators,0);break;case Sk.astnodes.ListComp:this.newTmpname(e.lineno),this.visitExpr(e.elt),this.visitComprehension(e.generators,0);break;case Sk.astnodes.GeneratorExp:this.visitGenexp(e);break;case Sk.astnodes.Yield:if(e.value&&this.visitExpr(e.value),this.cur.generator=!0,this.cur.returnsValue)throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename);break;case Sk.astnodes.Compare:this.visitExpr(e.left),this.SEQExpr(e.comparators);break;case Sk.astnodes.Call:if(this.visitExpr(e.func),e.args)for(let t of e.args)t.constructor===Sk.astnodes.Starred?this.visitExpr(t.value):this.visitExpr(t);if(e.keywords)for(let t of e.keywords)this.visitExpr(t.value);break;case Sk.astnodes.Num:case Sk.astnodes.Str:case Sk.astnodes.Bytes:break;case Sk.astnodes.JoinedStr:for(let t of e.values)this.visitExpr(t);break;case Sk.astnodes.FormattedValue:this.visitExpr(e.value),e.format_spec&&this.visitExpr(e.format_spec);break;case Sk.astnodes.Attribute:this.visitExpr(e.value);break;case Sk.astnodes.Subscript:this.visitExpr(e.value),this.visitSlice(e.slice);break;case Sk.astnodes.Name:this.addDef(e.id,e.ctx===Sk.astnodes.Load?8:2,e.lineno);break;case Sk.astnodes.NameConstant:break;case Sk.astnodes.List:case Sk.astnodes.Tuple:case Sk.astnodes.Set:this.SEQExpr(e.elts);break;case Sk.astnodes.Starred:this.visitExpr(e.value);break;default:Sk.asserts.fail("Unhandled type "+e.constructor.name+" in visitExpr")}},r.prototype.visitComprehension=function(e,t){var n,i=e.length;for(n=t;n<i;++n)t=e[n],this.visitExpr(t.target),this.visitExpr(t.iter),this.SEQExpr(t.ifs)},r.prototype.visitAlias=function(e,t){var n,i;for(i=0;i<e.length;++i){var r=e[i],s=n=null===r.asname?r.name.v:r.asname.v;if(-1!==(r=n.indexOf("."))&&(s=n.substr(0,r)),"*"!==n)this.addDef(new Sk.builtin.str(s),1024,t);else if("module"!==this.cur.blockType)throw new Sk.builtin.SyntaxError("import * only allowed at module level",this.filename)}},r.prototype.visitGenexp=function(e){var t=e.generators[0];this.visitExpr(t.iter),this.enterBlock("genexpr","function",e,e.lineno),this.cur.generator=!0,this.addDef(new Sk.builtin.str(".0"),4,e.lineno),this.visitExpr(t.target),this.SEQExpr(t.ifs),this.visitComprehension(e.generators,1),this.visitExpr(e.elt),this.exitBlock()},r.prototype.visitExcepthandlers=function(e){var t,n;for(t=0;n=e[t];++t)n.type&&this.visitExpr(n.type),n.name&&this.visitExpr(n.name),this.SEQStmt(n.body)},r.prototype.analyzeBlock=function(e,t,n,i){var r={},s={},a={},l={},u={};for(p in"class"==e.blockType&&(o(a,i),t&&o(l,t)),e.symFlags){var c=e.symFlags[p];this.analyzeName(e,s,p,c,t,r,n,i)}"class"!==e.blockType&&("function"===e.blockType&&o(l,r),t&&o(l,t),o(a,i)),r={};var p=e.children.length;for(c=0;c<p;++c)i=e.children[c],this.analyzeChildBlock(i,l,u,a,r),(i.hasFree||i.childHasFree)&&(e.childHasFree=!0);o(u,r),"function"===e.blockType&&this.analyzeCells(s,u),t=this.updateSymbols(e.symFlags,s,t,u,"class"===e.blockType),e.hasFree=e.hasFree||t,o(n,u)},r.prototype.analyzeChildBlock=function(e,t,n,i,r){var s={};o(s,t),o(t={},n),o(n={},i),this.analyzeBlock(e,s,t,n),o(r,t)},r.prototype.analyzeCells=function(e,t){var n;for(n in e){1===e[n]&&void 0!==t[n]&&(e[n]=5,delete t[n])}},r.prototype.updateSymbols=function(e,t,n,i,r){var s,o=!1;for(s in e){var a=e[s];a|=t[s]<<11,e[s]=a}for(s in i)void 0!==(t=e[s])?r&&1031&t&&(t|=512,e[s]=t):void 0!==n[s]&&(e[s]=8192,o=!0);return o},r.prototype.analyzeName=function(e,t,n,i,r,s,o,a){if(1&i){if(4&i)throw new Sk.builtin.SyntaxError("name '"+n+"' is local and global",this.filename,e.lineno);t[n]=2,a[n]=null,r&&void 0!==r[n]&&delete r[n]}else 1030&i?(t[n]=1,s[n]=null,delete a[n]):r&&void 0!==r[n]?(t[n]=4,e.hasFree=!0,o[n]=null):(a&&void 0!==a[n]||!e.isNested||(e.hasFree=!0),t[n]=3)},r.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})},Sk.symboltable=function(e,t){var n=new r(t);for(n.enterBlock("top","module",e,0),n.top=n.cur,t=0;t<e.body.length;++t)n.visitStmt(e.body[t]);return n.exitBlock(),n.analyze(),n},Sk.dumpSymtab=function(e){var t=function(e){return e?"True":"False"},n=function(e){var t,n=[];for(t=0;t<e.length;++t)n.push(new Sk.builtin.str(e[t]).$r().v);return"["+n.join(", ")+"]"},i=function(e,r){var s,o;void 0===r&&(r="");var a=r+"Sym_type: "+e.get_type()+"\n";a+=r+"Sym_name: "+e.get_name()+"\n",a+=r+"Sym_lineno: "+e.get_lineno()+"\n",a+=r+"Sym_nested: "+t(e.is_nested())+"\n",a+=r+"Sym_haschildren: "+t(e.has_children())+"\n","class"===e.get_type()?a+=r+"Class_methods: "+n(e.get_methods())+"\n":"function"===e.get_type()&&(a+=r+"Func_params: "+n(e.get_parameters())+"\n",a+=r+"Func_locals: "+n(e.get_locals())+"\n",a+=r+"Func_globals: "+n(e.get_globals())+"\n",a+=r+"Func_frees: "+n(e.get_frees())+"\n"),a+=r+"-- Identifiers --\n";var l=e.get_identifiers(),u=l.length;for(o=0;o<u;++o){var c=e.lookup(l[o]);a+=r+"name: "+c.get_name()+"\n",a+=r+" is_referenced: "+t(c.is_referenced())+"\n",a+=r+" is_imported: "+t(c.is_imported())+"\n",a+=r+" is_parameter: "+t(c.is_parameter())+"\n",a+=r+" is_global: "+t(c.is_global())+"\n",a+=r+" is_declared_global: "+t(c.is_declared_global())+"\n",a+=r+" is_local: "+t(c.is_local())+"\n",a+=r+" is_free: "+t(c.is_free())+"\n",a+=r+" is_assigned: "+t(c.is_assigned())+"\n",a+=r+" is_namespace: "+t(c.is_namespace())+"\n";var p=c.get_namespaces(),h=p.length;a+=r+" namespaces: [\n";var d=[];for(s=0;s<h;++s)c=p[s],d.push(i(c,r+" "));a+=d.join("\n"),a+=r+" ]\n"}return a};return i(e.top,"")},Sk.exportSymbol("Sk.symboltable",Sk.symboltable),Sk.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab)},function(e,t){function n(e,t,n,i,r){this.filename=e,this.st=t,this.flags=n,this.canSuspend=i,this.interactive=!1,this.nestlevel=0,this.u=null,this.stack=[],this.result=[],this.allUnits=[],this.source=!!r&&r.split("\n")}function i(){this.name=this.ste=null,this.doesSuspend=this.canSuspend=!1,this.private_=null,this.lineno=this.firstlineno=0,this.linenoSet=!1,this.localnames=[],this.localtemps=[],this.tempsToSave=[],this.blocknum=0,this.blocks=[],this.curblock=0,this.consts={},this.scopename=null,this.suffixCode=this.switchCode=this.varDeclsCode=this.prefixCode="",this.breakBlocks=[],this.continueBlocks=[],this.exceptBlocks=[],this.finallyBlocks=[]}function r(e){return void 0===a[e]?e:e+"_$rw$"}function s(e,t){var n=t.v;if(null===e||null===n||"_"!==n.charAt(0)||"_"!==n.charAt(1)||"_"===n.charAt(n.length-1)&&"_"===n.charAt(n.length-2))return t;var i=e.v;return i.replace(/_/g,""),""===i?t:((i=e.v).replace(/^_*/,""),new Sk.builtin.str("_"+i+n))}var o;Sk.gensymcount=0,i.prototype.activateScope=function(){var e=this;o=function(){var t,n=e.blocks[e.curblock];if(null===n._next)for(t=0;t<arguments.length;++t)n.push(arguments[t])}},n.prototype.getSourceLine=function(e){return Sk.asserts.assert(this.source),this.source[e-1]},n.prototype.annotateSource=function(e){var t;if(this.source){var n=e.lineno,i=e.col_offset;for(o("\n//\n// line ",n,":\n// ",this.getSourceLine(n),"\n// "),t=0;t<i;++t)o(" ");o("^\n//\n"),Sk.asserts.assert(void 0!==e.lineno&&void 0!==e.col_offset),o("$currLineNo = ",n,";\n$currColNo = ",i,";\n\n")}},n.prototype.gensym=function(e){return"$"+(e||"")+Sk.gensymcount++},n.prototype.niceName=function(e){return this.gensym(e.replace("<","").replace(">","").replace(" ","_"))};var a=Sk.builtin.str.reservedWords_;n.prototype.makeConstant=function(e){var t,n="";for(t=0;t<arguments.length;++t)n+=arguments[t];for(i in this.u.consts)if(this.u.consts.hasOwnProperty(i)&&(t=this.u.consts[i])==n)return i;var i=this.u.scopename+"."+this.gensym("const");return this.u.consts[i]=n,i},n.prototype._gr=function(e,t){var n,i=this.gensym(e);for(this.u.localtemps.push(i),o("var ",i,"="),n=1;n<arguments.length;++n)o(arguments[n]);return o(";"),i},n.prototype.outputInterruptTest=function(){var e="";return(null!==Sk.execLimit||null!==Sk.yieldLimit&&this.u.canSuspend)&&(e+="var $dateNow = Date.now();",null!==Sk.execLimit&&(e+="if ($dateNow - Sk.execStart > Sk.execLimit) {throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(e=e+"if ($dateNow - Sk.lastYield > Sk.yieldLimit) {var $susp = $saveSuspension({data: {type: 'Sk.yield'}, resume: function() {}}, '"+this.filename+"',$currLineNo,$currColNo);",e+="$susp.$blk = $blk;$susp.optional = true;return $susp;}",this.u.doesSuspend=!0)),e},n.prototype._jumpfalse=function(e,t){e=this._gr("jfalse","(",e,"===false||!Sk.misceval.isTrue(",e,"))"),o("if(",e,"){/*test failed */$blk=",t,";continue;}")},n.prototype._jumpundef=function(e,t){o("if(",e,"===undefined){$blk=",t,";continue;}")},n.prototype._jumpnotundef=function(e,t){o("if(",e,"!==undefined){$blk=",t,";continue;}")},n.prototype._jumptrue=function(e,t){e=this._gr("jtrue","(",e,"===true||Sk.misceval.isTrue(",e,"))"),o("if(",e,"){/*test passed */$blk=",t,";continue;}")},n.prototype._jump=function(e){null===this.u.blocks[this.u.curblock]._next&&(o("$blk=",e,";"),this.u.blocks[this.u.curblock]._next=e)},n.prototype._checkSuspension=function(e){if(this.u.canSuspend){var t=this.newBlock("function return or resume suspension");this._jump(t),this.setBlock(t),e=e||{lineno:"$currLineNo",col_offset:"$currColNo"},o("if ($ret && $ret.$isSuspension) { return $saveSuspension($ret,'"+this.filename+"',"+e.lineno+","+e.col_offset+"); }"),this.u.doesSuspend=!0,this.u.tempsToSave=this.u.tempsToSave.concat(this.u.localtemps)}else o("if ($ret && $ret.$isSuspension) { $ret = Sk.misceval.retryOptionalSuspensionOrThrow($ret); }")},n.prototype.cunpackstarstoarray=function(e,t){if(!e||0==e.length)return"[]";let n=!1;for(let i of e){if(t&&n)throw new Sk.builtin.SyntaxError("Extended argument unpacking is not permitted in Python 2");i.constructor===Sk.astnodes.Starred&&(n=!0)}if(n){t=this._gr("unpack","[]");for(let n of e)n.constructor!==Sk.astnodes.Starred?o(t,".push(",this.vexpr(n),");"):(o("$ret = Sk.misceval.iterFor(Sk.abstr.iter(",this.vexpr(n.value),"), function(e) { ",t,".push(e); });"),this._checkSuspension());return t}return"["+e.map((e=>this.vexpr(e))).join(",")+"]"},n.prototype.ctuplelistorset=function(e,t,n){var i;Sk.asserts.assert("tuple"===n||"list"===n||"set"===n);var r=!1;for(i=0;i<e.elts.length;i++)if(e.elts[i].constructor===Sk.astnodes.Starred){r=!0;var s=i;break}if(e.ctx===Sk.astnodes.Store){if(r){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("assignment unpacking with stars is not supported in Python 2",this.filename,e.lineno);for(i=s+1;i<e.elts.length;i++)if(e.elts[i].constructor===Sk.astnodes.Starred)throw new Sk.builtin.SyntaxError("multiple starred expressions in assignment",this.filename,e.lineno)}for(n=r?s:e.elts.length,o("$ret = Sk.abstr.sequenceUnpack("+t+","+n+","+(r?e.elts.length-1:n)+", "+r+");"),this._checkSuspension(),t=this._gr("items","$ret"),i=0;i<e.elts.length;++i)i===s?this.vexpr(e.elts[i].value,t+"["+i+"]"):this.vexpr(e.elts[i],t+"["+i+"]")}else if(e.ctx===Sk.astnodes.Load||"set"===n){if(r){if(!Sk.__future__.python3)throw new Sk.builtin.SyntaxError("List packing with stars is not supported in Python 2");return this._gr("load"+n,"new Sk.builtins['",n,"'](",this.cunpackstarstoarray(e.elts),")")}if("tuple"===n){for(r=!0,t=[],i=0;i<e.elts.length;++i)s=this.vexpr(e.elts[i]),r&&-1==s.indexOf("$const")&&(r=!1),t.push(s);if(r)return this.makeConstant("new Sk.builtin.tuple(["+t+"])");for(i=0;i<t.length;++i)t[i]=this._gr("elem",t[i]);return this._gr("load"+n,"new Sk.builtins['",n,"']([",t,"])")}for(t=[],i=0;i<e.elts.length;++i)t.push(this._gr("elem",this.vexpr(e.elts[i])));return this._gr("load"+n,"new Sk.builtins['",n,"']([",t,"])")}},n.prototype.cdict=function(e){var t,n=[];if(null!==e.keys)for(Sk.asserts.assert(e.values.length===e.keys.length),t=0;t<e.values.length;++t){var i=this.vexpr(e.values[t]);n.push(this.vexpr(e.keys[t])),n.push(i)}return this._gr("loaddict","new Sk.builtins['dict']([",n,"])")},n.prototype.clistcomp=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.ListComp);var t=this._gr("_compr","new Sk.builtins['list']([])");return this.ccompgen("list",t,e.generators,0,e.elt,null,e)},n.prototype.cdictcomp=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.DictComp);var t=this._gr("_dcompr","new Sk.builtins.dict([])");return this.ccompgen("dict",t,e.generators,0,e.value,e.key,e)},n.prototype.csetcomp=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.SetComp);var t=this._gr("_setcompr","new Sk.builtins.set([])");return this.ccompgen("set",t,e.generators,0,e.elt,null,e)},n.prototype.ccompgen=function(e,t,n,i,r,s,a){var l,u=this.newBlock(e+" comp start"),c=this.newBlock(e+" comp skip"),p=this.newBlock(e+" comp anchor"),h=n[i],d=this.vexpr(h.iter);d=this._gr("iter","Sk.abstr.iter(",d,")"),this._jump(u),this.setBlock(u),o("$ret = Sk.abstr.iternext(",d,", true);"),this._checkSuspension(a),d=this._gr("next","$ret"),this._jumpundef(d,p),this.vexpr(h.target,d);var f=h.ifs?h.ifs.length:0;for(l=0;l<f;++l)d=this.vexpr(h.ifs[l]),this._jumpfalse(d,u);return++i<n.length&&this.ccompgen(e,t,n,i,r,s,a),i>=n.length&&(n=this.vexpr(r),"dict"===e?(e=this.vexpr(s),o(t,".mp$ass_subscript(",e,",",n,");")):"list"===e?o(t,".v.push(",n,");"):"set"===e&&o(t,".v.mp$ass_subscript(",n,", true);"),this._jump(c),this.setBlock(c)),this._jump(u),this.setBlock(p),t},n.prototype.cyield=function(e){if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'yield' outside function",this.filename,e.lineno);var t="Sk.builtin.none.none$";return e.value&&(t=this.vexpr(e.value)),e=this.newBlock("after yield"),o("return [/*resume*/",e,",/*ret*/",t,"];"),this.setBlock(e),"$gen.gi$sentvalue"},n.prototype.ccompare=function(e){var t;Sk.asserts.assert(e.ops.length===e.comparators.length);var n=this.vexpr(e.left),i=e.ops.length,r=this.newBlock("done"),s=this._gr("compareres","null");for(t=0;t<i;++t){var a=this.vexpr(e.comparators[t]);o("$ret = Sk.builtin.bool(Sk.misceval.richCompareBool(",n,",",a,",'",e.ops[t].prototype._astname,"', true));"),this._checkSuspension(e),o(s,"=$ret;"),this._jumpfalse("$ret",r),n=a}return this._jump(r),this.setBlock(r),s},n.prototype.ccall=function(e){var t=this.vexpr(e.func);let n=this.cunpackstarstoarray(e.args,!Sk.__future__.python3);var i="undefined";if(e.keywords&&0<e.keywords.length){let n=!1;i=[];for(let t of e.keywords){if(n&&!Sk.__future__.python3)throw new SyntaxError("Advanced unpacking of function arguments is not supported in Python 2");t.arg?(i.push("'"+t.arg.v+"'"),i.push(this.vexpr(t.value))):n=!0}if(i="["+i.join(",")+"]",n){i=this._gr("keywordArgs",i);for(let n of e.keywords)n.arg||(o("$ret = Sk.abstr.mappingUnpackIntoKeywordArray(",i,",",this.vexpr(n.value),",",t,");"),this._checkSuspension())}}return Sk.__future__.super_args&&e.func.id&&"super"===e.func.id.v&&"[]"===n&&(o('if (typeof self === "undefined" || self.toString().indexOf("Window") > 0) { throw new Sk.builtin.RuntimeError("super(): no arguments") };'),n="[$gbl.__class__,self]"),o("$ret = (",t,".tp$call)?",t,".tp$call(",n,",",i,") : Sk.misceval.applyOrSuspend(",t,",undefined,undefined,",i,",",n,");"),this._checkSuspension(e),this._gr("call","$ret")},n.prototype.cslice=function(e){if(Sk.asserts.assert(e instanceof Sk.astnodes.Slice),Sk.__future__.python3)var t=e.lower?this.vexpr(e.lower):"Sk.builtin.none.none$",n=e.upper?this.vexpr(e.upper):"Sk.builtin.none.none$";else t=e.lower?this.vexpr(e.lower):e.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(0)",n=e.upper?this.vexpr(e.upper):e.step?"Sk.builtin.none.none$":"new Sk.builtin.int_(2147483647)";return e=e.step?this.vexpr(e.step):"Sk.builtin.none.none$",this._gr("slice","new Sk.builtins['slice'](",t,",",n,",",e,")")},n.prototype.eslice=function(e){var t;Sk.asserts.assert(e instanceof Array);var n=[];for(t=0;t<e.length;t++)n.push(this.vslicesub(e[t]));return this._gr("extslice","new Sk.builtins['tuple']([",n,"])")},n.prototype.vslicesub=function(e){switch(e.constructor){case Sk.astnodes.Index:var t=this.vexpr(e.value);break;case Sk.astnodes.Slice:t=this.cslice(e);break;case Sk.astnodes.Ellipsis:Sk.asserts.fail("todo compile.js Ellipsis;");break;case Sk.astnodes.ExtSlice:t=this.eslice(e.dims);break;default:Sk.asserts.fail("invalid subscript kind")}return t},n.prototype.vslice=function(e,t,n,i){return e=this.vslicesub(e),this.chandlesubscr(t,n,e,i)},n.prototype.chandlesubscr=function(e,t,n,i){if(e===Sk.astnodes.Load||e===Sk.astnodes.AugLoad)return o("$ret = Sk.abstr.objectGetItem(",t,",",n,", true);"),this._checkSuspension(),this._gr("lsubscr","$ret");e===Sk.astnodes.Store||e===Sk.astnodes.AugStore?(o("$ret = Sk.abstr.objectSetItem(",t,",",n,",",i,", true);"),this._checkSuspension()):e===Sk.astnodes.Del?o("Sk.abstr.objectDelItem(",t,",",n,");"):Sk.asserts.fail("handlesubscr fail")},n.prototype.cboolop=function(e){var t,n;Sk.asserts.assert(e instanceof Sk.astnodes.BoolOp);var i=e.op===Sk.astnodes.And?this._jumpfalse:this._jumptrue,r=this.newBlock("end of boolop"),s=e.values,a=s.length;for(t=0;t<a;++t)e=this.vexpr(s[t]),0===t&&(n=this._gr("boolopsucc",e)),o(n,"=",e,";"),i.call(this,e,r);return this._jump(r),this.setBlock(r),n},n.prototype.cjoinedstr=function(e){let t;Sk.asserts.assert(e instanceof Sk.astnodes.JoinedStr);for(let n of e.values)e=this.vexpr(n),t?o(t,"=",t,".sq$concat(",e,");"):t=this._gr("joinedstr",e);return t||(t="Sk.builtin.str.$emptystr"),t},n.prototype.cformattedvalue=function(e){let t=this.vexpr(e.value);switch(e.conversion){case"s":t=this._gr("value","new Sk.builtin.str(",t,")");break;case"a":t=this._gr("value","Sk.builtin.ascii(",t,")");break;case"r":t=this._gr("value","Sk.builtin.repr(",t,")")}return e=e.format_spec?this.vexpr(e.format_spec):"Sk.builtin.str.$emptystr",this._gr("formatted","Sk.abstr.objectFormat("+t+","+e+")")},n.prototype.vexpr=function(e,t,n,i){var r;switch(e.lineno>this.u.lineno&&(this.u.lineno=e.lineno,this.u.linenoSet=!1),e.constructor){case Sk.astnodes.BoolOp:return this.cboolop(e);case Sk.astnodes.BinOp:return this._gr("binop","Sk.abstr.numberBinOp(",this.vexpr(e.left),",",this.vexpr(e.right),",'",e.op.prototype._astname,"')");case Sk.astnodes.UnaryOp:return this._gr("unaryop","Sk.abstr.numberUnaryOp(",this.vexpr(e.operand),",'",e.op.prototype._astname,"')");case Sk.astnodes.Lambda:return this.clambda(e);case Sk.astnodes.IfExp:return this.cifexp(e);case Sk.astnodes.Dict:return this.cdict(e);case Sk.astnodes.ListComp:return this.clistcomp(e);case Sk.astnodes.DictComp:return this.cdictcomp(e);case Sk.astnodes.SetComp:return this.csetcomp(e);case Sk.astnodes.GeneratorExp:return this.cgenexp(e);case Sk.astnodes.Yield:return this.cyield(e);case Sk.astnodes.Compare:return this.ccompare(e);case Sk.astnodes.Call:return t=this.ccall(e),this.annotateSource(e),t;case Sk.astnodes.Num:if("number"==typeof e.n)return e.n;if(e.n instanceof Sk.builtin.lng)return this.makeConstant("new Sk.builtin.lng('"+e.n.v.toString()+"')");if(e.n instanceof Sk.builtin.int_)return"number"==typeof e.n.v?this.makeConstant("new Sk.builtin.int_("+e.n.v+")"):this.makeConstant("new Sk.builtin.int_('"+e.n.v.toString()+"')");if(e.n instanceof Sk.builtin.float_)return e=0===e.n.v&&-1/0==1/e.n.v?"-0":e.n.v,this.makeConstant("new Sk.builtin.float_("+e+")");if(e.n instanceof Sk.builtin.complex)return this.makeConstant("new Sk.builtin.complex("+(0===e.n.real&&-1/0==1/e.n.real?"-0":e.n.real)+", "+(0===e.n.imag&&-1/0==1/e.n.imag?"-0":e.n.imag)+")");Sk.asserts.fail("unhandled Num type");case Sk.astnodes.Bytes:if(Sk.__future__.python3){for(t=[],e=e.s.$jsstr(),n=0;n<e.length;n++)t.push(e.charCodeAt(n));return this.makeConstant("new Sk.builtin.bytes([",t.join(", "),"])")}case Sk.astnodes.Str:return this.makeConstant("new Sk.builtin.str(",function(e){let t='"';for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);t=10==i?t+"\\n":92==i?t+"\\\\":34==i||32>i||127<=i&&256>i?t+"\\x"+("0"+i.toString(16)).substr(-2):256<=i?t+"\\u"+("000"+i.toString(16)).substr(-4):t+e.charAt(n)}return t+'"'}(e.s.$jsstr()),")");case Sk.astnodes.Attribute:switch(e.ctx!==Sk.astnodes.AugLoad&&e.ctx!==Sk.astnodes.AugStore&&(r=this.vexpr(e.value)),i=(i=e.attr.$r().v).substring(1,i.length-1),i=s(this.u.private_,new Sk.builtin.str(i)).v,i=this.makeConstant("new Sk.builtin.str('"+i+"')"),e.ctx){case Sk.astnodes.AugLoad:return o("$ret = ",n,".tp$getattr(",i,", true);"),this._checkSuspension(e),o("\nif ($ret === undefined) {"),o("\nthrow new Sk.builtin.AttributeError(",n,'.sk$attrError() + " has no attribute \'" + ',i,'.$jsstr() + "\'");'),o("\n};"),this._gr("lattr","$ret");case Sk.astnodes.Load:return o("$ret = ",r,".tp$getattr(",i,", true);"),this._checkSuspension(e),o("\nif ($ret === undefined) {"),o("\nthrow new Sk.builtin.AttributeError(",r,'.sk$attrError() + " has no attribute \'" + ',i,'.$jsstr() + "\'");'),o("\n};"),this._gr("lattr","$ret");case Sk.astnodes.AugStore:o("$ret = undefined;"),o("if(",t,"!==undefined){"),o("$ret = ",n,".tp$setattr(",i,",",t,", true);"),o("}"),this._checkSuspension(e);break;case Sk.astnodes.Store:o("$ret = ",r,".tp$setattr(",i,",",t,", true);"),this._checkSuspension(e);break;case Sk.astnodes.Del:o("$ret = ",r,".tp$setattr(",i,", undefined, true);"),this._checkSuspension(e);break;default:Sk.asserts.fail("invalid attribute expression")}break;case Sk.astnodes.Subscript:switch(e.ctx){case Sk.astnodes.AugLoad:return o("$ret = Sk.abstr.objectGetItem(",n,",",i,", true);"),this._checkSuspension(e),this._gr("gitem","$ret");case Sk.astnodes.Load:case Sk.astnodes.Store:case Sk.astnodes.Del:return this.vslice(e.slice,e.ctx,this.vexpr(e.value),t);case Sk.astnodes.AugStore:o("$ret=undefined;"),o("if(",t,"!==undefined){"),o("$ret=Sk.abstr.objectSetItem(",n,",",i,",",t,", true)"),o("}"),this._checkSuspension(e);break;default:Sk.asserts.fail("invalid subscript expression")}break;case Sk.astnodes.Name:return this.nameop(e.id,e.ctx,t);case Sk.astnodes.NameConstant:if(e.ctx===Sk.astnodes.Store||e.ctx===Sk.astnodes.AugStore||e.ctx===Sk.astnodes.Del)throw new Sk.builtin.SyntaxError("can not assign to a constant name");switch(e.value){case Sk.builtin.none.none$:return"Sk.builtin.none.none$";case Sk.builtin.bool.true$:return"Sk.builtin.bool.true$";case Sk.builtin.bool.false$:return"Sk.builtin.bool.false$";default:Sk.asserts.fail("invalid named constant")}break;case Sk.astnodes.List:return this.ctuplelistorset(e,t,"list");case Sk.astnodes.Tuple:return this.ctuplelistorset(e,t,"tuple");case Sk.astnodes.Set:return this.ctuplelistorset(e,t,"set");case Sk.astnodes.Starred:if(e.ctx===Sk.astnodes.Store)throw new Sk.builtin.SyntaxError("starred assignment target must be in a list or tuple",this.filename,e.lineno);throw new Sk.builtin.SyntaxError("can't use starred expression here",this.filename,e.lineno);case Sk.astnodes.JoinedStr:return this.cjoinedstr(e);case Sk.astnodes.FormattedValue:return this.cformattedvalue(e);default:Sk.asserts.fail("unhandled case "+e.constructor.name+" vexpr")}},n.prototype.vseqexpr=function(e,t){var n;Sk.asserts.assert(void 0===t||e.length===t.length);var i=[];for(n=0;n<e.length;++n)i.push(this.vexpr(e[n],void 0===t?void 0:t[n]));return i},n.prototype.caugassign=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.AugAssign);var t=e.target;switch(t.constructor){case Sk.astnodes.Attribute:var n=this.vexpr(t.value);t=new Sk.astnodes.Attribute(t.value,t.attr,Sk.astnodes.AugLoad,t.lineno,t.col_offset);var i=this.vexpr(t,void 0,n),r=this.vexpr(e.value);return e=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",i,",",r,",'",e.op.prototype._astname,"')"),t.ctx=Sk.astnodes.AugStore,this.vexpr(t,e,n);case Sk.astnodes.Subscript:n=this.vexpr(t.value);var s=this.vslicesub(t.slice);return t=new Sk.astnodes.Subscript(t.value,s,Sk.astnodes.AugLoad,t.lineno,t.col_offset),i=this.vexpr(t,void 0,n,s),r=this.vexpr(e.value),e=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",i,",",r,",'",e.op.prototype._astname,"')"),t.ctx=Sk.astnodes.AugStore,this.vexpr(t,e,n,s);case Sk.astnodes.Name:return n=this.nameop(t.id,Sk.astnodes.Load),r=this.vexpr(e.value),e=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",n,",",r,",'",e.op.prototype._astname,"')"),this.nameop(t.id,Sk.astnodes.Store,e);default:Sk.asserts.fail("unhandled case in augassign")}},n.prototype.exprConstant=function(e){switch(e.constructor){case Sk.astnodes.Num:return Sk.misceval.isTrue(e.n)?1:0;case Sk.astnodes.Str:return Sk.misceval.isTrue(e.s)?1:0;default:return-1}},n.prototype.newBlock=function(e){var t=this.u.blocknum++;return this.u.blocks[t]=[],this.u.blocks[t]._name=e||"<unnamed>",this.u.blocks[t]._next=null,t},n.prototype.setBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.curblock=e},n.prototype.pushBreakBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.breakBlocks.push(e)},n.prototype.popBreakBlock=function(){this.u.breakBlocks.pop()},n.prototype.pushContinueBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.continueBlocks.push(e)},n.prototype.popContinueBlock=function(){this.u.continueBlocks.pop()},n.prototype.pushExceptBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),this.u.exceptBlocks.push(e)},n.prototype.popExceptBlock=function(){this.u.exceptBlocks.pop()},n.prototype.pushFinallyBlock=function(e){Sk.asserts.assert(0<=e&&e<this.u.blocknum),Sk.asserts.assert(this.u.breakBlocks.length===this.u.continueBlocks.length),this.u.finallyBlocks.push({blk:e,breakDepth:this.u.breakBlocks.length})},n.prototype.popFinallyBlock=function(){this.u.finallyBlocks.pop()},n.prototype.peekFinallyBlock=function(){return 0<this.u.finallyBlocks.length?this.u.finallyBlocks[this.u.finallyBlocks.length-1]:void 0},n.prototype.setupExcept=function(e){o("$exc.push(",e,");")},n.prototype.endExcept=function(){o("$exc.pop();")},n.prototype.outputLocals=function(e){var t,n={};for(t=0;e.argnames&&t<e.argnames.length;++t)n[e.argnames[t]]=!0;e.localnames.sort();var i=[];for(t=0;t<e.localnames.length;++t){var r=e.localnames[t];void 0===n[r]&&(i.push(r),n[r]=!0)}return 0<i.length?"var "+i.join(",")+"; /* locals */":""},n.prototype.outputSuspensionHelpers=function(e){var t,n=[],i=e.localnames.concat(e.tempsToSave),r={},s=e.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&e.ste.childHasFree,o=(0<i.length?"var "+i.join(",")+";":"")+"var $wakeFromSuspension = function() {var susp = "+e.scopename+".$wakingSuspension; "+e.scopename+".$wakingSuspension = undefined;$blk=susp.$blk; $loc=susp.$loc; $gbl=susp.$gbl; $exc=susp.$exc; $err=susp.$err; $postfinally=susp.$postfinally;$currLineNo=susp.$lineno; $currColNo=susp.$colno; Sk.lastYield=Date.now();"+(s?"$cell=susp.$cell;":"");for(t=0;t<i.length;t++){var a=i[t];void 0===r[a]&&(o+=a+"=susp.$tmps."+a+";",r[a]=!0)}for(o+="try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }};",o+="var $saveSuspension = function($child, $filename, $lineno, $colno) {var susp = new Sk.misceval.Suspension(); susp.child=$child;susp.resume=function(){"+e.scopename+".$wakingSuspension=susp; return "+e.scopename+"("+(e.ste.generator?"$gen":"")+"); };susp.data=susp.child.data;susp.$blk=$blk;susp.$loc=$loc;susp.$gbl=$gbl;susp.$exc=$exc;susp.$err=$err;susp.$postfinally=$postfinally;susp.$filename=$filename;susp.$lineno=$lineno;susp.$colno=$colno;susp.optional=susp.child.optional;"+(s?"susp.$cell=$cell;":""),r={},t=0;t<i.length;t++)void 0===r[a=i[t]]&&(n.push('"'+a+'":'+a),r[a]=!0);return o+"susp.$tmps={"+n.join(",")+"};return susp;};"},n.prototype.outputAllUnits=function(){var e,t,n="";for(t=0;t<this.allUnits.length;++t){var i=this.allUnits[t];n+=i.prefixCode,n+=this.outputLocals(i),i.doesSuspend&&(n+=this.outputSuspensionHelpers(i)),n+=i.varDeclsCode,n+=i.switchCode;var r=i.blocks,s=Object.create(null);for(e=0;e<r.length;++e){var o=e;if(!(o in s))for(;;){if(s[o]=!0,n+="case "+o+": /* --- "+r[o]._name+" --- */",n+=r[o].join(""),null===r[o]._next){n+="throw new Sk.builtin.SystemError('internal error: unterminated block');";break}if(r[o]._next in s){n+="/* jump */ continue;";break}n+="/* allowing case fallthrough */",o=r[o]._next}}n+=i.suffixCode}return n},n.prototype.cif=function(e){var t;Sk.asserts.assert(e instanceof Sk.astnodes.If);var n=this.exprConstant(e.test);if(0===n)e.orelse&&0<e.orelse.length&&this.vseqstmt(e.orelse);else if(1===n)this.vseqstmt(e.body);else{var i=this.newBlock("end of if");e.orelse&&0<e.orelse.length&&(t=this.newBlock("next branch of if")),n=this.vexpr(e.test),e.orelse&&0<e.orelse.length?(this._jumpfalse(n,t),this.vseqstmt(e.body),this._jump(i),this.setBlock(t),this.vseqstmt(e.orelse)):(this._jumpfalse(n,i),this.vseqstmt(e.body)),this._jump(i),this.setBlock(i)}},n.prototype.cwhile=function(e){if(0===this.exprConstant(e.test))e.orelse&&this.vseqstmt(e.orelse);else{var t=this.newBlock("while test");this._jump(t),this.setBlock(t);var n=this.newBlock("after while"),i=0<e.orelse.length?this.newBlock("while orelse"):null,r=this.newBlock("while body");this.annotateSource(e),this._jumpfalse(this.vexpr(e.test),i||n),this._jump(r),this.pushBreakBlock(n),this.pushContinueBlock(t),this.setBlock(r),(Sk.debugging||Sk.killableWhile)&&this.u.canSuspend&&(r=this.newBlock("debug breakpoint for line "+e.lineno),o("if (Sk.breakpoints('"+this.filename+"',"+e.lineno+","+e.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '"+this.filename+"',"+e.lineno+","+e.col_offset+");","$susp.$blk = "+r+";","$susp.optional = true;","return $susp;","}"),this._jump(r),this.setBlock(r),this.u.doesSuspend=!0),this.vseqstmt(e.body),this._jump(t),this.popContinueBlock(),this.popBreakBlock(),0<e.orelse.length&&(this.setBlock(i),this.vseqstmt(e.orelse),this._jump(n)),this.setBlock(n)}},n.prototype.cfor=function(e){var t=this.newBlock("for start"),n=this.newBlock("for cleanup"),i=this.newBlock("for end");this.pushBreakBlock(i),this.pushContinueBlock(t);var r=this.vexpr(e.iter);if(this.u.ste.generator){var s="$loc."+this.gensym("iter");o(s,"=Sk.abstr.iter(",r,");")}else s=this._gr("iter","Sk.abstr.iter(",r,")"),this.u.tempsToSave.push(s);this._jump(t),this.setBlock(t),o("$ret = Sk.abstr.iternext(",s,this.u.canSuspend?", true":", false",");"),this._checkSuspension(e),s=this._gr("next","$ret"),this._jumpundef(s,n),this.vexpr(e.target,s),(Sk.debugging||Sk.killableFor)&&this.u.canSuspend&&(s=this.newBlock("debug breakpoint for line "+e.lineno),o("if (Sk.breakpoints('"+this.filename+"',"+e.lineno+","+e.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '"+this.filename+"',"+e.lineno+","+e.col_offset+");","$susp.$blk = "+s+";","$susp.optional = true;","return $susp;","}"),this._jump(s),this.setBlock(s),this.u.doesSuspend=!0),this.vseqstmt(e.body),this._jump(t),this.setBlock(n),this.popContinueBlock(),this.popBreakBlock(),this.vseqstmt(e.orelse),this._jump(i),this.setBlock(i)},n.prototype.craise=function(e){if(e.exc){var t=this._gr("exc",this.vexpr(e.exc)),n=this.newBlock("exception now instantiated"),i=this._gr("isclass",t+".prototype instanceof Sk.builtin.BaseException");this._jumpfalse(i,n),e.inst?(i=this._gr("inst",this.vexpr(e.inst)),o("if(!(",i," instanceof Sk.builtin.tuple)) {",i,"= new Sk.builtin.tuple([",i,"]);","}"),o("$ret = Sk.misceval.callsimOrSuspendArray(",t,",",i,".v);")):o("$ret = Sk.misceval.callsimOrSuspend(",t,");"),this._checkSuspension(e),o(t,"=$ret;"),this._jump(n),this.setBlock(n),o("if (",t," instanceof Sk.builtin.BaseException) {throw ",t,";} else {throw new Sk.builtin.TypeError('exceptions must derive from BaseException');};")}else o("throw $err;")},n.prototype.outputFinallyCascade=function(e){if(0==this.u.finallyBlocks.length)o("if($postfinally!==undefined) { if ($postfinally.returning) { return $postfinally.returning; } else { $blk=$postfinally.gotoBlock; $postfinally=undefined; continue; } }");else{var t=this.peekFinallyBlock();o("if($postfinally!==undefined) {","if ($postfinally.returning",t.breakDepth==e.breakDepth?"|| $postfinally.isBreak":"",") {","$blk=",t.blk,";continue;","} else {","$blk=$postfinally.gotoBlock;$postfinally=undefined;continue;","}","}")}},n.prototype.ctry=function(e){var t,n=e.handlers.length;if(e.finalbody){var i=this.newBlock("finalbody"),r=this.newBlock("finalexh"),s=this._gr("finally_reraise","undefined");this.u.tempsToSave.push(s),this.pushFinallyBlock(i);var a=this.peekFinallyBlock();this.setupExcept(r)}var l=[];for(t=0;t<n;++t)l.push(this.newBlock("except_"+t+"_"));var u=this.newBlock("unhandled"),c=this.newBlock("orelse"),p=this.newBlock("end");for(0!=l.length&&this.setupExcept(l[0]),this.vseqstmt(e.body),0!=l.length&&this.endExcept(),this._jump(c),t=0;t<n;++t){this.setBlock(l[t]);var h=e.handlers[t];if(!h.type&&t<n-1)throw new Sk.builtin.SyntaxError("default 'except:' must be last",this.filename,h.lineno);if(h.type){var d=this.vexpr(h.type),f=t==n-1?u:l[t+1];d=this._gr("instance","Sk.misceval.isTrue(Sk.builtin.isinstance($err, ",d,"))"),this._jumpfalse(d,f)}h.name&&this.vexpr(h.name,"$err"),this.vseqstmt(h.body),this._jump(p)}this.setBlock(u),o("throw $err;"),this.setBlock(c),this.vseqstmt(e.orelse),this._jump(p),this.setBlock(p),e.finalbody&&(this.endExcept(),this._jump(i),this.setBlock(r),o(s,"=$err;"),this._jump(i),this.setBlock(i),this.popFinallyBlock(),this.vseqstmt(e.finalbody),o("if(",s,"!==undefined) { throw ",s,";}"),this.outputFinallyCascade(a))},n.prototype.cwith=function(e,t){var n=this.newBlock("withexh"),i=this.newBlock("withtidyup"),r=this.newBlock("withcarryon"),s=this._gr("mgr",this.vexpr(e.items[t].context_expr));o("$ret = Sk.abstr.lookupSpecial(",s,",Sk.builtin.str.$exit);"),this._checkSuspension(e);var a=this._gr("exit","$ret");this.u.tempsToSave.push(a),o("$ret = Sk.abstr.lookupSpecial(",s,",Sk.builtin.str.$enter);"),this._checkSuspension(e),o("$ret = Sk.misceval.callsimOrSuspendArray($ret);"),this._checkSuspension(e),s=this._gr("value","$ret"),this.pushFinallyBlock(i);var l=this.u.finallyBlocks[this.u.finallyBlocks.length-1];this.setupExcept(n),e.items[t].optional_vars&&this.nameop(e.items[t].optional_vars.id,Sk.astnodes.Store,s),t+1<e.items.length?this.cwith(e,t+1):this.vseqstmt(e.body),this.endExcept(),this._jump(i),this.setBlock(n),o("$ret = Sk.misceval.applyOrSuspend(",a,",undefined,Sk.builtin.getExcInfo($err),undefined,[]);"),this._checkSuspension(e),this._jumptrue("$ret",r),o("throw $err;"),this.setBlock(i),this.popFinallyBlock(),o("$ret = Sk.misceval.callsimOrSuspendArray(",a,",[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.none.none$]);"),this._checkSuspension(e),this.outputFinallyCascade(l),this._jump(r),this.setBlock(r)},n.prototype.cassert=function(e){var t=this.vexpr(e.test),n=this.newBlock("end");this._jumptrue(t,n),o("throw new Sk.builtin.AssertionError(",e.msg?this.vexpr(e.msg):"",");"),this.setBlock(n)},n.prototype.cimportas=function(e,t,n){var i=(e=e.v).indexOf("."),r=n;if(-1!==i)for(e=e.substr(i+1);-1!==i;)n=-1!==(i=e.indexOf("."))?e.substr(0,i):e,r=this._gr("lattr","Sk.abstr.gattr(",r,", new Sk.builtin.str('",n,"'))"),e=e.substr(i+1);return this.nameop(t,Sk.astnodes.Store,r)},n.prototype.cimport=function(e){var t,n=e.names.length;for(t=0;t<n;++t){var i=e.names[t];o("$ret = Sk.builtin.__import__(",i.name.$r().v,",$gbl,$loc,[],",Sk.__future__.absolute_import?0:-1,");"),this._checkSuspension(e);var r=this._gr("module","$ret");if(i.asname)this.cimportas(i.name,i.asname,r);else{var s=i.name;-1!==(i=s.v.indexOf("."))&&(s=new Sk.builtin.str(s.v.substr(0,i))),this.nameop(s,Sk.astnodes.Store,r)}}},n.prototype.cfromimport=function(e){var t,n=e.names.length,i=[],s=e.level;for(0!=s||Sk.__future__.absolute_import||(s=-1),t=0;t<n;++t)i[t]="'"+r(e.names[t].name.v)+"'";for(o("$ret = Sk.builtin.__import__(",e.module.$r().v,",$gbl,$loc,[",i,"],",s,");"),this._checkSuspension(e),s=this._gr("module","$ret"),t=0;t<n;++t){var a="'"+(i=e.names[t]).name.v+"'";if(0===t&&"*"===i.name.v){Sk.asserts.assert(1===n),o("Sk.importStar(",s,",$loc, $gbl);");break}var l=this._gr("item","Sk.abstr.gattr(",s,", new Sk.builtin.str(",a,"), undefined)");a=i.name,i.asname&&(a=i.asname),this.nameop(a,Sk.astnodes.Store,l)}},n.prototype.buildcodeobj=function(e,t,n,i,a,l){var u,c=[],p=[],h=[],d=[],f=null,_=null;if(n&&(p=this.vseqexpr(n)),i&&i.defaults&&(h=this.vseqexpr(i.defaults)),i&&i.kw_defaults&&(d=i.kw_defaults.map((e=>e?this.vexpr(e):"undefined"))),i&&i.vararg&&(f=i.vararg),i&&i.kwarg&&(_=i.kwarg),!Sk.__future__.python3&&i&&i.kwonlyargs&&0!=i.kwonlyargs.length)throw new Sk.builtin.SyntaxError("Keyword-only arguments are not supported in Python 2");var m=this.enterScope(t,e,e.lineno,this.canSuspend);n=this.u.ste.generator;var b=this.u.ste.hasFree,g=this.u.ste.childHasFree,S=this.newBlock("codeobj entry");this.u.prefixCode="var "+m+"=(function "+this.niceName(t.v)+"$(";var k=[];if(n){if(_)throw new Sk.builtin.SyntaxError(t.v+"(): keyword arguments in generators not supported",this.filename,e.lineno);if(f)throw new Sk.builtin.SyntaxError(t.v+"(): variable number of arguments in generators not supported",this.filename,e.lineno);k.push("$gen")}else{for(_&&(k.push("$kwa"),this.u.tempsToSave.push("$kwa")),u=0;i&&u<i.args.length;++u)k.push(this.nameop(i.args[u].arg,Sk.astnodes.Param));for(u=0;i&&i.kwonlyargs&&u<i.kwonlyargs.length;++u)k.push(this.nameop(i.kwonlyargs[u].arg,Sk.astnodes.Param));f&&k.push(this.nameop(i.vararg.arg,Sk.astnodes.Param))}let y=!n;b&&(y||k.push("$free"),this.u.tempsToSave.push("$free")),this.u.prefixCode=y?this.u.prefixCode+"$posargs,$kwargs":this.u.prefixCode+k.join(","),this.u.prefixCode+="){",n&&(this.u.prefixCode+="\n// generator\n"),b&&(this.u.prefixCode+="\n// has free\n"),g&&(this.u.prefixCode+="\n// has cell\n"),y&&(this.u.prefixCode+="\n// fast call\n");var v="{}";if(n&&(S="$gen.gi$resumeat",v="$gen.gi$locals"),u=",$cell={}",g&&n&&(u=",$cell=$gen.gi$cells"),this.u.varDeclsCode+="var $blk="+S+",$exc=[],$loc="+v+u+",$gbl="+(y?"this && this.func_globals":"this")+(y&&b?",$free=this && this.func_closure":"")+",$err=undefined,$ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;",null!==Sk.execLimit&&(this.u.varDeclsCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.varDeclsCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"),this.u.varDeclsCode+="if ("+m+".$wakingSuspension!==undefined) { $wakeFromSuspension(); } else {",y){for(this.u.varDeclsCode=_||f||i&&i.kwonlyargs&&0!==i.kwonlyargs.length?this.u.varDeclsCode+"\nvar $args = this.$resolveArgs($posargs,$kwargs)\n":this.u.varDeclsCode+"var $args = ((!$kwargs || $kwargs.length===0) && $posargs.length==="+k.length+") ? $posargs : this.$resolveArgs($posargs,$kwargs)",u=0;u<k.length;u++)this.u.varDeclsCode+=","+k[u]+"=$args["+u+"]";this.u.varDeclsCode+=";\n"}if(n&&0<h.length)for(S=i.args.length-h.length,u=0;u<h.length;++u)k=this.nameop(i.args[u+S].arg,Sk.astnodes.Param),this.u.varDeclsCode+="if("+k+"===undefined)"+k+"="+m+".$defaults["+u+"];";for(u=0;i&&u<i.args.length;++u)k=i.args[u].arg,this.isCell(k)&&(k=r(s(this.u.private_,k).v),this.u.varDeclsCode+="$cell."+k+"="+k+";");for(u=0;i&&i.kwonlyargs&&u<i.kwonlyargs.length;++u)k=i.kwonlyargs[u].arg,this.isCell(k)&&(k=r(s(this.u.private_,k).v),this.u.varDeclsCode+="$cell."+k+"="+k+";");if(f&&this.isCell(f.arg)&&(u=r(s(this.u.private_,f.arg).v),this.u.varDeclsCode+="$cell."+u+"="+u+";"),_&&(this.u.localnames.push(_.arg.v),this.u.varDeclsCode+=_.arg.v+"=new Sk.builtins['dict']($kwa);",this.isCell(_.arg)&&(u=r(s(this.u.private_,_.arg).v),this.u.varDeclsCode+="$cell."+u+"="+u+";")),this.u.varDeclsCode+="}",Sk.__future__.python3&&l&&(this.u.varDeclsCode+="$gbl.__class__=$gbl."+l.v+";"),this.u.switchCode="while(true){try{",this.u.switchCode+=this.outputInterruptTest(),this.u.switchCode+="switch($blk){",this.u.suffixCode="} }catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});",a.call(this,m),i){for(let e of i.args)c.push(e.arg.v);for(let e of i.kwonlyargs||[])c.push(e.arg.v);this.u.argnames=c}if(this.exitScope(),0<h.length&&o(m,".$defaults=[",h.join(","),"];"),i&&i.kwonlyargs&&0<i.kwonlyargs.length&&(o(m,".co_argcount=",i.args.length,";"),o(m,".co_kwonlyargcount=",i.kwonlyargs.length,";"),o(m,".$kwdefs=[",d.join(","),"];")),0<c.length?o(m,".co_varnames=['",c.join("','"),"'];"):o(m,".co_varnames=[];"),o(m,".co_docstring=",this.cDocstringOfCode(e),";"),_&&o(m,".co_kwargs=1;"),f&&o(m,".co_varargs=1;"),n||o(m,".co_fastcall=1;"),e="",b&&(e=",$cell",(a=this.u.ste.hasFree)&&(e+=",$free")),n)return i&&0<i.args.length?this._gr("gener","new Sk.builtins['function']((function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgsLen(\"",t.v,'",arguments.length,',i.args.length-h.length,",",i.args.length,");return new Sk.builtins['generator'](",m,",$gbl,$origargs",e,");}))"):this._gr("gener","new Sk.builtins['function']((function(){Sk.builtin.pyCheckArgsLen(\"",t.v,"\",arguments.length,0,0);return new Sk.builtins['generator'](",m,",$gbl,[]",e,");}))");if(0<p.length){o("$ret = new Sk.builtins['function'](",m,",$gbl",e,");");for(let e of p.reverse())o("$ret = Sk.misceval.callsimOrSuspendArray(",e,",[$ret]);"),this._checkSuspension();return this._gr("funcobj","$ret")}return this._gr("funcobj","new Sk.builtins['function'](",m,",$gbl",e,")")},n.prototype.maybeCDocstringOfBody=function(e){return 0===e.length||(e=e[0]).constructor!==Sk.astnodes.Expr||(e=e.value).constructor!==Sk.astnodes.Str?null:this.vexpr(e)},n.prototype.cDocstringOfCode=function(e){switch(e.constructor){case Sk.astnodes.AsyncFunctionDef:case Sk.astnodes.FunctionDef:return this.maybeCDocstringOfBody(e.body)||"Sk.builtin.none.none$";case Sk.astnodes.Lambda:case Sk.astnodes.GeneratorExp:return"Sk.builtin.none.none$";default:Sk.asserts.fail(`unexpected node kind ${e.constructor.name}`)}},n.prototype.cfunction=function(e,t){Sk.asserts.assert(e instanceof Sk.astnodes.FunctionDef),t=this.buildcodeobj(e,e.name,e.decorator_list,e.args,(function(t){this.vseqstmt(e.body),o("return Sk.builtin.none.none$;")}),t),this.nameop(e.name,Sk.astnodes.Store,t)},n.prototype.clambda=function(e){return Sk.asserts.assert(e instanceof Sk.astnodes.Lambda),this.buildcodeobj(e,new Sk.builtin.str("<lambda>"),null,e.args,(function(t){t=this.vexpr(e.body),o("return ",t,";")}))},n.prototype.cifexp=function(e){var t=this.newBlock("next of ifexp"),n=this.newBlock("end of ifexp"),i=this._gr("res","null"),r=this.vexpr(e.test);return this._jumpfalse(r,t),o(i,"=",this.vexpr(e.body),";"),this._jump(n),this.setBlock(t),o(i,"=",this.vexpr(e.orelse),";"),this._jump(n),this.setBlock(n),i},n.prototype.cgenexpgen=function(e,t,n){var i=this.newBlock("start for "+t),r=this.newBlock("skip for "+t);this.newBlock("if cleanup for "+t);var s=this.newBlock("end for "+t),a=e[t];if(0===t)var l="$loc.$iter0";else{var u=this.vexpr(a.iter);l="$loc."+this.gensym("iter"),o(l,"=","Sk.abstr.iter(",u,");")}this._jump(i),this.setBlock(i),this.annotateSource(n),o("$ret = Sk.abstr.iternext(",l,this.u.canSuspend?", true":", false",");"),this._checkSuspension(n),u=this._gr("next","$ret"),this._jumpundef(u,s),this.vexpr(a.target,u);var c=a.ifs?a.ifs.length:0;for(l=0;l<c;++l)this.annotateSource(a.ifs[l]),u=this.vexpr(a.ifs[l]),this._jumpfalse(u,i);++t<e.length&&this.cgenexpgen(e,t,n),t>=e.length&&(this.annotateSource(n),e=this.vexpr(n),o("return [",r,"/*resume*/,",e,"/*ret*/];"),this.setBlock(r)),this._jump(i),this.setBlock(s),1===t&&o("return Sk.builtin.none.none$;")},n.prototype.cgenexp=function(e){var t=this.buildcodeobj(e,new Sk.builtin.str("<genexpr>"),null,null,(function(t){this.cgenexpgen(e.generators,0,e.elt)}));return t=this._gr("gener","Sk.misceval.callsimArray(",t,");"),o(t,".gi$locals.$iter0=Sk.abstr.iter(",this.vexpr(e.generators[0].iter),");"),t},n.prototype.cclass=function(e){Sk.asserts.assert(e instanceof Sk.astnodes.ClassDef);var t=this.vseqexpr(e.decorator_list),n=this.vseqexpr(e.bases),i=this.enterScope(e.name,e,e.lineno),r=this.newBlock("class entry");this.u.prefixCode="var "+i+"=(function $"+e.name.v+"$class_outer($globals,$locals,$cell){var $gbl=$globals,$loc=$locals;$free=$globals;",this.u.switchCode+="(function $"+e.name.v+"$_closure($cell){",this.u.switchCode+="var $blk="+r+",$exc=[],$ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;",null!==Sk.execLimit&&(this.u.switchCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.switchCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"),this.u.switchCode+="while(true){try{",this.u.switchCode+=this.outputInterruptTest(),this.u.switchCode+="switch($blk){",this.u.suffixCode="}}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }}}",this.u.suffixCode+="}).call(null, $cell);});",this.u.private_=e.name,this.cbody(e.body,e.name),o("return;"),this.exitScope(),o("$ret = Sk.misceval.buildClass($gbl,",i,",",e.name.$r().v,",[",n,"], $cell);");for(let e of t)o("$ret = Sk.misceval.callsimOrSuspendArray(",e,", [$ret]);"),this._checkSuspension();this.nameop(e.name,Sk.astnodes.Store,"$ret")},n.prototype.ccontinue=function(e){var t=this.peekFinallyBlock();if(0==this.u.continueBlocks.length)throw new Sk.builtin.SyntaxError("'continue' outside loop",this.filename,e.lineno);e=this.u.continueBlocks[this.u.continueBlocks.length-1],Sk.asserts.assert(this.u.breakBlocks.length===this.u.continueBlocks.length),t&&t.breakDepth==this.u.continueBlocks.length?o("$postfinally={isBreak:true,gotoBlock:",e,"};"):this._jump(e)},n.prototype.cbreak=function(e){var t=this.peekFinallyBlock();if(0===this.u.breakBlocks.length)throw new Sk.builtin.SyntaxError("'break' outside loop",this.filename,e.lineno);e=this.u.breakBlocks[this.u.breakBlocks.length-1],t&&t.breakDepth==this.u.breakBlocks.length?o("$postfinally={isBreak:true,gotoBlock:",e,"};"):this._jump(e)},n.prototype.vstmt=function(e,t){if(this.u.lineno=e.lineno,this.u.linenoSet=!1,this.u.localtemps=[],Sk.debugging&&this.u.canSuspend){var n=this.newBlock("debug breakpoint for line "+e.lineno);o("if (Sk.breakpoints('"+this.filename+"',"+e.lineno+","+e.col_offset+")) {","var $susp = $saveSuspension({data: {type: 'Sk.debug'}, resume: function() {}}, '"+this.filename+"',"+e.lineno+","+e.col_offset+");","$susp.$blk = "+n+";","$susp.optional = true;","return $susp;","}"),this._jump(n),this.setBlock(n),this.u.doesSuspend=!0}switch(this.annotateSource(e),e.constructor){case Sk.astnodes.FunctionDef:this.cfunction(e,t);break;case Sk.astnodes.ClassDef:this.cclass(e);break;case Sk.astnodes.Return:if(this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock)throw new Sk.builtin.SyntaxError("'return' outside function",this.filename,e.lineno);n=e.value?this.vexpr(e.value):"Sk.builtin.none.none$",0==this.u.finallyBlocks.length?o("return ",n,";"):(o("$postfinally={returning:",n,"};"),this._jump(this.peekFinallyBlock().blk));break;case Sk.astnodes.Delete:this.vseqexpr(e.targets);break;case Sk.astnodes.Assign:var i=e.targets.length;for(n=this.vexpr(e.value),t=0;t<i;++t)this.vexpr(e.targets[t],n);break;case Sk.astnodes.AnnAssign:n=this.vexpr(e.value),this.vexpr(e.target,n),this.vexpr(e.annotation);break;case Sk.astnodes.AugAssign:return this.caugassign(e);case Sk.astnodes.Print:this.cprint(e);break;case Sk.astnodes.For:return this.cfor(e);case Sk.astnodes.While:return this.cwhile(e);case Sk.astnodes.If:return this.cif(e);case Sk.astnodes.Raise:return this.craise(e);case Sk.astnodes.Try:return this.ctry(e);case Sk.astnodes.With:return this.cwith(e,0);case Sk.astnodes.Assert:return this.cassert(e);case Sk.astnodes.Import:return this.cimport(e);case Sk.astnodes.ImportFrom:return this.cfromimport(e);case Sk.astnodes.Global:break;case Sk.astnodes.Expr:this.vexpr(e.value);break;case Sk.astnodes.Pass:break;case Sk.astnodes.Break:this.cbreak(e);break;case Sk.astnodes.Continue:this.ccontinue(e);break;case Sk.astnodes.Debugger:o("debugger;");break;default:Sk.asserts.fail("unhandled case in vstmt: "+JSON.stringify(e))}},n.prototype.vseqstmt=function(e){var t;for(t=0;t<e.length;++t)this.vstmt(e[t])},n.prototype.isCell=function(e){return e=r(s(this.u.private_,e).v),this.u.ste.getScope(e)===Sk.SYMTAB_CONSTS.CELL},n.prototype.nameop=function(e,t,n){if((t===Sk.astnodes.Store||t===Sk.astnodes.AugStore||t===Sk.astnodes.Del)&&"__debug__"===e.v)throw new Sk.builtin.SyntaxError("can not assign to __debug__",this.filename,this.u.lineno);if(Sk.asserts.assert("None"!==e.v),"NotImplemented"===e.v)return"Sk.builtin.NotImplemented.NotImplemented$";var i=s(this.u.private_,e).v;i=r(i);var a=3,l=this.u.ste.getScope(i),u=null;switch(l){case Sk.SYMTAB_CONSTS.FREE:u="$free",a=2;break;case Sk.SYMTAB_CONSTS.CELL:u="$cell",a=2;break;case Sk.SYMTAB_CONSTS.LOCAL:this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock||this.u.ste.generator||(a=0);break;case Sk.SYMTAB_CONSTS.GLOBAL_IMPLICIT:this.u.ste.blockType===Sk.SYMTAB_CONSTS.FunctionBlock&&(a=1);break;case Sk.SYMTAB_CONSTS.GLOBAL_EXPLICIT:a=1}switch(Sk.asserts.assert(l||"_"===e.v.charAt(1)),e=i,this.u.ste.generator||this.u.ste.blockType!==Sk.SYMTAB_CONSTS.FunctionBlock?i="$loc."+i:(0===a||3===a)&&this.u.localnames.push(i),a){case 0:switch(t){case Sk.astnodes.Load:case Sk.astnodes.Param:return o("if (",i," === undefined) { throw new Sk.builtin.UnboundLocalError('local variable \\'",i,"\\' referenced before assignment'); }\n"),i;case Sk.astnodes.Store:o(i,"=",n,";");break;case Sk.astnodes.Del:o("delete ",i,";");break;default:Sk.asserts.fail("unhandled")}break;case 3:switch(t){case Sk.astnodes.Load:return this._gr("loadname",i,"!==undefined?",i,":Sk.misceval.loadname('",e,"',$gbl);");case Sk.astnodes.Store:o(i,"=",n,";");break;case Sk.astnodes.Del:o("delete ",i,";");break;case Sk.astnodes.Param:return i;default:Sk.asserts.fail("unhandled")}break;case 1:switch(t){case Sk.astnodes.Load:return this._gr("loadgbl","Sk.misceval.loadname('",e,"',$gbl)");case Sk.astnodes.Store:o("$gbl.",e,"=",n,";");break;case Sk.astnodes.Del:o("delete $gbl.",e);break;default:Sk.asserts.fail("unhandled case in name op_global")}break;case 2:switch(t){case Sk.astnodes.Load:return u+"."+e;case Sk.astnodes.Store:o(u,".",e,"=",n,";");break;case Sk.astnodes.Param:return e;default:Sk.asserts.fail("unhandled case in name op_deref")}break;default:Sk.asserts.fail("unhandled case")}},n.prototype.enterScope=function(e,t,n,r){var s=new i;return s.ste=this.st.getStsForAst(t),s.name=e,s.firstlineno=n,s.canSuspend=r||!1,this.u&&this.u.private_&&(s.private_=this.u.private_),this.stack.push(this.u),this.allUnits.push(s),e=this.gensym("scope"),s.scopename=e,this.u=s,this.u.activateScope(),this.nestlevel++,e},n.prototype.exitScope=function(){var e=this.u;if(this.nestlevel--,(this.u=0<=this.stack.length-1?this.stack.pop():null)&&this.u.activateScope(),"<module>"!==e.name.v){var t=e.name.$r().v;t=t.substring(1,t.length-1),o(e.scopename,".co_name=new Sk.builtins['str']('",t,"');"),this.stack.length&&"class"==this.u.ste.blockType&&o(e.scopename,".co_qualname=new Sk.builtins['str']('"+this.u.name.v+"."+t+"');")}for(var n in e.consts)e.consts.hasOwnProperty(n)&&(e.suffixCode+=n+" = "+e.consts[n]+";")},n.prototype.cbody=function(e,t){var n=0;const i=this.maybeCDocstringOfBody(e);for(null!==i&&(o("$loc.__doc__ = ",i,";"),n=1);n<e.length;++n)this.vstmt(e[n],t)},n.prototype.cprint=function(e){var t;Sk.asserts.assert(e instanceof Sk.astnodes.Print),e.dest&&this.vexpr(e.dest);var n=e.values.length;for(t=0;t<n;++t)o("$ret = Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(e.values[t]),").v);"),this._checkSuspension(e)},n.prototype.cmod=function(e){var t=this.enterScope(new Sk.builtin.str("<module>"),e,0,this.canSuspend),n=this.newBlock("module entry");if(this.u.prefixCode="var "+t+"=(function($forcegbl){",this.u.varDeclsCode="var $gbl = $forcegbl || {}, $blk="+n+",$exc=[],$loc=$gbl,$cell={},$err=undefined;$loc.__file__=new Sk.builtins.str('"+this.filename+"');var $ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;",null!==Sk.execLimit&&(this.u.varDeclsCode+="if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"),null!==Sk.yieldLimit&&this.u.canSuspend&&(this.u.varDeclsCode+="if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"),this.u.varDeclsCode+="if ("+t+".$wakingSuspension!==undefined) { $wakeFromSuspension(); }if (Sk.retainGlobals) { if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; } if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; $loc.__file__=new Sk.builtins.str('"+this.filename+"');} else { Sk.globals = $gbl; }} else { Sk.globals = $gbl; }",this.u.switchCode="while(true){try{",this.u.switchCode+=this.outputInterruptTest(),this.u.switchCode+="switch($blk){",this.u.suffixCode="}",this.u.suffixCode+="}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} } });",e.constructor===Sk.astnodes.Module)this.cbody(e.body),o("return $loc;");else Sk.asserts.fail("todo; unhandled case in compilerMod");return this.exitScope(),this.result.push(this.outputAllUnits()),t},Sk.compile=function(e,t,i,r){i=Sk.__future__,Sk.__future__=Object.create(Sk.__future__);var s=Sk.parse(t,e),o=Sk.astFromParse(s.cst,t,s.flags);return s=s.flags,t=(e=new n(t,Sk.symboltable(o,t),s,r,e)).cmod(o),Sk.__future__=i,{funcname:"$compiledmod",code:"$compiledmod = function() {"+e.result.join("")+"\nreturn "+t+";}();"}},Sk.exportSymbol("Sk.compile",Sk.compile),Sk.resetCompiler=function(){Sk.gensymcount=0},Sk.exportSymbol("Sk.resetCompiler",Sk.resetCompiler),Sk.fixReserved=r,Sk.exportSymbol("Sk.fixReserved",Sk.fixReserved),Sk.unfixReserved=function(e){return e.replace(/_\$rw\$$/,"")},Sk.exportSymbol("Sk.unfixReserved",Sk.unfixReserved),Sk.mangleName=s,Sk.exportSymbol("Sk.mangleName",Sk.mangleName),Sk.reservedWords_=a,Sk.exportSymbol("Sk.reservedWords_",Sk.reservedWords_)},function(e,t){Sk.sysmodules=new Sk.builtin.dict([]),Sk.realsyspath=void 0,Sk.importSearchPathForName=function(e,t,n){var i=e.replace(/\./g,"/"),r=function(e,t){return Sk.misceval.chain(Sk.misceval.tryCatch((function(){return Sk.read(e)}),(function(e){})),(function(n){if(void 0!==n)return new Sk.misceval.Break({filename:e,code:n,packagePath:t})}))};return void 0===n&&(n=Sk.realsyspath),Sk.misceval.iterFor(n.tp$iter(),(function(e){return Sk.misceval.chain(r(e.v+"/"+i+t,!1),(function(n){return n||r(e.v+"/"+i+"/__init__"+t,e.v+"/"+i)}))}))},Sk.importSetUpPath=function(e){if(!Sk.realsyspath){var t=[new Sk.builtin.str("src/builtin"),new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")];for(e=0;e<Sk.syspath.length;++e)t.push(new Sk.builtin.str(Sk.syspath[e]));Sk.realsyspath=new Sk.builtin.list(t)}},Sk.importModuleInternal_=function(e,t,n,i,r,s,o){var a,l,u,c,p=null,h=void 0!==r?r.tp$getattr(Sk.builtin.str.$name):void 0,d=void 0!==h?h.v+".":"",f=void 0!==r?r.tp$getattr(Sk.builtin.str.$path):void 0;if(Sk.importSetUpPath(o),r&&!h){if(s)return;throw new Sk.builtin.ValueError("Attempted to import relative to invalid package (no name)")}void 0===n&&(n=d+e);var _=e.split(".");if(1<_.length){var m=_.slice(0,_.length-1).join(".");p=Sk.importModuleInternal_(m,t,void 0,void 0,r,s,o)}var b=Sk.misceval.chain(p,(function(b){return p=b,void 0!==(l=Sk.sysmodules.quick$lookup(new Sk.builtin.str(n)))?p||l:Sk.misceval.chain(void 0,(function(){var t=e;if(1<_.length){if(!p)return;u=Sk.sysmodules.mp$subscript(new Sk.builtin.str(d+m)),t=_[_.length-1],f=u.tp$getattr(Sk.builtin.str.$path)}if(c=new Sk.builtin.module,"string"==typeof i){a=e+".py";var n=Sk.compile(i,a,"exec",o)}else n=Sk.misceval.chain(void 0,(function(){if(Sk.onBeforeImport&&"function"==typeof Sk.onBeforeImport)return Sk.onBeforeImport(e)}),(function(n){if(!1===n)throw new Sk.builtin.ImportError("Importing "+e+" is not allowed");if("string"==typeof n)throw new Sk.builtin.ImportError(n);return Sk.importSearchPathForName(t,".js",f)}),(function(e){return e?{funcname:"$builtinmodule",code:e.code,filename:e.filename,packagePath:e.packagePath}:Sk.misceval.chain(Sk.importSearchPathForName(t,".py",f),(function(t){if(e=t)return Sk.compile(e.code,e.filename,"exec",o)}),(function(t){if(t)return t.packagePath=e.packagePath,t}))}));return n}),(function(e){if(e){Sk.sysmodules.mp$ass_subscript(new Sk.builtin.str(n),c);var i=c.$js=e.code;if(null==a&&(a=e.filename),null!=Sk.dateSet&&Sk.dateSet||(i="Sk.execStart = Sk.lastYield = new Date();\n"+e.code,Sk.dateSet=!0),t){i=function(e){var t,n=Sk.js_beautify(e).split("\n");for(t=1;t<=n.length;++t){var i=(""+t).length;for(e="";5>i;++i)e+=" ";n[t-1]="/* "+e+t+" */ "+n[t-1]}return n.join("\n")}(i),Sk.debugout(i)}return i+="\n"+e.funcname+";",i=Sk.global.eval(i),c.$d={__name__:new Sk.builtin.str(n),__doc__:Sk.builtin.none.none$,__package__:e.packagePath?new Sk.builtin.str(n):m?new Sk.builtin.str(d+m):h||Sk.builtin.none.none$},e.packagePath&&(c.$d.__path__=new Sk.builtin.tuple([new Sk.builtin.str(e.packagePath)])),i(c.$d)}}),(function(t){var n;if(void 0===t){if(s&&!p)return;throw new Sk.builtin.ImportError("No module named "+e)}if(t!==c.$d){for(n in c.$d)t[n]||(t[n]=c.$d[n]);c.$d=t}if(Sk.onAfterImport&&"function"==typeof Sk.onAfterImport)try{Sk.onAfterImport(e)}catch(e){}return p?(u.tp$setattr(new Sk.builtin.str(_[_.length-1]),c),p):(r&&r.tp$setattr(new Sk.builtin.str(e),c),c)}))}));return o?b:Sk.misceval.retryOptionalSuspensionOrThrow(b)},Sk.importModule=function(e,t,n){return Sk.importModuleInternal_(e,t,void 0,void 0,void 0,!1,n)},Sk.importMain=function(e,t,n){return Sk.dateSet=!1,Sk.filesLoaded=!1,Sk.sysmodules=new Sk.builtin.dict([]),Sk.realsyspath=void 0,Sk.resetCompiler(),Sk.importModuleInternal_(e,t,"__main__",void 0,void 0,!1,n)},Sk.importMainWithBody=function(e,t,n,i){return Sk.dateSet=!1,Sk.filesLoaded=!1,Sk.sysmodules=new Sk.builtin.dict([]),Sk.realsyspath=void 0,Sk.resetCompiler(),Sk.importModuleInternal_(e,t,"__main__",n,void 0,!1,i)},Sk.importBuiltinWithBody=function(e,t,n,i){return Sk.importModuleInternal_(e,t,"__builtin__."+e,n,void 0,!1,i)},Sk.builtin.__import__=function(e,t,n,i,r){var s,o=Sk.globals;if(void 0===r&&(r=Sk.__future__.absolute_import?0:-1),0!==r&&t.__package__&&t.__package__!==Sk.builtin.none.none$){if((s=t.__package__.v)&&0<r){if(t=s.split("."),r-1>=t.length)throw new Sk.builtin.ValueError("Attempted relative import beyond toplevel package");t.length-=r-1,s=t.join(".")}var a=Sk.sysmodules.quick$lookup(new Sk.builtin.str(s))}if(0<r&&void 0===a)throw new Sk.builtin.ValueError("Attempted relative import in non-package");return e.split("."),Sk.misceval.chain(void 0,(function(){if(0!==r&&void 0!==a)return""===e?a:Sk.importModuleInternal_(e,void 0,s+"."+e,void 0,a,-1==r,!0)}),(function(t){return void 0===t?(s=a=void 0,Sk.importModuleInternal_(e,void 0,void 0,void 0,void 0,!1,!0)):t}),(function(t){if(i&&0!==i.length){var n,r=Sk.sysmodules.mp$subscript(new Sk.builtin.str((s||"")+(s&&e?".":"")+e));for(t=0;t<i.length;t++){var o=i[t];"*"!=o&&void 0===r.tp$getattr(new Sk.builtin.str(o))&&(n=Sk.misceval.chain(n,Sk.importModuleInternal_.bind(null,o,void 0,void 0,void 0,r,!0,!0)))}return Sk.misceval.chain(n,(function(){return Sk.asserts.assert(r),r}))}return t}),(function(e){return o!==Sk.globals&&(Sk.globals=o),e}))},Sk.importStar=function(e,t,n){if(n=e.tp$getattr(new Sk.builtin.str("__all__")))for(let i=Sk.abstr.iter(n),r=i.tp$iternext();void 0!==r;r=i.tp$iternext())t[r.v]=Sk.abstr.gattr(e,r);else{n=Object.getOwnPropertyNames(e.$d);for(let i in n)"_"!=n[i].charAt(0)&&(t[n[i]]=e.$d[n[i]])}},Sk.exportSymbol("Sk.importMain",Sk.importMain),Sk.exportSymbol("Sk.importMainWithBody",Sk.importMainWithBody),Sk.exportSymbol("Sk.importBuiltinWithBody",Sk.importBuiltinWithBody),Sk.exportSymbol("Sk.builtin.__import__",Sk.builtin.__import__),Sk.exportSymbol("Sk.importStar",Sk.importStar)},function(e,t){Sk.builtin.timSort=function(e,t){this.list=new Sk.builtin.list(e.v),this.MIN_GALLOP=7,this.listlength=t||e.sq$length()},Sk.builtin.timSort.prototype.lt=function(e,t){return Sk.misceval.richCompareBool(e,t,"Lt")},Sk.builtin.timSort.prototype.le=function(e,t){return!this.lt(t,e)},Sk.builtin.timSort.prototype.setitem=function(e,t){this.list.v[e]=t},Sk.builtin.timSort.prototype.binary_sort=function(e,t){var n;for(n=e.base+t;n<e.base+e.len;n++){var i=e.base,r=n;for(t=e.getitem(r);i<r;){var s=i+(r-i>>1);this.lt(t,e.getitem(s))?r=s:i=s+1}for(Sk.asserts.assert(i===r),s=n;s>i;s--)e.setitem(s,e.getitem(s-1));e.setitem(i,t)}},Sk.builtin.timSort.prototype.count_run=function(e){var t;if(1>=e.len)var n=e.len,i=!1;else if(n=2,this.lt(e.getitem(e.base+1),e.getitem(e.base)))for(i=!0,t=e.base+2;t<e.base+e.len&&this.lt(e.getitem(t),e.getitem(t-1));t++)n++;else for(i=!1,t=e.base+2;t<e.base+e.len&&!this.lt(e.getitem(t),e.getitem(t-1));t++)n++;return{run:new Sk.builtin.listSlice(e.list,e.base,n),descending:i}},Sk.builtin.timSort.prototype.sort=function(){var e,t=new Sk.builtin.listSlice(this.list,0,this.listlength);if(!(2>t.len)){for(this.merge_init(),e=this.merge_compute_minrun(t.len);0<t.len;){var n=this.count_run(t);if(n.descending&&n.run.reverse(),n.run.len<e){var i=n.run.len;n.run.len=e<t.len?e:t.len,this.binary_sort(n.run,i)}t.advance(n.run.len),this.pending.push(n.run),this.merge_collapse()}Sk.asserts.assert(t.base==this.listlength),this.merge_force_collapse(),Sk.asserts.assert(1==this.pending.length),Sk.asserts.assert(0===this.pending[0].base),Sk.asserts.assert(this.pending[0].len==this.listlength)}},Sk.builtin.timSort.prototype.gallop=function(e,t,n,i){var r;Sk.asserts.assert(0<=n&&n<t.len);var s=this;i=i?function(e,t){return s.le(e,t)}:function(e,t){return s.lt(e,t)};var o=t.base+n,a=0,l=1;if(i(t.getitem(o),e)){for(r=t.len-n;l<r&&i(t.getitem(o+l),e);){a=l;try{l=1+(l<<1)}catch(e){l=r}}l>r&&(l=r),a+=n,l+=n}else{for(r=n+1;l<r&&!i(t.getitem(o-l),e);){a=l;try{l=1+(l<<1)}catch(e){l=r}}l>r&&(l=r),o=n-a,a=n-l,l=o}for(Sk.asserts.assert(-1<=a<l<=t.len),a+=1;a<l;)n=a+(l-a>>1),i(t.getitem(t.base+n),e)?a=n+1:l=n;return Sk.asserts.assert(a==l),l},Sk.builtin.timSort.prototype.merge_init=function(){this.min_gallop=this.MIN_GALLOP,this.pending=[]},Sk.builtin.timSort.prototype.merge_lo=function(e,t){var n,i,r;Sk.asserts.assert(0<e.len&&0<t.len&&e.base+e.len==t.base);var s=this.min_gallop,o=e.base;e=e.copyitems();try{if(this.setitem(o,t.popleft()),o++,1!=e.len&&0!==t.len)for(;;){for(i=n=0;;)if(this.lt(t.getitem(t.base),e.getitem(e.base))){if(this.setitem(o,t.popleft()),o++,0===t.len)return;if(n=0,++i>=s)break}else{if(this.setitem(o,e.popleft()),o++,1==e.len)return;if(i=0,++n>=s)break}for(s+=1;;){for(this.min_gallop=s-=1<s,n=this.gallop(t.getitem(t.base),e,0,!0),r=e.base;r<e.base+n;r++)this.setitem(o,e.getitem(r)),o++;if(e.advance(n),1>=e.len)return;if(this.setitem(o,t.popleft()),o++,0===t.len)return;for(i=this.gallop(e.getitem(e.base),t,0,!1),r=t.base;r<t.base+i;r++)this.setitem(o,t.getitem(r)),o++;if(t.advance(i),0===t.len)return;if(this.setitem(o,e.popleft()),o++,1==e.len)return;if(n<this.MIN_GALLOP&&i<this.MIN_GALLOP)break;s++,this.min_gallop=s}}}finally{for(Sk.asserts.assert(0<=e.len&&0<=t.len),r=t.base;r<t.base+t.len;r++)this.setitem(o,t.getitem(r)),o++;for(r=e.base;r<e.base+e.len;r++)this.setitem(o,e.getitem(r)),o++}},Sk.builtin.timSort.prototype.merge_hi=function(e,t){var n,i,r;Sk.asserts.assert(0<e.len&&0<t.len&&e.base+e.len==t.base);var s=this.min_gallop,o=t.base+t.len;t=t.copyitems();try{if(o--,this.setitem(o,e.popright()),0!==e.len&&1!=t.len)for(;;){for(i=n=0;;){var a=e.getitem(e.base+e.len-1),l=t.getitem(t.base+t.len-1);if(this.lt(l,a)){if(o--,this.setitem(o,a),e.len--,0===e.len)return;if(i=0,++n>=s)break}else{if(o--,this.setitem(o,l),t.len--,1==t.len)return;if(n=0,++i>=s)break}}for(s+=1;;){this.min_gallop=s-=1<s,l=t.getitem(t.base+t.len-1);var u=this.gallop(l,e,e.len-1,!0);for(n=e.len-u,r=e.base+e.len-1;r>e.base+u-1;r--)o--,this.setitem(o,e.getitem(r));if(e.len-=n,0===e.len)return;if(o--,this.setitem(o,t.popright()),1==t.len)return;for(a=e.getitem(e.base+e.len-1),u=this.gallop(a,t,t.len-1,!1),i=t.len-u,r=t.base+t.len-1;r>t.base+u-1;r--)o--,this.setitem(o,t.getitem(r));if(t.len-=i,1>=t.len)return;if(o--,this.setitem(o,e.popright()),0===e.len)return;if(n<this.MIN_GALLOP&&i<this.MIN_GALLOP)break;s++,this.min_gallop=s}}}finally{for(Sk.asserts.assert(0<=e.len&&0<=t.len),r=e.base+e.len-1;r>e.base-1;r--)o--,this.setitem(o,e.getitem(r));for(r=t.base+t.len-1;r>t.base-1;r--)o--,this.setitem(o,t.getitem(r))}},Sk.builtin.timSort.prototype.merge_at=function(e){0>e&&(e=this.pending.length+e);var t=this.pending[e],n=this.pending[e+1];Sk.asserts.assert(0<t.len&&0<n.len),Sk.asserts.assert(t.base+t.len==n.base),this.pending[e]=new Sk.builtin.listSlice(this.list,t.base,t.len+n.len),this.pending.splice(e+1,1),e=this.gallop(n.getitem(n.base),t,0,!0),t.advance(e),0!==t.len&&(n.len=this.gallop(t.getitem(t.base+t.len-1),n,n.len-1,!1),0!==n.len&&(t.len<=n.len?this.merge_lo(t,n):this.merge_hi(t,n)))},Sk.builtin.timSort.prototype.merge_collapse=function(){for(var e=this.pending;1<e.length;)if(3<=e.length&&e[e.length-3].len<=e[e.length-2].len+e[e.length-1].len)e[e.length-3].len<e[e.length-1].len?this.merge_at(-3):this.merge_at(-2);else{if(!(e[e.length-2].len<=e[e.length-1].len))break;this.merge_at(-2)}},Sk.builtin.timSort.prototype.merge_force_collapse=function(){for(var e=this.pending;1<e.length;)3<=e.length&&e[e.length-3].len<e[e.length-1].len?this.merge_at(-3):this.merge_at(-2)},Sk.builtin.timSort.prototype.merge_compute_minrun=function(e){for(var t=0;64<=e;)t|=1&e,e>>=1;return e+t},Sk.builtin.listSlice=function(e,t,n){this.list=e,this.base=t,this.len=n},Sk.builtin.listSlice.prototype.copyitems=function(){var e=this.base,t=this.base+this.len;return Sk.asserts.assert(0<=e<=t),new Sk.builtin.listSlice(new Sk.builtin.list(this.list.v.slice(e,t)),0,this.len)},Sk.builtin.listSlice.prototype.advance=function(e){this.base+=e,this.len-=e,Sk.asserts.assert(this.base<=this.list.sq$length())},Sk.builtin.listSlice.prototype.getitem=function(e){return this.list.v[e]},Sk.builtin.listSlice.prototype.setitem=function(e,t){this.list.v[e]=t},Sk.builtin.listSlice.prototype.popleft=function(){var e=this.list.v[this.base];return this.base++,this.len--,e},Sk.builtin.listSlice.prototype.popright=function(){return this.len--,this.list.v[this.base+this.len]},Sk.builtin.listSlice.prototype.reverse=function(){for(var e,t,n=this.list,i=this.base,r=i+this.len-1;i<r;)e=n.v[r],t=n.v[i],n.v[i]=e,n.v[r]=t,i++,r--},Sk.exportSymbol("Sk.builtin.listSlice",Sk.builtin.listSlice),Sk.exportSymbol("Sk.builtin.timSort",Sk.builtin.timSort)},function(e,t){Sk.builtin.super_=Sk.abstr.buildNativeClass("super",{constructor:function(e,t){if(Sk.asserts.assert(this instanceof Sk.builtin.super_,"bad call to super, use 'new'"),this.type=e,this.obj=t,void 0!==e&&!Sk.builtin.checkClass(e))throw new Sk.builtin.TypeError("must be type, not "+Sk.abstr.typeName(e));this.obj_type=void 0!==this.obj?this.$supercheck(e,this.obj):null},slots:{tp$doc:"super() -> same as super(__class__, <first argument>)\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super().meth(arg)\nThis works for class methods too:\nclass C(B):\n @classmethod\n def cmeth(cls, arg):\n super().cmeth(arg)\n",tp$new:Sk.generic.new,tp$init(e,t){if(Sk.abstr.checkNoKwargs("super",t),Sk.abstr.checkArgsLen("super",e,1,2),t=e[0],e=e[1],!Sk.builtin.checkClass(t))throw new Sk.builtin.TypeError("must be type, not "+Sk.abstr.typeName(t));this.obj=e,this.type=t,null!=this.obj&&(this.obj_type=this.$supercheck(t,this.obj))},$r(){return this.obj?new Sk.builtin.str("<super: <class '"+this.type.prototype.tp$name+"'>, <"+Sk.abstr.typeName(this.obj)+" object>>"):new Sk.builtin.str("<super: <class '"+this.type.prototype.tp$name+"'>, NULL>")},tp$getattr(e,t){let n=this.obj_type;if(null==n)return Sk.generic.getAttr.call(this,e,t);var i=n.prototype.tp$mro;const r=i.length;if(e===Sk.builtin.str.$class)return Sk.generic.getAttr.call(this,e,t);let s,o;for(s=0;s+1<r&&this.type!==i[s];s++);if(s++,s>=r)return Sk.generic.getAttr.call(this,e,t);for(e=e.$mangled;s<r;){if((t=i[s].prototype).hasOwnProperty(e)&&(o=t[e]),void 0!==o)return void 0!==(i=o.tp$descr_get)&&(o=i.call(o,this.obj===n?null:this.obj,n)),o;s++}},tp$descr_get(e,t){if(null===e||null!=this.obj)return this;if(this.ob$type!==Sk.builtin.super_)return Sk.misceval.callsimOrSuspendArray(this.ob$type,[this.type,e]);{t=this.$supercheck(this.type,e);const n=new Sk.builtin.super_;return n.type=this.type,n.obj=e,n.obj_type=t,n}}},getsets:{__thisclass__:{$get(){return this.type},$doc:"the class invoking super()"},__self__:{$get(){return this.obj||Sk.builtin.none.none$},$doc:"the instance invoking super(); may be None"},__self_class__:{$get(){return this.obj_type||Sk.builtin.none.none$},$doc:"the type of the instance invoking super(); may be None"}},proto:{$supercheck(e,t){if(Sk.builtin.checkClass(t)&&t.$isSubType(e))return t;if(t.ob$type.$isSubType(e))return t.ob$type;{const n=t.tp$getattr(Sk.builtin.str.$class);if(void 0!==n&&n!==t.ob$type&&Sk.builtin.checkClass(n)&&n.$isSubType(e))return n}throw new Sk.builtin.TypeError("super(type, obj): obj must be an instance or subtype of type")}}})},function(e,t){Sk.builtins={round:null,len:null,min:null,max:null,sum:null,abs:null,fabs:null,ord:null,chr:null,hex:null,oct:null,bin:null,dir:null,repr:null,open:null,isinstance:null,hash:null,getattr:null,hasattr:null,id:null,reduce:new Sk.builtin.func(Sk.builtin.reduce),sorted:null,any:null,all:null,enumerate:Sk.builtin.enumerate,filter:Sk.builtin.filter_,map:Sk.builtin.map_,range:Sk.builtin.range_,reversed:Sk.builtin.reversed,zip:Sk.builtin.zip_,BaseException:Sk.builtin.BaseException,AttributeError:Sk.builtin.AttributeError,ValueError:Sk.builtin.ValueError,Exception:Sk.builtin.Exception,ZeroDivisionError:Sk.builtin.ZeroDivisionError,AssertionError:Sk.builtin.AssertionError,ImportError:Sk.builtin.ImportError,IndentationError:Sk.builtin.IndentationError,IndexError:Sk.builtin.IndexError,LookupError:Sk.builtin.LookupError,KeyError:Sk.builtin.KeyError,TypeError:Sk.builtin.TypeError,UnicodeDecodeError:Sk.builtin.UnicodeDecodeError,UnicodeEncodeError:Sk.builtin.UnicodeEncodeError,NameError:Sk.builtin.NameError,IOError:Sk.builtin.IOError,NotImplementedError:Sk.builtin.NotImplementedError,SystemExit:Sk.builtin.SystemExit,OverflowError:Sk.builtin.OverflowError,OperationError:Sk.builtin.OperationError,NegativePowerError:Sk.builtin.NegativePowerError,RuntimeError:Sk.builtin.RuntimeError,RecursionError:Sk.builtin.RecursionError,StopIteration:Sk.builtin.StopIteration,SyntaxError:Sk.builtin.SyntaxError,SystemError:Sk.builtin.SystemError,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,bool:Sk.builtin.bool,complex:Sk.builtin.complex,dict:Sk.builtin.dict,file:Sk.builtin.file,frozenset:Sk.builtin.frozenset,function:Sk.builtin.func,generator:Sk.builtin.generator,list:Sk.builtin.list,long_$rw$:Sk.builtin.lng,method:Sk.builtin.method,object:Sk.builtin.object,slice:Sk.builtin.slice,str:Sk.builtin.str,set:Sk.builtin.set,tuple:Sk.builtin.tuple,type:Sk.builtin.type,input:null,raw_input:new Sk.builtin.func(Sk.builtin.raw_input),setattr:null,jseval:Sk.builtin.jseval,jsmillis:Sk.builtin.jsmillis,quit:new Sk.builtin.func(Sk.builtin.quit),exit:new Sk.builtin.func(Sk.builtin.quit),print:null,divmod:null,format:null,globals:null,issubclass:null,iter:null,execfile:Sk.builtin.execfile,help:Sk.builtin.help,memoryview:Sk.builtin.memoryview,reload:Sk.builtin.reload,super_$rw$:Sk.builtin.super_,unichr:Sk.builtin.unichr,vars:Sk.builtin.vars,apply_$rw$:Sk.builtin.apply_,buffer:Sk.builtin.buffer,coerce:Sk.builtin.coerce,intern:Sk.builtin.intern,property:Sk.builtin.property,classmethod:Sk.builtin.classmethod,staticmethod:Sk.builtin.staticmethod},Sk.abstr.setUpModuleMethods("builtins",Sk.builtins,{__import__:{$meth:Sk.builtin.__import__,$flags:{NamedArgs:["name","globals","locals","fromlist","level"]},$textsig:null,$doc:"__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\nImport a module. Because this function is meant for use by the Python\ninterpreter and not for general use, it is better to use\nimportlib.import_module() to programmatically import a module.\n\nThe globals argument is only used to determine the context;\nthey are not modified. The locals argument is unused. The fromlist\nshould be a list of names to emulate ``from name import ...'', or an\nempty list to emulate ``import name''.\nWhen importing a module from a package, note that __import__('A.B', ...)\nreturns package A when fromlist is empty, but its submodule B when\nfromlist is not empty. The level argument is used to determine whether to\nperform absolute or relative imports: 0 is absolute, while a positive number\nis the number of parent directories to search relative to the current module."},abs:{$meth:Sk.builtin.abs,$flags:{OneArg:!0},$textsig:"($module, x, /)",$doc:"Return the absolute value of the argument."},all:{$meth:Sk.builtin.all,$flags:{OneArg:!0},$textsig:"($module, iterable, /)",$doc:"Return True if bool(x) is True for all values x in the iterable.\n\nIf the iterable is empty, return True."},any:{$meth:Sk.builtin.any,$flags:{OneArg:!0},$textsig:"($module, iterable, /)",$doc:"Return True if bool(x) is True for any x in the iterable.\n\nIf the iterable is empty, return False."},ascii:{$meth:Sk.builtin.ascii,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2."},bin:{$meth:Sk.builtin.bin,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the binary representation of an integer.\n\n >>> bin(2796202)\n '0b1010101010101010101010'"},callable:{$meth:Sk.builtin.callable,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\n__call__() method."},chr:{$meth:Sk.builtin.chr,$flags:{OneArg:!0},$textsig:"($module, i, /)",$doc:"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."},delattr:{$meth:Sk.builtin.delattr,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, name, /)",$doc:"Deletes the named attribute from the given object.\n\ndelattr(x, 'y') is equivalent to ``del x.y''"},dir:{$meth:Sk.builtin.dir,$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"dir([object]) -> list of strings\n\nIf called without an argument, return the names in the current scope.\nElse, return an alphabetized list of names comprising (some of) the attributes\nof the given object, and of attributes reachable from it.\nIf the object supplies a method named __dir__, it will be used; otherwise\nthe default dir() logic is used and returns:\n for a module object: the module's attributes.\n for a class object: its attributes, and recursively the attributes\n of its bases.\n for any other object: its attributes, its class's attributes, and\n recursively the attributes of its class's base classes."},divmod:{$meth:Sk.builtin.divmod,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, x, y, /)",$doc:"Return the tuple (x//y, x%y). Invariant: div*y + mod == x."},eval_$rw$:{$name:"eval",$meth:Sk.builtin.eval_,$flags:{MinArgs:1,MaxArgs:3},$textsig:"($module, source, globals=None, locals=None, /)",$doc:"Evaluate the given source in the context of globals and locals.\n\nThe source may be a string representing a Python expression\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it."},format:{$meth:Sk.builtin.format,$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, value, format_spec='', /)",$doc:"Return value.__format__(format_spec)\n\nformat_spec defaults to the empty string.\nSee the Format Specification Mini-Language section of help('FORMATTING') for\ndetails."},getattr:{$meth:Sk.builtin.getattr,$flags:{MinArgs:2,MaxArgs:3},$textsig:null,$doc:"getattr(object, name[, default]) -> value\n\nGet a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\nWhen a default argument is given, it is returned when the attribute doesn't\nexist; without it, an exception is raised in that case."},globals:{$meth:Sk.builtin.globals,$flags:{NoArgs:!0},$textsig:"($module, /)",$doc:"Return the dictionary containing the current scope's global variables.\n\nNOTE: Updates to this dictionary *will* affect name lookups in the current\nglobal scope and vice-versa."},hasattr:{$meth:Sk.builtin.hasattr,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, name, /)",$doc:"Return whether the object has an attribute with the given name.\n\nThis is done by calling getattr(obj, name) and catching AttributeError."},hash:{$meth:Sk.builtin.hash,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the hash value for the given object.\n\nTwo objects that compare equal must also have the same hash value, but the\nreverse is not necessarily true."},hex:{$meth:Sk.builtin.hex,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the hexadecimal representation of an integer.\n\n >>> hex(12648430)\n '0xc0ffee'"},id:{$meth:Sk.builtin.id,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the identity of an object.\n\nThis is guaranteed to be unique among simultaneously existing objects.\n(CPython uses the object's memory address.)"},input:{$meth:Sk.builtin.input,$flags:{MinArgs:0,MaxArgs:1},$textsig:"($module, prompt=None, /)",$doc:"Read a string from standard input. The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available."},isinstance:{$meth:Sk.builtin.isinstance,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, obj, class_or_tuple, /)",$doc:"Return whether an object is an instance of a class or of a subclass thereof.\n\nA tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\nor ...`` etc."},issubclass:{$meth:Sk.builtin.issubclass,$flags:{MinArgs:2,MaxArgs:2},$textsig:"($module, cls, class_or_tuple, /)",$doc:"Return whether 'cls' is a derived from another class or is the same class.\n\nA tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\nor ...`` etc."},iter:{$meth:Sk.builtin.iter,$flags:{MinArgs:1,MaxArgs:2},$textsig:"($module, iterable /)",$doc:"iter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object. In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel."},len:{$meth:Sk.builtin.len,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the number of items in a container."},locals:{$meth:Sk.builtin.locals,$flags:{NoArgs:!0},$textsig:"($module, /)",$doc:"Return a dictionary containing the current scope's local variables.\n\nNOTE: Whether or not updates to this dictionary will affect name lookups in\nthe local scope and vice-versa is *implementation dependent* and not\ncovered by any backwards compatibility guarantees."},max:{$meth:Sk.builtin.max,$flags:{FastCall:!0},$textsig:null,$doc:"max(iterable, *[, default=obj, key=func]) -> value\nmax(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its biggest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the largest argument."},min:{$meth:Sk.builtin.min,$flags:{FastCall:!0},$textsig:null,$doc:"min(iterable, *[, default=obj, key=func]) -> value\nmin(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its smallest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the smallest argument."},next:{$name:"next",$meth:Sk.builtin.next_,$flags:{MinArgs:1,MaxArgs:2},$textsig:null,$doc:"next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration."},oct:{$meth:Sk.builtin.oct,$flags:{OneArg:!0},$textsig:"($module, number, /)",$doc:"Return the octal representation of an integer.\n\n >>> oct(342391)\n '0o1234567'"},open:{$meth:Sk.builtin.open,$flags:{MinArgs:1,MaxArgs:3},$textsig:null,$doc:"open(name[, mode[, buffering]]) -> file object\n\nOpen a file using the file() type, returns a file object. This is the\npreferred way to open a file. See file.__doc__ for further information."},ord:{$meth:Sk.builtin.ord,$flags:{OneArg:!0},$textsig:"($module, c, /)",$doc:"Return the Unicode code point for a one-character string."},pow:{$meth:Sk.builtin.pow,$flags:{MinArgs:2,MaxArgs:3},$textsig:"($module, x, y, z=None, /)",$doc:"Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n\nSome types, such as ints, are able to use a more efficient algorithm when\ninvoked using the three argument form."},print:{$meth:Sk.builtin.print,$flags:{FastCall:!0},$textsig:null,$doc:"print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream."},repr:{$meth:Sk.builtin.repr,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return the canonical string representation of the object.\n\nFor many object types, including most builtins, eval(repr(obj)) == obj."},round:{$meth:Sk.builtin.round,$flags:{NamedArgs:["number","ndigits"]},$textsig:"($module, /, number, ndigits=None)",$doc:"Round a number to a given precision in decimal digits.\n\nThe return value is an integer if ndigits is omitted or None. Otherwise\nthe return value has the same type as the number. ndigits may be negative."},setattr:{$meth:Sk.builtin.setattr,$flags:{MinArgs:3,MaxArgs:3},$textsig:"($module, obj, name, value, /)",$doc:"Sets the named attribute on the given object to the specified value.\n\nsetattr(x, 'y', v) is equivalent to ``x.y = v''"},sorted:{$meth:Sk.builtin.sorted,$flags:{NamedArgs:[null,"cmp","key","reverse"],Defaults:[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.bool.false$]},$textsig:"($module, iterable, /, *, key=None, reverse=False)",$doc:"Return a new list containing all items from the iterable in ascending order.\n\nA custom key function can be supplied to customize the sort order, and the\nreverse flag can be set to request the result in descending order."},sum:{$meth:Sk.builtin.sum,$flags:{NamedArgs:[null,"start"],Defaults:[new Sk.builtin.int_(0)]},$textsig:"($module, iterable, /, start=0)",$doc:"Return the sum of a 'start' value (default: 0) plus an iterable of numbers\n\nWhen the iterable is empty, return the start value.\nThis function is intended specifically for use with numeric values and may\nreject non-numeric types."},vars:{$meth:Sk.builtin.vars,$flags:{MinArgs:0,MaxArgs:1},$textsig:null,$doc:"vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__."}}),Sk.setupObjects=function(e){e?(Sk.builtins.filter=Sk.builtin.filter_,Sk.builtins.map=Sk.builtin.map_,Sk.builtins.zip=Sk.builtin.zip_,Sk.builtins.range=Sk.builtin.range_,delete Sk.builtins.xrange,delete Sk.builtins.StandardError,delete Sk.builtins.unicode,delete Sk.builtins.basestring,delete Sk.builtins.long_$rw$,Sk.builtin.int_.prototype.$r=function(){return new Sk.builtin.str(this.v.toString())},delete Sk.builtin.int_.prototype.tp$str,delete Sk.builtin.bool.prototype.tp$str,delete Sk.builtins.raw_input,delete Sk.builtin.str.prototype.decode,Sk.builtins.bytes=Sk.builtin.bytes,Sk.builtins.ascii=new Sk.builtin.sk_method({$meth:Sk.builtin.ascii,$flags:{OneArg:!0},$textsig:"($module, obj, /)",$doc:"Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2."},null,"builtins")):(Sk.builtins.range=new Sk.builtin.sk_method({$meth:Sk.builtin.range,$name:"range",$flags:{MinArgs:1,MaxArgs:3}},void 0,"builtins"),Sk.builtins.xrange=new Sk.builtin.sk_method({$meth:Sk.builtin.xrange,$name:"xrange",$flags:{MinArgs:1,MaxArgs:3}},null,"builtins"),Sk.builtins.filter=new Sk.builtin.func(Sk.builtin.filter),Sk.builtins.map=new Sk.builtin.func(Sk.builtin.map),Sk.builtins.zip=new Sk.builtin.func(Sk.builtin.zip),Sk.builtins.StandardError=Sk.builtin.Exception,Sk.builtins.unicode=Sk.builtin.str,Sk.builtins.basestring=Sk.builtin.str,Sk.builtins.long_$rw$=Sk.builtin.lng,Sk.builtin.int_.prototype.$r=function(){const e=this.v;return"number"==typeof e?new Sk.builtin.str(e.toString()):new Sk.builtin.str(e.toString()+"L")},Sk.builtin.int_.prototype.tp$str=function(){return new Sk.builtin.str(this.v.toString())},Sk.builtin.bool.prototype.tp$str=function(){return this.$r()},Sk.builtins.raw_input=new Sk.builtin.func(Sk.builtin.raw_input),Sk.builtin.str.prototype.decode=Sk.builtin.str.$py2decode,delete Sk.builtins.bytes,delete Sk.builtins.ascii)},Sk.exportSymbol("Sk.setupObjects",Sk.setupObjects),Sk.exportSymbol("Sk.builtins",Sk.builtins)},function(e,t){Sk.builtin.str.$empty=new Sk.builtin.str(""),Sk.builtin.str.$emptystr=Sk.builtin.str.$empty,Sk.builtin.str.$utf8=new Sk.builtin.str("utf-8"),Sk.builtin.str.$ascii=new Sk.builtin.str("ascii"),Sk.builtin.str.$default_factory=new Sk.builtin.str("default_factory"),Sk.builtin.str.$imag=new Sk.builtin.str("imag"),Sk.builtin.str.$real=new Sk.builtin.str("real"),Sk.builtin.str.$abs=new Sk.builtin.str("__abs__"),Sk.builtin.str.$bytes=new Sk.builtin.str("__bytes__"),Sk.builtin.str.$call=new Sk.builtin.str("__call__"),Sk.builtin.str.$class=new Sk.builtin.str("__class__"),Sk.builtin.str.$cmp=new Sk.builtin.str("__cmp__"),Sk.builtin.str.$complex=new Sk.builtin.str("__complex__"),Sk.builtin.str.$contains=new Sk.builtin.str("__contains__"),Sk.builtin.str.$copy=new Sk.builtin.str("__copy__"),Sk.builtin.str.$dict=new Sk.builtin.str("__dict__"),Sk.builtin.str.$dir=new Sk.builtin.str("__dir__"),Sk.builtin.str.$doc=new Sk.builtin.str("__doc__"),Sk.builtin.str.$enter=new Sk.builtin.str("__enter__"),Sk.builtin.str.$eq=new Sk.builtin.str("__eq__"),Sk.builtin.str.$exit=new Sk.builtin.str("__exit__"),Sk.builtin.str.$index=new Sk.builtin.str("__index__"),Sk.builtin.str.$init=new Sk.builtin.str("__init__"),Sk.builtin.str.$int_=new Sk.builtin.str("__int__"),Sk.builtin.str.$iter=new Sk.builtin.str("__iter__"),Sk.builtin.str.$file=new Sk.builtin.str("__file__"),Sk.builtin.str.$float_=new Sk.builtin.str("__float__"),Sk.builtin.str.$format=new Sk.builtin.str("__format__"),Sk.builtin.str.$ge=new Sk.builtin.str("__ge__"),Sk.builtin.str.$getattr=new Sk.builtin.str("__getattr__"),Sk.builtin.str.$getattribute=new Sk.builtin.str("__getattribute__"),Sk.builtin.str.$getitem=new Sk.builtin.str("__getitem__"),Sk.builtin.str.$gt=new Sk.builtin.str("__gt__"),Sk.builtin.str.$keys=new Sk.builtin.str("keys"),Sk.builtin.str.$le=new Sk.builtin.str("__le__"),Sk.builtin.str.$len=new Sk.builtin.str("__len__"),Sk.builtin.str.$length_hint=new Sk.builtin.str("__length_hint__"),Sk.builtin.str.$loader=new Sk.builtin.str("__loader__"),Sk.builtin.str.$lt=new Sk.builtin.str("__lt__"),Sk.builtin.str.$module=new Sk.builtin.str("__module__"),Sk.builtin.str.$missing=new Sk.builtin.str("__missing__"),Sk.builtin.str.$name=new Sk.builtin.str("__name__"),Sk.builtin.str.$ne=new Sk.builtin.str("__ne__"),Sk.builtin.str.$new=new Sk.builtin.str("__new__"),Sk.builtin.str.$next=new Sk.builtin.str("__next__"),Sk.builtin.str.$path=new Sk.builtin.str("__path__"),Sk.builtin.str.$qualname=new Sk.builtin.str("__qualname__"),Sk.builtin.str.$repr=new Sk.builtin.str("__repr__"),Sk.builtin.str.$reversed=new Sk.builtin.str("__reversed__"),Sk.builtin.str.$round=new Sk.builtin.str("__round__"),Sk.builtin.str.$setattr=new Sk.builtin.str("__setattr__"),Sk.builtin.str.$setitem=new Sk.builtin.str("__setitem__"),Sk.builtin.str.$str=new Sk.builtin.str("__str__"),Sk.builtin.str.$trunc=new Sk.builtin.str("__trunc__"),Sk.builtin.str.$write=new Sk.builtin.str("write"),Sk.misceval.op2method_={Eq:Sk.builtin.str.$eq,NotEq:Sk.builtin.str.$ne,Gt:Sk.builtin.str.$gt,GtE:Sk.builtin.str.$ge,Lt:Sk.builtin.str.$lt,LtE:Sk.builtin.str.$le}}])}).call(this||window)}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=i[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{"use strict";var e={};n.r(e),n.d(e,{controls_type:()=>Q,controls_typeLists:()=>Z,lists_zip:()=>ee,lists_zip_container:()=>te,lists_zip_item:()=>ne,unpack_iterable_object:()=>ie,variables_change:()=>K,variables_get:()=>q,variables_global:()=>J,variables_set:()=>W});var t={};n.r(t),n.d(t,{base_setup:()=>oe,controls_delay:()=>ae,controls_end_program:()=>le,controls_except:()=>ye,controls_finally:()=>ve,controls_flow_statements:()=>fe,controls_for:()=>_e,controls_forEach:()=>pe,controls_for_range:()=>me,controls_if:()=>ue,controls_if_else:()=>Se,controls_if_elseif:()=>ge,controls_if_if:()=>be,controls_lambda:()=>Ee,controls_main:()=>se,controls_pass:()=>Ie,controls_range:()=>ce,controls_repeat_ext:()=>Te,controls_thread:()=>we,controls_try:()=>ke,controls_try_finally:()=>de,controls_whileUntil:()=>he,datetime_fromtimestamp:()=>Ce,do_while:()=>xe,garbage_collection:()=>Ae,gene_unique_identifier:()=>Re,get_mem_alloc:()=>$e,get_mem_free:()=>Oe,get_unique_identifier:()=>Me});var i={};n.r(i),n.d(i,{base_map:()=>et,generate_cartesian_product:()=>nt,math_arithmetic:()=>Fe,math_bit:()=>je,math_constant:()=>De,math_constant_mp:()=>Pe,math_constrain:()=>ze,math_dec:()=>Ue,math_degree_to_radian:()=>rt,math_indexer_number:()=>We,math_map:()=>qe,math_max_min:()=>Ge,math_number:()=>Le,math_number_base_conversion:()=>Xe,math_radian_to_degree:()=>it,math_random:()=>He,math_random_seed:()=>Ke,math_round:()=>Je,math_selfcalcu:()=>Be,math_to_int:()=>Ye,math_trig:()=>Ve,text_to_number:()=>Qe,text_to_number_skulpt:()=>Ze,turn_to_int:()=>tt});var r={};n.r(r),n.d(r,{ascii_to_char:()=>pt,char_to_ascii:()=>ht,number_to_text:()=>dt,os_system:()=>Ft,text:()=>ot,text_bytes:()=>lt,text_capital:()=>vt,text_center:()=>Tt,text_char:()=>ut,text_char_at:()=>mt,text_char_at2:()=>_t,text_char_at3:()=>Nt,text_compareTo:()=>Rt,text_compare_to:()=>yt,text_create_with_container:()=>Ot,text_create_with_item:()=>Mt,text_encode:()=>Dt,text_equals_starts_ends:()=>kt,text_eval:()=>Pt,text_find:()=>Et,text_format:()=>$t,text_format_noreturn:()=>Lt,text_join:()=>ct,text_join_seq:()=>It,text_length:()=>ft,text_random_char:()=>bt,text_replace:()=>wt,text_split:()=>xt,text_strip:()=>At,text_substring:()=>St,text_substring2:()=>gt,text_substring3:()=>Ct,text_textarea:()=>at});var s={};n.r(s),n.d(s,{ENUMERATE:()=>yn,content_in_lists:()=>Tn,enumerate:()=>vn,list_many_input:()=>ln,list_tolist:()=>hn,list_tolist2:()=>kn,list_trig:()=>sn,lists_2d_get_col_row_data:()=>Yt,lists_2d_get_data_with_col_row:()=>Ut,lists_append_extend:()=>Wt,lists_change_to:()=>an,lists_change_to_general:()=>cn,lists_clear:()=>en,lists_create_with:()=>Gt,lists_create_with2:()=>dn,lists_create_with_container:()=>Ht,lists_create_with_item:()=>zt,lists_create_with_noreturn:()=>un,lists_create_with_text:()=>Xt,lists_create_with_text2:()=>fn,lists_del_general:()=>pn,lists_find:()=>rn,lists_getIndex3:()=>_n,lists_getSublist3:()=>mn,lists_get_index:()=>jt,lists_get_random_item:()=>Kt,lists_get_random_sublist:()=>Jt,lists_get_sublist:()=>Vt,lists_insert_value:()=>Qt,lists_insert_value2:()=>gn,lists_pop:()=>nn,lists_remove_at:()=>tn,lists_remove_at2:()=>Sn,lists_reverse:()=>Zt,lists_setIndex3:()=>bn,lists_set_index:()=>qt,lists_sort:()=>on});var o={};n.r(o),n.d(o,{dicts_add_change_del:()=>Bn,dicts_add_or_change:()=>Mn,dicts_clear:()=>Nn,dicts_create_with:()=>In,dicts_create_with_container:()=>wn,dicts_create_with_item:()=>xn,dicts_create_with_noreturn:()=>Un,dicts_deldict:()=>Fn,dicts_delete:()=>Cn,dicts_get:()=>$n,dicts_get_default:()=>On,dicts_items:()=>Ln,dicts_keys:()=>An,dicts_length:()=>Pn,dicts_pop:()=>jn,dicts_setdefault:()=>Vn,dicts_to_json:()=>Gn,dicts_to_json2:()=>zn,dicts_to_to:()=>Hn,dicts_todict:()=>Yn,dicts_update:()=>Rn,dicts_values:()=>Dn,json_to_dicts:()=>Xn});var a={};n.r(a),n.d(a,{logic_boolean:()=>Zn,logic_compare:()=>Wn,logic_compare_continous:()=>Kn,logic_is:()=>ii,logic_is_in:()=>ni,logic_negate:()=>Qn,logic_null:()=>ei,logic_operation:()=>Jn,logic_tobool:()=>ri,logic_true_or_false:()=>ti});var l={};n.r(l),n.d(l,{sdcard_mount:()=>xi,sdcard_use_spi_init:()=>wi,storage_can_write_ornot:()=>di,storage_change_dir:()=>Ei,storage_close_file:()=>_i,storage_delete_file:()=>bi,storage_file_seek:()=>ki,storage_file_tell:()=>Si,storage_file_write:()=>ui,storage_fileopen:()=>oi,storage_fileopen_new:()=>ai,storage_fileopen_new_encoding:()=>li,storage_get_a_line:()=>hi,storage_get_contents:()=>pi,storage_get_contents_without_para:()=>ci,storage_get_current_dir:()=>yi,storage_get_file_size:()=>gi,storage_get_filename:()=>fi,storage_is_file:()=>Ii,storage_list_all_files:()=>mi,storage_make_dir:()=>vi,storage_open_file_with_os:()=>si,storage_rename:()=>Ti});var u={};n.r(u),n.d(u,{procedures_callnoreturn:()=>Ci,procedures_callreturn:()=>Ri,procedures_defnoreturn:()=>Ai,procedures_defreturn:()=>$i,procedures_ifreturn:()=>Ni,procedures_mutatorarg:()=>Mi,procedures_mutatorcontainer:()=>Oi,procedures_return:()=>Li});var c={};n.r(c),n.d(c,{tuple_change_to:()=>zi,tuple_create_llm_params:()=>nr,tuple_create_with:()=>Pi,tuple_create_with_container:()=>Fi,tuple_create_with_item:()=>Bi,tuple_create_with_noreturn:()=>Ji,tuple_create_with_text2:()=>ji,tuple_create_with_text_return:()=>Vi,tuple_del:()=>Gi,tuple_find:()=>qi,tuple_getIndex:()=>Ui,tuple_getSublist:()=>Ki,tuple_get_random_item:()=>Zi,tuple_get_sublist:()=>Qi,tuple_input:()=>tr,tuple_join:()=>Xi,tuple_length:()=>Yi,tuple_max:()=>Hi,tuple_totuple:()=>er,tuple_trig:()=>Wi});var p={};n.r(p),n.d(p,{set_add_discard:()=>hr,set_clear:()=>ur,set_create_with:()=>rr,set_create_with_container:()=>sr,set_create_with_item:()=>or,set_create_with_text_return:()=>_r,set_length:()=>ar,set_operate:()=>cr,set_operate_update:()=>pr,set_pop:()=>lr,set_sub:()=>dr,set_toset:()=>mr,set_update:()=>fr});var h={};n.r(h),n.d(h,{html_content:()=>yr,html_content_more:()=>vr,html_document:()=>gr,html_form:()=>Er,html_head_body:()=>kr,html_style:()=>Tr,html_style_color:()=>wr,html_style_content:()=>Ir,html_text:()=>xr,html_title:()=>Sr});var d={};n.r(d),n.d(d,{attribute_access:()=>Vr,function_call:()=>Fr,function_call_container:()=>Br,function_call_item:()=>jr,raw_block:()=>Or,raw_empty:()=>Cr,raw_expression:()=>Mr,raw_table:()=>$r,text_comment:()=>Rr,text_print_multiple:()=>Lr,text_print_multiple_container:()=>Dr,text_print_multiple_item:()=>Pr,type_check:()=>Nr});var f={};n.r(f),n.d(f,{array_create:()=>rs,array_toarray:()=>gs,dataframe_create:()=>Xr,dataframe_create_from_index:()=>zr,dataframe_create_from_one_index:()=>Hr,dataframe_get:()=>_s,numpy_trig:()=>hs,pandas_readcsv:()=>fs,pl_axes:()=>es,pl_bar:()=>ls,pl_hist:()=>cs,pl_label:()=>is,pl_legend:()=>ts,pl_pie:()=>us,pl_plot:()=>Qr,pl_plot_bar:()=>ss,pl_plot_easy:()=>Jr,pl_plot_scatter:()=>os,pl_plot_xy:()=>as,pl_savefig:()=>ms,pl_show:()=>Zr,pl_subplot:()=>ds,pl_text:()=>bs,pl_ticks:()=>ps,pl_title:()=>ns,plot_axes:()=>vs,plot_bar:()=>$s,plot_hist:()=>Ms,plot_label:()=>Is,plot_legend:()=>Ts,plot_pie:()=>Os,plot_plot:()=>ks,plot_plot_bar:()=>ws,plot_plot_easy:()=>Ss,plot_plot_scatter:()=>xs,plot_plot_xy:()=>As,plot_savefig:()=>Ns,plot_show:()=>ys,plot_subplot:()=>Rs,plot_text:()=>Ls,plot_ticks:()=>Cs,plot_title:()=>Es,series_create:()=>Yr,series_create_from_index:()=>Gr,series_create_from_text:()=>qr,series_get_num:()=>Kr,series_index_value:()=>Wr});var _={};n.r(_),n.d(_,{inout_input:()=>Ps,inout_print:()=>Fs,inout_print_container:()=>Ys,inout_print_end:()=>js,inout_print_inline:()=>Bs,inout_print_item:()=>Gs,inout_print_many:()=>Us,inout_type_input:()=>Vs});var m={};n.r(m),n.d(m,{Panic_with_status_code:()=>Ws,base_delay:()=>Hs,controls_millis:()=>zs,controls_mstimer2:()=>Js,controls_mstimer2_start:()=>Qs,controls_mstimer2_stop:()=>Zs,reset:()=>Ks,time_localtime:()=>qs,time_sleep:()=>eo});var b={};n.r(b),n.d(b,{turtle_bgcolor:()=>vo,turtle_bgcolor_hex:()=>Mo,turtle_bgcolor_hex_new:()=>wo,turtle_circle:()=>So,turtle_circle_advanced:()=>ko,turtle_clear:()=>ho,turtle_clone:()=>Io,turtle_color:()=>$o,turtle_color_hex:()=>Oo,turtle_color_seclet:()=>Vo,turtle_create:()=>no,turtle_done:()=>io,turtle_exitonclick:()=>ro,turtle_fill:()=>_o,turtle_fillcolor:()=>Eo,turtle_fillcolor_hex:()=>Ro,turtle_fillcolor_hex_new:()=>Ao,turtle_getscreen:()=>Uo,turtle_goto:()=>uo,turtle_listen:()=>Ho,turtle_move:()=>so,turtle_numinput:()=>Do,turtle_onclick:()=>Go,turtle_onkey:()=>Yo,turtle_ontimer:()=>Xo,turtle_pencolor:()=>To,turtle_pencolor_hex:()=>Co,turtle_pencolor_hex_new:()=>xo,turtle_penup:()=>fo,turtle_pos_shape:()=>po,turtle_rotate:()=>oo,turtle_screen_delay:()=>lo,turtle_screen_savefig:()=>zo,turtle_setheading:()=>ao,turtle_setxy:()=>co,turtle_shape:()=>No,turtle_shapesize:()=>Lo,turtle_size:()=>bo,turtle_size_speed:()=>mo,turtle_speed:()=>go,turtle_stamp:()=>qo,turtle_textinput:()=>Po,turtle_visible:()=>yo,turtle_write:()=>Fo,turtle_write_format:()=>Bo,turtle_write_format_skulpt:()=>jo});var g={};n.r(g),n.d(g,{Turn:()=>ra,addOil:()=>ka,game_get_character_img:()=>ha,game_get_local_img:()=>la,game_get_path_img:()=>ca,game_init:()=>na,get_actor_point:()=>fa,initSettedMap_1:()=>Wo,initSettedMap_2:()=>Ko,initSettedMap_3:()=>Jo,initSettedMap_4:()=>Qo,initSettedMap_5:()=>Zo,initSettedMap_6:()=>ea,initSettedMap_7:()=>ta,initialize:()=>da,isBarrier:()=>_a,isCirculationRight:()=>ya,isDone:()=>sa,isLightGreen:()=>ga,isLightRed:()=>Sa,isOilFull:()=>ba,isPath:()=>oa,move_direction_steps:()=>ia,place_item:()=>pa,randomOil:()=>ma,set_map:()=>aa,set_pathtype:()=>ua});var S={};n.r(S),n.d(S,{controls_type:()=>wa,controls_typeLists:()=>xa,lists_zip:()=>Aa,unpack_iterable_object:()=>$a,variables_change:()=>Ea,variables_get:()=>va,variables_global:()=>Ia,variables_set:()=>Ta});var k={};n.r(k),n.d(k,{Panic_with_status_code:()=>Ba,base_setup:()=>Ma,controls_delay:()=>Fa,controls_flow_statements:()=>Pa,controls_for:()=>Na,controls_forEach:()=>Ga,controls_for_range:()=>La,controls_if:()=>Ca,controls_interrupts:()=>Ua,controls_lambda:()=>Ha,controls_main:()=>Oa,controls_millis:()=>ja,controls_nointerrupts:()=>Ya,controls_pass:()=>qa,controls_range:()=>Xa,controls_repeat:()=>nl,controls_repeat_ext:()=>Ja,controls_thread:()=>Wa,controls_try_finally:()=>Ra,controls_whileUntil:()=>Da,datetime_fromtimestamp:()=>il,do_while:()=>Ka,garbage_collection:()=>Qa,gene_unique_identifier:()=>rl,get_mem_alloc:()=>Za,get_mem_free:()=>el,get_unique_identifier:()=>tl,reset:()=>Va,time_sleep:()=>za});var y={};n.r(y),n.d(y,{base_map:()=>Il,generate_cartesian_product:()=>xl,math_arithmetic:()=>ul,math_bit:()=>ll,math_constant:()=>ol,math_constant_mp:()=>al,math_constrain:()=>gl,math_dec:()=>dl,math_degree_to_radian:()=>$l,math_indexer_number:()=>yl,math_map:()=>bl,math_max_min:()=>_l,math_number:()=>sl,math_number_base_conversion:()=>Sl,math_radian_to_degree:()=>Al,math_random:()=>ml,math_random_seed:()=>kl,math_round:()=>vl,math_selfcalcu:()=>cl,math_single:()=>pl,math_to_int:()=>fl,math_trig:()=>hl,text_to_number:()=>Tl,text_to_number_skulpt:()=>El,turn_to_int:()=>wl});var v={};n.r(v),n.d(v,{ascii_to_char:()=>Ll,char_to_ascii:()=>Dl,number_to_text:()=>Pl,os_system:()=>ou,text:()=>Ol,text_bytes:()=>Cl,text_capital:()=>Hl,text_center:()=>zl,text_char:()=>Rl,text_char_at:()=>jl,text_char_at2:()=>Bl,text_char_at3:()=>iu,text_compareTo:()=>nu,text_compare_to:()=>Yl,text_encode:()=>ru,text_equals_starts_ends:()=>Ul,text_eval:()=>su,text_find:()=>ql,text_format:()=>Zl,text_format_noreturn:()=>eu,text_join:()=>Nl,text_join_seq:()=>Wl,text_length:()=>Fl,text_random_char:()=>Vl,text_replace:()=>Kl,text_split:()=>Jl,text_strip:()=>Ql,text_substring:()=>Xl,text_substring2:()=>Gl,text_substring3:()=>tu,text_textarea:()=>Ml});var T={};n.r(T),n.d(T,{content_in_lists:()=>ju,enumerate:()=>Bu,list_many_input:()=>wu,list_tolist:()=>Pu,list_tolist2:()=>Fu,list_trig:()=>Tu,lists_2d_get_col_row_data:()=>uu,lists_2d_get_data_with_col_row:()=>lu,lists_append_extend:()=>fu,lists_change_to:()=>Iu,lists_change_to_general:()=>Au,lists_clear:()=>Su,lists_create_with:()=>cu,lists_create_with2:()=>Ou,lists_create_with_noreturn:()=>xu,lists_create_with_text:()=>pu,lists_create_with_text2:()=>Mu,lists_del_general:()=>$u,lists_find:()=>ku,lists_getIndex3:()=>Cu,lists_getSublist3:()=>Ru,lists_get_index:()=>hu,lists_get_random_item:()=>_u,lists_get_random_sublist:()=>mu,lists_get_sublist:()=>au,lists_insert_value:()=>bu,lists_insert_value2:()=>Lu,lists_pop:()=>vu,lists_remove_at:()=>yu,lists_remove_at2:()=>Du,lists_reverse:()=>gu,lists_setIndex3:()=>Nu,lists_set_index:()=>du,lists_sort:()=>Eu});var E={};n.r(E),n.d(E,{dicts_add_change_del:()=>Zu,dicts_add_or_change:()=>Xu,dicts_clear:()=>qu,dicts_create_with:()=>Vu,dicts_create_with_noreturn:()=>nc,dicts_deldict:()=>Qu,dicts_delete:()=>Hu,dicts_get:()=>Yu,dicts_get_default:()=>Gu,dicts_items:()=>Wu,dicts_keys:()=>Uu,dicts_length:()=>Ju,dicts_pop:()=>ec,dicts_setdefault:()=>tc,dicts_to_json:()=>rc,dicts_to_json2:()=>ac,dicts_to_to:()=>oc,dicts_todict:()=>ic,dicts_update:()=>zu,dicts_values:()=>Ku,json_to_dicts:()=>sc});var I={};n.r(I),n.d(I,{logic_boolean:()=>hc,logic_compare:()=>lc,logic_compare_continous:()=>uc,logic_is:()=>mc,logic_is_in:()=>_c,logic_negate:()=>pc,logic_null:()=>dc,logic_operation:()=>cc,logic_tobool:()=>bc,logic_true_or_false:()=>fc});var w={};n.r(w),n.d(w,{sdcard_mount:()=>jc,sdcard_use_spi_init:()=>Bc,storage_can_write_ornot:()=>wc,storage_change_dir:()=>Nc,storage_close_file:()=>Ac,storage_delete_file:()=>Oc,storage_file_seek:()=>Rc,storage_file_tell:()=>Cc,storage_file_write:()=>vc,storage_fileopen:()=>Sc,storage_fileopen_new:()=>kc,storage_fileopen_new_encoding:()=>yc,storage_get_a_line:()=>Ic,storage_get_contents:()=>Ec,storage_get_contents_without_para:()=>Tc,storage_get_current_dir:()=>Lc,storage_get_file_size:()=>Mc,storage_get_filename:()=>xc,storage_is_file:()=>Fc,storage_list_all_files:()=>$c,storage_make_dir:()=>Dc,storage_open_file_with_os:()=>gc,storage_rename:()=>Pc});var x={};n.r(x),n.d(x,{procedures_callnoreturn:()=>Gc,procedures_callreturn:()=>Yc,procedures_defnoreturn:()=>Uc,procedures_defreturn:()=>Vc,procedures_ifreturn:()=>Xc,procedures_return:()=>Hc});var A={};n.r(A),n.d(A,{tuple_change_to:()=>tp,tuple_create_llm_params:()=>cp,tuple_create_with:()=>zc,tuple_create_with_noreturn:()=>sp,tuple_create_with_text2:()=>qc,tuple_create_with_text_return:()=>Wc,tuple_del:()=>Qc,tuple_find:()=>np,tuple_getIndex:()=>Kc,tuple_getSublist:()=>rp,tuple_get_random_item:()=>ap,tuple_get_sublist:()=>op,tuple_input:()=>up,tuple_join:()=>Zc,tuple_length:()=>Jc,tuple_max:()=>ep,tuple_totuple:()=>lp,tuple_trig:()=>ip});var O={};n.r(O),n.d(O,{set_add_discard:()=>bp,set_clear:()=>fp,set_create_with:()=>pp,set_create_with_text_return:()=>kp,set_length:()=>hp,set_operate:()=>_p,set_operate_update:()=>mp,set_pop:()=>dp,set_sub:()=>gp,set_toset:()=>yp,set_update:()=>Sp});var M={};n.r(M),n.d(M,{html_content:()=>Ip,html_content_more:()=>wp,html_document:()=>vp,html_form:()=>Ap,html_head_body:()=>Ep,html_style:()=>xp,html_style_content:()=>$p,html_text:()=>Op,html_title:()=>Tp});var C={};n.r(C),n.d(C,{attribute_access:()=>Pp,function_call:()=>Dp,raw_block:()=>Mp,raw_empty:()=>Rp,raw_expression:()=>Cp,raw_table:()=>Np,type_check:()=>Lp});var R={};n.r(R),n.d(R,{array_create:()=>Zp,array_toarray:()=>dh,dataframe_create:()=>jp,dataframe_create_from_index:()=>Vp,dataframe_create_from_one_index:()=>Up,dataframe_get:()=>ch,numpy_trig:()=>ah,pandas_readcsv:()=>uh,pl_axes:()=>zp,pl_bar:()=>ih,pl_hist:()=>sh,pl_label:()=>Qp,pl_legend:()=>Kp,pl_pie:()=>rh,pl_plot:()=>Wp,pl_plot_bar:()=>eh,pl_plot_easy:()=>qp,pl_plot_scatter:()=>th,pl_plot_xy:()=>nh,pl_savefig:()=>ph,pl_show:()=>Hp,pl_subplot:()=>lh,pl_text:()=>hh,pl_ticks:()=>oh,pl_title:()=>Jp,plot_axes:()=>_h,plot_bar:()=>Eh,plot_hist:()=>wh,plot_label:()=>kh,plot_legend:()=>gh,plot_pie:()=>Ih,plot_plot:()=>bh,plot_plot_bar:()=>yh,plot_plot_easy:()=>mh,plot_plot_scatter:()=>vh,plot_plot_xy:()=>Th,plot_savefig:()=>$h,plot_show:()=>fh,plot_subplot:()=>Ah,plot_text:()=>Oh,plot_ticks:()=>xh,plot_title:()=>Sh,series_create:()=>Fp,series_create_from_index:()=>Bp,series_create_from_text:()=>Yp,series_get_num:()=>Xp,series_index_value:()=>Gp});var N={};n.r(N),n.d(N,{inout_input:()=>Mh,inout_print:()=>Ch,inout_print_end:()=>Nh,inout_print_inline:()=>Rh,inout_print_many:()=>Dh,inout_type_input:()=>Lh});var L={};n.r(L),n.d(L,{controls_end_program:()=>Fh,controls_millis:()=>Ph,time_localtime:()=>Bh});var D={};n.r(D),n.d(D,{turtle_bgcolor:()=>sd,turtle_bgcolor_hex:()=>ud,turtle_bgcolor_hex_new:()=>hd,turtle_circle:()=>td,turtle_circle_advanced:()=>id,turtle_clear:()=>Wh,turtle_clone:()=>ld,turtle_color:()=>md,turtle_color_hex:()=>_d,turtle_color_seclet:()=>Ed,turtle_create:()=>jh,turtle_done:()=>Vh,turtle_exitonclick:()=>Uh,turtle_fill:()=>Jh,turtle_fillcolor:()=>ad,turtle_fillcolor_hex:()=>pd,turtle_fillcolor_hex_new:()=>fd,turtle_getscreen:()=>Id,turtle_goto:()=>zh,turtle_listen:()=>$d,turtle_move:()=>Yh,turtle_numinput:()=>kd,turtle_onclick:()=>xd,turtle_onkey:()=>wd,turtle_ontimer:()=>Ad,turtle_pencolor:()=>od,turtle_pencolor_hex:()=>cd,turtle_pencolor_hex_new:()=>dd,turtle_penup:()=>Kh,turtle_pos_shape:()=>qh,turtle_rotate:()=>Gh,turtle_screen_delay:()=>Hh,turtle_screen_savefig:()=>Od,turtle_setheading:()=>Xh,turtle_setxy:()=>nd,turtle_shape:()=>bd,turtle_shapesize:()=>gd,turtle_size:()=>Zh,turtle_size_speed:()=>Qh,turtle_speed:()=>ed,turtle_stamp:()=>Md,turtle_textinput:()=>Sd,turtle_visible:()=>rd,turtle_write:()=>yd,turtle_write_format:()=>vd,turtle_write_format_skulpt:()=>Td});var P={};n.r(P),n.d(P,{Turn:()=>Vd,addOil:()=>rf,game_get_character_img:()=>zd,game_get_local_img:()=>Xd,game_get_path_img:()=>Kd,game_init:()=>Cd,get_actor_point:()=>Gd,initSettedMap_1:()=>Nd,initSettedMap_2:()=>Ld,initSettedMap_3:()=>Dd,initSettedMap_4:()=>Pd,initSettedMap_5:()=>Fd,initSettedMap_6:()=>Bd,initSettedMap_7:()=>jd,initialize:()=>qd,isBarrier:()=>Qd,isCirculationRight:()=>sf,isDone:()=>Ud,isLightGreen:()=>tf,isLightRed:()=>nf,isOilFull:()=>ef,isPath:()=>Yd,move_direction_steps:()=>Rd,place_item:()=>Wd,randomOil:()=>Zd,set_map:()=>Hd,set_pathtype:()=>Jd});const F=Blockly,B=Mixly,j={NAME_TYPE:"VARIABLE",allVariables:function(e){var t;if(e.getDescendants)t=e.getDescendants();else{if(!e.getAllBlocks)throw"Not Block or Workspace: "+e;t=e.getAllBlocks()}for(var n=Object.create(null),i=0;i<t.length;i++)for(var r=t[i].getVars(),s=0;s<r.length;s++){var o=r[s];o&&(n[o]=o)}var a=[];for(var l in n)a.push(n[l]);return a},renameVariable:function(e,t,n){F.Events.setGroup(!0);for(var i=n.getAllBlocks(),r=0;r<i.length;r++)i[r].renameVar(e,t);F.Events.setGroup(!1)},flyoutCategory:function(e){var t=j.allVariables(e),n=[];((o=F.utils.xml.createElement("block")).setAttribute("type","variables_global"),n.push(o),F.Blocks.variables_set)&&((o=F.utils.xml.createElement("block")).setAttribute("type","variables_set"),n.push(o));F.Blocks.variables_change&&((o=F.utils.xml.createElement("block")).setAttribute("type","variables_change"),n.push(o));F.Blocks.controls_type&&((o=F.utils.xml.createElement("block")).setAttribute("type","controls_type"),n.push(o));F.Blocks.controls_typeLists&&((o=F.utils.xml.createElement("block")).setAttribute("type","controls_typeLists"),n.push(o));if(F.Blocks.lists_zip){(o=F.utils.xml.createElement("block")).setAttribute("type","lists_zip"),o.setAttribute("inline","false");var i=F.utils.xml.createElement("mutation");i.setAttribute("items",2),o.appendChild(i);for(let e=0;e<2;e++){let t=F.utils.xml.createElement("value");t.setAttribute("name",`ADD${e}`),o.appendChild(t)}n.push(o)}F.Blocks.unpack_iterable_object&&((o=F.utils.xml.createElement("block")).setAttribute("type","unpack_iterable_object"),n.push(o));for(var r=0;r<t.length;r++){if(F.Blocks.variables_set){(o=F.utils.xml.createElement("block")).setAttribute("type","variables_set"),F.Blocks.variables_get&&o.setAttribute("gap",8),(a=F.utils.xml.createElement("field",null,t[r])).setAttribute("name","VAR");var s=F.utils.xml.createTextNode(t[r]);a.appendChild(s),o.appendChild(a),n.push(o)}if(F.Blocks.variables_get){var o,a;(o=F.utils.xml.createElement("block")).setAttribute("type","variables_get"),F.Blocks.variables_set&&o.setAttribute("gap",24),(a=F.utils.xml.createElement("field",null,t[r])).setAttribute("name","VAR");s=F.utils.xml.createTextNode(t[r]);a.appendChild(s),o.appendChild(a),n.push(o)}}return n},generateUniqueName:function(e){var t=j.allVariables(e),n="";if(t.length)for(var i=1,r="ijkmnopqrstuvwxyzabcdefgh",s=0,o=r.charAt(s);!n;){for(var a=!1,l=0;l<t.length;l++)if(t[l]==o){a=!0;break}a?(25==++s&&(s=0,i++),o=r.charAt(s),i>1&&(o+=i)):n=o}else n="i";return n}},V=j,U={};U.NAME_TYPE=F.PROCEDURE_CATEGORY_NAME,U.allProcedures=function(e){for(var t=e.getAllBlocks(!1),n=[],i=[],r=0;r<t.length;r++)if(t[r].getProcedureDef){var s=t[r].getProcedureDef();s&&(s[2]?n.push(s):i.push(s))}return i.sort(U.procTupleComparator_),n.sort(U.procTupleComparator_),[i,n]},U.procTupleComparator_=function(e,t){return e[0].toLowerCase().localeCompare(t[0].toLowerCase())},U.findLegalName=function(e,t){if(t.isInFlyout)return e;for(e=e||F.Msg.UNNAMED_KEY||"unnamed";!U.isLegalName_(e,t.workspace,t);){var n=e.match(/^(.*?)(\d+)$/);n?e=n[1]+(parseInt(n[2],10)+1):e+="2"}return e},U.isLegalName_=function(e,t,n){return!U.isNameUsed(e,t,n)},U.isNameUsed=function(e,t,n){for(var i=t.getAllBlocks(!1),r=0;r<i.length;r++)if(i[r]!=n&&i[r].getProcedureDef){var s=i[r].getProcedureDef();if(F.Names.equals(s[0],e))return!0}return!1},U.rename=function(e){e=e.trim();var t=U.findLegalName(e,this.getSourceBlock()),n=this.getValue();if(n!=e&&n!=t)for(var i=this.getSourceBlock().workspace.getAllBlocks(!1),r=0;r<i.length;r++)i[r].renameProcedure&&i[r].renameProcedure(n,t);return t},U.flyoutCategory=function(e){var t,n,i=[];F.Blocks.procedures_defnoreturn&&((n=F.utils.xml.createElement("block")).setAttribute("type","procedures_defnoreturn"),n.setAttribute("gap",16),(t=F.utils.xml.createElement("field")).setAttribute("name","NAME"),t.appendChild(F.utils.xml.createTextNode(F.Msg.PROCEDURES_DEFNORETURN_PROCEDURE)),n.appendChild(t),i.push(n));F.Blocks.procedures_defreturn&&((n=F.utils.xml.createElement("block")).setAttribute("type","procedures_defreturn"),n.setAttribute("gap",16),(t=F.utils.xml.createElement("field")).setAttribute("name","NAME"),t.appendChild(F.utils.xml.createTextNode(F.Msg.PROCEDURES_DEFRETURN_PROCEDURE)),n.appendChild(t),i.push(n));F.Blocks.procedures_return&&((n=F.utils.xml.createElement("block")).setAttribute("type","procedures_return"),n.setAttribute("gap",16),i.push(n));F.Blocks.procedures_ifreturn&&((n=F.utils.xml.createElement("block")).setAttribute("type","procedures_ifreturn"),n.setAttribute("gap",16),i.push(n));function r(e,t){for(var n=0;n<e.length;n++){var r=e[n][0],s=e[n][1],o=F.utils.xml.createElement("block");o.setAttribute("type",t),o.setAttribute("gap",16);var a=F.utils.xml.createElement("mutation");a.setAttribute("name",r),o.appendChild(a);for(var l=0;l<s.length;l++){var u=F.utils.xml.createElement("arg");u.setAttribute("name",s[l]),a.appendChild(u)}i.push(o)}}i.length&&i[i.length-1].setAttribute("gap",24);var s=U.allProcedures(e);return r(s[0],"procedures_callnoreturn"),r(s[1],"procedures_callreturn"),i},U.getCallers=function(e,t){for(var n=[],i=t.getAllBlocks(!1),r=0;r<i.length;r++)if(i[r].getProcedureCall){var s=i[r].getProcedureCall();s&&F.Names.equals(s,e)&&n.push(i[r])}return n},U.mutateCallers=function(e){const t=F.Events.getRecordUndo(),n=e.getProcedureDef()[0],i=e.mutationToDom(!0),r=F.Procedures.getCallers(n,e.workspace);for(let e,n=0;e=r[n];n++){const n=e.mutationToDom(),r=n&&F.utils.xml.domToText(n);e.domToMutation&&e.domToMutation(i);const s=e.mutationToDom(),o=s&&F.utils.xml.domToText(s);r!==o&&(F.Events.setRecordUndo(!1),F.Events.fire(new(F.Events.get(F.Events.BLOCK_CHANGE))(e,"mutation",null,r,o)),F.Events.setRecordUndo(t))}},U.getDefinition=function(e,t){for(var n=t.getTopBlocks(!1),i=0;i<n.length;i++)if(n[i].getProcedureDef){var r=n[i].getProcedureDef();if(r&&F.Names.equals(r[0],e))return n[i]}return null};const Y=U;
|
||
/**
|
||
* @license
|
||
* Visual Blocks Editor
|
||
*
|
||
* Copyright 2012 Google Inc.
|
||
* https://developers.google.com/blockly/
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/
|
||
class G{constructor(e,t){if(this.variablePrefix_=t||"",this.reservedDict_=Object.create(null),e)for(var n=e.split(","),i=0;i<n.length;i++)this.reservedDict_[n[i]]=!0;this.reset()}static equals(e,t){return e==t}reset(){this.db_=Object.create(null),this.dbReverse_=Object.create(null),this.variableMap_=null}setVariableMap(e){this.variableMap_=e}getNameForUserVariable_(e){if(!this.variableMap_)return null;var t=this.variableMap_.getVariableById(e);return t?t.name:null}getName(e,t){if(t==V.NAME_TYPE){var n=this.getNameForUserVariable_(e);n&&(e=n)}var i=e+"_"+t,r=t==V.NAME_TYPE||t==G.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"";if(i in this.db_)return r+this.db_[i];var s=this.getDistinctName(e,t);return this.db_[i]=s.substr(r.length),s}getDistinctName(e,t){for(var n=this.safeName_(e),i="";this.dbReverse_[n+i]||n+i in this.reservedDict_;)i=i?i+1:2;return n+=i,this.dbReverse_[n]=!0,(t==V.NAME_TYPE||t==G.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"")+n}safeName_(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^,\w]/g,"_"),-1!="0123456789".indexOf(e[0])&&(e="my_"+e)):e="unnamed",e}}G.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE";const X=G,H=new F.Generator("Python");H.INDENT=" ",H.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip"),H.ORDER_ATOMIC=0,H.ORDER_COLLECTION=1,H.ORDER_STRING_CONVERSION=1,H.ORDER_UNARY_POSTFIX=1,H.ORDER_UNARY_PREFIX=2,H.ORDER_MEMBER=2.1,H.ORDER_FUNCTION_CALL=2.2,H.ORDER_EXPONENTIATION=3,H.ORDER_UNARY_SIGN=4,H.ORDER_BITWISE_NOT=4,H.ORDER_MULTIPLICATIVE=5,H.ORDER_ADDITIVE=6,H.ORDER_BITWISE_SHIFT=7,H.ORDER_BITWISE_AND=8,H.ORDER_BITWISE_XOR=9,H.ORDER_BITWISE_OR=10,H.ORDER_RELATIONAL=11,H.ORDER_EQUALITY=11,H.ORDER_LOGICAL_NOT=12,H.ORDER_LOGICAL_AND=13,H.ORDER_LOGICAL_OR=14,H.ORDER_ASSIGNMENT=14,H.ORDER_CONDITIONAL=15,H.ORDER_LAMBDA=16,H.ORDER_NONE=99,H.ORDER_OVERRIDES=[[H.ORDER_FUNCTION_CALL,H.ORDER_MEMBER],[H.ORDER_FUNCTION_CALL,H.ORDER_FUNCTION_CALL],[H.ORDER_MEMBER,H.ORDER_MEMBER],[H.ORDER_MEMBER,H.ORDER_FUNCTION_CALL]],H.init=function(){H.PASS=this.INDENT+"pass\n",H.definitions_=Object.create(null),H.functionNames_=Object.create(null),H.setups_=Object.create(null),H.loops_=Object.create(null),H.codeEnd_=Object.create(null),H.variableDB_?H.variableDB_.reset():H.variableDB_=new X(H.RESERVED_WORDS_)},H.finish=function(e){""!==e&&(e=(e=e.replace(/\n/g,"\n")).replace(/\n\s+$/,"\n"));var t=[],n=[],i=[];for(var r in this.definitions_){var s=this.definitions_[r];0===r.indexOf("import")?t.push(s):0===r.indexOf("var_declare")?n.push(s):i.push(s)}t.length&&t.push("\n\n"),n.length&&n.push("\n\n"),i.length&&i.push("\n\n");var o=[];for(var r in H.functions_)o.push(H.functions_[r]);o.length&&o.push("\n\n");var a=[];for(var r in H.setups_)a.push(H.setups_[r]);a.length&&a.push("\n\n");var l=[];for(var r in H.loops_)l.push(H.loops_[r]);var u=[];for(var r in H.codeEnd_)u.push(H.codeEnd_[r]);return 0!==u.length&&u.push("\n"),l.length>0?t.join("\n")+n.join("\n")+i.join("\n")+o.join("\n")+a.join("")+e+"while True:\n"+l.join("")+u.join("\n"):t.join("\n")+n.join("\n")+i.join("\n")+o.join("\n")+a.join("")+e+u.join("\n")},H.scrubNakedValue=function(e){return e+"\n"},H.quote_=function(e){var t="'";return-1!==e.indexOf("'")&&(-1===e.indexOf('"')?t='"':e=e.replace(/'/g,"\\'")),t+e+t},H.multiline_quote_=function(e){return"'''"+(e=e.replace(/'''/g,"\\'\\'\\'"))+"'''"},H.scrub_=function(e,t,n){var i="";if(!e.outputConnection||!e.outputConnection.targetConnection){(s=e.getCommentText())&&(s=F.utils.string.wrap(s,H.COMMENT_WRAP-3),i+=H.prefixLines(s+"\n","# "));for(var r=0;r<e.inputList.length;r++)if(e.inputList[r].type==F.INPUT_VALUE){var s,o=e.inputList[r].connection.targetBlock();if(o)(s=H.allNestedComments(o))&&(i+=H.prefixLines(s,"# "))}}var a=e.nextConnection&&e.nextConnection.targetBlock();return i+t+(n?"":H.blockToCode(a))},H.getAdjustedInt=function(e,t,n,i){var r=n||0;e.workspace.options.oneBasedIndex&&r--;var s=e.workspace.options.oneBasedIndex?"1":"0",o=r?H.ORDER_ADDITIVE:H.ORDER_NONE,a=H.valueToCode(e,t,o)||s;return F.isNumber(a)?(a=parseInt(a,10)+r,i&&(a=-a)):(a=r>0?"int("+a+" + "+r+")":r<0?"int("+a+" - "+-r+")":"int("+a+")",i&&(a="-"+a)),a};const z=330,q={init:function(){this.setColour(z),this.appendDummyInput().appendField(new F.FieldTextInput(""),"VAR"),this.setOutput(!0),this.setTooltip(F.Msg.VARIABLES_GET_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){X.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")}},W={init:function(){this.setColour(z),this.appendValueInput("VALUE").appendField(new F.FieldTextInput(""),"VAR").appendField(F.Msg.MIXLY_VALUE2),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.VARIABLES_SET_TOOLTIP)},getVars:function(){var e=this.getFieldValue("VAR");return null==e?[]:e.split(",")},renameVar:function(e,t){X.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")}},K={init:function(){this.setColour(z);var e=[[F.Msg.LANG_MATH_INT,"int"],[F.Msg.LANG_MATH_FLOAT,"float"],[F.Msg.LANG_MATH_BOOLEAN,"bool"],[F.Msg.LANG_MATH_STRING,"str"],[F.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[F.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[F.Msg.MIXLY_MICROBIT_TYPE_DICT,"dict"],[F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[F.Msg.LANG_MATH_BYTE,"bytes"]];this.appendValueInput("MYVALUE").appendField(new F.FieldDropdown(e),"OP"),this.setOutput(!0)}},J={init:function(){this.setColour(z),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_PYTHON_GLOBAL).setCheck("var"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(F.Msg.TEXT_PRINT_TOOLTIP)}},Q={init:function(){this.setColour(z),this.appendValueInput("DATA").appendField(F.Msg.MICROBIT_PYTHON_TYPE),this.setOutput(!0),this.setTooltip(F.Msg.MICROBIT_PYTHON_TYPE)}},Z={init:function(){this.setColour(z),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_CONTORL_GET_TYPE).appendField(new F.FieldDropdown([[F.Msg.LANG_MATH_INT,"int"],[F.Msg.MIXLY_MICROBIT_TYPE_FLOAT,"float"],[F.Msg.MIXLY_MICROBIT_TYPE_STRING,"str"],[F.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[F.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[F.Msg.MIXLY_MICROBIT_TYPE_DICT,"dict"],[F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[F.Msg.LANG_MATH_BYTE,"bytes"],[F.Msg.LOGIC_NULL,"type(None)"]]),"type"),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("type");return F.Msg.MICROBIT_controls_TypeLists+{int:F.Msg.LANG_MATH_INT,float:F.Msg.MIXLY_MICROBIT_TYPE_FLOAT,str:F.Msg.MIXLY_MICROBIT_TYPE_STRING,list:F.Msg.MIXLY_MICROBIT_TYPE_LIST,tuple:F.Msg.MIXLY_MICROBIT_TYPE_TUPLE,dict:F.Msg.MIXLY_MICROBIT_TYPE_DICT,set:F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,image:F.Msg.MIXLY_MICROBIT_IMAGE,bytes:F.Msg.LANG_MATH_BYTE,NoneType:F.Msg.LOGIC_NULL}[t]}))}},ee={init:function(){this.setColour(z),this.itemCount_=2,this.updateShape_(),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setMutator(new F.icons.MutatorIcon(["lists_zip_item"],this)),this.setTooltip(F.Msg.MIXLY_PYTHON_LISTS_ZIP_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_zip_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_zip_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.MIXLY_PYTHON_LISTS_ZIP);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.MIXLY_PYTHON_LISTS_ZIP)}}},te={init:function(){this.setColour(z),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_LISTS_ZIP),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_CONTAINER_TOOLTIP),this.contextMenu=!1}},ne={init:function(){this.setColour(z),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM_TOOLTIP),this.contextMenu=!1}},ie={init:function(){this.setColour(z),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_VARIABLE_UNPACK).appendField(new F.FieldDropdown([[F.Msg.MIXLY_PYTHON_LISTS_ZIP_ITEM,"*"],[F.Msg.MIXLY_MICROBIT_TYPE_DICT,"**"]]),"TYPE"),this.setTooltip(""),this.setOutput(!0)}},re=120,se={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_NAME_MAIN),this.appendStatementInput("DO").appendField(""),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_SETUP)}},oe={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_SETUP),this.appendStatementInput("DO").appendField(""),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_SETUP)}},ae={init:function(){var e=[[F.Msg.MIXLY_mSecond,"delay"],[F.Msg.MIXLY_uSecond,"delayMicroseconds"]];this.setColour(re),this.appendValueInput("DELAY_TIME",Number).appendField(F.Msg.MIXLY_DELAY).appendField(new F.FieldDropdown(e),"UNIT").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_DELAY),this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id9"),this.wiki={"zh-hans":{page:["Arduino AVR","控制","延时"]}}}},le={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_CONTROL_END_PROGRAM),this.setPreviousStatement(!0),this.setTooltip(F.Msg.MIXLY_MIXPY_CONTROL_END_TOOLTIP)}},ue={init:function(){this.setColour(re),this.appendValueInput("IF0").setCheck([Boolean,Number]).appendField(F.Msg.CONTROLS_IF_MSG_IF),this.appendStatementInput("DO0").appendField(F.Msg.CONTROLS_IF_MSG_THEN),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#if"),this.setMutator(new F.icons.MutatorIcon(["controls_if_elseif","controls_if_else"],this));var e=this;this.setTooltip((function(){return e.elseifCount_||e.elseCount_?!e.elseifCount_&&e.elseCount_?F.Msg.CONTROLS_IF_TOOLTIP_2:e.elseifCount_&&!e.elseCount_?F.Msg.CONTROLS_IF_TOOLTIP_3:e.elseifCount_&&e.elseCount_?F.Msg.CONTROLS_IF_TOOLTIP_4:"":F.Msg.CONTROLS_IF_TOOLTIP_1})),this.elseifCount_=0,this.elseCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=document.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(e){var t=this,n=[],i=[];this.elseCount_&&this.removeInput("ELSE");for(var r=this.elseifCount_;r>0;r--)t.getInputTargetBlock("IF"+r)&&t.getInputTargetBlock("IF"+r).previousConnection?n[r]=t.getInputTargetBlock("IF"+r).previousConnection:n[r]=null,this.removeInput("IF"+r),t.getInputTargetBlock("DO"+r)&&t.getInputTargetBlock("DO"+r).previousConnection?i[r]=t.getInputTargetBlock("DO"+r).previousConnection:i[r]=null,this.removeInput("DO"+r);this.elseifCount_=parseInt(e.getAttribute("elseif"),10),this.elseCount_=parseInt(e.getAttribute("else"),10);for(r=1;r<=this.elseifCount_;r++)this.appendValueInput("IF"+r).setCheck([Boolean,Number]).appendField(F.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+r).appendField(F.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(F.Msg.CONTROLS_IF_MSG_ELSE);for(r=n.length-2;r>0;r--)n[r]&&n[r].reconnect(this,"IF"+r);for(r=i.length-2;r>0;r--)i[r]&&i[r].reconnect(this,"DO"+r)},decompose:function(e){var t=e.newBlock("controls_if_if");t.initSvg();for(var n=t.getInput("STACK").connection,i=1;i<=this.elseifCount_;i++){var r=e.newBlock("controls_if_elseif");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}if(this.elseCount_){var s=e.newBlock("controls_if_else");s.initSvg(),n.connect(s.previousConnection)}return t},compose:function(e){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var t=this.elseifCount_;t>0;t--)this.removeInput("IF"+t),this.removeInput("DO"+t);this.elseifCount_=0;for(var n=e.getInputTargetBlock("STACK"),i=[null],r=[null],s=null;n;){switch(n.type){case"controls_if_elseif":this.elseifCount_++,i.push(n.valueConnection_),r.push(n.statementConnection_);break;case"controls_if_else":this.elseCount_++,s=n.statementConnection_;break;default:throw Error("Unknown block type: "+n.type)}n=n.nextConnection&&n.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(i,r,s)},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=1;t;){switch(t.type){case"controls_if_elseif":var i=this.getInput("IF"+n),r=this.getInput("DO"+n);t.valueConnection_=i&&i.connection.targetConnection,t.statementConnection_=r&&r.connection.targetConnection,n++;break;case"controls_if_else":r=this.getInput("ELSE");t.statementConnection_=r&&r.connection.targetConnection;break;default:throw"Unknown block type."}t=t.nextConnection&&t.nextConnection.targetBlock()}},rebuildShape_:function(){var e=[null],t=[null],n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(var i=1;this.getInput("IF"+i);){var r=this.getInput("IF"+i),s=this.getInput("DO"+i);console.log(r.connection.targetConnection),e.push(r.connection.targetConnection),t.push(s.connection.targetConnection),i++}this.updateShape_(),this.reconnectChildBlocks_(e,t,n)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck([Number,Boolean]).appendField(F.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(F.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(F.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,t,n){for(var i=1;i<=this.elseifCount_;i++)e[i]&&e[i].reconnect(this,"IF"+i),t[i]&&t[i].reconnect(this,"DO"+i);n&&n.reconnect(this,"ELSE")}},ce={init:function(){this.setColour(re),this.appendValueInput("FROM").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.PYTHON_RANGE).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.PYTHON_RANGE_STEP),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},pe={init:function(){this.setColour(re),this.appendValueInput("LIST").setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.CONTROLS_FOREACH_INPUT),this.appendValueInput("VAR").appendField(F.Msg.CONTROLS_FOREACH_INPUT_ITEM),this.appendStatementInput("DO").appendField(F.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip((function(){return F.Msg.CONTROLS_FOR_TOOLTIP.replace("“%1”","")}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},he={init:function(){this.setColour(re),this.appendValueInput("BOOL").setCheck([Boolean,Number]).appendField(F.Msg.MIXLY_MICROBIT_JS_CURRENT).appendField(new F.FieldDropdown(this.OPERATORS),"MODE"),this.appendStatementInput("DO").appendField(F.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT+F.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE");return{WHILE:F.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,UNTIL:F.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}[t]}))}},de={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_TRY),this.appendStatementInput("try"),this.appendValueInput("IF1").appendField(F.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO1").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new F.icons.MutatorIcon(["controls_except","controls_finally"],this)),this.setTooltip(F.Msg.MIXLY_MIXPY_CONTROL_TRY_TOOLTIP),this.elseifCount_=1,this.elseCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=document.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(e){var t=this,n=[],i=[];this.elseCount_&&this.removeInput("ELSE");for(var r=this.elseifCount_;r>0;r--)t.getInputTargetBlock("IF"+r)&&t.getInputTargetBlock("IF"+r).previousConnection?n[r]=t.getInputTargetBlock("IF"+r).previousConnection:n[r]=null,this.removeInput("IF"+r),t.getInputTargetBlock("DO"+r)&&t.getInputTargetBlock("DO"+r).previousConnection?i[r]=t.getInputTargetBlock("DO"+r).previousConnection:i[r]=null,this.removeInput("DO"+r);this.elseifCount_=parseInt(e.getAttribute("elseif"),10),this.elseCount_=parseInt(e.getAttribute("else"),10);for(r=1;r<=this.elseifCount_;r++)this.appendValueInput("IF"+r).setCheck([Boolean,Number]).appendField(F.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO"+r).appendField("");this.elseCount_&&this.appendStatementInput("ELSE").appendField(F.Msg.MIXLY_PYTHON_FINALLY);for(r=n.length-2;r>0;r--)n[r]&&n[r].reconnect(this,"IF"+r);for(r=i.length-2;r>0;r--)i[r]&&i[r].reconnect(this,"DO"+r)},decompose:function(e){var t=e.newBlock("controls_try");t.initSvg();for(var n=t.getInput("STACK").connection,i=1;i<=this.elseifCount_;i++){var r=e.newBlock("controls_except");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}if(this.elseCount_){var s=e.newBlock("controls_finally");s.initSvg(),n.connect(s.previousConnection)}return t},compose:function(e){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var t=this.elseifCount_;t>0;t--)this.removeInput("IF"+t),this.removeInput("DO"+t);this.elseifCount_=0;for(var n=e.getInputTargetBlock("STACK"),i=[null],r=[null],s=null;n;){switch(n.type){case"controls_except":this.elseifCount_++,i.push(n.valueConnection_),r.push(n.statementConnection_);break;case"controls_finally":this.elseCount_++,s=n.statementConnection_;break;default:throw Error("Unknown block type: "+n.type)}n=n.nextConnection&&n.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(i,r,s)},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=1;t;){switch(t.type){case"controls_except":var i=this.getInput("IF"+n),r=this.getInput("DO"+n);t.valueConnection_=i&&i.connection.targetConnection,t.statementConnection_=r&&r.connection.targetConnection,n++;break;case"controls_finally":r=this.getInput("ELSE");t.statementConnection_=r&&r.connection.targetConnection;break;default:throw"Unknown block type."}t=t.nextConnection&&t.nextConnection.targetBlock()}},rebuildShape_:function(){var e=[null],t=[null],n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(var i=1;this.getInput("IF"+i);){var r=this.getInput("IF"+i),s=this.getInput("DO"+i);console.log(r.connection.targetConnection),e.push(r.connection.targetConnection),t.push(s.connection.targetConnection),i++}this.updateShape_(),this.reconnectChildBlocks_(e,t,n)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck([Number,Boolean]).appendField(F.Msg.MIXLY_PYTHON_EXCEPT),this.appendStatementInput("DO"+e).appendField("");this.elseCount_&&this.appendStatementInput("ELSE").appendField(F.Msg.MIXLY_PYTHON_FINALLY)},reconnectChildBlocks_:function(e,t,n){for(var i=1;i<=this.elseifCount_;i++)e[i]&&e[i].reconnect(this,"IF"+i),t[i]&&t[i].reconnect(this,"DO"+i);n&&n.reconnect(this,"ELSE")}},fe={init:function(){this.setColour(re);var e=new F.FieldDropdown(this.OPERATORS);this.appendDummyInput().appendField(e,"FLOW").appendField(F.Msg.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP),this.setPreviousStatement(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_FLOW_STATEMENTS_TOOLTIP);var t=this;this.setTooltip((function(){var e=t.getFieldValue("FLOW");return{BREAK:F.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK,CONTINUE:F.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}[e]}))},onchange:function(){if(this.workspace){var e=!1,t=this;do{if("controls_repeat"==t.type||"controls_for"==t.type||"controls_forEach"==t.type||"controls_repeat_ext"==t.type||"controls_whileUntil"==t.type||"do_while"==t.type){e=!0;break}t=t.getSurroundParent()}while(t);e?this.setWarningText(null):this.setWarningText(F.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING)}}},_e={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_WITH).appendField(new F.FieldTextInput("i"),"VAR"),this.appendValueInput("FROM").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.MIXLY_STEP),this.appendStatementInput("DO").appendField(F.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip((function(){return F.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",e.getFieldValue("VAR"))}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},me={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_WITH).appendField(new F.FieldTextInput("i"),"VAR"),this.appendValueInput("FROM").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.MIXLY_STEP),this.appendStatementInput("DO").appendField(F.Msg.MIXLY_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip((function(){return F.Msg.MIXLY_PYTHON_CONTROLS_FOR_RANGE_TOOLTIP.replace("%1",e.getFieldValue("VAR"))}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}};he.OPERATORS=[[F.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"WHILE"],[F.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"UNTIL"]],fe.OPERATORS=[[F.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK,"BREAK"],[F.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE,"CONTINUE"]];const be={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.CONTROLS_IF_IF_TITLE_IF),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.CONTROLS_IF_IF_TOOLTIP),this.contextMenu=!1}},ge={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.CONTROLS_IF_ELSEIF_TOOLTIP),this.contextMenu=!1}},Se={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.CONTROLS_IF_ELSE_TITLE_ELSE),this.setPreviousStatement(!0),this.setTooltip(F.Msg.CONTROLS_IF_ELSE_TOOLTIP),this.contextMenu=!1}},ke={init:function(){this.setColour(re),this.appendDummyInput().appendField("try"),this.appendStatementInput("STACK"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.contextMenu=!1}},ye={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_EXCEPT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.contextMenu=!1,this.setTooltip(F.Msg.MIXLY_MIXPY_CONTROL_EXCEPT_TOOLTIP)}},ve={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_FINALLY),this.setPreviousStatement(!0),this.contextMenu=!1,this.setTooltip(F.Msg.MIXLY_MIXPY_CONTROL_FINALLY_TOOLTIP)}},Te={init:function(){this.jsonInit({message0:F.Msg.CONTROLS_REPEAT_TITLE,args0:[{type:"input_value",name:"TIMES"}],previousStatement:null,nextStatement:null,colour:re,tooltip:F.Msg.CONTROLS_REPEAT_TOOLTIP,helpUrl:F.Msg.CONTROLS_REPEAT_HELPURL}),this.appendStatementInput("DO")}},Ee={init:function(){this.setColour(re),this.appendValueInput("BOOL").appendField("lambda"),this.appendStatementInput("DO").appendField(F.Msg.MIXLY_STAT),this.setOutput(!0)}},Ie={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_PASS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_PASS_TOOLTIP)}},we={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_CONTROLS_THREAD_START),this.appendValueInput("callback").appendField(F.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_PARAMS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_THREAD_TOOLTIP)}},xe={init:function(){this.appendDummyInput().appendField(F.Msg.CONTROLS_REPEAT_TITLE_REPEAT+F.Msg.MIXLY_DO),this.appendStatementInput("input_data").setCheck(null),this.appendValueInput("select_data").setCheck(null).appendField(F.Msg.CONTROLS_OPERATOR_UNTIL).appendField(new F.FieldDropdown([[F.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"true"],[F.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"false"]]),"type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(re),this.setTooltip("do-while loop"),this.setHelpUrl("")}},Ae={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_OP_GARBAGE_COLLECT),this.setPreviousStatement(!0),this.setNextStatement(!0)}},$e={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_GET_MEM_ALLOC),this.setOutput(!0)}},Oe={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_GET_MEM_FREE),this.setOutput(!0)}},Me={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_GET+F.Msg.MIXLY_DEVICE+"ID"),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.PROCEDURES_DEFRETURN_RETURN+F.Msg.MIXLY_GET_UNIQUE_IDEN)}},Ce={init:function(){this.setColour(re),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_RTC_TIMESTAMP),this.appendDummyInput().appendField(F.Msg.MIXLY_TIMESTAMP_TO_DATA),this.setInputsInline(!0),this.setOutput(!0,Number)}},Re={init:function(){this.setColour(re),this.appendDummyInput().appendField(F.Msg.MIXLY_GET_UNIQUE_IDEN),this.setOutput(!0)}},Ne=230;F.FieldTextInput.math_number_validator=function(e){return String(e)},F.FieldTextInput.math_number_validator_include_blank=function(e){if(""===e)return"";return/^-?(0X|0x|0O|0o|0B|0b)?[a-fA-F0-9]{1,}(\.[a-fA-F0-9]+)?$/.test(e)?String(e):null};const Le={init:function(){this.setColour(Ne),this.appendDummyInput().appendField(new F.FieldTextInput("0",F.FieldTextInput.math_number_validator),"NUM"),this.setOutput(!0,Number),this.setTooltip(F.Msg.MATH_NUMBER_TOOLTIP)}},De={init:function(){this.setColour(Ne);this.appendDummyInput("").appendField(F.Msg.MIXLY_PYTHON_MATH_CONSTANT).appendField(new F.FieldDropdown([["π","pi"],["e","e"]]),"CONSTANT"),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("CONSTANT");return{pi:F.Msg.MIXLY_PYTHON_MATH_CONSTANT_PI_TOOLTIP,e:F.Msg.MIXLY_PYTHON_MATH_CONSTANT_E_TOOLTIP}[t]}))}},Pe={init:function(){this.setColour(Ne);this.appendDummyInput("").appendField(F.Msg.MIXLY_PYTHON_MATH_CONSTANT).appendField(new F.FieldDropdown([["π","pi"],["e","e"]]),"CONSTANT"),this.setOutput(!0,Number);var e=this;this.setTooltip((function(){var t=e.getFieldValue("CONSTANT");return{pi:F.Msg.MIXLY_PYTHON_MATH_CONSTANT_PI_MP_TOOLTIP,e:F.Msg.MIXLY_PYTHON_MATH_CONSTANT_E_MP_TOOLTIP}[t]}))}},Fe={init:function(){this.setColour(Ne),this.setOutput(!0),this.appendValueInput("A"),this.appendValueInput("B").appendField(new F.FieldDropdown([["+","ADD"],["-","MINUS"],["×","MULTIPLY"],["÷","DIVIDE"],["%","QUYU"],["//","ZHENGCHU"],["**","POWER"]]),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{ADD:F.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:F.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:F.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:F.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,QUYU:F.Msg.MATH_MODULO_TOOLTIP,ZHENGCHU:F.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:F.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[t]}))}},Be={init:function(){this.setColour(Ne),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("A"),this.appendValueInput("B").appendField(new F.FieldDropdown([["+=","ADD"],["-=","MINUS"],["×=","MULTIPLY"],["÷=","DIVIDE"],["%=","QUYU"],["//=","ZHENGCHU"],["**=","POWER"]]),"OP"),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{ADD:F.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:F.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:F.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:F.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,QUYU:F.Msg.MATH_MODULO_TOOLTIP,ZHENGCHU:F.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:F.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[t]}))}},je={init:function(){this.setColour(Ne),this.setOutput(!0,Number),this.appendValueInput("A").setCheck(Number),this.appendValueInput("B").setCheck(Number).appendField(new F.FieldDropdown([["&","&"],["|","|"],[">>",">>"],["<<","<<"]]),"OP"),this.setInputsInline(!0),this.setTooltip("位运算")}},Ve={init:function(){this.setColour(Ne),this.setOutput(!0,Number),this.appendValueInput("NUM").setCheck(Number).appendField(new F.FieldDropdown([["sin","SIN"],["cos","COS"],["tan","TAN"],["asin","ASIN"],["acos","ACOS"],["atan","ATAN"],["-","-"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]),"OP");var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{SIN:F.Msg.MATH_TRIG_TOOLTIP_SIN,COS:F.Msg.MATH_TRIG_TOOLTIP_COS,TAN:F.Msg.MATH_TRIG_TOOLTIP_TAN,ASIN:F.Msg.MATH_TRIG_TOOLTIP_ASIN,ACOS:F.Msg.MATH_TRIG_TOOLTIP_ACOS,ATAN:F.Msg.MATH_TRIG_TOOLTIP_ATAN,LN:F.Msg.MATH_SINGLE_TOOLTIP_LN}[t]}))}},Ue={init:function(){var e=[[F.Msg.MATH_BIN,"bin"],[F.Msg.MATH_OCT,"oct"],[F.Msg.MATH_HEX,"hex"]];this.setColour(Ne),this.setOutput(!0,String),this.appendValueInput("NUM").setCheck(Number).appendField(new F.FieldDropdown(e),"OP");var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{bin:F.Msg.MATH_DEC_TOOLTIP_BIN,oct:F.Msg.MATH_DEC_TOOLTIP_OCT,hex:F.Msg.MATH_DEC_TOOLTIP_HEX}[e]}))}},Ye={init:function(){var e=[[F.Msg.LANG_MATH_TO_ROUND,"round"],[F.Msg.LANG_MATH_TO_CEIL,"ceil"],[F.Msg.LANG_MATH_TO_FLOOR,"floor"],[F.Msg.MATH_ABS,"fabs"],[F.Msg.MATH_SQRT,"sqrt"]];this.setColour(Ne),this.appendValueInput("A").setCheck(Number).appendField(new F.FieldDropdown(e),"OP"),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{sqrt:F.Msg.MATH_SINGLE_TOOLTIP_ROOT,fabs:F.Msg.MATH_SINGLE_TOOLTIP_ABS,sq:F.Msg.MATH_SINGLE_TOOLTIP_SQ,round:F.Msg.MATH_SINGLE_TOOLTIP_ROUND,ceil:F.Msg.MATH_SINGLE_TOOLTIP_CEIL,floor:F.Msg.MATH_SINGLE_TOOLTIP_FLOOR}[e]}))}},Ge={init:function(){var e=[[F.Msg.MIXLY_MAX,"max"],[F.Msg.MIXLY_MIN,"min"]];this.setColour(Ne),this.appendValueInput("A").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(new F.FieldDropdown(e),"OP").appendField("("),this.appendValueInput("B").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(","),this.appendDummyInput("").setAlign(F.inputs.Align.RIGHT).appendField(")"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{max:F.Msg.MIXLY_TOOLTIP_MATH_MAX,min:F.Msg.MIXLY_TOOLTIP_MATH_MIN}[e]}))}},Xe={init:function(){var e=[[F.Msg.MATH_TWO,"two"],[F.Msg.MATH_EIGHT,"eight"],[F.Msg.MATH_TEN,"ten"],[F.Msg.MATH_SIXTEEN,"sixteen"]];this.setColour(Ne),this.appendDummyInput("").appendField(F.Msg.MATH_BA),this.appendValueInput("NUM").appendField(new F.FieldDropdown(e),"OP").appendField(F.Msg.MATH_JinZhi).setCheck(Number),this.appendDummyInput("").appendField(F.Msg.MATH_ZHW).appendField(new F.FieldDropdown(e),"OP2").appendField(F.Msg.MATH_JinZhi),this.setFieldValue("ten","OP2"),this.setOutput(!0),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP"),n={two:F.Msg.MATH_Before_two,eight:F.Msg.MATH_Before_eight,ten:F.Msg.MATH_Before_ten,sixteen:F.Msg.MATH_Before_sixteen},i=t.getFieldValue("OP2"),r={two:F.Msg.MATH_Behind_two,eight:F.Msg.MATH_Behind_eight,ten:F.Msg.MATH_Behind_ten,sixteen:F.Msg.MATH_Behind_sixteen};return n[e]+r[i]}))}},He={init:function(){var e=[[F.Msg.LANG_MATH_INT,"int"],[F.Msg.LANG_MATH_FLOAT,"float"]];this.setColour(Ne),this.setOutput(!0,Number),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_RANDOM).appendField(new F.FieldDropdown(e),"TYPE"),this.appendValueInput("FROM").setCheck(Number).appendField(F.Msg.LANG_CONTROLS_FOR_INPUT_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.LANG_MATH_RANDOM_INT_INPUT_TO),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("TYPE"),n={int:F.Msg.LANG_MATH_INT,float:F.Msg.LANG_MATH_FLOAT_RANDOM};return F.Msg.MATH_RANDOM_INT_TOOLTIP+n[e]}))}},ze={init:function(){this.setColour(Ne),this.setOutput(!0,Number),this.appendValueInput("VALUE").setCheck(Number).appendField(F.Msg.LANG_MATH_CONSTRAIN_INPUT_CONSTRAIN),this.appendValueInput("LOW").setCheck(Number).appendField(F.Msg.LANG_MATH_CONSTRAIN_INPUT_LOW),this.appendValueInput("HIGH").setCheck(Number).appendField(F.Msg.LANG_MATH_CONSTRAIN_INPUT_HIGH),this.setInputsInline(!0),this.setTooltip(F.Msg.MATH_CONSTRAIN_TOOLTIP)}},qe={init:function(){this.setColour(Ne),this.appendValueInput("NUM",Number).appendField(F.Msg.MIXLY_MAP).setCheck(Number),this.appendValueInput("fromLow",Number).appendField(F.Msg.MIXLY_MAP_FROM).setCheck(Number),this.appendValueInput("fromHigh",Number).appendField(",").setCheck(Number),this.appendValueInput("toLow",Number).appendField(F.Msg.MIXLY_MAP_TO).setCheck(Number),this.appendValueInput("toHigh",Number).appendField(",").setCheck(Number),this.appendDummyInput("").appendField("]"),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_MATH_MAP)}},We={init:function(){this.setColour(Ne),this.appendDummyInput().appendField(new F.FieldTextInput("0",F.FieldTextInput.math_number_validator_include_blank),"NUM"),this.setOutput(!0),this.setTooltip(F.Msg.MATH_NUMBER_TOOLTIP)}},Ke={init:function(){this.setColour(Ne),this.appendValueInput("NUM").setCheck(Number).appendField(F.Msg.LANG_MATH_RANDOM_SEED),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_MATH_RANDOM_SEED)}},Je={init:function(){this.setColour(Ne),this.setOutput(!0,Number),this.appendValueInput("VALUE").setCheck(Number),this.appendValueInput("VAR").setCheck(Number).appendField(F.Msg.MATH_ROUND).appendField(F.Msg.TEXT_KEEP),this.appendDummyInput().appendField(F.Msg.TEXT_DECIMAL),this.setInputsInline(!0),this.setTooltip(F.Msg.MATH_ROUND_NEW_TOOLTIP)}},Qe={init:function(){var e=[[F.Msg.MIXLY_TO_INT,"int"],[F.Msg.MIXLY_TO_FLOAT,"float"],[F.Msg.MIXLY_TO_BITES,"b"],[F.Msg.LANG_MATH_BYTE+F.Msg.MIXLY_TO_INT,"bti"]];this.setColour(Ne),this.appendValueInput("VAR").appendField(new F.FieldDropdown(e),"TOWHAT"),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("TOWHAT");return{int:F.Msg.MIXLY_PYTHON_TOOLTIP_TOINT,float:F.Msg.MIXLY_PYTHON_TOOLTIP_TOFLOAT,b:F.Msg.MIXLY_TOOLTIP_TEXT_TOBYTE}[e]}))}},Ze={init:function(){var e=[[F.Msg.MIXLY_TO_INT,"int"],[F.Msg.MIXLY_TO_FLOAT,"float"]];this.setColour(Ne),this.appendValueInput("VAR").appendField(new F.FieldDropdown(e),"TOWHAT"),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("TOWHAT");return{int:F.Msg.MIXLY_TOOLTIP_TEXT_TOINT,float:F.Msg.MIXLY_TOOLTIP_TEXT_TOFLOAT}[e]}))}},et=qe,tt={init:function(){this.setColour(Ne),this.appendValueInput("VAR").appendField(F.Msg.LANG_MATH_BYTE+F.Msg.MIXLY_TO_HEX),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOHEX)}},nt={init:function(){this.setColour(Ne),this.itemCount_=1,this.setMutator(new F.icons.MutatorIcon(["lists_create_with_item"],this)),this.appendDummyInput("DUMMY").appendField(F.Msg.MIXLY_PRODUCT+F.Msg.MIXLY_GENERATE_CARTESIAN_PRODUCT),this.appendValueInput("REPEAT").appendField(F.Msg.MIXLY_EVERY_PER_ELEPER_ELEMENT),this.appendDummyInput().appendField(F.Msg.CONTROLS_REPEAT_TITLE_TIMES),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0),this.setTooltip(F.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP),this.updateShape_()},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput(`ADD${i}`).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput(`ADD${n}`);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else{let e=0;for(;this.getInput(`ADD${e}`);)this.removeInput(`ADD${e}`),e++}if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.MIXLY_EMPTY_REMINDER);else for(let e=0;e<this.itemCount_;e++)this.appendValueInput(`ADD${e}`),this.moveInputBefore(`ADD${e}`,"REPEAT")},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},it={init:function(){this.setColour(Ne),this.setOutput(!0),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_SET_RADIAN),this.appendDummyInput().appendField(F.Msg.MIXLY_TRANS_TO_ANGLE),this.setInputsInline(!0)}},rt={init:function(){this.setColour(Ne),this.setOutput(!0),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_SET_DEGREE),this.appendDummyInput().appendField(F.Msg.MIXLY_TRANS_TO_RADIAN),this.setInputsInline(!0)}},st=160,ot={init:function(){this.setColour(st),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new F.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(F.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new F.FieldImage(t,12,12,'"')}},at={init:function(){this.setColour(st),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new F.FieldMultilineInput("Hello\nMixly"),"VALUE").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(F.Msg.TEXT_LINES_TOOLTIP)},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new F.FieldImage(t,12,12,'"')}},lt={init:function(){this.setColour(st),this.appendDummyInput().appendField(F.Msg.MIXLY_TEXT_BYTES).appendField(this.newQuote_(!0)).appendField(new F.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,String),this.setTooltip(F.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(e){if(e==this.RTL)var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==";else t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC";return new F.FieldImage(t,12,12,'"')}};F.FieldTextInput.char_validator=function(e){if(e.length>1&&"\\"===e.charAt(0)){var t=e.charAt(1);if("0"===t||"b"===t||"f"===t||"n"===t||"r"===t||"t"===t||"\\"===t||"'"===t)return String(e).substring(0,2);if("x"===t&&"0"===e.charAt(2)&&"B"===e.charAt(3))return String(e).substring(0,4)}return String(e).substring(0,1)};const ut={init:function(){this.setColour(st),this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new F.FieldTextInput("",F.FieldTextInput.char_validator),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,Number),this.setTooltip(F.Msg.TEXT_CHAR_TOOLTIP)},newQuote_:function(e){if(1==e)var t="../../media/quote2.png";else t="../../media/quote3.png";return new F.FieldImage(t,7,12,'"')}},ct={init:function(){this.setColour(st),this.appendValueInput("A").setCheck([String,Number]),this.appendValueInput("B").setCheck([String,Number]).appendField(F.Msg.MIXLY_TEXT_JOIN),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TEXT_JOIN)}},pt={init:function(){this.setColour(st),this.appendValueInput("VAR").setCheck(Number).appendField(F.Msg.MIXLY_TOCHAR),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TEXT_TOCHAR)}},ht={init:function(){this.setColour(st),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.MIXLY_TOASCII),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TEXT_TOASCII)}},dt={init:function(){this.setColour(st),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TOSTRING),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOTEXT)}},ft={init:function(){this.setColour(st),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_LENGTH),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TEXT_LENGTH)}},_t={init:function(){this.WHERE_OPTIONS=[[F.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[F.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[F.Msg.TEXT_GET_INDEX_RANDOM+1+F.Msg.TEXT_CHARAT2,"RANDOM"]],this.setHelpUrl(F.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(st),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT").setCheck(Number),this.appendDummyInput().appendField(F.Msg.LISTS_GET_INDEX_GET,"MODE"),F.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(F.Msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE"),n=e.getFieldValue("WHERE"),i="";switch(t+" "+n){case"GET FROM_START":case"GET FROM_END":i=F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET RANDOM":i=F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":i=F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE RANDOM":i=F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM}return"FROM_START"!=n&&"FROM_END"!=n||(i+=" "+F.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",F.Msg.ONE_BASED_INDEXING?"#1":"#0")),i}));var t=this;this.setTooltip((function(){var e=t.getFieldValue("WHERE"),n={FROM_START:F.Msg.LISTS_GET_INDEX_FROM_START,FROM_END:F.Msg.LISTS_GET_INDEX_FROM_END,RANDOM:F.Msg.TEXT_GET_INDEX_RANDOM};return F.Msg.PROCEDURES_DEFRETURN_RETURN+F.Msg.MIXLY_MICROBIT_TYPE_STRING+n[e]+"n"+F.Msg.TEXT_CHARAT2}))},mutationToDom:function(){var e=document.createElement("mutation");e.setAttribute("statement",!this.outputConnection);var t=this.getInput("AT").type==F.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){var t="true"==e.getAttribute("statement");this.updateStatement_(t),e="false"!=e.getAttribute("at"),this.updateAt_(e)},updateStatement_:function(e){e!=!this.outputConnection&&(this.unplug(!0,!0),e?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck(Number),F.Msg.TEXT_CHARAT2&&this.appendDummyInput("ORDINAL").appendField(F.Msg.TEXT_CHARAT2)):this.appendDummyInput("AT");var t=new F.FieldDropdown(this.WHERE_OPTIONS,(function(t){var n="FROM_START"==t||"FROM_END"==t;if(n!=e){var i=this.sourceBlock_;return i.updateAt_(n),i.setFieldValue(t,"WHERE"),null}}));this.getInput("AT").appendField(t,"WHERE"),F.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},mt={init:function(){this.setHelpUrl(F.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(st),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT").setCheck(Number).appendField(F.Msg.LISTS_GET_INDEX_GET+" "+F.Msg.LISTS_GET_INDEX_FROM_START),this.appendDummyInput().appendField(F.Msg.TEXT_CHARAT2),this.setOutput(!0),this.setTooltip(F.Msg.PROCEDURES_DEFRETURN_RETURN+F.Msg.MIXLY_MICROBIT_TYPE_STRING+F.Msg.LISTS_GET_INDEX_FROM_START+"n"+F.Msg.TEXT_CHARAT2)}},bt={init:function(){this.setHelpUrl(F.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(st),this.appendValueInput("VAR").setCheck(String),this.appendDummyInput().appendField(F.Msg.TEXT_RANDOM_CHAR),this.setOutput(!0),this.setTooltip(F.Msg.TEXT_RANDOM_CHAR_TOOLTIP)}},gt={init:function(){this.WHERE_OPTIONS_1=[[F.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[F.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[F.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[F.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[F.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[F.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(F.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(st),this.appendValueInput("VAR").setCheck(String),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),this.setInputsInline(!0),this.setOutput(!0,"List"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(F.Msg._GET_TEXT_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==F.INPUT_VALUE;e.setAttribute("at1",t);var n=this.getInput("AT2").type==F.INPUT_VALUE;return e.setAttribute("at2",n),e},domToMutation:function(e){var t="true"==e.getAttribute("at1"),n="true"==e.getAttribute("at2");this.updateAt_(1,t),this.updateAt_(2,n)},updateAt_:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck(Number),F.Msg.TEXT_CHARAT2&&this.appendDummyInput("ORDINAL"+e).appendField(F.Msg.TEXT_CHARAT2)):this.appendDummyInput("AT"+e);var n=new F.FieldDropdown(this["WHERE_OPTIONS_"+e],(function(n){var i="FROM_START"==n||"FROM_END"==n;if(i!=t){var r=this.sourceBlock_;return r.updateAt_(e,i),r.setFieldValue(n,"WHERE"+e),null}}));this.getInput("AT"+e).appendField(n,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},St={init:function(){this.setHelpUrl(F.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(st),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("AT1").appendField(F.Msg.LISTS_GET_INDEX_GET+" "+F.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(F.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(F.Msg.TEXT_CHARAT2),this.setInputsInline(!0),this.setOutput(!0,["List",String]),this.setTooltip(F.Msg._GET_TEXT_SUBLIST_TOOLTIP)}},kt={init:function(){var e=[[F.Msg.MIXLY_EQUALS,"==="],[F.Msg.MIXLY_STARTSWITH,"startswith"],[F.Msg.MIXLY_ENDSWITH,"endswith"]];this.setColour(st),this.appendValueInput("STR1").setCheck(String),this.appendValueInput("STR2").appendField(new F.FieldDropdown(e),"DOWHAT").setCheck(String),this.setOutput(!0,[Boolean,Number]),this.setInputsInline(!0)}},yt={init:function(){this.setColour(st),this.appendValueInput("STR1").setCheck(String),this.appendValueInput("STR2").appendField(F.Msg.MIXLY_COMPARETO).setCheck(String),this.setOutput(!0,Number),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_COMPARETO_HELP)}},vt={init:function(){var e=[[F.Msg.TEXT_UPPER,"upper"],[F.Msg.TEXT_TITLE,"title"],[F.Msg.TEXT_CAPITALIZE,"capitalize"],[F.Msg.TEXT_SWAPCASE,"swapcase"],[F.Msg.TEXT_LOWER,"lower"]];this.setColour(st),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new F.FieldDropdown(e),"CAPITAL").setCheck(String),this.setOutput(!0,String);var t=this;this.setTooltip((function(){var e=t.getFieldValue("CAPITAL");return{upper:F.Msg.MIXLY_MIXPY_TEXT_UPPER_TOOLTIP,title:F.Msg.MIXLY_MIXPY_TEXT_TITLE_TOOLTIP,swapcase:F.Msg.MIXLY_MIXPY_TEXT_SWAPCASE_TOOLTIP,capitalize:F.Msg.MIXLY_MIXPY_TEXT_CAPITALIZE_TOOLTIP,lower:F.Msg.MIXLY_MIXPY_TEXT_LOWER_TOOLTIP}[e]}))}},Tt={init:function(){var e=[[F.Msg.TEXT_LJUST,"ljust"],[F.Msg.TEXT_CENTER,"center"],[F.Msg.TEXT_RJUST,"rjust"]];this.setColour(st),this.appendValueInput("VAR").appendField(new F.FieldDropdown(e),"CENTER").setCheck(String),this.appendValueInput("WID").appendField(F.Msg.MIXLY_WIDTH).setCheck(Number),this.appendValueInput("Symbol").appendField(F.Msg.MIXLY_RECT_Fill).setCheck(String),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_MIXPY_TEXT_CENTER_TOOLTIP)}},Et={init:function(){this.setColour(st),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).setCheck(String),this.appendValueInput("STR").appendField(F.Msg.MIXLY_MID+F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER).setCheck(String),this.appendDummyInput().appendField(F.Msg.MIXLY_LIST_INDEX),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_MIXPY_TEXT_FIND_TOOLTIP)}},It={init:function(){this.setColour(st),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_USE_STR).setCheck(String),this.appendValueInput("LIST").appendField(F.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_SEQ).setCheck("List","Tuple","Set","Dict"),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_GET_STR),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_PYTHON_TEXT_JOIN_SEQ_TOOLTIP)}},wt={init:function(){this.setColour(st),this.appendValueInput("VAR").setCheck(String),this.appendValueInput("STR1").appendField(F.Msg.MIXLY_MIXPY_REPLACE).setCheck(String),this.appendValueInput("STR2").appendField(F.Msg.LISTS_SET_INDEX_INPUT_TO).setCheck(String),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_MIXPY_TEXT_REPLACE_TOOLTIP)}},xt={init:function(){this.setColour(st),this.appendValueInput("VAR"),this.appendValueInput("VAL").appendField(F.Msg.LIST_SPLIT_AS),this.appendDummyInput("").appendField(F.Msg.LIST_SPLIT),this.setOutput(!0,"List"),this.setTooltip(F.Msg.MIXLY_MIXPY_TEXT_SPLIT_TOOLTIP),this.setInputsInline(!0)}},At={init:function(){var e=[[F.Msg.TEXT_TRIM_BOTH,"strip"],[F.Msg.TEXT_TRIM_LEFT,"lstrip"],[F.Msg.TEXT_TRIM_RIGHT,"rstrip"]];this.setColour(st),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(F.Msg.TEXT_STRIM),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"TOWHAT"),this.appendDummyInput("").appendField(F.Msg.TEXT_BLANK),this.setOutput(!0,String),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("TOWHAT");return{strip:F.Msg.TEXT_TRIM_BOTH_TOOLTIP,lstrip:F.Msg.TEXT_TRIM_LEFT_TOOLTIP,rstrip:F.Msg.TEXT_TRIM_RIGHT_TOOLTIP}[e]}))}},$t={init:function(){this.setColour(st),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROPYTHON_FORMAT),this.appendDummyInput("").appendField(new F.FieldTextInput("str"),"VAR"),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new F.icons.MutatorIcon(["text_create_with_item"],this)),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_MIXPY_TEXT_FORMAT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("text_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("text_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField();else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.PROCEDURES_BEFORE_PARAMS)}},getVars:function(){if(null!=this.getFieldValue("VAR"))return-1==this.getFieldValue("VAR").indexOf("'")&&-1==this.getFieldValue("VAR").indexOf('"')?[this.getFieldValue("VAR")]:[]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ot={init:function(){this.setColour(st),this.appendDummyInput().appendField(F.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.TUPLE_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Mt={init:function(){this.setColour(st),this.appendDummyInput().appendField(F.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Ct=St,Rt=yt,Nt=mt,Lt={init:function(){this.setColour(st),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROPYTHON_FORMAT),this.appendValueInput("VAR").setCheck(String),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new F.icons.MutatorIcon(["text_create_with_item"],this)),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_MIXPY_TEXT_FORMAT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("text_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("text_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField();else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.PROCEDURES_BEFORE_PARAMS)}}},Dt={init:function(){this.setColour(st);var e=[[F.Msg.MIXPY_TEXT_ENCODE,"encode"],[F.Msg.MIXPY_TEXT_DECODE,"decode"]];this.appendDummyInput().appendField(new F.FieldDropdown([["ASCII","ASCII"],["gb2312","gb2312"],["gbk","gbk"],["utf-8","utf-8"],["utf-16","utf-16"],["utf-32","utf-32"]]),"CODE").appendField(" "),this.appendValueInput("VAR").appendField(new F.FieldDropdown(e),"DIR").appendField(F.Msg.LANG_MATH_STRING),this.setOutput(!0,String),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXPY_TEXT_ENCODE_DECODE_TOOLTIP)}},Pt={init:function(){this.setColour(st),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.MIXLY_PYTHON_TEXT_EVAL),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_TEXT_EVAL_RESULT),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_TEXT_EVAL_TOOLTIP)}},Ft={init:function(){this.setColour(st),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.MIXLY_PYTHON_OS_SYSTEM),this.setInputsInline(!0),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_OS_SYSTEM_TOOLTIP)}},Bt=260,jt={init:function(){this.setHelpUrl(F.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(Bt),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+F.Msg.LISTS_GET_INDEX_FROM_START),this.appendDummyInput().appendField(F.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM)}},Vt={init:function(){this.setHelpUrl(F.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Bt),this.appendValueInput("LIST"),this.appendDummyInput(""),this.appendValueInput("AT1").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+F.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(F.Msg.TEXT_CHARAT_TAIL+" "+F.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(F.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0,"List"),this.setTooltip(F.Msg.PYTHON_LISTS_GET_SUBLIST_TOOLTIP)}},Ut={init:function(){this.appendValueInput("LIST").setCheck(null),this.appendValueInput("row").setCheck(null).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+F.Msg.DATAFRAME_RAW),this.appendValueInput("col").setCheck(null).appendField(F.Msg.DATAFRAME_COLUMN),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(Bt),this.setTooltip(""),this.setHelpUrl("")}},Yt={init:function(){this.appendValueInput("LIST").setCheck(null),this.appendValueInput("row_start").setCheck(null).appendField(F.Msg.MIXLY_GET+" "+F.Msg.DATAFRAME_RAW+" ["),this.appendValueInput("row_end").setCheck(null).appendField(","),this.appendValueInput("col_start").setCheck(null).appendField(") "+F.Msg.DATAFRAME_COLUMN+" ["),this.appendValueInput("col_end").setCheck(null).appendField(","),this.appendDummyInput().appendField(") "+F.Msg.DICTS_ADD_VALUE),this.setInputsInline(!0),this.setOutput(!0,"List"),this.setColour(Bt),this.setTooltip(""),this.setHelpUrl("")}},Gt={init:function(){this.setColour(Bt),this.appendDummyInput("").appendField(new F.FieldTextInput("mylist"),"VAR").appendField("[").appendField("]"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new F.icons.MutatorIcon(["lists_create_with_item"],this)),this.setTooltip(F.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Xt={init:function(){this.setColour(Bt),this.appendDummyInput("").appendField(new F.FieldTextInput("mylist"),"VAR").appendField(" = [").appendField(new F.FieldTextInput("0,0,0"),"TEXT").appendField("]"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_LISTS_CREATE_WITH_TEXT2)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Ht={init:function(){this.setColour(Bt),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_TYPE_LIST),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},zt={init:function(){this.setColour(Bt),this.appendDummyInput().appendField(F.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},qt={init:function(){this.setColour(Bt),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(F.Msg.MIXLY_MICROBIT_LIST_ASSIGN_AT),this.appendValueInput("TO").appendField(F.Msg.MIXLY_MICROBIT_JS_LIST_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.LANG_LISTS_SET_INDEX_TOOLTIP)}},Wt={init:function(){this.setColour(Bt),this.TYPE=[[F.Msg.MIXLY_blockpy_set_add,"append"],[F.Msg.MIXLY_MICROBIT_LIST_EXTEND,"extend"]],this.appendValueInput("LIST").setCheck("List"),this.appendValueInput("DATA").appendField(new F.FieldDropdown(this.TYPE),"OP").appendField(F.Msg.MIXLY_MICROBIT_LIST_A_ITEM),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROBIT_JS_LIST_TO_END),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{append:F.Msg.MIXLY_TOOLTIP_LIST_APPEND,extend:F.Msg.LISTS_EXTEND_TOOLTIP}[t]}))}},Kt={init:function(){this.setColour(Bt),this.appendValueInput("LIST"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+F.Msg.LISTS_GET_INDEX_RANDOM),this.setTooltip(F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM),this.setOutput(!0)}},Jt={init:function(){this.setColour(Bt),this.appendValueInput("LIST"),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+F.Msg.MIXLY_MICROBIT_RANDOM),this.appendDummyInput().appendField(F.Msg.LANG_LISTS_GET_INDEX2+F.Msg.LISTS_GET_RANDOM_SUBLIST),this.setTooltip(F.Msg.LISTS_GET_RANDOM_SUBLIST_TOOLTIP),this.setOutput(!0,"List")}},Qt={init:function(){this.setColour(Bt),this.appendValueInput("LIST"),this.appendValueInput("AT").setCheck(Number).appendField(F.Msg.MIXLY_MICROBIT_JS_LIST_INSERT_AT),this.appendValueInput("VALUE").appendField(F.Msg.MIXLY_MICROBIT_JS_LIST_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.LANG_LISTS_SET_INDEX_TOOLTIP),this.setTooltip(F.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT)}},Zt={init:function(){this.setColour(Bt),this.appendValueInput("VAR").setCheck("List"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_JS_LIST_REVERSE),this.setTooltip(F.Msg.LANG_LISTS_CLEAR_TOOLTIP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},en={init:function(){this.setColour(Bt),this.appendValueInput("VAR"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROPYTHON_CLEAR),this.setTooltip(F.Msg.LANG_LISTS_REVERSE_TOOLTIP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},tn={init:function(){this.setColour(Bt),this.TYPE=[[F.Msg.SERIES_INDEX,"del"],[F.Msg.MIXLY_MICROBIT_JS_I2C_VALUE,"remove"]],this.appendValueInput("LIST").setCheck("List"),this.appendValueInput("DATA").appendField(F.Msg.MIXLY_MIXPY_LISTS_REMOVE).appendField(new F.FieldDropdown(this.TYPE),"OP"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("OP");return{del:F.Msg.LISTS_SET_INDEX_TOOLTIP_DELETE,remove:F.Msg.MIXLY_TOOLTIP_LIST_REMOVE}[t]}))}},nn={init:function(){this.setColour(Bt),this.appendValueInput("LIST"),this.appendValueInput("VALUE").appendField(F.Msg.MIXLY_MICROBIT_LIST_POP),this.appendDummyInput().appendField(F.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM)}},rn={init:function(){var e=[[F.Msg.MIXLY_LIST_INDEX,"INDEX"],[F.Msg.MIXLY_LIST_COUNT,"COUNT"]];this.setColour(Bt),this.appendValueInput("VAR").setCheck("List"),this.appendValueInput("data").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(F.Msg.HTML_VALUE),this.appendDummyInput().appendField(F.Msg.MIXLY_DE).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{INDEX:F.Msg.MIXLY_TOOLTIP_LIST_FIND_INDEX,COUNT:F.Msg.MIXLY_TOOLTIP_LIST_FIND_COUNT}[e]}))}},sn={init:function(){var e=[[F.Msg.MIXLY_LIST_LEN,"LEN"],[F.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[F.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[F.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[F.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[F.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[F.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[F.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"]];this.setColour(Bt),this.setOutput(!0,Number),this.appendValueInput("data"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{LEN:F.Msg.LISTS_LENGTH_TOOLTIP,SUM:F.Msg.MATH_ONLIST_TOOLTIP_SUM,MAX:F.Msg.MATH_ONLIST_TOOLTIP_MAX,MIN:F.Msg.MATH_ONLIST_TOOLTIP_MIN,AVERAGE:F.Msg.MATH_ONLIST_TOOLTIP_AVERAGE,MEDIAN:F.Msg.MATH_ONLIST_TOOLTIP_MEDIAN,MODE:F.Msg.MATH_ONLIST_TOOLTIP_MODE,STD_DEV:F.Msg.MATH_ONLIST_TOOLTIP_STD_DEV}[e]}))}},on={init:function(){this.jsonInit({args0:[{type:"input_value",name:"LIST",check:"List"},{type:"field_dropdown",name:"TYPE",options:[[F.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[F.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[F.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[F.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[F.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]}],message0:F.Msg.LISTS_SORT_TITLE,inputsInline:!0,output:"List",colour:Bt,tooltip:F.Msg.LISTS_SORT_TOOLTIP,helpUrl:F.Msg.LISTS_SORT_HELPURL})}},an={init:function(){var e=[[F.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"],[F.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD,"array"]];this.setColour(Bt),this.appendValueInput("VAR").setCheck("List"),this.appendDummyInput("").appendField(F.Msg.A_TO_B).appendField(new F.FieldDropdown(e),"OP");var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{tuple:F.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_TUPLE,set:F.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_SET,array:F.Msg.MIXLY_TOOLTIP_CONVERT_LIST_TO_ARRAY}[e]})),this.setInputsInline(!0),this.setOutput(!0)}},ln={init:function(){this.setColour(Bt),this.appendDummyInput("").appendField("[").appendField(new F.FieldTextInput("0,0,0"),"CONTENT").appendField("]"),this.setInputsInline(!0),this.setOutput(!0)}},un={init:function(){this.setColour(Bt),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setMutator(new F.icons.MutatorIcon(["lists_create_with_item"],this)),this.setTooltip(F.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},cn={init:function(){var e=[[F.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[F.Msg.MIXLY_MICROBIT_TYPE_TUPLE,"tuple"],[F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"]];this.setColour(Bt),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(F.Msg.A_TO_B).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0)}},pn={init:function(){this.setColour(Bt),this.appendValueInput("TUP"),this.appendDummyInput("").appendField(F.Msg.OBJECT_DELETE),this.setPreviousStatement(!0),this.setNextStatement(!0)}},hn={init:function(){this.setColour(Bt),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TOLIST),this.setOutput(!0,"List"),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOLIST)}},dn=Gt,fn=Xt,_n=jt,mn=Vt,bn=qt,gn=Qt,Sn=tn,kn=hn,yn={init:function(){this.setColour(Bt),this.appendValueInput("VAR").appendField(F.Msg.blockpy_USE_LIST),this.appendDummyInput().appendField(F.Msg.MIXLY_TO_INDEX_SEQUENCE),this.setInputsInline(!0),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_TOTO_INDEX_SEQUENC_TOOLTIP)}},vn={init:function(){this.setColour(Bt),this.appendDummyInput().appendField(F.Msg.blockpy_USE_LIST),this.appendValueInput("LIST"),this.appendValueInput("VALUE").appendField(F.Msg.MIXLY_TO_INDEX_SEQUENCE).appendField(F.Msg.MIXLY_INDEX+F.Msg.MIXLY_STARTSWITH),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_TOTO_INDEX_SEQUENC_TOOLTIP)}},Tn={init:function(){this.setColour(Bt),this.appendValueInput("CON"),this.appendDummyInput().appendField(F.Msg.MIXLY_ESP32_MIXGO_MUSIC_SHOW_IN),this.appendValueInput("LIST"),this.appendDummyInput().appendField(F.Msg.MIXLY_MID),this.setInputsInline(!0),this.setOutput(!0)}},En=345,In={init:function(){this.setColour(En),this.appendDummyInput("").appendField(new F.FieldTextInput("mydict"),"VAR").appendField(new F.FieldLabel(F.Msg.DICTS_CREATE_WITH_INPUT_WITH),"TIP"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new F.icons.MutatorIcon(["dicts_create_with_item"],this)),this.setTooltip(F.Msg.DICTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("dicts_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("dicts_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var e=[],t=0;this.getInput("ADD"+t);t++)e.push(this.getFieldValue("KEY"+t)),this.removeInput("ADD"+t);if(0==this.itemCount_)this.getField("TIP").setValue(F.Msg.DICTS_CREATE_EMPTY_TITLE);else{this.getField("TIP").setValue(F.Msg.DICTS_CREATE_WITH_INPUT_WITH);for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setCheck(null).setAlign(F.inputs.Align.RIGHT).appendField(new F.FieldTextInput(e.length>t?e[t]:0==t?'"key"':'"key'+(t+1)+'"'),"KEY"+t).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},wn={init:function(){this.setColour(En),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_TYPE_DICT),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.DICTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},xn={init:function(){this.setColour(En),this.appendDummyInput().appendField(F.Msg.DICTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.DICTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},An={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.DICT_KEYS),this.setTooltip(F.Msg.DICTS_KEYS_TOOLTIP),this.setOutput(!0,"List")}},$n={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(F.Msg.DICTS_GET_IN),this.appendDummyInput("").appendField(F.Msg.DICTS_ADD_VALUE),this.setOutput(!0),this.setTooltip(F.Msg.DICTS_GET_TOOLTIP)}},On={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(F.Msg.DICTS_GET_IN),this.appendDummyInput("").appendField(F.Msg.DICTS_ADD_VALUE),this.appendValueInput("VAR").appendField(F.Msg.DICTS_DEFAULT_VALUE),this.setOutput(!0),this.setTooltip(F.Msg.DICTS_GET_DEFAULT_TOOLTIP)}},Mn={init:function(){this.setColour(En),this.appendValueInput("DICT"),this.appendValueInput("KEY").appendField(F.Msg.DICTS_ADD),this.appendDummyInput(),this.appendValueInput("VAR").appendField(F.Msg.DICTS_ADD_VALUE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.DICTS_ADD_OR_CHANGE_TOOLTIP)}},Cn={init:function(){this.setColour(En),this.appendValueInput("DICT"),this.appendValueInput("KEY").appendField(F.Msg.DICTS_DELETE_IN),this.appendDummyInput("").appendField(F.Msg.DICTS_DELETE_VALUE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.DICTS_DELETE_TOOLTIP)}},Rn={init:function(){this.setColour(En),this.appendValueInput("DICT2").setCheck("Dict").appendField(F.Msg.MAKE_DICT),this.appendValueInput("DICT").setCheck("Dict").appendField(F.Msg.DICT_UPDATE),this.appendDummyInput("").appendField(F.Msg.MIXLY_MID),this.setTooltip(F.Msg.DICTS_UPDATE_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Nn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.DICT_CLEAR),this.setTooltip(F.Msg.DICTS_CLEAR_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ln={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.DICT_ITEMS),this.setTooltip(F.Msg.DICTS_ITEMS_TOOLTIP),this.setOutput(!0,"List")}},Dn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.DICT_VALUES),this.setTooltip(F.Msg.DICTS_VALUES_TOOLTIP),this.setOutput(!0,"List")}},Pn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.MIXLY_LENGTH),this.setTooltip(F.Msg.DICT_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},Fn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.DICT_DELDICT),this.setTooltip(F.Msg.DICTS_DEL_TOOLTIP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Bn={init:function(){this.MODE=[[F.Msg.DICTS_ADD_OR_CHANGE,"INSERT"],[F.Msg.MIXLY_MICROBIT_JS_DELETE_VAR,"DELETE"]],this.setHelpUrl(F.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("AT2"),this.appendValueInput("KEY"),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE).appendField(F.Msg.DICTS_ADD_VALUE),this.updateAt_(!0),this.setInputsInline(!0),this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t="";switch(e.getFieldValue("WHERE")){case"INSERT":t=F.Msg.DICTS_ADD_TOOLTIP;break;case"DELETE":t=F.Msg.DICTS_DELETE_TOOLTIP}return t}))},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT2").type==F.INPUT_VALUE;return e.setAttribute("at2",t),e},domToMutation:function(e){var t="true"==e.getAttribute("at2");this.updateAt_(t)},updateAt_:function(e){this.removeInput("AT2"),this.removeInput("ORDINAL",!0),e?this.appendValueInput("AT2").setCheck(Number):this.appendDummyInput("AT2");var t=new F.FieldDropdown(this.MODE,(function(t){var n="INSERT"==t;if(n!=e){var i=this.sourceBlock_;return i.updateAt_(n),i.setFieldValue(t,"WHERE"),null}}));this.getInput("AT2").appendField(t,"WHERE")}},jn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.blockpy_DICT_POP),this.appendValueInput("KEY"),this.appendDummyInput("").appendField(F.Msg.DICTS_ADD_VALUE),this.setTooltip(F.Msg.DICT_POP_TOOLTIP),this.setInputsInline(!0),this.setOutput(!0)}},Vn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(F.Msg.DICTS_SET_DEFAULT),this.appendDummyInput("").appendField(F.Msg.DICTS_DEFAULT_VALUE),this.appendValueInput("VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.DICTS_SETDEFAULT_TOOLTIP)}},Un={init:function(){this.setColour(En),this.appendDummyInput("").appendField(new F.FieldLabel(F.Msg.MIXLY_MICROBIT_TYPE_DICT),"TIP").appendField(" "),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Dict"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setMutator(new F.icons.MutatorIcon(["dicts_create_with_item"],this)),this.setTooltip(F.Msg.DICTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("dicts_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("dicts_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("EMPTY")&&this.removeInput("EMPTY");for(var e=[],t=0;this.getInput("ADD"+t);t++)e.push(this.getFieldValue("KEY"+t)),this.removeInput("ADD"+t);if(0==this.itemCount_)this.getField("TIP").setValue(F.Msg.LOGIC_NULL+F.Msg.MIXLY_MICROBIT_TYPE_DICT);else{this.getField("TIP").setValue(F.Msg.MIXLY_MICROBIT_TYPE_DICT);for(t=0;t<this.itemCount_;t++)this.appendValueInput("ADD"+t).setCheck(null).setAlign(F.inputs.Align.RIGHT).appendField(new F.FieldTextInput(e.length>t?e[t]:0==t?'"key"':'"key'+(t+1)+'"'),"KEY"+t).appendField(":")}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Yn={init:function(){this.setColour(En),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TODICT),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TODICT)}},Gn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendDummyInput("").appendField(F.Msg.MIXLY_TO_JSON),this.setTooltip(F.Msg.MIXLY_TO_JSON_TOOLTIP),this.setOutput(!0)}},Xn={init:function(){this.setColour(En),this.appendValueInput("VAR"),this.appendDummyInput("").appendField(F.Msg.MIXLY_CONVERT_TO_JSON),this.setTooltip(F.Msg.MIXLY_CONVERT_TO_JSON_TOOLTIP),this.setOutput(!0)}},Hn={init:function(){this.setColour(En),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("VAR1").appendField("key1"),this.appendValueInput("VAR2").appendField("index"),this.appendValueInput("VAR3").appendField("key2"),this.appendValueInput("VAR4").appendField("key3"),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_CONVERT_TO_JSON_TOOLTIP),this.setOutput(!0)}},zn={init:function(){this.setColour(En),this.appendValueInput("DICT"),this.appendDummyInput("").appendField(F.Msg.MIXLY_TO_JSON),this.setTooltip(F.Msg.MIXLY_TO_JSON_TOOLTIP),this.setOutput(!0)}},qn=210,Wn={init:function(){var e=F.RTL?[["=","EQ"],["≠","NEQ"],[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setColour(qn),this.setOutput(!0,Boolean),this.appendValueInput("A"),this.appendValueInput("B").appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{EQ:F.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:F.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:F.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:F.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:F.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:F.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[e]})),this.prevBlocks_=[null,null]}},Kn={init:function(){var e=F.RTL?[[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]],t=F.RTL?[[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setColour(qn),this.setOutput(!0,Boolean),this.appendValueInput("A"),this.appendValueInput("B").appendField(new F.FieldDropdown(e),"OP1"),this.appendValueInput("C").appendField(new F.FieldDropdown(t),"OP2"),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_LOGIC_COMPARE_CONTINOUS_TOOLTIP)}},Jn={init:function(){var e=[[F.Msg.LOGIC_OPERATION_AND,"AND"],[F.Msg.LOGIC_OPERATION_OR,"OR"],[F.Msg.LOGIC_OPERATION_NOR,"NOR"],[F.Msg.LOGIC_OPERATION_XOR,"XOR"]];this.setColour(qn),this.setOutput(!0,Boolean),this.appendValueInput("A").setCheck([Boolean,Number]),this.appendValueInput("B").setCheck([Boolean,Number]).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{AND:F.Msg.LOGIC_OPERATION_TOOLTIP_AND,OR:F.Msg.LOGIC_OPERATION_TOOLTIP_OR,NOR:F.Msg.LOGIC_OPERATION_TOOLTIP_NOR,XOR:F.Msg.LOGIC_OPERATION_TOOLTIP_XOR}[e]}))}},Qn={init:function(){this.setColour(qn),this.setOutput(!0,Boolean),this.appendValueInput("BOOL").setCheck([Number,Boolean]).appendField(F.Msg.LOGIC_NEGATE_TITLE),this.setTooltip(F.Msg.LOGIC_NEGATE_TOOLTIP)}},Zn={init:function(){var e=[[F.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[F.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setColour(qn),this.setOutput(!0,Boolean),this.appendDummyInput().appendField(new F.FieldDropdown(e),"BOOL"),this.setTooltip(F.Msg.LOGIC_BOOLEAN_TOOLTIP)}},ei={init:function(){this.setColour(qn),this.setOutput(!0),this.appendDummyInput().appendField(F.Msg.LOGIC_NULL),this.setTooltip(F.Msg.LOGIC_NULL_TOOLTIP)}},ti={init:function(){this.setColour(qn),this.appendValueInput("A"),this.appendValueInput("B").appendField(F.Msg.LOGIC_TERNARY_IF_TRUE),this.appendValueInput("C").appendField(F.Msg.LOGIC_TERNARY_IF_FALSE),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_LOGIT_TRUEORFALSE)}},ni={init:function(){var e=[[F.Msg.TEXT_APPEND_TO,"in"],[F.Msg.MIXLY_PYTHON_LOGIC_IS_NOT_IN,"not in"]];this.setColour(qn),this.appendValueInput("A"),this.appendValueInput("B").setCheck([String,"List"]).appendField(new F.FieldDropdown(e),"BOOL"),this.appendDummyInput("").appendField(F.Msg.MICROBIT_LOGIC_IS_IN),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(F.Msg.IN)}},ii={init:function(){var e=[[F.Msg.MIXLY_PYTHON_LOGIC_IS,"is"],[F.Msg.MIXLY_PYTHON_LOGIC_IS_NOT,"is not"]];this.setColour(qn),this.appendValueInput("A"),this.appendValueInput("B").appendField(new F.FieldDropdown(e),"BOOL"),this.setOutput(!0,Boolean),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_LOGIC_IS_TOOLTIP)}},ri={init:function(){this.setColour(qn),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TOBOOL),this.setOutput(!0,Boolean),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOBOOL)}},si={init:function(){this.setColour(0),this.appendValueInput("fn").setCheck(String).appendField(F.Msg.MIXLY_PYTHON_STORAGE_OPEN_FILE_WITH_OS+"(For Windows)"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0)}},oi={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"],[F.Msg.MIXLY_ADD,"a"],[F.Msg.MATH_BIN+F.Msg.MIXLY_ADD,"ab"],[F.Msg.MIXLY_R_W,"r+"],[F.Msg.MATH_BIN+F.Msg.MIXLY_R_W,"rb+"],[F.Msg.MIXLY_W_R,"w+"],[F.Msg.MATH_BIN+F.Msg.MIXLY_W_R,"wb+"],[F.Msg.MIXLY_A_R,"a+"],[F.Msg.MATH_BIN+F.Msg.MIXLY_A_R,"ab+"]]),"MODE"),this.appendValueInput("FILE").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_AS),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE"),n=F.Msg.MIXLY_USE,i=F.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,r=F.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,s=F.Msg.MIXLY_BELONG;return n+{r:F.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:F.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[t]+s+i+r}))},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},ai={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE"),n=F.Msg.MIXLY_USE,i=F.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,r=F.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,s=F.Msg.MIXLY_BELONG,o=F.Msg.PY_STORAGE_FILE_OBJECT;return n+{r:F.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:F.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[t]+s+i+r+o}))}},li={init:function(){this.setColour(0),this.appendValueInput("FILENAME").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE);this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE).appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,"r"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,"w"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,"rb"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE,"wb"]]),"MODE"),this.appendDummyInput().appendField(F.Msg.MIXPY_TEXT_ENCODE).appendField(new F.FieldDropdown([["ANSI","ANSI"],["gbk","gbk"],["utf-8","utf-8"]]),"CODE"),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setOutput(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE"),n=F.Msg.MIXLY_USE,i=F.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE,r=F.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE,s=F.Msg.MIXLY_BELONG,o=F.Msg.PY_STORAGE_FILE_OBJECT;return n+{r:F.Msg.MIXLY_MICROBIT_PY_STORAGE_READ,w:F.Msg.MIXLY_MICROBIT_PY_STORAGE_WRITE,rb:F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_READ,wb:F.Msg.MIXLY_MICROBIT_PY_STORAGE_BIT_WRITE}[t]+s+i+r+o}))}},ui={init:function(){this.setColour(0),this.appendValueInput("data").setCheck(String).appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendValueInput("FILE").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_WRITE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE+F.Msg.MIXLY_MICROBIT_TYPE_STRING+F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_WRITE)}},ci={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL,"read"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE,"readline"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES,"readlines"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String)}},pi={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_NO_MORE_THAN_SIZE,"read"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE,"readline"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES_NO_MORE_THAN_SIZE,"readlines"]]),"MODE"),this.appendValueInput("SIZE").setCheck(Number),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE"),n=F.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE,i=F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER;return n+{read:F.Msg.MIXLY_MICROBIT_PY_STORAGE_NO_MORE_THAN_SIZE,readline:F.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE,readlines:F.Msg.MIXLY_MICROBIT_PY_STORAGE_ALL_LINES_NO_MORE_THAN_SIZE}[t]+"x"+i}))}},hi={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FROM_FILE),this.setNextStatement(!0),this.appendValueInput("SIZE").setCheck(Number).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_ONE_LINE_NO_MORE_THAN_SIZE),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String),this.setTooltip(F.Msg.MICROBIT_PYTHON_TYPE)}},di={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(F.Msg.HTML_FILE),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CAN_WRITE_ORNOT),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Boolean),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CAN_WRITE_ORNOT1)}},fi={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILENAME),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,String),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILENAME)}},_i={init:function(){this.setColour(0),this.appendValueInput("FILE").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE)}},mi={init:function(){this.setColour(0),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_LIST_ALL_FILES),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_LIST_ALL_FILES)}};F.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE;const bi={init:function(){this.setColour(0),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE,"remove"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_DIRS,"removedirs"]]),"MODE"),this.appendValueInput("FILE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE)}},gi={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE+F.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE)}},Si={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_RETURN_FILE),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_PRESENT_LOCATION),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_TELL)}},ki={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck("Variable").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_SET_FILE_POSITION),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CURRENT_POSITION),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_START,"start"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_CURRENT,"current"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_END,"end"]]),"MODE"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET),this.appendValueInput("SIZE").setCheck(Number),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE"),n=F.Msg.MIXLY_MICROBIT_PY_STORAGE_SET_FILE_POSITION+F.Msg.MIXLY_MICROBIT_PY_STORAGE_CURRENT_POSITION,i=F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHARACTER,r=F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET;return n+" "+{start:F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_START,current:F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_CURRENT,end:F.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_END}[t]+r+"x"+i}))}},yi={init:function(){this.setColour(0),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_CURRENT_DIR),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"List"),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_CURRENT_DIR)}},vi={init:function(){this.setColour(0),this.appendValueInput("PATH").setCheck(String).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_PATH),this.appendDummyInput().appendField(F.Msg.MIXLY_ESP32_SET),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,"mkdir"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_MAKEDIRS,"makedirs"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1);var e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE");return F.Msg.MIXLY_MICROBIT_PY_STORAGE_PATH+"x"+F.Msg.MIXLY_ESP32_SET+{mkdir:F.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,makedirs:F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKEDIRS}[t]}))}},Ti={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_RENAME),this.appendValueInput("NEWFILE").setCheck(String).appendField(F.Msg.MIXLY_AS),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_RENAME)}},Ei={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHANGE_DIR),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.MIXLY_MICROBIT_PY_STORAGE_CHANGE_DIR)}},Ii={init:function(){this.setColour(0),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_OR_NOT),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.HTML_FILE,"isfile"],[F.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_DIR,"isdir"]]),"MODE"),this.setInputsInline(!0),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,Boolean);let e=this;this.setTooltip((function(){var t=e.getFieldValue("MODE");return F.Msg.MIXLY_MICROBIT_PY_STORAGE_THE_PATH+"x"+F.Msg.MIXLY_MICROBIT_PY_STORAGE_IS_OR_NOT+{isfile:F.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR,isdir:F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKEDIRS}[t]}))}},wi={init:function(){this.setColour(0),this.appendValueInput("SPISUB").appendField(F.Msg.CONTROLS_FOR_INPUT_WITH+"SPI").setCheck("var"),this.appendValueInput("PINSUB").appendField("CS"),this.appendValueInput("SUB").appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE).setCheck("var"),this.appendDummyInput("").appendField(F.Msg.MIXLY_SETUP+F.Msg.LISTS_SET_INDEX_INPUT_TO).appendField(F.Msg.MIXLY_SD_CARD),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null)}},xi={init:function(){this.setColour(0),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_SD_CARD),this.appendValueInput("DIR").setCheck(String).appendField(F.Msg.MIXLY_SDCARD_MOUNT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip()}},Ai={init:function(){var e=F.Procedures.findLegalName("",this),t=new F.FieldTextInput(e,F.Procedures.rename);t.setSpellcheck(!1),this.appendDummyInput().appendField(t,"NAME").appendField("","PARAMS"),this.setMutator(new F.icons.MutatorIcon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&F.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(F.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(F.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(F.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(F.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){var e="";this.arguments_.length&&(e=F.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),F.Events.disable();try{this.setFieldValue(e,"PARAMS")}finally{F.Events.enable()}},mutationToDom:function(e){var t=F.utils.xml.createElement("mutation");e&&t.setAttribute("name",this.getFieldValue("NAME"));for(var n=0;n<this.argumentVarModels_.length;n++){var i=F.utils.xml.createElement("arg"),r=this.argumentVarModels_[n];i.setAttribute("name",r.name),i.setAttribute("varid",r.getId()),e&&this.paramIds_&&i.setAttribute("paramId",this.paramIds_[n]),t.appendChild(i)}return this.hasStatements_||t.setAttribute("statements","false"),t},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(var t,n=0;t=e.childNodes[n];n++)if("arg"==t.nodeName.toLowerCase()){var i=t.getAttribute("name"),r=t.getAttribute("varid")||t.getAttribute("varId");this.arguments_.push(i);var s=F.Variables.getOrCreateVariablePackage(this.workspace,r,i,"");null!=s?this.argumentVarModels_.push(s):console.log("Failed to create a variable with name "+i+", ignoring.")}this.updateParams_(),F.Procedures.mutateCallers(this),this.setStatements_("false"!==e.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;const e=Object.create(null);if(this.argumentVarModels_.length){e.params=[];for(let t=0;t<this.argumentVarModels_.length;t++)e.params.push({name:this.argumentVarModels_[t].name,id:this.argumentVarModels_[t].getId()})}return this.hasStatements_||(e.hasStatements=!1),e},loadExtraState:function(e){if(this.arguments_=[],this.argumentVarModels_=[],e.params)for(let t=0;t<e.params.length;t++){const n=e.params[t],i=F.Variables.getOrCreateVariablePackage(this.workspace,n.id,n.name,"");this.arguments_.push(i.name),this.argumentVarModels_.push(i)}this.updateParams_(),F.Procedures.mutateCallers(this),this.setStatements_(!1!==e.hasStatements)},decompose:function(e){var t=F.utils.xml.createElement("block");t.setAttribute("type","procedures_mutatorcontainer");var n=F.utils.xml.createElement("statement");n.setAttribute("name","STACK"),t.appendChild(n);for(var i=n,r=0;r<this.arguments_.length;r++){var s=F.utils.xml.createElement("block");s.setAttribute("type","procedures_mutatorarg");var o=F.utils.xml.createElement("field");o.setAttribute("name","NAME");var a=F.utils.xml.createTextNode(this.arguments_[r]);o.appendChild(a),s.appendChild(o);var l=F.utils.xml.createElement("next");s.appendChild(l),i.appendChild(s),i=l}var u=F.Xml.domToBlock(t,e);return"procedures_defreturn"==this.type?u.setFieldValue(this.hasStatements_,"STATEMENTS"):u.removeInput("STATEMENT_INPUT"),F.Procedures.mutateCallers(this),u},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];for(var t=e.getInputTargetBlock("STACK");t&&!t.isInsertionMarker();){var n=t.getFieldValue("NAME");this.arguments_.push(n);var i=this.workspace.getVariable(n,"");this.argumentVarModels_.push(i),this.paramIds_.push(t.id),t=t.nextConnection&&t.nextConnection.targetBlock()}this.updateParams_(),F.Procedures.mutateCallers(this);var r=e.getFieldValue("STATEMENTS");if(null!==r&&(r="TRUE"==r,this.hasStatements_!=r))if(r)this.setStatements_(!0),this.statementConnection_&&this.statementConnection_.reconnect(this,"STACK"),this.statementConnection_=null;else{var s=this.getInput("STACK").connection;if(this.statementConnection_=s.targetConnection,this.statementConnection_){var o=s.targetBlock();o.unplug(),o.bumpNeighbours()}this.setStatements_(!1)}},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(e,t){var n=this.workspace.getVariableById(e);if(""==n.type){for(var i=n.name,r=this.workspace.getVariableById(t),s=!1,o=0;o<this.argumentVarModels_.length;o++)this.argumentVarModels_[o].getId()==e&&(this.arguments_[o]=r.name,this.argumentVarModels_[o]=r,s=!0);s&&(this.displayRenamedVar_(i,r.name),F.Procedures.mutateCallers(this))}},updateVarName:function(e){for(var t=e.name,n=!1,i=0;i<this.argumentVarModels_.length;i++)if(this.argumentVarModels_[i].getId()==e.getId()){var r=this.arguments_[i];this.arguments_[i]=t,n=!0}n&&(this.displayRenamedVar_(r,t),F.Procedures.mutateCallers(this))},displayRenamedVar_:function(e,t){this.updateParams_();const n=this.getIcon(F.icons.MutatorIcon.TYPE);if(n&&n.bubbleIsVisible())for(var i,r=n.getWorkspace().getAllBlocks(!1),s=0;i=r[s];s++)"procedures_mutatorarg"==i.type&&F.Names.equals(e,i.getFieldValue("NAME"))&&i.setFieldValue(t,"NAME")},customContextMenu:function(e){if(!this.isInFlyout){var t={enabled:!0},n=this.getFieldValue("NAME");t.text=F.Msg.PROCEDURES_CREATE_DO.replace("%1",n);var i=F.utils.xml.createElement("mutation");i.setAttribute("name",n);for(var r=0;r<this.arguments_.length;r++){var s=F.utils.xml.createElement("arg");s.setAttribute("name",this.arguments_[r]),i.appendChild(s)}var o=F.utils.xml.createElement("block");if(o.setAttribute("type",this.callType_),o.appendChild(i),t.callback=F.ContextMenu.callbackFactory(this,o),e.push(t),!this.isCollapsed())for(r=0;r<this.argumentVarModels_.length;r++){var a={enabled:!0},l=this.argumentVarModels_[r];a.text=F.Msg.VARIABLES_SET_CREATE_GET.replace("%1",l.name);var u=F.Variables.generateVariableFieldDom(l),c=F.utils.xml.createElement("block");c.setAttribute("type","variables_get"),c.appendChild(u),a.callback=F.ContextMenu.callbackFactory(this,c),e.push(a)}}},callType_:"procedures_callnoreturn"},$i={init:function(){var e=F.Procedures.findLegalName("",this),t=new F.FieldTextInput(e,F.Procedures.rename);t.setSpellcheck(!1),this.appendDummyInput().appendField(t,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new F.icons.MutatorIcon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&F.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(F.Msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(F.Msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(F.Msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:Ai.setStatements_,updateParams_:Ai.updateParams_,mutationToDom:Ai.mutationToDom,domToMutation:Ai.domToMutation,decompose:Ai.decompose,compose:Ai.compose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:Ai.getVars,getVarModels:Ai.getVarModels,renameVarById:Ai.renameVarById,updateVarName:Ai.updateVarName,displayRenamedVar_:Ai.displayRenamedVar_,customContextMenu:Ai.customContextMenu,callType_:"procedures_callreturn"},Oi={init:function(){this.appendDummyInput().appendField(F.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(F.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new F.FieldCheckbox("TRUE"),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(F.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}},Mi={init:function(){var e=new F.FieldTextInput(F.Procedures.DEFAULT_ARG,this.validator_);e.oldShowEditorFn_=e.showEditor_;e.showEditor_=function(){this.createdVariables_=[],this.oldShowEditorFn_()},this.appendDummyInput().appendField(F.Msg.PROCEDURES_BEFORE_PARAMS).appendField(e,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(F.Msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1,e.onFinishEditing_=this.deleteIntermediateVars_,e.createdVariables_=[],e.onFinishEditing_("x")},validator_:function(e){var t=this.getSourceBlock(),n=t.workspace.getRootWorkspace();if(!(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;for(var i=(t.workspace.targetWorkspace||t.workspace).getAllBlocks(!1),r=e.toLowerCase(),s=0;s<i.length;s++)if(i[s].id!=this.getSourceBlock().id){var o=i[s].getFieldValue("NAME");if(o&&o.toLowerCase()==r)return null}if(t.isInFlyout)return e;var a=n.getVariable(e,"");return a&&a.name!=e&&n.renameVariableById(a.getId(),e),a||(a=n.createVariable(e,""))&&this.createdVariables_&&this.createdVariables_.push(a),e},deleteIntermediateVars_:function(e){var t=this.getSourceBlock().workspace.getRootWorkspace();if(t)for(var n=0;n<this.createdVariables_.length;n++){var i=this.createdVariables_[n];i.name!=e&&t.deleteVariableById(i.getId())}}},Ci={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(F.Msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,t){if(F.Names.equals(e,this.getProcedureCall())){this.setFieldValue(t,"NAME");var n=this.outputConnection?F.Msg.PROCEDURES_CALLRETURN_TOOLTIP:F.Msg.PROCEDURES_CALLNORETURN_TOOLTIP;this.setTooltip(n.replace("%1",t))}},setProcedureParameters_:function(e,t){const n=F.Procedures.getDefinition(this.getProcedureCall(),this.workspace),i=n&&n.getIcon(F.icons.MutatorIcon.TYPE),r=i&&i.bubbleIsVisible();if(r?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=null),e.join("\n")!==this.arguments_.join("\n")){if(t.length!==e.length)throw Error("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let e=0;e<this.arguments_.length;e++){const n=this.getInput("ARG"+e);if(n){const i=n?.connection?.targetConnection;this.quarkConnections_[this.quarkIds_[e]]=i,r&&i&&!t.includes(this.quarkIds_[e])&&(i.disconnect(),i.getSourceBlock().bumpNeighbours())}}this.arguments_=[].concat(e),this.argumentVarModels_=[];for(var s=0;s<this.arguments_.length;s++){var o=F.Variables.getOrCreateVariablePackage(this.workspace,null,this.arguments_[s],"");this.argumentVarModels_.push(o)}if(this.updateShape_(),this.quarkIds_=t,this.quarkIds_)for(let e=0;e<this.arguments_.length;e++){const t=this.quarkIds_[e];if(t in this.quarkConnections_){const n=this.quarkConnections_[t];n?.reconnect(this,"ARG"+e)||delete this.quarkConnections_[t]}}}else this.quarkIds_=t},updateShape_:function(){for(var e=0;e<this.arguments_.length;e++){var t=this.getField("ARGNAME"+e);if(t){F.Events.disable();try{t.setValue(this.arguments_[e])}finally{F.Events.enable()}}else{t=new F.FieldLabel(this.arguments_[e]),this.appendValueInput("ARG"+e).setAlign(F.inputs.Align.RIGHT).appendField(t,"ARGNAME"+e).init()}}for(;this.getInput("ARG"+e);)this.removeInput("ARG"+e),e++;var n=this.getInput("TOPROW");n&&(this.arguments_.length?this.getField("WITH")||(n.appendField(F.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),n.init()):this.getField("WITH")&&n.removeField("WITH"))},mutationToDom:function(){var e=F.utils.xml.createElement("mutation");e.setAttribute("name",this.getProcedureCall());for(var t=0;t<this.arguments_.length;t++){var n=F.utils.xml.createElement("arg");n.setAttribute("name",this.arguments_[t]),e.appendChild(n)}return e},domToMutation:function(e){var t=e.getAttribute("name");this.renameProcedure(this.getProcedureCall(),t);for(var n,i=[],r=[],s=0;n=e.childNodes[s];s++)"arg"==n.nodeName.toLowerCase()&&(i.push(n.getAttribute("name")),r.push(n.getAttribute("paramId")));this.setProcedureParameters_(i,r)},saveExtraState:function(){const e=Object.create(null);return e.name=this.getProcedureCall(),this.arguments_.length&&(e.params=this.arguments_),e},loadExtraState:function(e){this.renameProcedure(this.getProcedureCall(),e.name);const t=e.params;if(t){const e=[];e.length=t.length,e.fill(null),this.setProcedureParameters_(t,e)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(e){if(this.workspace&&!this.workspace.isFlyout&&e.recordUndo)if(e.type==F.Events.BLOCK_CREATE&&-1!=e.ids.indexOf(this.id)){var t=this.getProcedureCall();if((d=F.Procedures.getDefinition(t,this.workspace))&&d.type!=this.defType_&&(d=null),d){if(JSON.stringify(d.getVars())!=JSON.stringify(this.arguments_)){let e=d.arguments_,t=[];for(var n=0;n<this.arguments_.length;n++){var i=this.getInput("ARG"+n);if(i){var r=i.connection.targetConnection;r?t.push(r.sourceBlock_.id):t.push(null)}}this.setProcedureParameters_(e,t)}}else{F.Events.setGroup(e.group);var s=F.utils.xml.createElement("xml"),o=F.utils.xml.createElement("block");o.setAttribute("type",this.defType_);var a=this.getRelativeToSurfaceXY(),l=a.x+F.SNAP_RADIUS*(this.RTL?-1:1),u=a.y+2*F.SNAP_RADIUS;o.setAttribute("x",l),o.setAttribute("y",u);var c=this.mutationToDom();o.appendChild(c);var p=F.utils.xml.createElement("field");p.setAttribute("name","NAME");var h=this.getProcedureCall();h||(h=F.Procedures.findLegalName("",this),this.renameProcedure("",h)),p.appendChild(F.utils.xml.createTextNode(h)),o.appendChild(p),s.appendChild(o),F.Xml.domToWorkspace(s,this.workspace),F.Events.setGroup(!1)}}else if(e.type==F.Events.BLOCK_DELETE){t=this.getProcedureCall();(d=F.Procedures.getDefinition(t,this.workspace))||(F.Events.setGroup(e.group),this.dispose(!0),F.Events.setGroup(!1))}else if(e.type==F.Events.CHANGE&&"disabled"==e.element){var d;t=this.getProcedureCall();if((d=F.Procedures.getDefinition(t,this.workspace))&&d.id==e.blockId){var f=F.Events.getGroup();f&&console.log("Saw an existing group while responding to a definition change"),F.Events.setGroup(e.group),e.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),F.Events.setGroup(f)}}},customContextMenu:function(e){if(this.workspace.isMovable()){var t={enabled:!0};t.text=F.Msg.PROCEDURES_HIGHLIGHT_DEF;var n=this.getProcedureCall(),i=this.workspace;t.callback=function(){var e=F.Procedures.getDefinition(n,i);e&&(i.centerOnBlock(e.id),e.select())},e.push(t)}},defType_:"procedures_defnoreturn"},Ri={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(F.Msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:Ci.getProcedureCall,renameProcedure:Ci.renameProcedure,setProcedureParameters_:Ci.setProcedureParameters_,updateShape_:Ci.updateShape_,mutationToDom:Ci.mutationToDom,domToMutation:Ci.domToMutation,getVars:Ci.getVars,getVarModels:Ci.getVarModels,onchange:Ci.onchange,customContextMenu:Ci.customContextMenu,defType_:"procedures_defreturn"},Ni={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(F.Msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(F.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(F.Msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){var e=F.utils.xml.createElement("mutation");return e.setAttribute("value",Number(this.hasReturnValue_)),e},domToMutation:function(e){var t=e.getAttribute("value");this.hasReturnValue_=1==t,this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.workspace.isDragging&&!this.workspace.isDragging()){var e=!1,t=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(t.type)){e=!0;break}t=t.getSurroundParent()}while(t);e?("procedures_defnoreturn"==t.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=t.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(F.Msg.PROCEDURES_IFRETURN_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},Li={init:function(){this.setStyle("procedure_blocks"),this.appendValueInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.hasReturnValue_=!0},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("value",Number(this.hasReturnValue_)),e},domToMutation:function(e){var t=e.getAttribute("value");this.hasReturnValue_=1==t,this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){var e=!1,t=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(t.type)){e=!0;break}t=t.getSurroundParent()}while(t);e?("procedures_defnoreturn"==t.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=t.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(F.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(F.Msg.PROCEDURES_IFRETURN_WARNING)},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn","method_procedures_defnoreturn","method_procedures_defreturn"]},Di=195,Pi={init:function(){this.setColour(Di),this.appendDummyInput("").appendField(new F.FieldTextInput("mytup"),"VAR"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new F.icons.MutatorIcon(["tuple_create_with_item"],this)),this.setTooltip(F.Msg.TUPLE_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("tuple_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("tuple_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.TUPLE_CREATE_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.TUPLE_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Fi={init:function(){this.setColour(Di),this.appendDummyInput().appendField(F.Msg.TUPLE_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.TUPLE_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Bi={init:function(){this.setColour(Di),this.appendDummyInput().appendField(F.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},ji={init:function(){this.setColour(Di),this.appendDummyInput("").appendField(new F.FieldTextInput("mytup"),"VAR").appendField(" = (").appendField(new F.FieldTextInput("0,0,0"),"TEXT").appendField(")"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Vi={init:function(){this.setColour(Di),this.appendDummyInput("").appendField("(").appendField(new F.FieldTextInput("0,0,0"),"TEXT").appendField(")"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)}},Ui={init:function(){this.setColour(Di),this.setOutput(!0),this.appendValueInput("TUP").setCheck("Tuple"),this.appendValueInput("AT").setCheck(Number).appendField(F.Msg.LANG_LISTS_GET_INDEX1),this.appendDummyInput("").appendField(F.Msg.LANG_LISTS_GET_INDEX2),this.setInputsInline(!0),this.setTooltip(F.Msg.TUPLE_GET_INDEX_TOOLTIP)}},Yi={init:function(){this.setColour(Di),this.appendValueInput("TUP"),this.appendDummyInput("").appendField(F.Msg.MIXLY_LENGTH),this.setTooltip(F.Msg.TUPLE_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},Gi={init:function(){this.setColour(Di),this.appendValueInput("TUP").setCheck("Tuple"),this.appendDummyInput("").appendField(F.Msg.TUPLE_DEL),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TUPLE_DEL_TOOLTIP)}},Xi={init:function(){this.setColour(Di),this.appendValueInput("TUP1").setCheck("Tuple"),this.appendDummyInput("").appendField(F.Msg.TUPLE_JOIN),this.appendValueInput("TUP2").setCheck("Tuple"),this.setInputsInline(!0),this.setTooltip(F.Msg.TUPLE_JOIN_TOOLTIP),this.setOutput(!0,"Tuple")}},Hi={init:function(){this.appendValueInput("TUP").setCheck("Tuple");var e=[[F.Msg.blockpy_TUPLE_MAX,"max"],[F.Msg.blockpy_TUPLE_MIN,"min"],[F.Msg.MATH_ONLIST_OPERATOR_SUM,"sum"]];this.setColour(Di),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROBIT_JS_GET).appendField(new F.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{max:F.Msg.MIXLY_TOOLTIP_TUPLE_MAX,min:F.Msg.MIXLY_TOOLTIP_TUPLE_MIN,sum:F.Msg.MIXLY_TOOLTIP_TUPLE_SUM}[e]}))}},zi={init:function(){var e=[[F.Msg.MIXLY_MICROBIT_TYPE_LIST,"list"],[F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD,"set"]];this.setColour(Di),this.appendValueInput("VAR").setCheck("Tuple"),this.appendDummyInput("").appendField(F.Msg.A_TO_B).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{list:F.Msg.TUPLE_TO_LISTS,set:F.Msg.TUPLE_TO_SET}[e]}))}},qi={init:function(){var e=[[F.Msg.MIXLY_LIST_INDEX,"INDEX"],[F.Msg.MIXLY_LIST_COUNT,"COUNT"]];this.setColour(Di),this.appendValueInput("VAR").setCheck("List"),this.appendValueInput("data").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(F.Msg.HTML_VALUE),this.appendDummyInput().appendField(F.Msg.MIXLY_DE).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0),this.setOutput(!0,Number);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{INDEX:F.Msg.MIXLY_TOOLTIP_TUPLE_FIND_INDEX,COUNT:F.Msg.MIXLY_TOOLTIP_TUPLE_FIND_COUNT}[e]}))}},Wi={init:function(){var e=[[F.Msg.MIXLY_LIST_LEN,"LEN"],[F.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[F.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[F.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[F.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[F.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[F.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[F.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"]];this.setColour(Di),this.setOutput(!0,Number),this.appendValueInput("data").setCheck("List"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new F.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OP");return{LEN:F.Msg.TUPLE_LENGTH_TOOLTIP,SUM:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_SUM,MAX:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MAX,MIN:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MIN,AVERAGE:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_AVERAGE,MEDIAN:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MEDIAN,MODE:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_MODE,STD_DEV:F.Msg.MATH_ONLIST_TOOLTIP_TUPLE_STD_DEV}[e]}))}},Ki={init:function(){this.WHERE_OPTIONS_1=[[F.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[F.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[F.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[F.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[F.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[F.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(F.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Di),this.appendValueInput("LIST").setCheck("List"),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),this.setInputsInline(!0),this.setOutput(!0,"List"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(F.Msg.PYTHON_TUPLE_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==F.INPUT_VALUE;e.setAttribute("at1",t);var n=this.getInput("AT2").type==F.INPUT_VALUE;return e.setAttribute("at2",n),e},domToMutation:function(e){var t="true"==e.getAttribute("at1"),n="true"==e.getAttribute("at2");this.updateAt_(1,t),this.updateAt_(2,n)},updateAt_:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck(Number),F.Msg.TEXT_CHARAT_TAIL&&this.appendDummyInput("ORDINAL"+e).appendField(F.Msg.TEXT_CHARAT_TAIL)):this.appendDummyInput("AT"+e);var n=new F.FieldDropdown(this["WHERE_OPTIONS_"+e],(function(n){var i="FROM_START"==n||"FROM_END"==n;if(i!=t){var r=this.sourceBlock_;return r.updateAt_(e,i),r.setFieldValue(n,"WHERE"+e),null}}));this.getInput("AT"+e).appendField(n,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},Ji={init:function(){this.setColour(Di),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0,"Tuple"),this.setMutator(new F.icons.MutatorIcon(["tuple_create_with_item"],this)),this.setTooltip(F.Msg.TUPLE_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("tuple_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("tuple_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.TUPLE_CREATE_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.TUPLE_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Qi={init:function(){this.setHelpUrl(F.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(Di),this.appendValueInput("LIST"),this.appendDummyInput(""),this.appendValueInput("AT1").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+F.Msg.LISTS_GET_INDEX_FROM_START),this.appendValueInput("AT2").appendField(F.Msg.TEXT_CHARAT_TAIL+" "+F.Msg.LISTS_GET_SUBLIST_END_FROM_START),this.appendDummyInput().appendField(F.Msg.TEXT_CHARAT_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Tuple"),this.setTooltip(F.Msg.PYTHON_TUPLE_GET_SUBLIST_TOOLTIP)}},Zi={init:function(){this.setColour(Di),this.appendValueInput("TUP"),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+" "+F.Msg.LISTS_GET_INDEX_RANDOM),this.setTooltip(F.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM),this.setOutput(!0)}},er={init:function(){this.setColour(Di),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TOTUPLE),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOTUPLE)}};const tr={init:function(){var e;this.setColour(Di),this.appendDummyInput("").appendField("(").appendField(new F.FieldTextInput((e=new Date,e.getFullYear()+","+(e.getMonth()+1)+","+e.getDate()+","+e.getHours()+","+e.getMinutes()+","+e.getSeconds())),"CONTENT").appendField(")"),this.setOutput(!0)}},nr={init:function(){this.setColour(Di),this.appendValueInput("params").appendField("(").appendField(F.Msg.MIXLY_NAME_OF_PARAMS),this.appendDummyInput().appendField(",").appendField(F.Msg.MIXLY_TYPE).appendField(new F.FieldDropdown([[F.Msg.MIXLY_TYPE_BOOLEAN,"boolean"],[F.Msg.MIXLY_TYPE_STRING,"string"],[F.Msg.MIXLY_TYPE_NUMBER,"number"],[F.Msg.MIXLY_TYPE_INTEGER,"integer"],[F.Msg.MIXLY_TYPE_NULL,"null"]]),"type"),this.appendValueInput("des").appendField(",").appendField(F.Msg.MIXLY_DESCRIPTION),this.appendDummyInput().appendField(")"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXPY_TOOLTIP_TUPLE_CREATE_WITH_TEXT)}},ir=100,rr={init:function(){this.setColour(ir),this.appendDummyInput("").appendField(new F.FieldTextInput("s1"),"VAR"),this.itemCount_=3,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new F.icons.MutatorIcon(["set_create_with_item"],this)),this.setTooltip(F.Msg.blockpy_SET_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("set_create_with_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("set_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.blockpy_SET_CREATE_EMPTY_TITLE);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.blockpy_SET_CREATE_WITH_INPUT_WITH)}},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},sr={init:function(){this.setColour(ir),this.appendDummyInput().appendField(F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},or={init:function(){this.setColour(ir),this.appendDummyInput().appendField(F.Msg.blockpy_SET_VARIABLES_NAME),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.blockpy_SET_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},ar={init:function(){this.setColour(ir),this.appendValueInput("SET"),this.appendDummyInput("").appendField(F.Msg.MIXLY_LENGTH),this.setInputsInline(!0),this.setTooltip(F.Msg.SET_LENGTH_TOOLTIP),this.setOutput(!0,Number)}},lr={init:function(){this.setColour(ir),this.appendValueInput("SET").setCheck("Set"),this.appendDummyInput("").appendField(F.Msg.blockpy_SET_GET_AND_REMOVE_LAST),this.setTooltip(F.Msg.SET_POP_TOOLTIP),this.setInputsInline(!0),this.setOutput(!0)}},ur={init:function(){this.setColour(ir),this.appendValueInput("SET").setCheck("Set"),this.appendDummyInput("").appendField(F.Msg.SET_CLEAR),this.setPreviousStatement(!0),this.setNextStatement(!0)}},cr={init:function(){this.appendValueInput("SET1").setCheck("Set");var e=[[F.Msg.blockpy_set_union,"union"],[F.Msg.blockpy_set_intersection,"intersection"],[F.Msg.blockpy_set_difference,"difference"]];this.setColour(ir),this.appendDummyInput("").appendField(F.Msg.blockpy_and_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(F.Msg.blockpy_set_get_operate).appendField(new F.FieldDropdown(e),"OPERATE"),this.setInputsInline(!0),this.setOutput(!0,"set");var t=this;this.setTooltip((function(){var e=t.getFieldValue("OPERATE");return{union:F.Msg.MIXLY_TOOLTIP_SET_UNION,intersection:F.Msg.MIXLY_TOOLTIP_SET_INTERSECTION,difference:F.Msg.MIXLY_TOOLTIP_SET_DIFFERENCE}[e]}))}},pr={init:function(){this.appendValueInput("SET1").setCheck("Set");var e=[[F.Msg.blockpy_set_union,"update"],[F.Msg.blockpy_set_intersection,"intersection_update"],[F.Msg.blockpy_set_difference,"difference_update"]];this.setColour(ir),this.appendDummyInput("").appendField(F.Msg.blockpy_and_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(F.Msg.blockpy_set_get_operate).appendField(new F.FieldDropdown(e),"OPERATE"),this.appendDummyInput("").appendField(F.Msg.blockpy_set_update),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OPERATE");return{update:F.Msg.MIXLY_TOOLTIP_SET_UPDATE,intersection_update:F.Msg.MIXLY_TOOLTIP_SET_INTERSECTION_UPDATE,difference_update:F.Msg.MIXLY_TOOLTIP_SET_DIFFERENCE_UPDATE}[e]}))}},hr={init:function(){this.appendValueInput("SET").setCheck("Set");var e=[[F.Msg.MIXLY_blockpy_set_add,"add"],[F.Msg.MIXLY_blockpy_set_discard,"discard"]];this.setColour(ir),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"OPERATE"),this.appendValueInput("data").appendField(F.Msg.blockpy_SET_VARIABLES_NAME),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OPERATE");return{add:F.Msg.SET_ADD_TOOLTIP,discard:F.Msg.SET_DISCARD_TOOLTIP}[e]}))}},dr={init:function(){this.appendValueInput("SET1").setCheck("Set");var e=[[F.Msg.blockpy_set_sub,"issubset"],[F.Msg.blockpy_set_super,"issuperset"]];this.setColour(ir),this.appendDummyInput("").appendField(F.Msg.blockpy_is_set),this.appendValueInput("SET2").setCheck("Set"),this.appendDummyInput("").appendField(F.Msg.blockpy_set_of).appendField(new F.FieldDropdown(e),"OPERATE"),this.setInputsInline(!0),this.setOutput(!0,Boolean);var t=this;this.setTooltip((function(){var e=t.getFieldValue("OPERATE");return{issubset:F.Msg.MIXLY_TOOLTIP_SET_SUB,issuperset:F.Msg.MIXLY_TOOLTIP_SET_SUPER}[e]}))}},fr={init:function(){this.appendValueInput("SET").setCheck("Set"),this.setColour(ir),this.appendValueInput("VAR").setCheck([String,"List"]).appendField(F.Msg.blockpy_set_add_update),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.SET_UPDATE_TOOLTIP)}},_r={init:function(){this.setColour(ir),this.appendDummyInput("").appendField("{").appendField(new F.FieldTextInput("0,0,0"),"TEXT").appendField("}"),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXPY_TOOLTIP_SET_CREATE_WITH_TEXT)}},mr={init:function(){this.setColour(ir),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TOSET),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOSET)}},br="#1ec1e4",gr={init:function(){this.setColour(br),this.appendDummyInput().appendField(F.Msg.HTML_DOCUMENT),this.appendStatementInput("HEAD").appendField(F.Msg.HTML_HEAD),this.appendStatementInput("BODY").appendField(F.Msg.HTML_BODY),this.setOutput(!0)}},Sr={init:function(){this.setColour(br),this.appendDummyInput().appendField(F.Msg.HTML_LEVEL).appendField(new F.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0)}},kr={init:function(){this.setColour(br),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.HTML_HEAD,"head"],[F.Msg.HTML_BODY,"body"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setPreviousStatement(!0),this.setNextStatement(!0)}},yr={init:function(){this.setColour(br),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.HTML_P,"p"],[F.Msg.HTML_SPAN,"span"],[F.Msg.HTML_FORM,"form"],[F.Msg.HTML_TABLE,"table"],[F.Msg.HTML_LINE,"tr"],[F.Msg.HTML_CELL,"td"],[F.Msg.HTML_OL,"ol"],[F.Msg.HTML_UL,"ul"],[F.Msg.HTML_LI,"li"]]),"LEVEL"),this.appendStatementInput("DO").appendField(""),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)}},vr={init:function(){this.setColour(br),this.appendDummyInput().appendField("<").appendField(new F.FieldTextInput("tag"),"LEVEL").appendField(">"),this.appendValueInput("style").appendField(F.Msg.MIXLY_AIP_ATTR).setAlign(F.inputs.Align.RIGHT),this.appendStatementInput("DO").appendField(""),this.setInputsInline(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Tr={init:function(){this.setColour(br),this.appendDummyInput().appendField(F.Msg.HTML_STYLE),this.appendStatementInput("STYLE"),this.setOutput(!0)}},Er={init:function(){this.setColour(br),this.appendDummyInput().appendField(F.Msg.HTML_FORM_CONTENT).appendField(new F.FieldDropdown([[F.Msg.HTML_TEXT,"text"],[F.Msg.HTML_EMAIL,"email"],[F.Msg.HTML_NUMBER,"number"],[F.Msg.HTML_PASSWORD,"password"],[F.Msg.HTML_CHECKBOX,"checkbox"],[F.Msg.HTML_RADIOBUTTON,"radiobutton"],[F.Msg.HTML_BUTTON,"button"],[F.Msg.HTML_COLOUR,"colour"],[F.Msg.HTML_DATE,"date"],[F.Msg.HTML_LOCALTIME,"local time"],[F.Msg.HTML_FILE,"file"],[F.Msg.HTML_HIDDEN,"hidden"],[F.Msg.HTML_IMAGE,"image"],[F.Msg.HTML_MONTH,"month"],[F.Msg.HTML_RANGE,"range"],[F.Msg.HTML_RESET,"reset"],[F.Msg.HTML_SEARCH,"search"],[F.Msg.HTML_SUBMIT,"submit"],[F.Msg.HTML_TELEPHONENUMBER,"telephone number"],[F.Msg.HTML_TIME,"time"],[F.Msg.HTML_URL,"url"],[F.Msg.HTML_WEEK,"week"]]),"LEVEL"),this.appendDummyInput().appendField(F.Msg.HTML_NAME).appendField(new F.FieldTextInput("car"),"NAME"),this.appendDummyInput().appendField(F.Msg.HTML_VALUE).appendField(new F.FieldTextInput("go"),"VALUE"),this.appendValueInput("style").appendField(F.Msg.MIXLY_AIP_ATTR).setAlign(F.inputs.Align.RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ir={init:function(){this.setColour(br),this.appendDummyInput().appendField(new F.FieldTextInput("property"),"KEY").appendField(":").appendField(new F.FieldTextInput("value"),"VALUE"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},wr={init:function(){this.setColour(br),this.appendDummyInput().appendField(new F.FieldTextInput("property"),"KEY").appendField(":").appendField(new F.FieldColour("#ff0000"),"RGB_LED_COLOR"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},xr={init:function(){this.setColour(br),this.appendDummyInput().appendField(F.Msg.HTML_TEXT).appendField(new F.FieldTextInput("text"),"TEXT"),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ar=160,$r={init:function(){this.setColour(Ar),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendDummyInput().appendField("Tabular Abstraction:"),this.appendDummyInput().appendField(new F.FieldTable(""),"TEXT")}},Or={init:function(){this.setColour(Ar),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendDummyInput().appendField("Code Block:"),this.appendDummyInput().appendField(new F.FieldMultilineInput(""),"TEXT")}},Mr={init:function(){this.setColour(Ar),this.appendDummyInput().appendField("Code Expression:"),this.appendDummyInput().appendField(new F.FieldMultilineInput(""),"TEXT"),this.setOutput(!0)}},Cr={init:function(){this.setColour(Ar),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("VALUE").appendField(""),this.setInputsInline(!1)}},Rr={init:function(){this.setColour(Ar),this.appendDummyInput().appendTitle("Comment:").appendTitle(new F.FieldTextInput(""),"TEXT"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("This comment will be ignored by Python")}},Nr={init:function(){this.setColour(Ar),this.appendValueInput("VALUE").appendField(F.Msg.TYPE_CHECK),this.setInputsInline(!1),this.setOutput(!0,"Type")}},Lr={init:function(){this.setColour(Ar),this.itemCount_=1,this.updateShape_(),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new F.icons.MutatorIcon(["text_print_multiple_item"],this)),this.setTooltip(F.Msg.TEXT_PRINT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=F.Block.obtain(e,"text_print_multiple_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("text_print_multiple_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("PRINT"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("PRINT"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("PRINT"+e);)this.removeInput("PRINT"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField("print");else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("PRINT"+e);0==e&&t.appendField("print")}}},Dr={init:function(){this.setColour(Ar),this.appendDummyInput().appendField("print"),this.appendStatementInput("STACK"),this.setTooltip(""),this.contextMenu=!1}},Pr={init:function(){this.setColour(Ar),this.appendDummyInput().appendField("item"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1}},Fr={init:function(){this.setColour(Ar),this.itemCount_=1,this.hasReturn_=!1,this.appendDummyInput().appendField(new F.FieldTextInput("str"),"NAME"),this.updateShape_(),this.setMutator(new F.icons.MutatorIcon(["function_call_item"],this)),this.setTooltip("Can be used to call any function")},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e.setAttribute("hasReturn",this.hasReturn_?"TRUE":"FALSE"),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.hasReturn_="TRUE"===e.getAttribute("hasReturn"),this.updateShape_()},decompose:function(e){var t=F.Block.obtain(e,"function_call_container");t.initSvg(),t.setFieldValue(this.hasStatements_?"TRUE":"FALSE","RETURN");for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("function_call_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},setReturn:function(e){this.unplug(!0,!0),this.setOutput(e),this.setPreviousStatement(!e),this.setNextStatement(!e),this.rendered&&this.render()},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.hasReturn_="TRUE"===e.getFieldValue("RETURN"),this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ARGUMENT"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ARGUMENT"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ARGUMENT"+e);)this.removeInput("ARGUMENT"+e),e++;for(e=0;e<this.itemCount_;e++)this.appendValueInput("ARGUMENT"+e);this.setReturn(this.hasReturn_)}},Br={init:function(){this.setColour(Ar),this.appendDummyInput().appendField("Arguments"),this.appendStatementInput("STACK"),this.appendDummyInput().setAlign(F.inputs.Align.RIGHT).appendField("has return").appendField(new F.FieldCheckbox("TRUE"),"RETURN"),this.setTooltip(""),this.contextMenu=!1}},jr={init:function(){this.setColour(Ar),this.appendDummyInput().appendField("argument"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1}},Vr={init:function(){this.appendValueInput("MODULE").setCheck(null),this.appendValueInput("NAME").setCheck(null).appendField("."),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(230),this.setTooltip(""),this.setHelpUrl("")}},Ur=170,Yr={init:function(){this.setColour(Ur),this.appendDummyInput("").appendField(F.Msg.blockpy_series_create).appendField(new F.FieldTextInput("ser1"),"VAR"),this.appendValueInput("SER").appendField(F.Msg.blockpy_series_via),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.blockpy_series_create_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Gr={init:function(){this.setColour(Ur),this.appendDummyInput("").appendField(F.Msg.blockpy_series_create).appendField(new F.FieldTextInput("ser1"),"VAR"),this.appendValueInput("SER").appendField(F.Msg.blockpy_series_via),this.appendValueInput("INDEX").setCheck([String,"List"]).appendField(F.Msg.blockpy_series_set_index),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.blockpy_series_create_index_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Xr={init:function(){this.setColour(Ur),this.appendDummyInput("").appendField(F.Msg.blockpy_dataframe_create).appendField(new F.FieldTextInput("df1"),"VAR"),this.appendValueInput("SER").appendField(F.Msg.blockpy_series_via),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.blockpy_dataframe_create_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Hr={init:function(){this.setColour(Ur);var e=[[F.Msg.DATAFRAME_RAW,"index"],[F.Msg.DATAFRAME_COLUMN,"columns"]];this.appendDummyInput("").appendField(F.Msg.blockpy_dataframe_create).appendField(new F.FieldTextInput("df1"),"VAR"),this.appendValueInput("SER").appendField(F.Msg.blockpy_series_via),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"COLUMN_RAW"),this.appendValueInput("INDEX").setCheck([String,"List"]).appendField(F.Msg.blockpy_series_set_index),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.blockpy_dataframe_create_index_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},zr={init:function(){this.setColour(Ur),this.appendDummyInput("").appendField(F.Msg.blockpy_dataframe_create).appendField(new F.FieldTextInput("df1"),"VAR"),this.appendValueInput("SER").appendField(F.Msg.blockpy_series_via),this.appendValueInput("INDEX_COLUMN").setCheck([String,"List"]).appendField(F.Msg.blockpy_dataframe_set_index_column),this.appendValueInput("INDEX_RAW").setCheck([String,"List"]).appendField(F.Msg.blockpy_dataframe_set_index_raw),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.blockpy_dataframe_create_index_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},qr={init:function(){this.setColour(Ur),this.appendDummyInput("").appendField(new F.FieldTextInput("ser1"),"VAR").appendField(" = [").appendField(new F.FieldTextInput("1,2,3"),"TEXT").appendField("]"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_SERIES_CREATE_FROM_TEXT)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Wr={init:function(){this.setColour(Ur);var e=[[F.Msg.SERIES_INDEX,"index"],[F.Msg.HTML_VALUE,"value"]];this.appendValueInput("SERIES").setCheck("Series"),this.appendDummyInput("").appendField(F.Msg.SERIES_INDEX_VALUE).appendField(new F.FieldDropdown(e),"INDEX_VALUE"),this.setOutput(!0,"List");var t=this;this.setTooltip((function(){var e=t.getFieldValue("INDEX_VALUE");return{index:F.Msg.SERIES_INDEX_TOOLTIP,value:F.Msg.HTML_VALUE_TOOLTIP}[e]}))}},Kr={init:function(){this.setColour(Ur),this.setOutput(!0),this.appendValueInput("SER").setCheck("Series"),this.appendValueInput("AT").setCheck(Number).appendField(F.Msg.LANG_LISTS_GET_INDEX1),this.appendDummyInput("").appendField(F.Msg.LANG_LISTS_GET_INDEX2),this.setInputsInline(!0),this.setTooltip(F.Msg.TUPLE_GET_INDEX_TOOLTIP)}},Jr={init:function(){this.setColour(Ur),this.appendValueInput("SER").setCheck("Series").appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_PLOT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Qr={init:function(){this.setColour(Ur);var e=[[F.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[F.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[F.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[F.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[F.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[F.Msg.COLOUR_RGB_BLUE,"b"],[F.Msg.COLOUR_RGB_GREEN,"g"],[F.Msg.COLOUR_RGB_RED,"r"],[F.Msg.COLOUR_CYAN,"c"],[F.Msg.COLOUR_MAGENTA,"m"],[F.Msg.COLOUR_YELLOW,"y"],[F.Msg.COLOUR_BLACK,"k"],[F.Msg.COLOUR_WHITE,"w"]],n=[[F.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[F.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[F.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[F.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[F.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[F.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[F.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[F.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[F.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[F.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[F.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("SER").setCheck("Series").appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_PLOT),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new F.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new F.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldDropdown(t),"COLOR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Zr={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_SHOW),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},es={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.mixpy_PL_AXES),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ts={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_LEGEND),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ns={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_TITLE),this.appendValueInput("TITLE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},is={init:function(){this.setColour(Ur);var e=[[F.Msg.PYLAB_LABEL_X,"x"],[F.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_SET_LABEL).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("LABEL").appendField(F.Msg.blockpy_PYLAB_LABEL).setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},rs={init:function(){this.setColour(Ur),this.appendValueInput("FROM").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.MIXLY_SPLITBYDOU).appendField(F.Msg.MIXPY_DATA_ARRAY_CREATE_FROM),this.appendValueInput("TO").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.MIXPY_DATA_ARRAY_CREATE_TO),this.appendValueInput("STEP").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField(F.Msg.MIXLY_STEP),this.setInputsInline(!0),this.setOutput(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},ss={init:function(){this.setColour(Ur);var e=[[F.Msg.mixpy_PYLAB_PLOT_BAR_PLOT,"plot"],[F.Msg.mixpy_PYLAB_PLOT_BAR_BAR,"bar"]];this.appendDummyInput().appendField(F.Msg.MIXLY_DISPLAY_DRAW).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{plot:F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP,bar:F.Msg.mixpy_PYLAB_PLOT_BAR_EASY_TOOLTIP}[e]}))}},os={init:function(){this.setColour(Ur);var e=[[F.Msg.COLOUR_RGB_BLUE,"b"],[F.Msg.COLOUR_RGB_GREEN,"g"],[F.Msg.COLOUR_RGB_RED,"r"],[F.Msg.COLOUR_CYAN,"c"],[F.Msg.COLOUR_MAGENTA,"m"],[F.Msg.COLOUR_YELLOW,"y"],[F.Msg.COLOUR_BLACK,"k"],[F.Msg.COLOUR_WHITE,"w"]],t=[[F.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[F.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[F.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[F.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[F.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[F.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[F.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[F.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[F.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[F.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[F.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_SCATTER).appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("S").appendField(F.Msg.MIXLY_MICROBIT_JS_NUMBER),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new F.FieldDropdown(t),"DOT"),this.appendDummyInput("").appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldDropdown(e),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},as={init:function(){this.setColour(Ur);var e=[[F.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[F.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[F.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[F.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[F.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[F.Msg.COLOUR_RGB_BLUE,"b"],[F.Msg.COLOUR_RGB_GREEN,"g"],[F.Msg.COLOUR_RGB_RED,"r"],[F.Msg.COLOUR_CYAN,"c"],[F.Msg.COLOUR_MAGENTA,"m"],[F.Msg.COLOUR_YELLOW,"y"],[F.Msg.COLOUR_BLACK,"k"],[F.Msg.COLOUR_WHITE,"w"]],n=[[F.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[F.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[F.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_DOWN,"v"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_UP,"^"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_LEFT,"<"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIANGLE_RIGHT,">"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_UP,"1"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_DOWN,"2"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_LEFT,"3"],[F.Msg.blockpy_PYLAB_PLOT_DOT_TRIMARKER_RIGHT,"4"],[F.Msg.blockpy_PYLAB_PLOT_DOT_SQUARE,"s"],[F.Msg.blockpy_PYLAB_PLOT_DOT_PENTAGON,"p"],[F.Msg.blockpy_PYLAB_PLOT_DOT_STAR,"*"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_VERTICAL,"h"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HEXAGON_HORIZONTAL,"H"],[F.Msg.blockpy_PYLAB_PLOT_DOT_PLUS,"+"],[F.Msg.blockpy_PYLAB_PLOT_DOT_CROSS,"x"],[F.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND,"D"],[F.Msg.blockpy_PYLAB_PLOT_DOT_DIAMOND_SMALL,"d"],[F.Msg.blockpy_PYLAB_PLOT_DOT_VERTICAL,"|"],[F.Msg.blockpy_PYLAB_PLOT_DOT_HORIZONTAL,"_"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_PLOT_XY).appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new F.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new F.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldDropdown(t),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},ls={init:function(){this.setColour(Ur);var e=[[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[F.Msg.AILGN_EDGE,"edge"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_BAR).appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("WIDTH").setCheck(Number).appendField(F.Msg.MIXLY_WIDTH),this.appendDummyInput("").appendField(F.Msg.mixpy_PYLAB_BAR_ALIGN).appendField(new F.FieldDropdown(e),"ALIGN"),this.appendDummyInput().appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldColour("#0000ff"),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},us={init:function(){this.setColour(Ur);var e=[[F.Msg.mixpy_PL_PIE_SHADOW_N,"False"],[F.Msg.mixpy_PL_PIE_SHADOW_Y,"True"]],t=[[F.Msg.mixpy_PL_PIE_SHADOW_N,"None"],[F.Msg.mixpy_PYLAB_PIE_AUTOPCT_Z,"%.0f%%"],[F.Msg.mixpy_PYLAB_PIE_AUTOPCT_O,"%.1f%%"],[F.Msg.mixpy_PYLAB_PIE_AUTOPCT_T,"%.2f%%"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_PIE).appendField(F.Msg.COLOUR_BLEND_RATIO),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.appendValueInput("EXPLODE").appendField(F.Msg.mixpy_PYLAB_PIE_EXPLODE),this.appendDummyInput("").appendField(F.Msg.mixpy_PYLAB_PIE_AUTOPCT).appendField(new F.FieldDropdown(t),"autopct"),this.appendDummyInput("").appendField(F.Msg.mixpy_PYLAB_PIE_SHADOW).appendField(new F.FieldDropdown(e),"SHADOW"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},cs={init:function(){this.setColour(Ur),this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_HIST).appendField(F.Msg.MIXLY_SD_DATA),this.appendValueInput("B").appendField(F.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ps={init:function(){this.setColour(Ur);var e=[[F.Msg.PYLAB_LABEL_X,"x"],[F.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(F.Msg.MIXLY_SETTING).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_TICKS).appendField(F.Msg.MIXLY_MICROBIT_JS_I2C_VALUE),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_TICKS_TOOLTIP)}},hs={init:function(){var e=[["sin","sin"],["cos","cos"],["tan","tan"],["arcsin","arcsin"],["arccos","arccos"],["arctan","arctan"],[F.Msg.LANG_MATH_TO_ROUND,"round"],[F.Msg.LANG_MATH_TO_CEIL,"ceil"],[F.Msg.LANG_MATH_TO_FLOOR,"floor"]];this.setColour(Ur),this.setOutput(!0),this.setInputsInline(!0),this.appendDummyInput().appendField(F.Msg.mixpy_NUMPY_TRIG),this.appendValueInput("NUM").setCheck(Number).appendField(new F.FieldDropdown(e),"OP"),this.setTooltip(F.Msg.mixpy_NUMPY_TRIG_TOOLTIP)}},ds={init:function(){this.setColour(Ur),this.appendValueInput("VET").setCheck(Number).appendField(F.Msg.mixpy_SUBPLOT).appendField(F.Msg.mixpy_SUBPLOT_VERTICLE),this.appendValueInput("HOR").setCheck(Number).appendField(F.Msg.mixpy_SUBPLOT_HORIZEN),this.appendValueInput("NUM").setCheck(Number).appendField(F.Msg.mixpy_SUBPLOT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},fs={init:function(){this.setColour(Ur),this.appendValueInput("FILENAME").appendField(F.Msg.MIXPY_PANDAS_READ_CSV),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.mixpy_PANDAS_READCSV_HEADER_Y,"0"],[F.Msg.mixpy_PANDAS_READCSV_HEADER_N,"None"]]),"MODE"),this.appendDummyInput().appendField(F.Msg.mixpy_PANDAS_READCSV_TITLE),this.setOutput(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.mixpy_PANDAS_READCSV_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},_s={init:function(){this.setColour(Ur),this.appendValueInput("DICT").setCheck("Dict"),this.appendValueInput("KEY").appendField(F.Msg.mixpy_DATAFRAME_GET),this.appendDummyInput("").appendField(F.Msg.mixpy_DATAFRAME_GET_INDEX).appendField(new F.FieldDropdown([[F.Msg.DATAFRAME_COLUMN,"column"],[F.Msg.DATAFRAME_RAW,"raw"]]),"MODE"),this.setOutput(!0),this.setTooltip(F.Msg.mixpy_DATAFRAME_GET_TOOLTIP)}},ms={init:function(){this.setColour(Ur),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.mixpy_PL_SAVEFIG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.mixpy_PL_SAVEFIG_TOOLTIP)}},bs={init:function(){this.setColour(Ur);var e=[[F.Msg.TEXT_TRIM_LEFT,"right"],[F.Msg.mixpy_PL_TEXT_CENTER,"center"],[F.Msg.TEXT_TRIM_RIGHT,"left"]],t=[[F.Msg.mixpy_PL_TEXT_TOP,"bottom"],[F.Msg.mixpy_PL_TEXT_CENTER,"center"],[F.Msg.mixpy_PL_TEXT_BOTTOM,"top"]];this.appendValueInput("VET").setCheck(Number).appendField(F.Msg.MIXLY_SETTING).appendField(F.Msg.mixpy_PL_TEXT_X),this.appendValueInput("HOR").setCheck(Number).appendField(F.Msg.mixpy_PL_TEXT_Y),this.appendValueInput("NUM").setCheck(Number).appendField(F.Msg.mixpy_PL_TEXT_TAG),this.appendDummyInput("").appendField(F.Msg.mixpy_PL_TEXT_HOR).appendField(new F.FieldDropdown(e),"HALIGN"),this.appendDummyInput("").appendField(F.Msg.mixpy_PL_TEXT_VER).appendField(new F.FieldDropdown(t),"VALIGN"),this.appendValueInput("FONTNUM").setCheck(Number).appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PL_TEXT_TOOLTIP)}},gs={init:function(){this.setColour(Ur),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TOARRAY),this.setOutput(!0,"List"),this.setTooltip(F.Msg.MIXLY_PYTHON_TOOLTIP_TOARRAY)}},Ss={init:function(){this.setColour(Ur),this.appendValueInput("SER").setCheck("Series").appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_PLOT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ks={init:function(){this.setColour(Ur);var e=[[F.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[F.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[F.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[F.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[F.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[F.Msg.COLOUR_RGB_BLUE,"b"],[F.Msg.COLOUR_RGB_GREEN,"g"],[F.Msg.COLOUR_RGB_RED,"r"],[F.Msg.COLOUR_CYAN,"c"],[F.Msg.COLOUR_MAGENTA,"m"],[F.Msg.COLOUR_YELLOW,"y"],[F.Msg.COLOUR_BLACK,"k"],[F.Msg.COLOUR_WHITE,"w"]],n=[[F.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[F.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[F.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"]];this.appendValueInput("SER").setCheck("Series").appendField(F.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_PLOT),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new F.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new F.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldDropdown(t),"COLOR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ys={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_SHOW),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},vs={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.mixpy_PL_AXES),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ts={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_LEGEND),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Es={init:function(){this.setColour(Ur),this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_TITLE),this.appendValueInput("TITLE").setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Is={init:function(){this.setColour(Ur);var e=[[F.Msg.PYLAB_LABEL_X,"x"],[F.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(F.Msg.blockpy_PYLAB_SET_LABEL).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("LABEL").appendField(F.Msg.blockpy_PYLAB_LABEL).setCheck(String),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ws={init:function(){this.setColour(Ur);var e=[[F.Msg.mixpy_PYLAB_PLOT_BAR_PLOT,"plot"],[F.Msg.mixpy_PYLAB_PLOT_BAR_BAR,"bar"]];this.appendDummyInput().appendField(F.Msg.MIXLY_DISPLAY_DRAW).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{plot:F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP,bar:F.Msg.mixpy_PYLAB_PLOT_BAR_EASY_TOOLTIP}[e]}))}},xs={init:function(){this.setColour(Ur);var e=[[F.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[F.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[F.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_SCATTER).appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("S").appendField(F.Msg.MIXLY_MICROBIT_JS_NUMBER),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new F.FieldDropdown(e),"DOT"),this.appendDummyInput().appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldColour("#0000ff"),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},As={init:function(){this.setColour(Ur);var e=[[F.Msg.blockpy_PYLAB_PLOT_LINE_SOLID,"-"],[F.Msg.blockpy_PYLAB_PLOT_LINE_DOTTED,"--"],[F.Msg.blockpy_PYLAB_PLOT_LINE_CHAIN,"-."],[F.Msg.blockpy_PYLAB_PLOT_LINE_POINT_DOTTED,":"],[F.Msg.MIXLY_MICROBIT_JS_INOUT_PULL_NONE,""]],t=[[F.Msg.COLOUR_RGB_BLUE,"b"],[F.Msg.COLOUR_RGB_GREEN,"g"],[F.Msg.COLOUR_RGB_RED,"r"],[F.Msg.COLOUR_CYAN,"c"],[F.Msg.COLOUR_MAGENTA,"m"],[F.Msg.COLOUR_YELLOW,"y"],[F.Msg.COLOUR_BLACK,"k"],[F.Msg.COLOUR_WHITE,"w"]],n=[[F.Msg.blockpy_PYLAB_PLOT_DOT_CIRCULAR,"."],[F.Msg.blockpy_PYLAB_PLOT_DOT_PIXEL,","],[F.Msg.blockpy_PYLAB_PLOT_DOT_LARGE_DOT,"o"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_PLOT_XY).appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_DOT).appendField(new F.FieldDropdown(n),"DOT"),this.appendDummyInput("").appendField(F.Msg.blockpy_PYLAB_PLOT_LINE).appendField(new F.FieldDropdown(e),"LINE"),this.appendDummyInput("").appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldDropdown(t),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},$s={init:function(){this.setColour(Ur);var e=[[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[F.Msg.AILGN_EDGE,"edge"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_BAR).appendField(F.Msg.mixpy_PYLAB_PLOT_X),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_PLOT_Y),this.appendValueInput("WIDTH").setCheck(Number).appendField(F.Msg.MIXLY_WIDTH),this.appendDummyInput("").appendField(F.Msg.mixpy_PYLAB_BAR_ALIGN).appendField(new F.FieldDropdown(e),"ALIGN"),this.appendDummyInput().appendField(F.Msg.HTML_COLOUR).appendField(new F.FieldColour("#0000ff"),"COLOR"),this.appendValueInput("TAG").setCheck(String).appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},Os={init:function(){this.setColour(Ur);var e=[[F.Msg.mixpy_PL_PIE_SHADOW_N,"False"],[F.Msg.mixpy_PL_PIE_SHADOW_Y,"True"]],t=[[F.Msg.mixpy_PL_PIE_SHADOW_N,"None"],[F.Msg.mixpy_PYLAB_PIE_AUTOPCT_Z,"%.0f%%"],[F.Msg.mixpy_PYLAB_PIE_AUTOPCT_O,"%.1f%%"],[F.Msg.mixpy_PYLAB_PIE_AUTOPCT_T,"%.2f%%"]];this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_PIE).appendField(F.Msg.COLOUR_BLEND_RATIO),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.appendValueInput("EXPLODE").appendField(F.Msg.mixpy_PYLAB_PIE_EXPLODE),this.appendDummyInput("").appendField(F.Msg.mixpy_PYLAB_PIE_AUTOPCT).appendField(new F.FieldDropdown(t),"autopct"),this.appendDummyInput("").appendField(F.Msg.mixpy_PYLAB_PIE_SHADOW).appendField(new F.FieldDropdown(e),"SHADOW"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_PLOT_XY_TOOLTIP)}},Ms={init:function(){this.setColour(Ur),this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_HIST).appendField(F.Msg.MIXLY_SD_DATA),this.appendValueInput("B").appendField(F.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Cs={init:function(){this.setColour(Ur);var e=[[F.Msg.PYLAB_LABEL_X,"x"],[F.Msg.PYLAB_LABEL_Y,"y"]];this.appendDummyInput().appendField(F.Msg.MIXLY_SETTING).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("A").appendField(F.Msg.mixpy_PYLAB_TICKS).appendField(F.Msg.MIXLY_MICROBIT_JS_I2C_VALUE),this.appendValueInput("B").appendField(F.Msg.mixpy_PYLAB_TICKS_TAG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PYLAB_TICKS_TOOLTIP)}},Rs={init:function(){this.setColour(Ur),this.appendValueInput("VET").setCheck(Number).appendField(F.Msg.mixpy_SUBPLOT).appendField(F.Msg.mixpy_SUBPLOT_VERTICLE),this.appendValueInput("HOR").setCheck(Number).appendField(F.Msg.mixpy_SUBPLOT_HORIZEN),this.appendValueInput("NUM").setCheck(Number).appendField(F.Msg.mixpy_SUBPLOT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_CONTROLS_RANGE_TOOLTIP)}},Ns={init:function(){this.setColour(Ur),this.appendDummyInput("").appendField(F.Msg.mixpy_PL_SAVEFIG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.mixpy_PL_SAVEFIG_TOOLTIP)}},Ls={init:function(){this.setColour(Ur);var e=[[F.Msg.TEXT_TRIM_LEFT,"right"],[F.Msg.mixpy_PL_TEXT_CENTER,"center"],[F.Msg.TEXT_TRIM_RIGHT,"left"]],t=[[F.Msg.mixpy_PL_TEXT_TOP,"bottom"],[F.Msg.mixpy_PL_TEXT_CENTER,"center"],[F.Msg.mixpy_PL_TEXT_BOTTOM,"top"]];this.appendValueInput("VET").setCheck(Number).appendField(F.Msg.MIXLY_SETTING).appendField(F.Msg.mixpy_PL_TEXT_X),this.appendValueInput("HOR").setCheck(Number).appendField(F.Msg.mixpy_PL_TEXT_Y),this.appendValueInput("NUM").setCheck(Number).appendField(F.Msg.mixpy_PL_TEXT_TAG),this.appendDummyInput("").appendField(F.Msg.mixpy_PL_TEXT_HOR).appendField(new F.FieldDropdown(e),"HALIGN"),this.appendDummyInput("").appendField(F.Msg.mixpy_PL_TEXT_VER).appendField(new F.FieldDropdown(t),"VALIGN"),this.appendValueInput("FONTNUM").setCheck(Number).appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.mixpy_PL_TEXT_TOOLTIP)}},Ds=20,Ps={init:function(){this.setColour(Ds),this.appendValueInput("VAR").appendField(F.Msg.blockpy_inout_raw_input).setCheck(String),this.setOutput(!0),this.setTooltip(F.Msg.INOUT_input_TOOLTIP)}},Fs={init:function(){this.setColour(Ds),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_SERIAL_PRINTLN),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(F.Msg.BLOCKPY_PRINT_TOOLTIP)}},Bs={init:function(){this.setColour(Ds),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_SERIAL_PRINT),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setTooltip(F.Msg.TEXT_PRINT_TOOLTIP)}},js={init:function(){this.setColour(Ds),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_SERIAL_PRINT),this.appendValueInput("END").appendField(F.Msg.MIXLY_ENDSWITH),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_PYTHON_INOUT_PRINT_END_TOOLTIP)}},Vs={init:function(){var e=[[F.Msg.LANG_MATH_STRING,"str"],[F.Msg.LANG_MATH_INT,"int"],[F.Msg.LANG_MATH_FLOAT,"float"]];this.setColour(Ds),this.appendDummyInput("").appendField(F.Msg.MIXLY_MICROBIT_PY_STORAGE_GET).appendField(new F.FieldDropdown(e),"DIR"),this.appendValueInput("VAR").appendField(F.Msg.PROCEDURES_MUTATORCONTAINER_TITLE).setCheck(String),this.setInputsInline(!0),this.setOutput(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{str:F.Msg.MIXLY_MIXPY_INOUT_STR_INPUT_TOOLTIP,int:F.Msg.MIXLY_MIXPY_INOUT_INT_INPUT_TOOLTIP,float:F.Msg.MIXLY_MIXPY_INOUT_FLOAT_INPUT_TOOLTIP}[e]}))}},Us={init:function(){this.setColour(Ds),this.itemCount_=2,this.updateShape_(),this.setPreviousStatement(!1),this.setNextStatement(!1),this.setInputsInline(!0),this.setMutator(new F.icons.MutatorIcon(["inout_print_item"],this)),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("inout_print_container");t.initSvg();for(var n=t.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=e.newBlock("inout_print_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return t},compose:function(e){for(var t=e.getInputTargetBlock("STACK"),n=[],i=0;t;)n[i]=t.valueConnection_,t=t.nextConnection&&t.nextConnection.targetBlock(),i++;this.itemCount_=i,this.updateShape_();for(i=0;i<this.itemCount_;i++)n[i]&&this.getInput("ADD"+i).connection.connect(n[i])},saveConnections:function(e){for(var t=e.getInputTargetBlock("STACK"),n=0;t;){var i=this.getInput("ADD"+n);t.valueConnection_=i&&i.connection.targetConnection,n++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var e=0;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(F.Msg.MIXLY_MIXPY_INOUT_PRINT_EMPTY);else for(e=0;e<this.itemCount_;e++){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(F.Msg.MIXLY_SERIAL_PRINTLN)}}},Ys={init:function(){this.setColour(Ds),this.appendDummyInput().appendField(F.Msg.MIXLY_SERIAL_PRINTLN),this.appendStatementInput("STACK"),this.setTooltip(F.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_CONTAINER_TOOLTIP),this.contextMenu=!1}},Gs={init:function(){this.setColour(Ds),this.appendDummyInput().appendField(F.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_ITEM_TOOLTIP),this.contextMenu=!1}},Xs=120,Hs={init:function(){this.setColour(Xs),this.appendValueInput("DELAY_TIME",Number).appendField(F.Msg.MIXLY_DELAY+"("+F.Msg.MIXLY_MILLIS+")").setCheck(Number),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},zs={init:function(){this.setColour(Xs),this.appendDummyInput().appendField(F.Msg.blockpy_time_time),this.setOutput(!0,Number),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_MILLIS)}},qs={init:function(){this.setColour(Xs),this.appendDummyInput("").appendField(F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME),this.appendDummyInput().appendField(new F.FieldDropdown([[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_ALL,"all"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_YEAR,"0"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_MONTH,"1"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_DATE,"2"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_HOUR,"3"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_MINUTE,"4"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_SECOND,"5"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_INWEEK,"6"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_INYEAR,"7"],[F.Msg.MIXLY_SYSTEM_TIME_LOCALTIME_DST,"8"]]),"op"),this.setOutput(!0),this.setInputsInline(!0)}},Ws={init:function(){this.setColour(Xs),this.appendValueInput("STATUS_CODE",Number).appendField(F.Msg.MIXLY_MICROBIT_Panic_with_status_code).setCheck(Number),this.setPreviousStatement(!0,null),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},Ks={init:function(){this.setColour(Xs),this.appendDummyInput().appendField(F.Msg.MIXLY_MICROBIT_Reset_micro),this.setPreviousStatement(!0)}},Js={init:function(){this.setColour(Xs),this.appendValueInput("TIME").setCheck(Number).setAlign(F.inputs.Align.RIGHT).appendField("MsTimer2").appendField(F.Msg.MIXLY_MSTIMER2_EVERY),this.appendDummyInput().appendField("ms"),this.appendStatementInput("DO").appendField(F.Msg.MIXLY_MSTIMER2_DO),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Qs={init:function(){this.setColour(Xs),this.appendDummyInput().appendField("MsTimer2").appendField(F.Msg.MIXLY_MSTIMER2_START),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Zs={init:function(){this.setColour(Xs),this.appendDummyInput().appendField("MsTimer2").appendField(F.Msg.MIXLY_STOP),this.setPreviousStatement(!0),this.setNextStatement(!0)}},eo={init:function(){this.setColour(Xs),this.appendValueInput("DELAY_TIME",Number).appendField(F.Msg.MIXLY_DELAY).setCheck(Number),this.appendDummyInput().appendField(F.Msg.MIXLY_SECOND),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_CONTROL_DELAY)}},to=180,no={init:function(){this.setColour(to),this.appendDummyInput("").appendField(F.Msg.blockpy_turtle_create).appendField(new F.FieldTextInput("tina"),"VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.blockpy_turtle_create_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},io={init:function(){this.setColour(to),this.appendDummyInput().appendField(F.Msg.blockpy_TURTLE_DONE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},ro={init:function(){this.setColour(to),this.appendDummyInput().appendField(F.Msg.MIXLY_PYTHON_TURTLE_EXITONCLICK),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},so={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_forward,"forward"],[F.Msg.blockpy_backward,"backward"]];this.setColour(to),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_MICROBIT_JS_MOVE_BY).appendField(new F.FieldDropdown(e),"DIR").appendField(F.Msg.MIXLY_MICROBIT_JS_MOVE_BY_num),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{forward:F.Msg.MIXLY_TOOLTIP_TURTEL_FORWARD,backward:F.Msg.MIXLY_TOOLTIP_TURTEL_BACKWARD}[e]}))}},oo={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_left,"left"],[F.Msg.blockpy_right,"right"]];this.setColour(to),this.appendValueInput("VAR").appendField(F.Msg.blockpy_turtle_rotate).appendField(new F.FieldDropdown(e),"DIR").appendField(F.Msg.MIXLY_MICROBIT_JS_BY_ANGLE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{left:F.Msg.MIXLY_TOOLTIP_TURTEL_LEFT,right:F.Msg.MIXLY_TOOLTIP_TURTEL_RIGHT}[e]}))}},ao={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(F.Msg.blockpy_setheading),this.appendDummyInput().appendField(F.Msg.blockpy_setheading_degree),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},lo={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(F.Msg.MIXLY_TURTLE_SCREEN_DELAY),this.appendDummyInput().appendField(F.Msg.MIXLY_MILLIS),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TURTEL_SCREEN_DELAY),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},uo={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(F.Msg.blockpy_turtle_goto),this.appendValueInput("val").setCheck(Number).appendField(F.Msg.blockpy_turtle_goto_y),this.appendDummyInput().appendField(F.Msg.blockpy_turtle_goto_position),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},co={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.PYLAB_LABEL_X,"x"],[F.Msg.PYLAB_LABEL_Y,"y"]];this.setColour(to),this.appendValueInput("VAR").appendField(new F.FieldDropdown(e),"DIR").appendField(F.Msg.MIXLY_MIXPY_TURTLE_SETXY),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_MIXPY_TURTLE_SETXY_TOOLTIP)}},po={init:function(){this.setColour(to);var e=[[F.Msg.TURTLE_POS,"pos"],[F.Msg.TURTLE_SHAPE,"shape"],[F.Msg.TURTLE_HEADING,"heading"],[F.Msg.MIXLY_MIXPY_TURTLE_WIDTH,"width"],[F.Msg.MIXLY_TURTEL_GET_SHAPESIZE,"shapesize"],[F.Msg.MIXLY_SPEED,"speed"]];this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput("").appendField(F.Msg.TURTLE_POS_SHAPE).appendField(new F.FieldDropdown(e),"DIR");var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{pos:F.Msg.MIXLY_TOOLTIP_TURTEL_POS,shape:F.Msg.MIXLY_TOOLTIP_TURTEL_SHAPE,heading:F.Msg.MIXLY_TOOLTIP_TURTEL_HEADING,width:F.Msg.MIXLY_TOOLTIP_TURTEL_WIDTH,speed:F.Msg.MIXLY_TOOLTIP_TURTEL_GET_SPEED,shapesize:F.Msg.MIXLY_TURTEL_GET_SHAPESIZE_TOOLTIP}[e]})),this.setOutput(!0),this.setInputsInline(!0)}},ho={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.MIXLY_LCD_STAT_CLEAR,"clear"],[F.Msg.blockpy_turtle_reset,"reset"],[F.Msg.blockpy_turtle_home,"home"]];this.setColour(to),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{clear:F.Msg.MIXLY_TOOLTIP_TURTEL_CLEAR,reset:F.Msg.MIXLY_TOOLTIP_TURTEL_RESET,home:F.Msg.MIXLY_TOOLTIP_TURTEL_HOME}[e]}))}},fo={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_turtle_penup,"penup"],[F.Msg.blockpy_turtle_pendown,"pendown"]];this.setColour(to),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{penup:F.Msg.MIXLY_TOOLTIP_TURTEL_PENUP,pendown:F.Msg.MIXLY_TOOLTIP_TURTEL_PENDOWN}[e]}))}},_o={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_turtle_beginfill,"begin"],[F.Msg.blockpy_turtle_endfill,"end"]];this.setColour(to),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{begin:F.Msg.MIXLY_TOOLTIP_TURTEL_BEGINFILL,end:F.Msg.MIXLY_TOOLTIP_TURTEL_ENDFILL}[e]}))}},mo={init:function(){this.appendDummyInput("").appendField(new F.FieldTextInput("tina"),"TUR");var e=[[F.Msg.blockpy_turtle_size,"pensize"],[F.Msg.MIXLY_SPEED,"speed"]];this.setColour(to),this.appendValueInput("VAR").appendField(F.Msg.blockpy_turtle_set).appendField(new F.FieldDropdown(e),"DIR").appendField(F.Msg.blockpy_turtle_set_num),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{pensize:F.Msg.MIXLY_TOOLTIP_TURTEL_SIZE,speed:F.Msg.MIXLY_TOOLTIP_TURTEL_SPEED}[e]}))}},bo={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(F.Msg.blockpy_turtle_set_size),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TURTEL_SIZE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},go={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendValueInput("data").setCheck(Number).appendField(F.Msg.blockpy_turtle_set_speed),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TURTEL_SPEED),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},So={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_turtle_circle,"circle"],[F.Msg.blockpy_turtle_dot,"dot"]];this.setColour(to),this.appendValueInput("VAR").appendField(F.Msg.blockpy_turtle_draw).appendField(new F.FieldDropdown(e),"DIR").appendField(F.Msg.blockpy_turtle_radius),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{circle:F.Msg.MIXLY_TOOLTIP_TURTEL_CIRCLE,dot:F.Msg.MIXLY_TOOLTIP_TURTEL_DOT}[e]}))}},ko={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE).appendField(F.Msg.blockpy_turtle_radius),this.appendValueInput("data").setCheck(Number).appendField(F.Msg.blockpy_turtle_angle),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_TURTEL_CIRCLE)}},yo={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_turtle_hide,"hideturtle"],[F.Msg.blockpy_turtle_show,"showturtle"]];this.setColour(to),this.appendDummyInput("").appendField(new F.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip((function(){var e=t.getFieldValue("DIR");return{hideturtle:F.Msg.MIXLY_TOOLTIP_TURTEL_HIDE,showturtle:F.Msg.MIXLY_TOOLTIP_TURTEL_SHOW}[e]}))}},vo={init:function(){this.setColour(to),this.appendDummyInput().appendField(F.Msg.blockpy_turtle_bgcolor).appendField(new F.FieldColour("#ff0000"),"FIELDNAME"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},To={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendDummyInput().appendField(F.Msg.blockpy_turtle_pencolor).appendField(new F.FieldColour("#ff0000"),"FIELDNAME"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Eo={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendDummyInput().appendField(F.Msg.blockpy_turtle_fillcolor).appendField(new F.FieldColour("#ff0000"),"FIELDNAME"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Io={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput("").appendField(F.Msg.TURTLE_CLONE),this.setTooltip(F.Msg.TURTLE_CLONE_TOOLTIP),this.setOutput(!0)}},wo={init:function(){this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_bgcolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},xo={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_pencolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ao={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_fillcolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},$o={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendDummyInput().appendField(F.Msg.blockpy_turtle_pencolor).appendField(new F.FieldColour("#ff0000"),"FIELDNAME"),this.appendDummyInput().appendField(F.Msg.blockpy_turtle_fillcolor).appendField(new F.FieldColour("#ff0000"),"FIELDNAME2"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Oo={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR1").setCheck(String).appendField(F.Msg.blockpy_turtle_pencolor),this.appendValueInput("VAR2").setCheck(String).appendField(F.Msg.blockpy_turtle_fillcolor),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Mo={init:function(){this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_bgcolor_hex),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Co={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_pencolor_hex),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Ro={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_fillcolor_hex),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},No={init:function(){this.appendValueInput("TUR").setCheck("Turtle");var e=[[F.Msg.blockpy_turtle_shape_arrow,"arrow"],[F.Msg.blockpy_turtle_shape_turtle,"turtle"],[F.Msg.blockpy_turtle_shape_circle,"circle"],[F.Msg.blockpy_turtle_shape_square,"square"],[F.Msg.blockpy_turtle_shape_triangle,"triangle"],[F.Msg.blockpy_turtle_shape_classic,"classic"]];this.setColour(to),this.appendDummyInput("").appendField(F.Msg.blockpy_turtle_shape).appendField(new F.FieldDropdown(e),"DIR"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TURTLE_SHAPE_TOOLTIP)}},Lo={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTEL_SHAPESIZE),this.appendValueInput("WID").setCheck(Number).appendField(F.Msg.MIXLY_TURTEL_SHAPESIZE_WID),this.appendValueInput("LEN").setCheck(Number).appendField(F.Msg.MIXLY_TURTEL_SHAPESIZE_LEN),this.appendValueInput("OUTLINE").setCheck(Number).appendField(F.Msg.MIXLY_TURTEL_SHAPESIZE_OUTLINE),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_TOOLTIP_SHAPESIZE)}},Do={init:function(){this.appendDummyInput("").appendField(F.Msg.MIXLY_MIXPY_TURTLE_NUMINPUT),this.setColour(to),this.appendValueInput("TITLE").setCheck(String).appendField(F.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_TITLE),this.appendValueInput("PROMPT").setCheck(String).appendField(F.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_PROMPT),this.appendValueInput("DEFAULT").setCheck(Number).appendField(F.Msg.DICTS_DEFAULT_VALUE),this.appendValueInput("MIN").setCheck(Number).appendField(F.Msg.MATH_ONLIST_OPERATOR_MIN),this.appendValueInput("MAX").setCheck(Number).appendField(F.Msg.MATH_ONLIST_OPERATOR_MAX),this.setInputsInline(!0),this.setOutput(!0,Number),this.setTooltip(F.Msg.TURTLE_NUMINPUT_TOOLTIP)}},Po={init:function(){this.appendDummyInput("").appendField(F.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT),this.setColour(to),this.appendValueInput("TITLE").setCheck(String).appendField(F.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_TITLE),this.appendValueInput("PROMPT").setCheck(String).appendField(F.Msg.MIXLY_MIXPY_TURTLE_TEXTINPUT_PROMPT),this.setInputsInline(!0),this.setOutput(!0,String),this.setTooltip(F.Msg.TURTLE_TEXTINPUT_TOOLTIP)}},Fo={init:function(){this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_write),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TURTLE_WRITE_TOOLTIP)}},Bo={init:function(){var e=[[F.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE,"False"],[F.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE,"True"]],t=[[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_LEFT,"left"],[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_RIGHT,"right"]],n=[[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_NORMAL,"normal"],[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_BOLD,"bold"],[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_ITALIC,"italic"],[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_BOLD_ITALIC,'bold","italic']];this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_write),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTLE_WRITE_MOVE).appendField(new F.FieldDropdown(e),"MOVE"),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTLE_WRITE_ALIGN).appendField(new F.FieldDropdown(t),"ALIGN"),this.appendValueInput("FONTNAME").setCheck(String).appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_NAME),this.appendValueInput("FONTNUM").setCheck(Number).appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE).appendField(new F.FieldDropdown(n),"FONTTYPE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TURTLE_WRITE_TOOLTIP)}},jo={init:function(){var e=[[F.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE,"False"],[F.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE,"True"]],t=[[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_LEFT,"left"],[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_CENTER,"center"],[F.Msg.MIXLY_TURTLE_WRITE_ALIGN_RIGHT,"right"]],n=[[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_NORMAL,"normal"],[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_BOLD,"bold"],[F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE_ITALIC,"italic"]];this.appendValueInput("TUR").setCheck("Turtle"),this.setColour(to),this.appendValueInput("VAR").setCheck(String).appendField(F.Msg.blockpy_turtle_write),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTLE_WRITE_MOVE).appendField(new F.FieldDropdown(e),"MOVE"),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTLE_WRITE_ALIGN).appendField(new F.FieldDropdown(t),"ALIGN"),this.appendValueInput("FONTNAME").setCheck(String).appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_NAME),this.appendValueInput("FONTNUM").setCheck(Number).appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_NUM),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTLE_WRITE_FONT_TYPE).appendField(new F.FieldDropdown(n),"FONTTYPE"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.TURTLE_WRITE_TOOLTIP)}},Vo={init:function(){this.setColour(to),this.appendDummyInput("").setAlign(F.inputs.Align.RIGHT).appendField(new F.FieldColour("ff0000"),"COLOR"),this.setInputsInline(!0),this.setOutput(!0,String)}},Uo={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTEL_GETSCREEN).appendField(new F.FieldTextInput("screen"),"VAR"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(F.Msg.MIXLY_TURTEL_GETSCREEN_TOOLTIP)},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){F.Names.equals(e,this.getFieldValue("VAR"))&&this.setTitleValue(t,"VAR")}},Yo={init:function(){this.setColour(to),this.appendValueInput("TUR"),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TURTEL_EVENT_ONKEY),this.appendValueInput("callback").appendField(F.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TURTEL_EVENT_ONKEY_TOOLTIP)}},Go={init:function(){this.setColour(to),this.appendValueInput("TUR"),this.appendDummyInput("").appendField(F.Msg.MIXLY_TURTEL_EVENT_ONCLICK),this.appendValueInput("callback").appendField(F.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TURTEL_EVENT_ONCLICK_TOOLTIP)}},Xo={init:function(){this.setColour(to),this.appendValueInput("TUR"),this.appendValueInput("VAR").appendField(F.Msg.MIXLY_TURTEL_EVENT_ONTIMER),this.appendDummyInput("").appendField(F.Msg.MIXLY_mSecond),this.appendValueInput("callback").appendField(F.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(F.Msg.MIXLY_TURTEL_EVENT_ONTIMER_TOOLTIP)}},Ho={init:function(){this.setColour(to),this.appendValueInput("TUR"),this.appendDummyInput().appendField(F.Msg.MIXLY_TURTEL_SCREEN_LISTEN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},zo={init:function(){this.setColour(to),this.appendValueInput("TUR"),this.appendValueInput("FILE").setCheck(String).appendField(F.Msg.mixpy_PL_SAVEFIG),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setOutput(!1),this.setTooltip(F.Msg.mixpy_TURTLE_SAVEFIG_TOOLTIP)}},qo={init:function(){this.setColour(to),this.appendValueInput("TUR").setCheck("Turtle"),this.appendDummyInput().appendField(F.Msg.TURTLE_STAMP),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0)}},Wo={init:function(){this.appendDummyInput().appendField("初始化地图为第一关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},Ko={init:function(){this.appendDummyInput().appendField("初始化地图为第二关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},Jo={init:function(){this.appendDummyInput().appendField("初始化地图为第三关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},Qo={init:function(){this.appendDummyInput().appendField("初始化地图为第四关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},Zo={init:function(){this.appendDummyInput().appendField("初始化地图为第五关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},ea={init:function(){this.appendDummyInput().appendField("初始化地图为第六关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},ta={init:function(){this.appendDummyInput().appendField("初始化地图为第七关"),this.setInputsInline(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},na={init:function(){this.setNextStatement(!0),this.setColour(290),this.setTooltip(""),this.appendStatementInput("DO0").appendField(F.Msg.MIXLY_GAME_INIT)}},ia={init:function(){this.appendDummyInput().appendField("向").appendField(new F.FieldDropdown([["东","1"],["南","2"],["西","3"],["北","0"]]),"direction"),this.appendDummyInput().appendField("移动"),this.appendValueInput("times").setCheck(Number),this.appendDummyInput().appendField("步"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},ra={init:function(){var e=[[F.Msg.MIXLY_GAME_Turn_LEFT,"left"],[F.Msg.MIXLY_GAME_Turn_RIGHT,"right"]];this.appendDummyInput().appendField(F.Msg.MIXLY_GAME_TURN1).appendField(new F.FieldDropdown(e),"Direction").appendField(F.Msg.MIXLY_GAME_TURN2),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},sa={init:function(){this.appendDummyInput().appendField(F.Msg.MIXLY_GAME_ISDONE),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},oa={init:function(){var e=[[F.Msg.MIXLY_GAME_ISPATH_LEFT,"left"],[F.Msg.MIXLY_GAME_ISPATH_RIGHT,"right"]];this.appendDummyInput().appendField(F.Msg.MIXLY_GAME_ISPATH1).appendField(new F.FieldDropdown(e),"Direction").appendField(F.Msg.MIXLY_GAME_ISPATH2),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},aa={init:function(){this.appendValueInput("x").setCheck(Number).appendField("设置地图,长为:"),this.appendValueInput("y").setCheck(Number).appendField("宽为:"),this.appendValueInput("startPos").setCheck(null).appendField(",起点坐标"),this.appendValueInput("endPos").setCheck(null).appendField("终点坐标"),this.appendValueInput("background").setCheck(null).appendField("背景"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},la={init:function(){this.imgArr=this.getLocalImg(),this.appendDummyInput().appendField(new F.FieldDropdown(this.getLocalImg()),"type"),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")},onchange:function(){let e=this.getFieldValue("type"),t=this.imgArr;this.haveNewSrc(this.imgArr,t)&&(this.imgArr=t,this.getField("type").menuGenerator_=this.imgArr,this.checkSrc(e,this.imgArr)?this.setFieldValue(e,"type"):this.setFieldValue(this.imgArr[0][1],"type"))},haveNewSrc:function(e,t){if(e.length!==t.length)return!0;for(var n=0;n<e.length;n++)if(e[n][0].src!==t[n][0].src)return!0;return!1},checkSrc:function(e,t){for(var n=0;n<t.length;n++)if(t[n][0].src==e)return!0;return!1},getLocalImg:function(){let e=[];try{for(var t=["bg_default.png","bg_astro.png","bg_panda.jpg"],n=0;n<t.length;n++){var i={};i.src="./media/mixpyBuild/maps/"+t[n],i.width=40,i.height=45,""==t[n]?i.alt="无":i.alt="*";var r=[];r.push(i);var s=t[n].substring(0,t[n].lastIndexOf("."));s="'"+s+"'",r.push(s),e.push(r)}}catch(t){console.log(t),e=[["'无可用地图'","'无可用地图'"]]}return e.length>0?e:[["'无可用地图'","'无可用地图'"]]}},ua={init:function(){this.appendValueInput("pathtype").setCheck(null).appendField("设置路径样式为"),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},ca={init:function(){this.imgArr=this.getLocalImg(),this.appendDummyInput().appendField(new F.FieldDropdown(this.getLocalImg()),"type"),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")},onchange:function(){let e=this.getFieldValue("type"),t=this.imgArr;this.haveNewSrc(this.imgArr,t)&&(this.imgArr=t,this.getField("type").menuGenerator_=this.imgArr,this.checkSrc(e,this.imgArr)?this.setFieldValue(e,"type"):this.setFieldValue(this.imgArr[0][1],"type"))},haveNewSrc:function(e,t){if(e.length!==t.length)return!0;for(var n=0;n<e.length;n++)if(e[n][0].src!==t[n][0].src)return!0;return!1},checkSrc:function(e,t){for(var n=0;n<t.length;n++)if(t[n][0].src==e)return!0;return!1},getLocalImg:function(){let e=[];try{for(var t=["default.png","bamboo.png","pipeline.png"],n=0;n<t.length;n++){var i={};i.src="./media/mixpyBuild/path/"+t[n],i.width=40,i.height=45,i.alt="*";var r=[];r.push(i);var s=t[n].substring(0,t[n].lastIndexOf("."));s="'"+s+"'",r.push(s),e.push(r)}}catch(t){console.log(t),e=[["'无可用路径'","'无可用路径'"]]}return e.length>0?e:[["'无可用路径'","'无可用路径'"]]}},pa={init:function(){this.setColour(290),this.setPreviousStatement(!0),this.setNextStatement(!0),this.appendValueInput("posx").setCheck(null).appendField("在("),this.appendDummyInput().appendField(","),this.appendValueInput("posy").setCheck(null).appendField(""),this.appendDummyInput().appendField(")放置").appendField(new F.FieldDropdown([["障碍","'wall'"],["金币","'coin'"]]),"item"),this.setTooltip("")}},ha={init:function(){this.imgArr=this.getLocalImg(),this.appendDummyInput().appendField(new F.FieldDropdown(this.getLocalImg()),"type"),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")},onchange:function(){let e=this.getFieldValue("type"),t=this.imgArr;this.haveNewSrc(this.imgArr,t)&&(this.imgArr=t,this.getField("type").menuGenerator_=this.imgArr,this.checkSrc(e,this.imgArr)?this.setFieldValue(e,"type"):this.setFieldValue(this.imgArr[0][1],"type"))},haveNewSrc:function(e,t){if(e.length!==t.length)return!0;for(var n=0;n<e.length;n++)if(e[n][0].src!==t[n][0].src)return!0;return!1},checkSrc:function(e,t){for(var n=0;n<t.length;n++)if(t[n][0].src==e)return!0;return!1},getLocalImg:function(){let e=[];try{for(var t=["pegman.png","astro.png","panda.png","robot.png"],n=0;n<t.length;n++){var i={};i.src="./media/mixpyBuild/characters/"+t[n],i.width=40,i.height=45,i.alt="*";var r=[];r.push(i);var s=t[n].substring(0,t[n].lastIndexOf("."));s="'"+s+"'",r.push(s),e.push(r)}}catch(t){console.log(t),e=[["'无可用角色'","'无可用角色'"]]}return e.length>0?e:[["'无可用角色'","'无可用角色'"]]}},da={init:function(){this.setColour(290),this.appendValueInput("character").setCheck(null).appendField("初始化角色为"),this.appendDummyInput().appendField("面朝").appendField(new F.FieldDropdown([["北","0"],["南","2"],["西","3"],["东","1"]]),"direction"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},fa={init:function(){this.setColour(290),this.appendDummyInput().appendField("获取⻆⾊所获分数"),this.setOutput(!0,Number),this.setTooltip("")}},_a={init:function(){this.appendDummyInput().appendField(new F.FieldDropdown([["北","0"],["南","2"],["西","3"],["东","1"]]),"direction"),this.appendDummyInput().appendField("侧有障碍"),this.setInputsInline(!0),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},ma={init:function(){this.appendDummyInput().appendField("随机生成小车油量"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},ba={init:function(){this.appendDummyInput().appendField("需要加油"),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},ga={init:function(){this.appendDummyInput().appendField("信号灯为绿灯"),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},Sa={init:function(){this.appendDummyInput().appendField("信号灯为红灯"),this.setOutput(!0,null),this.setColour(290),this.setTooltip(""),this.setHelpUrl("")}},ka={init:function(){this.appendDummyInput().appendField("进加油站加油"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setColour(290),this.setTooltip("")}},ya={init:function(){this.appendDummyInput().appendField("检查程序循环数目是否正确"),this.setPreviousStatement(!0),this.setColour(290),this.setTooltip("")}},va=function(e,t){return[t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE),t.ORDER_ATOMIC]},Ta=function(e,t){if(""==this.getFieldValue("VAR"))return" = None\n";var n=t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"None";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = "+n+"\n"},Ea=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"MYVALUE",t.ORDER_ATOMIC)||"None";if("bytes"==n)var r=n+"("+i+',"UTF-8")';else r=n+"("+i+")";return[r,t.ORDER_ATOMIC]},Ia=function(e,t){return"global "+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"None")+"\n"},wa=function(e,t){return["type("+(t.valueToCode(this,"DATA",t.ORDER_ATOMIC)||"None")+")",t.ORDER_ATOMIC]},xa=function(e,t){return[this.getFieldValue("type"),t.ORDER_ATOMIC]},Aa=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"[]";return[n="zip("+n.join(", ")+")",t.ORDER_ATOMIC]},$a=function(e,t){const n=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"[]";return[`${this.getFieldValue("TYPE")}(${n})`,t.ORDER_ATOMIC]},Oa=function(e,t){var n=t.statementToCode(e,"DO");return"if __name__ == '__main__':\n"+(n=t.addLoopTrap(n,e.id)||t.PASS)},Ma=function(e,t){var n=t.statementToCode(this,"DO");return(n=n.replace(/(^\s*)|(\s*$)/g,"").replace(/\n {4}/g,"\n")).endsWith("\n")?t.setups_.setup_setup=n:t.setups_.setup_setup=n+"\n",""},Ca=function(e,t){var n=0,i="";do{i+=(0==n?"if ":"elif ")+(t.valueToCode(e,"IF"+n,t.ORDER_NONE)||"False")+":\n"+(t.statementToCode(e,"DO"+n)||t.PASS),++n}while(e.getInput("IF"+n));return e.getInput("ELSE")&&(i+="else:\n"+(t.statementToCode(e,"ELSE")||t.PASS)),i},Ra=function(e,t){var n=1,i=t.valueToCode(this,"IF"+n,t.ORDER_NONE)||"null",r="try:\n"+(t.statementToCode(this,"try")||" pass\n");for(n=1;n<=this.elseifCount_;n++)""!==(i=t.valueToCode(this,"IF"+n,t.ORDER_NONE)||"")&&(i=" "+i),r+="except"+i+": \n"+(t.statementToCode(this,"DO"+n)||" pass\n");return this.elseCount_&&(r+="finally:\n"+(t.statementToCode(this,"ELSE")||" pass\n")),r},Na=function(e,t){var n=t.variableDB_.getName(e.getFieldValue("VAR"),F.Variables.NAME_TYPE),i=t.valueToCode(e,"FROM",t.ORDER_NONE)||"0",r=t.valueToCode(e,"TO",t.ORDER_NONE)||"0",s=t.valueToCode(e,"STEP",t.ORDER_NONE)||"1",o=t.statementToCode(e,"DO"),a=(o=t.addLoopTrap(o,e.id)||t.PASS,""),l=function(e,t){return t.provideFunction_("upRange",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start <= stop:"," yield start"," start += abs(step)"])},u=function(e,t){return t.provideFunction_("downRange",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(start, stop, step):"," while start >= stop:"," yield start"," start -= abs(step)"])};if(e=function(e,t,n){return"("+e+" <= "+t+") and "+l()+"("+e+", "+t+", "+n+") or "+u()+"("+e+", "+t+", "+n+")"},F.isNumber(i)&&F.isNumber(r)&&F.isNumber(s))i=parseFloat(i),r=parseFloat(r),s=Math.abs(parseFloat(s)),0==i%1&&0==r%1&&0==s%1?(i<=r?(r++,e=0==i&&1==s?r:i+", "+r,1!=s&&(e+=", "+s)):e=i+", "+--r+", -"+s,e="range("+e+")"):(e=i<r?l():u(),e+="("+i+", "+r+", "+s+")");else{var c=function(e,i){if(F.isNumber(e))e=parseFloat(e);else{var r=t.variableDB_.getDistinctName(n+i,F.Variables.NAME_TYPE);a+=r+" = "+e+"\n",e=r}return e};i=c(i,"_start"),r=c(r,"_end");c(s,"_inc"),e="number"==typeof i&&"number"==typeof r?i<r?l(0,r):u(0,r):e(i,r,s)}return a+="for "+n+" in "+e+":\n"+o},La=function(e,t){var n=t.variableDB_.getName(e.getFieldValue("VAR"),F.Variables.NAME_TYPE),i=t.valueToCode(e,"FROM",t.ORDER_NONE)||"0",r=t.valueToCode(e,"TO",t.ORDER_NONE)||"0",s=t.valueToCode(e,"STEP",t.ORDER_NONE)||"1",o=t.statementToCode(e,"DO"),a=t.addLoopTrap(o,e.id)||t.PASS;return t.setups_.mixly_range="def mixly_range(start, stop, step):\n for i in range(start, stop + 1, step):\n yield i\n\n","for "+n+" in mixly_range("+i+", "+r+", "+s+"):\n"+a},Da=function(e,t){var n="UNTIL"==e.getFieldValue("MODE"),i=t.valueToCode(e,"BOOL",t.ORDER_NONE)||"False",r=t.statementToCode(e,"DO");return n&&(i="not "+i),"while "+i+":\n"+(r=t.addLoopTrap(r,e.id)||t.PASS)},Pa=function(e){switch(e.getFieldValue("FLOW")){case"BREAK":return"break\n";case"CONTINUE":return"continue\n"}throw"Unknown flow statement."},Fa=function(e,t){return"sleep("+(t.valueToCode(this,"DELAY_TIME",t.ORDER_ATOMIC)||"1000")+")\n"},Ba=function(e,t){return"panic("+(t.valueToCode(this,"STATUS_CODE",t.ORDER_ATOMIC)||"1000")+")\n"},ja=function(e,t){t.definitions_.import_time="import time";return["time.time()",t.ORDER_ATOMIC]},Va=function(e,t){return t.definitions_.import_microbit="from microbit import *","reset()\n"},Ua=function(){return"interrupts();\n"},Ya=function(){return"noInterrupts();\n"},Ga=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"''",i=t.valueToCode(e,"LIST",t.ORDER_RELATIONAL)||"[]",r=t.statementToCode(e,"DO");return"for "+n+" in "+i+":\n"+(r=t.addLoopTrap(r,e.id)||t.PASS)},Xa=function(e,t){return["range("+(t.valueToCode(this,"FROM",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"TO",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"STEP",t.ORDER_NONE)||"1")+")",t.ORDER_ATOMIC]},Ha=function(e,t){var n="lambda "+(t.valueToCode(e,"BOOL",t.ORDER_NONE)||"None")+": "+(t.statementToCode(e,"DO")||"pass");return[n=n.replace("\n","").replace(" ",""),t.ORDER_ATOMIC]},za=function(e,t){return t.definitions_.import_time="import time","time.sleep("+(t.valueToCode(this,"DELAY_TIME",t.ORDER_ATOMIC)||"1000")+")\n"},qa=function(){return"pass\n"},Wa=function(e,t){t.definitions_.import__thread="import _thread";var n=t.valueToCode(this,"VAR",t.ORDER_NONE)||"None";return"_thread.start_new_thread("+t.variableDB_.getName(t.valueToCode(this,"callback",t.ORDER_NONE)||"None",F.Procedures.NAME_TYPE)+", "+n+")\n"},Ka=function(e,t){var n=t.valueToCode(this,"select_data",t.ORDER_NONE)||"False",i=t.statementToCode(this,"input_data");return i="true"==this.getFieldValue("type")?i+" if ("+n+"):\n break\n":i+" if not ("+n+"):\n break\n","while True:\n"+(i=t.addLoopTrap(i,this.id)||t.PASS)},Ja=function(e,t){var n=t.valueToCode(this,"TIMES",t.ORDER_ATOMIC),i=t.statementToCode(e,"DO");return"for _my_variable in range("+n+"):\n"+(i=t.addLoopTrap(i,e.id)||t.PASS)},Qa=function(e,t){t.definitions_.import_gc="import gc";return"gc.collect()\n"},Za=function(e,t){t.definitions_.import_gc="import gc";return["gc.mem_alloc()",t.ORDER_ATOMIC]},el=function(e,t){t.definitions_.import_gc="import gc";return["gc.mem_free()",t.ORDER_ATOMIC]},tl=function(e,t){t.definitions_.import_machine="import machine";return["machine.unique_id()",t.ORDER_ATOMIC]},nl=Ja,il=function(e,t){return t.definitions_.import_datetime="import datetime",["datetime.datetime.fromtimestamp("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},rl=function(e,t){var n=B.Boards.getSelectedBoardKey().split(":")[2];t.definitions_["import_"+n+"uuid"]="from "+n+" import uuid";return["uuid()",t.ORDER_ATOMIC]},sl=function(e,t){var n=this.getFieldValue("NUM");return[n,n<0?t.ORDER_UNARY_PREFIX:t.ORDER_ATOMIC]},ol=function(e,t){return t.definitions_.import_math="import math",["math."+this.getFieldValue("CONSTANT"),t.ORDER_ATOMIC]},al=function(e,t){return t.definitions_.import_math="import math",["math."+this.getFieldValue("CONSTANT"),t.ORDER_ATOMIC]},ll=function(e,t){var n=this.getFieldValue("OP"),i=t.ORDER_ATOMIC;return["("+(t.valueToCode(this,"A",i)||"0")+n+(t.valueToCode(this,"B",i)||"0")+")",i]},ul=function(e,t){var n=(i={ADD:[" + ",t.ORDER_ADDITIVE],MINUS:[" - ",t.ORDER_ADDITIVE],MULTIPLY:[" * ",t.ORDER_MULTIPLICATIVE],DIVIDE:[" / ",t.ORDER_MULTIPLICATIVE],QUYU:[" % ",t.ORDER_MULTIPLICATIVE],ZHENGCHU:[" // ",t.ORDER_MULTIPLICATIVE],POWER:[" ** ",t.ORDER_EXPONENTIATION]}[e.getFieldValue("OP")])[0],i=i[1];return[(t.valueToCode(e,"A",i)||"0")+n+(e=t.valueToCode(e,"B",i)||"0"),i]},cl=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_RELATIONAL)||"0",i=t.valueToCode(this,"B",t.ORDER_RELATIONAL)||"0";switch(this.getFieldValue("OP")){case"ADD":var r="+=";break;case"MINUS":r="-=";break;case"MULTIPLY":r="*=";break;case"DIVIDE":r="/=";break;case"QUYU":r="%=";break;case"ZHENGCHU":r="//=";break;case"POWER":r="**="}return n+" "+r+" "+i+"\n"},pl=function(e,t){var n,i=e.getFieldValue("OP");if("NEG"==i)return["-"+(n=t.valueToCode(e,"NUM",t.ORDER_UNARY_SIGN)||"0"),t.ORDER_UNARY_SIGN];switch(t.definitions_.import_math="import math",e="SIN"==i||"COS"==i||"TAN"==i?t.valueToCode(e,"NUM",t.ORDER_MULTIPLICATIVE)||"0":t.valueToCode(e,"NUM",t.ORDER_NONE)||"0",i){case"ABS":n="math.fabs("+e+")";break;case"ROOT":n="math.sqrt("+e+")";break;case"LN":n="math.log("+e+")";break;case"LOG10":n="math.log10("+e+")";break;case"EXP":n="math.exp("+e+")";break;case"POW10":n="math.pow(10,"+e+")";break;case"ROUND":n="round("+e+")";break;case"ROUNDUP":n="math.ceil("+e+")";break;case"ROUNDDOWN":n="math.floor("+e+")";break;case"SIN":n="math.sin("+e+")";break;case"COS":n="math.cos("+e+")";break;case"TAN":n="math.tan("+e+")";break;case"++":n="++("+e+")";break;case"--":n="--("+e+")";break;case"-":n="-("+e+")"}if(n)return[n,t.ORDER_EXPONENTIATION];switch(i){case"ASIN":n="math.degrees(math.asin("+e+"))";break;case"ACOS":n="math.degrees(math.acos("+e+"))";break;case"ATAN":n="math.degrees(math.atan("+e+"))"}return[n,t.ORDER_MULTIPLICATIVE]},hl=pl,dl=function(e,t){var n=t.valueToCode(this,"NUM",t.ORDER_NONE)||"0";return[this.getFieldValue("OP")+"("+n+")",t.ORDER_ATOMIC]},fl=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_NONE)||"0",i=this.getFieldValue("OP"),r="";return"round"===i?r=i+"("+n+")":(r="math."+i+"("+n+")",t.definitions_.import_math="import math"),[r,t.ORDER_ATOMIC]},_l=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_NONE)||"0",i=t.valueToCode(this,"B",t.ORDER_NONE)||"0";return[this.getFieldValue("OP")+"("+n+", "+i+")",t.ORDER_ATOMIC]},ml=function(e,t){t.definitions_.import_random="import random";var n=this.getFieldValue("TYPE"),i=t.valueToCode(this,"FROM",t.ORDER_NONE)||"0",r=t.valueToCode(this,"TO",t.ORDER_NONE)||"0";if("int"==n)var s="random.randint("+i+", "+r+")";else if("float"==n)s="random.uniform("+i+", "+r+")";return[s,t.ORDER_UNARY_POSTFIX]},bl=function(e,t){var n=t.valueToCode(this,"NUM",t.ORDER_NONE),i=t.valueToCode(this,"fromLow",t.ORDER_ATOMIC),r=t.valueToCode(this,"fromHigh",t.ORDER_ATOMIC),s=t.valueToCode(this,"toLow",t.ORDER_ATOMIC),o=t.valueToCode(this,"toHigh",t.ORDER_ATOMIC);return t.definitions_.import_mixpy_math_map="from mixpy import math_map",["math_map("+n+", "+i+", "+r+", "+s+", "+o+")",t.ORDER_NONE]},gl=function(e,t){return["min(max("+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"LOW",t.ORDER_NONE)||"0")+"), "+(t.valueToCode(this,"HIGH",t.ORDER_NONE)||"0")+")",t.ORDER_UNARY_POSTFIX]},Sl=function(e,t){var n=e.getFieldValue("OP"),i=t.valueToCode(this,"NUM",t.ORDER_NONE)||"0",r=e.getFieldValue("OP2");t.definitions_.import_math="import math";var s="",o="10";if("two"==n?o="2":"eight"==n?o="8":"ten"==n?o="10":"sixteen"==n&&(o="16"),"two"==r?s="bin":"eight"==r?s="oct":"ten"==r?s="":"sixteen"==r&&(s="hex"),""==s)var a="int(str("+i+"), "+o+")";else a=s+"(int(str("+i+"), "+o+"))";return[a,t.ORDER_ATOMIC]},kl=function(e,t){return t.definitions_.import_random="import random","random.seed("+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+");\n"},yl=function(e,t){var n=this.getFieldValue("NUM");return[n,n<0?t.ORDER_UNARY_PREFIX:t.ORDER_ATOMIC]},vl=function(e,t){return["round("+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"VAR",t.ORDER_NONE)||"0")+")",t.ORDER_ATOMIC]},Tl=function(e,t){var n=this.getFieldValue("TOWHAT"),i=t.valueToCode(this,"VAR",t.ORDER_ATOMIC);return"b"==n?[i+'.encode("utf-8")',t.ORDER_ATOMIC]:"bti"==n?["int.from_bytes("+i+',"big")',t.ORDER_ATOMIC]:[n+"("+i+")",t.ORDER_ATOMIC]},El=function(e,t){var n=this.getFieldValue("TOWHAT"),i=t.valueToCode(this,"VAR",t.ORDER_ATOMIC);return"b"==n?[i+'.encode("utf-8")',t.ORDER_ATOMIC]:[n+"("+i+")",t.ORDER_ATOMIC]},Il=bl,wl=function(e,t){return t.definitions_.import_hexlify="from ubinascii import hexlify",["hexlify("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+").decode()",t.ORDER_ATOMIC]},xl=function(e,t){t.definitions_.import_itertools="import itertools";let n=t.valueToCode(this,"REPEAT",t.ORDER_ATOMIC),i=new Array(this.itemCount_);for(let e=0;e<this.itemCount_;e++)i[e]=t.valueToCode(this,`ADD${e}`,t.ORDER_NONE)||"0";let r="";return this.itemCount_&&(r=`itertools.product(${i.join(", ")}, repeat=${n})`),[r,t.ORDER_ATOMIC]},Al=function(e,t){return t.definitions_.import_math="import math",["math.degrees("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},$l=function(e,t){return t.definitions_.import_math="import math",["math.radians("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Ol=function(e,t){return[t.quote_(this.getFieldValue("TEXT")),t.ORDER_ATOMIC]},Ml=function(e,t){return['"""'+this.getFieldValue("VALUE")+'"""',t.ORDER_ATOMIC]},Cl=function(e,t){return[`b'${this.getFieldValue("TEXT")}'`,t.ORDER_ATOMIC]},Rl=function(e,t){return["'"+this.getFieldValue("TEXT")+"'",t.ORDER_ATOMIC]},Nl=function(e,t){return[t.valueToCode(this,"A",t.ORDER_ATOMIC)+" + "+t.valueToCode(this,"B",t.ORDER_ATOMIC),t.ORDER_ADDITIVE]},Ll=function(e,t){return["chr("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Dl=function(e,t){return["ord("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"a")+")",t.ORDER_ATOMIC]},Pl=function(e,t){return["str("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Fl=function(e,t){return["len("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Bl=function(e,t){var n=e.getFieldValue("WHERE")||"FROM_START",i=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""';switch(n){case"FROM_START":return[i+"["+(e=t.getAdjustedInt(e,"AT"))+"]",t.ORDER_ATOMIC];case"FROM_END":return[i+"["+(e=t.getAdjustedInt(e,"AT",1,!0))+"]",t.ORDER_ATOMIC];case"RANDOM":return t.definitions_.import_random="import random",["random.choice("+i+")",t.ORDER_FUNCTION_CALL]}throw"Unhandled combination (lists_getIndex)."},jl=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+"["+(t.valueToCode(this,"AT",t.ORDER_ATOMIC)||0)+"]",t.ORDER_ATOMIC]},Vl=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""';return t.definitions_.import_random="import random",["random.choice("+n+")",t.ORDER_FUNCTION_CALL]},Ul=function(e,t){var n=t.valueToCode(this,"STR1",t.ORDER_ATOMIC)||'""',i=t.valueToCode(this,"STR2",t.ORDER_ATOMIC)||'""',r=this.getFieldValue("DOWHAT");return"==="===r?[n+" == "+i,t.ORDER_ATOMIC]:[n+"."+r+"("+i+")",t.ORDER_ATOMIC]},Yl=function(e,t){return["cmp("+(t.valueToCode(this,"STR1",t.ORDER_ATOMIC)||'""')+","+(t.valueToCode(this,"STR2",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Gl=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""',i=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2");switch(i){case"FROM_START":"0"==(s=t.getAdjustedInt(e,"AT1"))&&(s="");break;case"FROM_END":var s=t.getAdjustedInt(e,"AT1",0,!0);break;case"FIRST":s="0";break;default:throw"Unhandled option (lists_getSublist)"}switch(r){case"FROM_START":var o=t.getAdjustedInt(e,"AT2");break;case"FROM_END":o=t.getAdjustedInt(e,"AT2",0,!0);F.isNumber(String(o))?"0"==o&&(o=""):(t.definitions_.import_sys="import sys",o+=" or sys.maxsize");break;case"LAST":o="-1";break;default:throw"Unhandled option (lists_getSublist)"}return[n+"["+s+" : "+o+"]",t.ORDER_ATOMIC]},Xl=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+"["+t.valueToCode(this,"AT1",t.ORDER_ATOMIC)+" : "+t.valueToCode(this,"AT2",t.ORDER_ATOMIC)+"]",t.ORDER_ATOMIC]},Hl=function(e,t){var n=this.getFieldValue("CAPITAL");return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+"."+n+"()",t.ORDER_ATOMIC]},zl=function(e,t){var n=this.getFieldValue("CENTER");return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+"."+n+"("+t.valueToCode(this,"WID",t.ORDER_ATOMIC)+","+t.valueToCode(this,"Symbol",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},ql=function(e,t){return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".find("+t.valueToCode(this,"STR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Wl=function(e,t){return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".join("+(t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},Kl=function(e,t){return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+".replace("+t.valueToCode(this,"STR1",t.ORDER_ATOMIC)+","+t.valueToCode(this,"STR2",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Jl=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+".split("+(t.valueToCode(this,"VAL",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Ql=function(e,t){var n=this.getFieldValue("TOWHAT");return[t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+"."+n+"()",t.ORDER_ATOMIC]},Zl=function(e,t){for(var n=this.getFieldValue("VAR"),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return[i=n+".format("+i.join(", ")+")",t.ORDER_ATOMIC]},eu=function(e,t){for(var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return[i=n+".format("+i.join(", ")+")",t.ORDER_ATOMIC]},tu=Xl,nu=Yl,iu=jl,ru=function(e,t){var n=this.getFieldValue("DIR"),i=this.getFieldValue("CODE");return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+"."+n+'("'+i+'")',t.ORDER_ATOMIC]},su=function(e,t){return["eval("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},ou=function(e,t){return t.definitions_.import_os="import os","os.system("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},au=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+"["+t.valueToCode(this,"AT1",t.ORDER_ADDITIVE)+" : "+t.valueToCode(this,"AT2",t.ORDER_ADDITIVE)+"]",t.ORDER_ATOMIC]},lu=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ATOMIC)||"mylist")+"["+(t.valueToCode(this,"row",t.ORDER_ATOMIC)||0)+","+(t.valueToCode(this,"col",t.ORDER_ATOMIC)||0)+"]",t.ORDER_ATOMIC]},uu=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ATOMIC)||"mylist")+"["+(t.valueToCode(this,"row_start",t.ORDER_ATOMIC)||0)+" : "+(t.valueToCode(this,"row_end",t.ORDER_ATOMIC)||1)+","+(t.valueToCode(this,"col_start",t.ORDER_ATOMIC)||0)+" : "+(t.valueToCode(this,"col_end",t.ORDER_ATOMIC)||1)+"]",t.ORDER_ATOMIC]},cu=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return i=n+" = ["+i.join(", ")+"]\n"},pu=function(e,t){return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = ["+this.getFieldValue("TEXT")+"]\n"},hu=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+"["+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||0)+"]",t.ORDER_ATOMIC]},du=function(e,t){return(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+"["+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"0")+"] = "+(t.valueToCode(this,"TO",t.ORDER_ASSIGNMENT)||"0")+"\n"},fu=function(e,t){var n=t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"DATA",t.ORDER_ASSIGNMENT)||"0";return n+"."+this.getFieldValue("OP")+"("+i+")\n"},_u=function(e,t){return t.definitions_.import_random="import random",["random.choice("+(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+")",t.ORDER_ATOMIC]},mu=function(e,t){return t.definitions_.import_random="import random",["random.sample("+(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+","+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},bu=function(e,t){return(t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0")+".insert("+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"0")+", "+(t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"0")+")\n"},gu=function(e,t){return(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+".reverse()\n"},Su=function(e,t){return(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+".clear()\n"},ku=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0";if("INDEX"==n)var s=i+".index("+r+")";else if("COUNT"==n)s=i+".count("+r+")";return[s,t.ORDER_ATOMIC]},yu=function(e,t){var n=t.valueToCode(this,"LIST",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"DATA",t.ORDER_ASSIGNMENT)||"0";return"del"==this.getFieldValue("OP")?"del "+n+"["+i+"]\n":n+".remove("+i+")\n"},vu=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+".pop("+(t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},Tu=function(e,t){var n,i=e.getFieldValue("OP");switch(t.definitions_.import_math="import math",e=t.valueToCode(e,"data",t.ORDER_NONE),i){case"LEN":n="len("+e+")";break;case"SUM":n="sum("+e+")";break;case"MIN":n="min("+e+")";break;case"MAX":n="max("+e+")";break;case"AVERAGE":t.definitions_.import_mixpy_math_mean="from mixpy import math_mean",n="math_mean("+e+")";break;case"MEDIAN":t.definitions_.import_mixpy_math_median="from mixpy import math_median",n="math_median("+e+")";break;case"MODE":t.definitions_.import_mixpy_math_modes="from mixpy import math_modes",n="math_modes("+e+")";break;case"STD_DEV":t.definitions_.import_mixpy_math_standard_deviation="from mixpy import math_standard_deviation",n="math_standard_deviation("+e+")";break;default:throw"Unknown operator: "+i}if(n)return[n,t.ORDER_ATOMIC]},Eu=function(e,t){return t.definitions_.import_mixpy_lists_sort="from mixpy import lists_sort",["lists_sort("+(t.valueToCode(e,"LIST",t.ORDER_NONE)||"[]")+', "'+e.getFieldValue("TYPE")+'", '+("1"===e.getFieldValue("DIRECTION")?"False":"True")+")",t.ORDER_ATOMIC]},Iu=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r="";return"array"==n?(t.definitions_.import_numpy="import numpy",r="numpy.array("+i+")"):r=n+"("+i+")",[r,t.ORDER_ATOMIC]},wu=function(e,t){return["["+this.getFieldValue("CONTENT")+"]",t.ORDER_ATOMIC]},xu=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0";return[n="["+n.join(", ")+"]",t.ORDER_ATOMIC]},Au=Iu,$u=function(e,t){return"del "+(t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0")+"\n"},Ou=cu,Mu=pu,Cu=hu,Ru=au,Nu=du,Lu=bu,Du=yu,Pu=function(e,t){return["list("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},Fu=function(e,t){return[(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+".tolist()",t.ORDER_ATOMIC]},Bu=function(e,t){return["enumerate("+(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist")+",start="+(t.valueToCode(this,"VALUE",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},ju=function(e,t){var n=t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"mylist";return[(t.valueToCode(this,"CON",t.ORDER_ASSIGNMENT)||"0")+" in "+n,t.ORDER_ATOMIC]},Vu=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++){var s=this.getFieldValue("KEY"+r);i[r]=s+":"+(t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0")}return i=n+"= {"+i.join(", ")+"}\n"},Uu=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".keys()",t.ORDER_ATOMIC]},Yu=function(e,t){var n=B.Boards.getSelectedBoardKey().split(":")[2],i=t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT);if("educore"==n)var s=i+".get("+r+")";else s=i+"["+r+"]";return[s,t.ORDER_ATOMIC]},Gu=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".get("+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+","+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},Xu=function(e,t){return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"mydict")+"["+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+"] = "+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+"\n"},Hu=function(e,t){return"del "+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"mydict")+"["+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+"]\n"},zu=function(e,t){var n=t.valueToCode(this,"DICT2",t.ORDER_ASSIGNMENT)||"0";return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".update("+n+")\n"},qu=function(e,t){return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".clear()\n"},Wu=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".items()",t.ORDER_ATOMIC]},Ku=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".values()",t.ORDER_ATOMIC]},Ju=function(e,t){return["len("+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},Qu=function(e,t){return"del "+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+"\n"},Zu=function(e,t){var n=t.valueToCode(e,"DICT",t.ORDER_MEMBER)||"[]",i=e.getFieldValue("WHERE"),r=t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT);switch(i){case"INSERT":var s=n+"["+r+"] = "+(t.valueToCode(this,"AT2",t.ORDER_ASSIGNMENT)||"0")+"\n";break;case"DELETE":s="del "+n+"["+r+"]\n";break;default:throw"Unhandled option (lists_setIndex2)"}return s},ec=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+".pop("+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+")",t.ORDER_ATOMIC]},tc=function(e,t){return(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"mydict")+".setdefault("+t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT)+","+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")\n"},nc=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++){var r=this.getFieldValue("KEY"+i);n[i]=r+": "+(t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0")}return[n="{"+n.join(", ")+"}",t.ORDER_ATOMIC]},ic=function(e,t){return["dict("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},rc=function(e,t){return t.definitions_.import_json="import json",["json.dumps("+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},sc=function(e,t){return t.definitions_.import_json="import json",["json.loads("+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"null")+")",t.ORDER_ATOMIC]},oc=function(e,t){return[(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+"["+(t.valueToCode(this,"VAR1",t.ORDER_ASSIGNMENT)||"null")+"]["+(t.valueToCode(this,"VAR2",t.ORDER_ASSIGNMENT)||"null")+"]["+(t.valueToCode(this,"VAR3",t.ORDER_ASSIGNMENT)||"null")+"]["+(t.valueToCode(this,"VAR4",t.ORDER_ASSIGNMENT)||"null")+"]",t.ORDER_ATOMIC]},ac=function(e,t){return t.definitions_.import_json="import json",t.definitions_.import_ujson="import ujson",["ujson.loads("+(t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},lc=function(e,t){var n=this.getFieldValue("OP"),i=lc.OPERATORS[n],r="=="==i||"!="==i?t.ORDER_EQUALITY:t.ORDER_RELATIONAL;return[(t.valueToCode(this,"A",r)||"0")+" "+i+" "+(t.valueToCode(this,"B",r)||"0"),r]},uc=function(e,t){var n=this.getFieldValue("OP1"),i=lc.OPERATORS[n],r=this.getFieldValue("OP2"),s=lc.OPERATORS[r];return[(t.valueToCode(this,"A",t.ORDER_RELATIONAL)||"0")+" "+i+" "+(t.valueToCode(this,"B",t.ORDER_RELATIONAL)||"0")+" "+s+" "+(t.valueToCode(this,"C",t.ORDER_RELATIONAL)||"0"),t.ORDER_RELATIONAL]};lc.OPERATORS={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="};const cc=function(e,t){var n=this.getFieldValue("OP"),i="&&"==n?t.ORDER_LOGICAL_AND:t.ORDER_LOGICAL_OR,r=t.valueToCode(this,"A",i)||"False",s=t.valueToCode(this,"B",i)||"False";if("AND"==n)var o=r+" and "+s;else if("OR"==n)o=r+" or "+s;else if("NOR"==n)o="not("+r+"^"+s+")";else o=r+"^"+s;return[o,i]},pc=function(e,t){var n=t.ORDER_UNARY_PREFIX;return["not "+(t.valueToCode(this,"BOOL",n)||"False"),n]},hc=function(e,t){return["TRUE"==this.getFieldValue("BOOL")?"True":"False",t.ORDER_ATOMIC]},dc=function(e,t){return["None",t.ORDER_ATOMIC]},fc=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"False";return["("+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"False")+" if "+n+" else "+(t.valueToCode(this,"C",t.ORDER_ATOMIC)||"False")+")",t.ORDER_ATOMIC]},_c=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''";return[n+" "+this.getFieldValue("BOOL")+" "+i,t.ORDER_ATOMIC]},mc=function(e,t){var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''";return[n+" "+this.getFieldValue("BOOL")+" "+i,t.ORDER_ATOMIC]},bc=function(e,t){return["bool("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},gc=function(e,t){return t.definitions_.import_os="import os","os.startfile("+t.valueToCode(this,"fn",t.ORDER_ATOMIC)+")\n"},Sc=function(e,t){return t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+" = open("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"')\n"},kc=function(e,t){return["open("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"')",t.ORDER_ATOMIC]},yc=function(e,t){return["open("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", '"+this.getFieldValue("MODE")+"', encoding=\""+this.getFieldValue("CODE")+'")',t.ORDER_ATOMIC]},vc=function(e,t){var n=t.valueToCode(this,"data",t.ORDER_ATOMIC);return t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".write("+n+")\n"},Tc=function(e,t){var n=this.getFieldValue("MODE");return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+"."+n+"()",t.ORDER_ATOMIC]},Ec=function(e,t){var n=this.getFieldValue("MODE");return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+"."+n+"("+t.valueToCode(this,"SIZE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Ic=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".readline("+t.valueToCode(this,"SIZE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},wc=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".writable()",t.ORDER_ATOMIC]},xc=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".name()",t.ORDER_ATOMIC]},Ac=function(e,t){return t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".close()\n"},$c=function(e,t){t.definitions_.import_os="import os";return["os.listdir()",t.ORDER_ATOMIC]},Oc=function(e,t){return t.definitions_.import_os="import os","os."+this.getFieldValue("MODE")+"("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},Mc=function(e,t){return t.definitions_.import_os="import os",["os.path.getsize("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},Cc=function(e,t){return[t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".tell()",t.ORDER_ATOMIC]},Rc=function(e,t){var n=this.getFieldValue("MODE"),i=0;return i="start"==n?0:"current"==n?1:2,t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+".seek("+t.valueToCode(this,"SIZE",t.ORDER_ATOMIC)+","+i+")\n"},Nc=function(e,t){return t.definitions_.import_os="import os","os.chdir("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},Lc=function(e,t){t.definitions_.import_os="import os";return["os.getcwd()",t.ORDER_ATOMIC]},Dc=function(e,t){return t.definitions_.import_os="import os","os."+this.getFieldValue("MODE")+"("+t.valueToCode(this,"PATH",t.ORDER_ATOMIC)+")\n"},Pc=function(e,t){return t.definitions_.import_os="import os","os.rename("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+","+t.valueToCode(this,"NEWFILE",t.ORDER_ATOMIC)+")\n"},Fc=function(e,t){t.definitions_.import_os="import os";var n=t.valueToCode(this,"FILE",t.ORDER_ATOMIC);return["os."+this.getFieldValue("MODE")+"("+n+")",t.ORDER_ATOMIC]},Bc=function(e,t){return t.definitions_.import_os="import os",t.definitions_.import_sdcard="import sdcard",t.valueToCode(this,"SUB",t.ORDER_ATOMIC)+" = sdcard.SDCard("+t.valueToCode(this,"SPISUB",t.ORDER_ATOMIC)+","+t.valueToCode(this,"PINSUB",t.ORDER_ATOMIC)+")\n"},jc=function(e,t){return t.definitions_.import_os="import os",t.definitions_.import_sdcard="import sdcard","os.mount("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+t.valueToCode(this,"DIR",t.ORDER_ATOMIC)+")\n"},Vc=function(e,t){var n=t.variableDB_.getName(this.getFieldValue("NAME"),F.Procedures.NAME_TYPE),i=(this.getInput("STACK")&&t.statementToCode(this,"STACK"))??" pass\n";t.INFINITE_LOOP_TRAP&&(i=t.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+this.id+"'")+i);var r=t.valueToCode(this,"RETURN",t.ORDER_NONE)||"";r&&(r=" return "+r+"\n");for(var s=[],o=0;o<this.arguments_.length;o++){var a=t.variableDB_.getName(this.arguments_[o],F.Variables.NAME_TYPE);s[o]=a}var l="def "+n+"("+s.join(", ")+"):\n"+i+r+"\n";return l=t.scrub_(this,l),t.setups_[n]=l,null},Uc=function(e,t){var n=t.variableDB_.getName(this.getFieldValue("NAME"),F.Procedures.NAME_TYPE),i=(this.getInput("STACK")&&t.statementToCode(this,"STACK"))??" pass\n";t.INFINITE_LOOP_TRAP&&(i=t.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+this.id+"'")+i);for(var r=[],s=0;s<this.arguments_.length;s++){var o=t.variableDB_.getName(this.arguments_[s],F.Variables.NAME_TYPE);r[s]=o}var a="def "+n+"("+r.join(", ")+"):\n"+i+"\n";return a=t.scrub_(this,a),t.setups_[n]=a,null},Yc=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("NAME"),F.Procedures.NAME_TYPE),i=[],r=0;r<this.arguments_.length;r++)i[r]=t.valueToCode(this,"ARG"+r,t.ORDER_NONE)||"null";return[n+"("+i.join(", ")+")",t.ORDER_UNARY_POSTFIX]},Gc=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("NAME"),F.Procedures.NAME_TYPE),i=[],r=0;r<this.arguments_.length;r++)i[r]=t.valueToCode(this,"ARG"+r,t.ORDER_NONE)||"null";return n+"("+i.join(", ")+")\n"},Xc=function(e,t){var n="if ("+(t.valueToCode(this,"CONDITION",t.ORDER_NONE)||"False")+") :\n";this.hasReturnValue_?n+=" return "+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"None"):n+=" return None";return n+="\n"},Hc=function(e,t){var n="";this.hasReturnValue_?n+="return "+(t.valueToCode(this,"VALUE",t.ORDER_NONE)||"None"):n+="return None";return n+="\n"},zc=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";if(1!=this.itemCount_)i=n+"= ("+i.join(", ")+")\n";else i=n+"= ("+i.join(", ")+",)\n";return i},qc=function(e,t){return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+"= ("+this.getFieldValue("TEXT")+")\n"},Wc=function(e,t){return["("+this.getFieldValue("TEXT")+")",t.ORDER_ATOMIC]},Kc=function(e,t){var n=t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"1";return i.match(/^\d+$/)&&(i=parseInt(i,10)),[n+"["+i+"]",t.ORDER_ATOMIC]},Jc=function(e,t){return["len("+(t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},Qc=function(e,t){return"del "+(t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0")+"\n"},Zc=function(e,t){return[(t.valueToCode(this,"TUP1",t.ORDER_ASSIGNMENT)||"0")+" + "+(t.valueToCode(this,"TUP2",t.ORDER_ASSIGNMENT)||"0"),t.ORDER_ATOMIC]},ep=function(e,t){var n=t.valueToCode(this,"TUP",t.ORDER_ASSIGNMENT)||"0";return[this.getFieldValue("DIR")+"("+n+")",t.ORDER_ATOMIC]},tp=function(e,t){return[this.getFieldValue("OP")+"("+(t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0")+")\n",t.ORDER_ATOMIC]},np=function(e,t){var n=this.getFieldValue("OP"),i=t.valueToCode(this,"VAR",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0";if("INDEX"==n)var s=i+".index("+r+")";else if("COUNT"==n)s=i+".count("+r+")";return[s,t.ORDER_ATOMIC]},ip=function(e,t){var n,i=e.getFieldValue("OP");switch(t.definitions_.import_math="import math",e=t.valueToCode(e,"data",t.ORDER_NONE),i){case"LEN":n="len("+e+")";break;case"SUM":n="sum("+e+")";break;case"MIN":n="min("+e+")";break;case"MAX":n="max("+e+")";break;case"AVERAGE":n=t.provideFunction_("math_mean",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = [e for e in myList if type(e) == int or type(e) == float]"," if not localList: return"," return float(sum(localList)) / len(localList)"])+"("+e+")";break;case"MEDIAN":n=t.provideFunction_("math_median",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(myList):"," localList = sorted([e for e in myList if type(e) == int or type(e) == float])"," if not localList: return"," if len(localList) % 2 == 0:"," return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0"," else:"," return localList[(len(localList) - 1) // 2]"])+"("+e+")";break;case"MODE":n=t.provideFunction_("math_modes",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(some_list):"," modes = []"," # Using a lists of [item, count] to keep count rather than dict",' # to avoid "unhashable" errors when the counted item is itself a list or dict.'," counts = []"," maxCount = 1"," for item in some_list:"," found = False"," for count in counts:"," if count[0] == item:"," count[1] += 1"," maxCount = max(maxCount, count[1])"," found = True"," if not found:"," counts.append([item, 1])"," for counted_item, item_count in counts:"," if item_count == maxCount:"," modes.append(counted_item)"," return modes"])+"("+e+")";break;case"STD_DEV":t.definitions_.import_math="import math",n=t.provideFunction_("math_standard_deviation",["def "+t.FUNCTION_NAME_PLACEHOLDER_+"(numbers):"," n = len(numbers)"," if n == 0: return"," mean = float(sum(numbers)) / n"," variance = sum((x - mean) ** 2 for x in numbers) / n"," return math.sqrt(variance)"])+"("+e+")";break;default:throw"Unknown operator: "+i}if(n)return[n,t.ORDER_FUNCTION_CALL]},rp=function(e,t){var n=t.valueToCode(e,"LIST",t.ORDER_MEMBER)||"[]",i=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2");switch(i){case"FROM_START":"0"==(s=t.getAdjustedInt(e,"AT1"))&&(s="");break;case"FROM_END":var s=t.getAdjustedInt(e,"AT1",1,!0);break;case"FIRST":s="0";break;default:throw"Unhandled option (lists_getSublist)"}switch(r){case"FROM_START":var o=t.getAdjustedInt(e,"AT2",1);o-=1;break;case"FROM_END":o=t.getAdjustedInt(e,"AT2",1,!0);F.isNumber(String(o))?"0"==o&&(o=""):(t.definitions_.import_sys="import sys",o+=" or sys.maxsize");break;case"LAST":o="-1";break;default:throw"Unhandled option (lists_getSublist)"}return[n+"["+s+" : "+o+"]",t.ORDER_MEMBER]},sp=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0";if(1!=this.itemCount_)n="("+n.join(", ")+")";else n="("+n.join(", ")+",)";return[n,t.ORDER_ATOMIC]},op=function(e,t){return[(t.valueToCode(this,"LIST",t.ORDER_ADDITIVE)||"0")+"["+(t.valueToCode(this,"AT1",t.ORDER_ADDITIVE)||"0")+" : "+(t.valueToCode(this,"AT2",t.ORDER_ADDITIVE)||"0")+"]",t.ORDER_ATOMIC]},ap=function(e,t){return t.definitions_.import_random="import random",["random.choice("+(t.valueToCode(this,"TUP",t.ORDER_ADDITIVE)||"mytup")+")",t.ORDER_ATOMIC]},lp=function(e,t){return["tuple("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},up=function(e,t){return["("+this.getFieldValue("CONTENT")+")",t.ORDER_ATOMIC]},cp=function(e,t){var n=t.valueToCode(this,"params",t.ORDER_ATOMIC)||"0",i=t.valueToCode(this,"des",t.ORDER_ATOMIC)||"0";return["("+n+',"'+this.getFieldValue("type")+'",'+i+")",t.ORDER_ATOMIC]},pp=function(e,t){for(var n=t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE),i=new Array(this.itemCount_),r=0;r<this.itemCount_;r++)i[r]=t.valueToCode(this,"ADD"+r,t.ORDER_NONE)||"0";return i=n+"= {"+i.join(", ")+"}\n",0==this.itemCount_&&(i=n+" = set()\n"),i},hp=function(e,t){return["len("+(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+")",t.ORDER_ATOMIC]},dp=function(e,t){return[(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+".pop()",t.ORDER_ATOMIC]},fp=function(e,t){return(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+".clear()\n"},_p=function(e,t){var n=t.valueToCode(this,"SET1",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"SET2",t.ORDER_ASSIGNMENT)||"0";return[n+"."+this.getFieldValue("OPERATE")+"("+i+")",t.ORDER_ATOMIC]},mp=function(e,t){var n=t.valueToCode(this,"SET1",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"SET2",t.ORDER_ASSIGNMENT)||"0";return n+"."+this.getFieldValue("OPERATE")+"("+i+")\n"},bp=function(e,t){return(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("OPERATE")+"("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},gp=function(e,t){var n=t.valueToCode(this,"SET1",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"SET2",t.ORDER_ASSIGNMENT)||"0";return[n+"."+this.getFieldValue("OPERATE")+"("+i+")",t.ORDER_ATOMIC]},Sp=function(e,t){return(t.valueToCode(this,"SET",t.ORDER_ASSIGNMENT)||"0")+".update("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},kp=function(e,t){return["{"+this.getFieldValue("TEXT")+"}",t.ORDER_ATOMIC]},yp=function(e,t){return["set("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0")+")",t.ORDER_ATOMIC]},vp=function(e,t){return["'''<!DOCTYPE HTML>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n"+t.statementToCode(this,"HEAD")+"</head>\n<body>\n"+t.statementToCode(this,"BODY")+"</body>\n</html>\n'''",t.ORDER_ATOMIC]},Tp=function(e,t){var n=t.statementToCode(this,"DO"),i=this.getFieldValue("LEVEL");return"<h"+i+">\n"+n+"</h"+i+">\n"},Ep=function(e,t){var n=t.statementToCode(this,"DO"),i=this.getFieldValue("LEVEL");if("head"==i)var r="<"+i+'>\n\t<meta charset="utf-8">\n'+n+"</"+i+">\n";else r="<"+i+">\n"+n+"</"+i+">\n";return r},Ip=function(e,t){var n=t.statementToCode(this,"DO"),i=this.getFieldValue("LEVEL");return"<"+i+">\n"+n+"</"+i+">\n"},wp=function(e,t){var n=t.statementToCode(this,"DO"),i=t.valueToCode(this,"style"),r=this.getFieldValue("LEVEL");return"<"+r+" "+i+" >\n"+n+"</"+r+">\n"},xp=function(e,t){return['style="'+t.statementToCode(this,"STYLE")+'"',t.ORDER_ATOMIC]},Ap=function(e,t){return'<input type="'+this.getFieldValue("LEVEL")+'" name="'+this.getFieldValue("NAME")+'" value="'+this.getFieldValue("VALUE")+'" '+(t.valueToCode(this,"style")||"")+" />"},$p=function(){return this.getFieldValue("KEY")+":"+this.getFieldValue("VALUE")+";"},Op=function(){return this.getFieldValue("TEXT")+"\n"},Mp=function(e){return e.getFieldValue("TEXT")+"\n"},Cp=function(e,t){return[e.getFieldValue("TEXT"),t.ORDER_ATOMIC]},Rp=function(e,t){return(t.valueToCode(e,"VALUE",t.ORDER_ATOMIC)||"")+"\n"},Np=function(){return""},Lp=function(e,t){return["type("+(t.valueToCode(e,"VALUE",t.ORDER_MEMBER)||"___")+")",t.ORDER_ATOMIC]},Dp=function(e,t){for(var n=e.getFieldValue("NAME"),i=e.hasReturn_,r=new Array(e.itemCount_),s=0;s<e.itemCount_;s++)r[s]=t.valueToCode(e,"ARGUMENT"+s,t.ORDER_NONE)||"___";var o=n+"("+r.join(", ")+")";return i?[o,t.ORDER_ATOMIC]:o+"\n"},Pp=function(e,t){var n=t.valueToCode(e,"MODULE",t.ORDER_ATOMIC),i=t.valueToCode(e,"NAME",t.ORDER_ATOMIC);return[n+"."+(i=i.substring(1,i.length-1)),t.ORDER_NONE]},Fp=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = pandas.Series("+n+")\n"},Bp=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"INDEX",t.ORDER_ATOMIC)||"''";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = pandas.Series("+n+",index="+i+")\n"},jp=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = pandas.DataFrame("+n+")\n"},Vp=function(e,t){t.definitions_.import_pandas="import pandas";var n=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"INDEX_COLUMN",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"INDEX_RAW",t.ORDER_ATOMIC)||"''";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = pandas.DataFrame("+n+",columns="+i+",index="+r+")\n"},Up=function(e,t){t.definitions_.import_pandas="import pandas";var n=this.getFieldValue("COLUMN_RAW"),i=t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"INDEX",t.ORDER_ATOMIC)||"''";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = pandas.DataFrame("+i+","+n+"="+r+")\n"},Yp=function(e,t){return t.definitions_.import_pandas="import pandas",t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = pandas.Series(["+this.getFieldValue("TEXT")+"])\n"},Gp=function(e,t){return t.definitions_.import_pandas="import pandas",[(t.valueToCode(this,"SERIES",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("INDEX_VALUE"),t.ORDER_ATOMIC]},Xp=function(e,t){return[(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+"["+(t.valueToCode(this,"AT",t.ORDER_ADDITIVE)||"1")+"]",t.ORDER_ATOMIC]},Hp=function(e,t){t.definitions_.import_pylab="import pylab";return"pylab.show()\n"},zp=function(e,t){t.definitions_.import_pylab="import pylab";return"pylab.axes(aspect=1)\n"},qp=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+")\n"},Wp=function(e,t){t.definitions_.import_pylab="import pylab";var n=this.getFieldValue("LINE"),i=this.getFieldValue("COLOR"),r=this.getFieldValue("DOT");return"pylab.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+",'"+r+n+i+"')\n"},Kp=function(e,t){t.definitions_.import_pylab="import pylab",t.definitions_.import_matplotlib_font_manager="import matplotlib.font_manager";return'pylab.legend(prop=matplotlib.font_manager.FontProperties("STSong"))\n'},Jp=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.title("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+', fontproperties = "STSong")\n'},Qp=function(e,t){return t.definitions_.import_pylab="import pylab","pylab."+this.getFieldValue("DIR")+"label("+t.valueToCode(this,"LABEL",t.ORDER_ATOMIC)+', fontproperties = "STSong")\n'},Zp=function(e,t){return t.definitions_.import_numpy="import numpy",["numpy.arange("+(t.valueToCode(this,"FROM",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"TO",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"STEP",t.ORDER_NONE)||"1")+")",t.ORDER_ATOMIC]},eh=function(e,t){return t.definitions_.import_pylab="import pylab","pylab."+this.getFieldValue("DIR")+"("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},th=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.scatter("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+",s="+(t.valueToCode(this,"S",t.ORDER_ATOMIC)||"''")+",c='"+this.getFieldValue("COLOR")+"',marker='"+this.getFieldValue("DOT")+"',label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},nh=function(e,t){t.definitions_.import_pylab="import pylab";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=this.getFieldValue("LINE"),s=this.getFieldValue("COLOR");return"pylab.plot("+n+","+i+",'"+this.getFieldValue("DOT")+r+s+"',label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},ih=function(e,t){t.definitions_.import_pylab="import pylab";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''",s=t.valueToCode(this,"WIDTH",t.ORDER_RELATIONAL)||"0",o=this.getFieldValue("COLOR");return"pylab.bar("+n+","+i+',align="'+this.getFieldValue("ALIGN")+'",color="'+o+'",width='+s+",label="+r+")\n"},rh=function(e,t){t.definitions_.import_pylab="import pylab";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"EXPLODE",t.ORDER_ATOMIC)||"''",s=this.getFieldValue("SHADOW"),o=this.getFieldValue("autopct");return"None"!=o&&(o="'"+o+"'"),"pylab.pie("+n+",explode="+r+",labels="+i+",autopct="+o+",shadow="+s+")\n"},sh=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.hist("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},oh=function(e,t){return t.definitions_.import_pylab="import pylab","pylab."+this.getFieldValue("DIR")+"ticks("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+",fontproperties = 'STSong')\n"},ah=function(e,t){t.definitions_.import_numpy="import numpy";var n=t.valueToCode(this,"NUM",t.ORDER_NONE)||"0";return["numpy."+this.getFieldValue("OP")+"("+n+")",t.ORDER_ATOMIC]},lh=function(e,t){return t.definitions_.import_numpy="import numpy","pylab.subplot("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+")\n"},uh=function(e,t){return t.definitions_.import_pandas="import pandas",["pandas.read_csv("+t.valueToCode(this,"FILENAME",t.ORDER_ATOMIC)+", header="+this.getFieldValue("MODE")+")\n",t.ORDER_ATOMIC]},ch=function(e,t){var n=this.getFieldValue("MODE"),i=t.valueToCode(this,"DICT",t.ORDER_ASSIGNMENT)||"0",r=t.valueToCode(this,"KEY",t.ORDER_ASSIGNMENT);if("column"==n)var s=i+"["+r+"]";else if("raw"==n)s=i+".loc["+r+"]";return[s,t.ORDER_ATOMIC]},ph=function(e,t){return t.definitions_.import_pylab="import pylab","pylab.savefig("+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},hh=function(e,t){return t.definitions_.import_numpy="import numpy","pylab.text("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+", ha='"+this.getFieldValue("HALIGN")+"', va='"+this.getFieldValue("VALIGN")+"', fontsize="+(t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0")+")\n"},dh=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||"0";return t.definitions_.import_numpy="import numpy",["numpy.array("+n+")",t.ORDER_ATOMIC]},fh=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";return"matplotlib.pyplot.show()\n"},_h=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";return"matplotlib.pyplot.axes(aspect=1)\n"},mh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+")\n"},bh=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";var n=this.getFieldValue("LINE"),i=this.getFieldValue("COLOR"),r=this.getFieldValue("DOT");return"matplotlib.pyplot.plot("+(t.valueToCode(this,"SER",t.ORDER_ASSIGNMENT)||"0")+",'"+r+n+i+"')\n"},gh=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot",t.definitions_.import_matplotlib_font_manager="import matplotlib.font_manager";return'matplotlib.pyplot.legend(prop=matplotlib.font_manager.FontProperties("STSong"))\n'},Sh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot.title("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+")\n"},kh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot."+this.getFieldValue("DIR")+"label("+t.valueToCode(this,"LABEL",t.ORDER_ATOMIC)+")\n"},yh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot."+this.getFieldValue("DIR")+"("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},vh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot.scatter("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+",s="+(t.valueToCode(this,"S",t.ORDER_ATOMIC)||"''")+",color='"+this.getFieldValue("COLOR")+"',marker='"+this.getFieldValue("DOT")+"',label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},Th=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=this.getFieldValue("LINE"),s=this.getFieldValue("COLOR");return"matplotlib.pyplot.plot("+n+","+i+",'"+this.getFieldValue("DOT")+r+s+"',label="+(t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''")+")\n"},Eh=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"TAG",t.ORDER_ATOMIC)||"''",s=t.valueToCode(this,"WIDTH",t.ORDER_RELATIONAL)||"0",o=this.getFieldValue("COLOR");return"matplotlib.pyplot.bar("+n+","+i+',align="'+this.getFieldValue("ALIGN")+'",color="'+o+'",width='+s+",label="+r+")\n"},Ih=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";var n=t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''",i=t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''",r=t.valueToCode(this,"EXPLODE",t.ORDER_ATOMIC)||"''",s=this.getFieldValue("SHADOW"),o=this.getFieldValue("autopct");return"None"!=o&&(o="'"+o+"'"),"matplotlib.pyplot.pie("+n+",explode="+r+",labels="+i+",autopct="+o+",shadow="+s+")\n"},wh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot.hist("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+")\n"},xh=function(e,t){return t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot."+this.getFieldValue("DIR")+"ticks("+(t.valueToCode(this,"A",t.ORDER_ATOMIC)||"''")+","+(t.valueToCode(this,"B",t.ORDER_ATOMIC)||"''")+",fontproperties = 'STSong')\n"},Ah=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot.subplot("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+")\n"},$h=function(e,t){t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot";return"matplotlib.pyplot.savefig('1.png')\n"},Oh=function(e,t){return t.definitions_.import_numpy="import numpy",t.definitions_.import_matplotlib_pyplot="import matplotlib.pyplot","matplotlib.pyplot.text("+(t.valueToCode(this,"VET",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"HOR",t.ORDER_NONE)||"0")+", "+(t.valueToCode(this,"NUM",t.ORDER_NONE)||"0")+", ha='"+this.getFieldValue("HALIGN")+"', va='"+this.getFieldValue("VALIGN")+"', fontsize="+(t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0")+")\n"},Mh=function(e,t){return["input("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")",t.ORDER_ATOMIC]},Ch=function(e,t){return"print("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+")\n"},Rh=function(e,t){return"print("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+',end ="")\n'},Nh=function(e,t){return"print("+(t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""')+",end ="+(t.valueToCode(this,"END",t.ORDER_ATOMIC)||'""')+")\n"},Lh=function(e,t){var n=t.valueToCode(this,"VAR",t.ORDER_ATOMIC)||'""',i=this.getFieldValue("DIR");if("str"==i)var r="input("+n+")";else if("int"==i)r="int(input("+n+"))";else if("float"==i)r="float(input("+n+"))";return[r,t.ORDER_ATOMIC]},Dh=function(e,t){for(var n=new Array(this.itemCount_),i=0;i<this.itemCount_;i++)n[i]=t.valueToCode(this,"ADD"+i,t.ORDER_NONE)||"0";return n="print("+n.join(", ")+")\n"},Ph=function(e,t){t.definitions_.import_time="import time";return["time.time()",t.ORDER_ATOMIC]},Fh=function(){return"exit()\n"},Bh=function(e,t){t.definitions_.import_time="import time";var n=this.getFieldValue("op"),i="time.localtime()["+n+"]";if("all"===n){return["time.localtime()",t.ORDER_ASSIGNMENT]}return[i,t.ORDER_ASSIGNMENT]},jh=function(e,t){return t.definitions_.import_turtle="import turtle",t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = turtle.Turtle()\n"},Vh=function(e,t){t.definitions_.import_turtle="import turtle";return"turtle.done()\n"},Uh=function(e,t){t.definitions_.import_turtle="import turtle";return"turtle.exitonclick()\n"},Yh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Gh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Xh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".setheading("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},Hh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".screen.delay("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},zh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".goto("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+","+(t.valueToCode(this,"val",t.ORDER_ASSIGNMENT)||"0")+")\n"},qh=function(e,t){return t.definitions_.import_turtle="import turtle",[(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()",t.ORDER_ATOMIC]},Wh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()\n"},Kh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()\n"},Jh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"_fill()\n"},Qh=function(e,t){return t.definitions_.import_turtle="import turtle",this.getFieldValue("TUR")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},Zh=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".pensize("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},ed=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".speed("+(t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0")+")\n"},td=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},nd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".set"+this.getFieldValue("DIR")+"("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},id=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"data",t.ORDER_ASSIGNMENT)||"0";return n+".circle ("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+i+")\n"},rd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+"."+this.getFieldValue("DIR")+"()\n"},sd=function(e,t){return t.definitions_.import_turtle="import turtle",'turtle.bgcolor("'+this.getFieldValue("FIELDNAME")+'")\n'},od=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+'.pencolor("'+this.getFieldValue("FIELDNAME")+'")\n'},ad=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+'.fillcolor("'+this.getFieldValue("FIELDNAME")+'")\n'},ld=function(e,t){return t.definitions_.import_turtle="import turtle",[(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".clone()",t.ORDER_ATOMIC]},ud=function(e,t){return t.definitions_.import_turtle="import turtle","turtle.bgcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},cd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".pencolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},pd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".fillcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},hd=function(e,t){return t.definitions_.import_turtle="import turtle","turtle.bgcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},dd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".pencolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},fd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".fillcolor("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},_d=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".color("+t.valueToCode(this,"VAR1",t.ORDER_ATOMIC)+","+t.valueToCode(this,"VAR2",t.ORDER_ATOMIC)+")\n"},md=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+'.color("'+this.getFieldValue("FIELDNAME")+'","'+this.getFieldValue("FIELDNAME2")+'")\n'},bd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".shape('"+this.getFieldValue("DIR")+"')\n"},gd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".shapesize("+(t.valueToCode(this,"WID",t.ORDER_ASSIGNMENT)||"0")+","+(t.valueToCode(this,"LEN",t.ORDER_ASSIGNMENT)||"0")+","+(t.valueToCode(this,"OUTLINE",t.ORDER_ASSIGNMENT)||"0")+")\n"},Sd=function(e,t){return t.definitions_.import_turtle="import turtle",["turtle.textinput("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+","+t.valueToCode(this,"PROMPT",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},kd=function(e,t){return t.definitions_.import_turtle="import turtle",["turtle.numinput("+t.valueToCode(this,"TITLE",t.ORDER_ATOMIC)+","+t.valueToCode(this,"PROMPT",t.ORDER_ATOMIC)+","+t.valueToCode(this,"DEFAULT",t.ORDER_ATOMIC)+",minval = "+t.valueToCode(this,"MIN",t.ORDER_ATOMIC)+",maxval = "+t.valueToCode(this,"MAX",t.ORDER_ATOMIC)+")",t.ORDER_ATOMIC]},yd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".write("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+")\n"},vd=function(e,t){t.definitions_.import_turtle="import turtle";var n=this.getFieldValue("MOVE"),i=this.getFieldValue("ALIGN"),r=t.valueToCode(this,"FONTNAME",t.ORDER_ATOMIC),s=t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0",o=this.getFieldValue("FONTTYPE");return(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".write("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+n+',align="'+i+'",font=('+r+","+s+',"'+o+'"))\n'},Td=function(e,t){t.definitions_.import_turtle="import turtle";var n=this.getFieldValue("MOVE"),i=this.getFieldValue("ALIGN"),r=t.valueToCode(this,"FONTNAME",t.ORDER_ATOMIC),s=t.valueToCode(this,"FONTNUM",t.ORDER_ASSIGNMENT)||"0",o=this.getFieldValue("FONTTYPE");return(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".write("+t.valueToCode(this,"VAR",t.ORDER_ATOMIC)+","+n+',align="'+i+'",font=('+r+","+s+',"'+o+'"))\n'},Ed=function(e,t){return['"'+this.getFieldValue("COLOR")+'"',t.ORDER_ATOMIC]},Id=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0";return t.variableDB_.getName(this.getFieldValue("VAR"),F.Variables.NAME_TYPE)+" = "+n+".getscreen()\n"},wd=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"VAR",t.ORDER_NONE)||"None";return n+".onkey("+(t.valueToCode(this,"callback",t.ORDER_NONE)||"None")+", "+i+")\n"},xd=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".onclick("+(t.valueToCode(this,"callback",t.ORDER_NONE)||"None")+")\n"},Ad=function(e,t){t.definitions_.import_turtle="import turtle";var n=t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0",i=t.valueToCode(this,"VAR",t.ORDER_NONE)||"None";return n+".ontimer("+(t.valueToCode(this,"callback",t.ORDER_NONE)||"None")+", "+i+")\n"},$d=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".listen()\n"},Od=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".getcanvas().postscript(file="+t.valueToCode(this,"FILE",t.ORDER_ATOMIC)+")\n"},Md=function(e,t){return t.definitions_.import_turtle="import turtle",(t.valueToCode(this,"TUR",t.ORDER_ASSIGNMENT)||"0")+".stamp()\n"},Cd=function(e,t){t.definitions_.import_blocklygame="import blocklygame";var n=t.statementToCode(e,"DO0")+"blocklygame.initMap('block_id="+e.id+"');\n",i=[];i=n.split("\n");for(var r=0;r<i.length;r++)i[r].indexOf(" ")>=0&&(i[r]=i[r].replace(" ",""));n="";for(r=0;r<i.length;r++)n+=i[r]+"\n";return n},Rd=function(e,t){t.definitions_.import_blocklygame="import blocklygame";var n=t.valueToCode(this,"times",t.ORDER_ATOMIC),i="actor.moveDirection("+this.getFieldValue("direction")+",'block_id="+e.id+"');\n";return"for _my_variable in range("+n+"):\n\t"+(i=t.addLoopTrap(i,e.id)||t.PASS)},Nd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(0,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\n"},Ld=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(1,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\n"},Dd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(2,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\n"},Pd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(3,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\nactor.randomOil('block_id="+e.id+"');\n"},Fd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(4,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\n"},Bd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(5,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\n"},jd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.settedMap(6,'block_id="+e.id+"');\nactor=blocklygame.Actor('car',2);\n"},Vd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","actor.turn('"+this.getFieldValue("Direction")+"','block_id="+e.id+"');\n"},Ud=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["actor.isDone('block_id="+e.id+"')",t.ORDER_ATOMIC]},Yd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["actor.isPath('"+this.getFieldValue("Direction")+"','block_id="+e.id+"')",t.ORDER_ATOMIC]},Gd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["actor.getPoint('block_id="+e.id+"')",t.ORDER_ATOMIC]},Xd=function(e,t){var n=this.getFieldValue("type");return t.definitions_.import_blocklygame="import blocklygame",[n,t.ORDER_ATOMIC]},Hd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.setMap("+t.valueToCode(this,"x",t.ORDER_ATOMIC)+","+t.valueToCode(this,"y",t.ORDER_ATOMIC)+","+t.valueToCode(this,"startPos",t.ORDER_ATOMIC)+","+t.valueToCode(this,"endPos",t.ORDER_ATOMIC)+","+t.valueToCode(this,"background",t.ORDER_ATOMIC)+",'block_id="+e.id+"');\n"},zd=function(e,t){var n=this.getFieldValue("type");return t.definitions_.import_blocklygame="import blocklygame",[n,t.ORDER_ATOMIC]},qd=function(e,t){t.definitions_.import_blocklygame="import blocklygame";var n=this.getFieldValue("direction");return"actor=blocklygame.Actor("+t.valueToCode(this,"character",t.ORDER_ATOMIC)+","+n+",'block_id="+e.id+"');\n"},Wd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.placeItem("+t.valueToCode(this,"posx",t.ORDER_ATOMIC)+","+t.valueToCode(this,"posy",t.ORDER_ATOMIC)+","+this.getFieldValue("item")+",'block_id="+e.id+"');\n"},Kd=function(e,t){var n=this.getFieldValue("type");return t.definitions_.import_blocklygame="import blocklygame",[n,t.ORDER_ATOMIC]},Jd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","blocklygame.setPathType("+t.valueToCode(this,"pathtype",t.ORDER_ATOMIC)+",'block_id="+e.id+"');\n"},Qd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["actor.isBarrier("+this.getFieldValue("direction")+",'block_id="+e.id+"')",t.ORDER_ATOMIC]},Zd=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","actor.randomOil('block_id="+e.id+"');\n"},ef=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["actor.isOilFull('block_id="+e.id+"')",t.ORDER_ATOMIC]},tf=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["actor.isLightGreen('block_id="+e.id+"')",t.ORDER_ATOMIC]},nf=function(e,t){return t.definitions_.import_blocklygame="import blocklygame",["not actor.isLightGreen('block_id="+e.id+"')",t.ORDER_ATOMIC]},rf=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","actor.addOil('block_id="+e.id+"');\n"},sf=function(e,t){return t.definitions_.import_blocklygame="import blocklygame","actor.isCirculationRight('block_id="+e.id+"');\n"},of=$;var af=n.n(of);class lf{constructor(){this.initProject()}initProject(){this.fileD={},this.MAINF="main.py",this.fileD[this.MAINF]=["",!0,1],this.selectFile=this.MAINF}add(e,t,n){this.exist(e)?console.log("Warning:file already in project"):this.fileD[e]=[t,!1,n]}delete(e){delete this.fileD[e],this.selectFile=void 0}getProject(){return Object.keys(this.fileD)}getUploadFileList(){var e=Object.keys(this.fileD),t=[];for(var n in e)2===this.fileD[e[n]][2]&&t.push(e[n]);return t}getNewFileList(){var e=Object.keys(this.fileD),t=[];for(var n in e)1===this.fileD[e[n]][2]&&t.push(e[n]);return t}isSelect(e){return this.fileD[e][1]}select(e){this.fileD[e][1]=!0}getFileNum(){return Object.keys(this.fileD).length}getFileContent(e){return this.fileD[e][0]}getFileType(e){return this.fileD[e][2]}modify(e,t){this.fileD[e][0]=t}exist(e){return e in this.fileD}}n(312),n(23);const uf=window.Sk;n(301);const cf=window.PyGameZero,pf={"./blocklygame/__init__.js":n.p+"bg_highlight_619188fb.js","./blocktool/__init__.js":n.p+"inittool_b5e8e605.js","./bg_nonehl/__init__.js":n.p+"bg_nonehl_8ade5557.js"};var hf;function df(e){return"string"==typeof e?e:void 0!==e.tp$str?e.tp$str().v:e.name+": "+e.message}class ff{#e=new B.Events(["input","output","display","finished","error"]);constructor(e,t){this.programStatus=e,this.mixpyProject=t,this.onExecutionEnd=null}getEvents(){return this.#e}executionEnd_(){null!==this.onExecutionEnd&&this.onExecutionEnd()}loadEngine(e){uf.__future__=uf.python3,uf.connectedServices={},uf.TurtleGraphics={target:e,width:500,height:500},cf.setContainer(e),uf.MatPlotLibGraphics={target:e,width:500,height:500},uf.inputfunTakesPrompt=!0,this.executionBuffer={},uf.domOutput=e=>this.#e.on("display",e)[0],uf.configure({output:e=>{this.#e.run("output",{content:e})},read:this.readFile.bind(this),inputfun:this.skInput.bind(this),inputfunTakesPrompt:!0,execLimit:Number.POSITIVE_INFINITY,fileread:this.fileread.bind(this),filewrite:this.filewrite.bind(this),__future__:uf.python3}),uf.builtins.value=new uf.builtin.func((function(){return uf.ffi.remapToPy(void 0===hf?5:hf)})),uf.builtins.set_value=new uf.builtin.func((function(e){hf=e.v})),uf.builtinFiles.files["./mixpy.py"]='import math\r\n\r\ndef math_map(v, al, ah, bl, bh):\r\n return bl + (bh - bl) * (v - al) / (ah - al)\r\n\r\ndef math_mean(myList):\r\n localList = [e for e in myList if type(e) == int or type(e) == float]\r\n if not localList: return\r\n return float(sum(localList)) / len(localList)\r\n\r\ndef math_median(myList):\r\n localList = sorted([e for e in myList if type(e) == int or type(e) == float])\r\n if not localList: return\r\n if len(localList) % 2 == 0:\r\n return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0\r\n else:\r\n return localList[(len(localList) - 1) // 2]\r\n\r\ndef math_modes(some_list):\r\n modes = []\r\n # Using a lists of [item, count] to keep count rather than dict\r\n # to avoid "unhashable" errors when the counted item is itself a list or dict.\r\n counts = []\r\n maxCount = 1\r\n for item in some_list:\r\n found = False\r\n for count in counts:\r\n if count[0] == item:\r\n count[1] += 1\r\n maxCount = max(maxCount, count[1])\r\n found = True\r\n if not found:\r\n counts.append([item, 1])\r\n for counted_item, item_count in counts:\r\n if item_count == maxCount:\r\n modes.append(counted_item)\r\n return modes\r\n\r\ndef math_standard_deviation(numbers):\r\n n = len(numbers)\r\n if n == 0: return\r\n mean = float(sum(numbers)) / n\r\n variance = sum((x - mean) ** 2 for x in numbers) / n\r\n return math.sqrt(variance)\r\n\r\ndef lists_sort(my_list, type, reverse):\r\n def try_float(s):\r\n try:\r\n return float(s)\r\n except:\r\n return 0\r\n key_funcs = {\r\n "NUMERIC": try_float,\r\n "TEXT": str,\r\n "IGNORE_CASE": lambda s: str(s).lower()\r\n }\r\n key_func = key_funcs[type]\r\n list_cpy = list(my_list)\r\n return sorted(list_cpy, key=key_func, reverse=reverse)'}readFile(e){if(cf.matchModelName(e))return cf.load(e);if(void 0!==pf[e])return uf.misceval.promiseToSuspension(fetch(pf[e]).then((e=>e.text())));if(void 0===uf.builtinFiles||void 0===uf.builtinFiles.files[e])throw"File not found: '"+e+"'";return uf.builtinFiles.files[e]}fileread(e,t){return this.mixpyProject.exist(e)?this.mixpyProject.getFileContent(e):-1!==t.indexOf("w")?(this.mixpyProject.add(e,"",1),""):null}filewrite(e,t){var n=e.name;this.mixpyProject.modify(n,t),this.mixpyProject.select(n)}skInput(e){return new Promise(((t,n)=>{this.#e.run("input",{content:{prompt:e},resolve:t,reject:n})}))}reset(){uf.execLimit=Number.POSITIVE_INFINITY,uf.TurtleGraphics.reset&&uf.TurtleGraphics.reset()}kill(){uf.execLimit=0,this.executionEnd_()}step(e,t,n,i){if("<stdin>.py"==i){var r=this.executionBuffer.step,s=this.parseGlobals(e);this.executionBuffer.trace.push({step:r,filename:i,line:t,column:n,properties:s.properties,modules:s.modules}),this.executionBuffer.step=r+1,this.executionBuffer.last_step=r+1,this.executionBuffer.line_number=t}}analyzeVariables(){if(""==this.main.model.programs.__main__().trim())return{}}analyze(){return this.main.model.execution.status("analyzing"),""!=this.main.model.programs.__main__().trim()||(this.main.components.feedback.emptyProgram("You haven't written any code yet!"),!1)}steprun(e){this.reset(),-1===e.indexOf("import blocklygame")&&-1===e.indexOf("from blocklygame import")||(cf.reset(),af()(uf.TurtleGraphics.target).empty()),-1!=e.indexOf("settedMap(4")|-1!=e.indexOf("settedMap(6")&&-1!=e.indexOf("moveDirection")&&(e+="actor.isCirculationRight()\n"),-1==e.indexOf("settedMap(5)")&&-1!=e.indexOf("moveDirection")&&(e+="actor.isSuccess()\n"),this.programStatus.running=!0,uf.misceval.asyncToPromise((()=>uf.importMainWithBody("<stdin>",!1,e,!0))).then((()=>{this.programStatus.running=!1,this.#e.run("finished")})).catch((e=>{B.Debug.error(e),this.programStatus.running=!1,this.#e.run("error",e);var t=df(e);this.#e.run("finished"),-1===t.indexOf("TimeLimitError")&&this.executionEnd_()}))}run(e){if(this.reset(),-1===e.indexOf("import blocklygame")&&-1===e.indexOf("from blocklygame import")||(cf.reset(),af()(uf.TurtleGraphics.target).empty()),-1!==e.indexOf("import blocktool")||-1!==e.indexOf("import blocklygame")||-1!==e.indexOf("from blocklygame import")){var t=[];t=e.split("\n");for(var n=0;n<t.length;n++){if(t[n].indexOf("block_id")>=0){var i="",r=/,?'block_id=[\s\S]*'/.exec(t[n]);null!=r&&(i=r[0],t[n]=t[n].replace(i,""))}(t[n].indexOf("import blocktool")>=0||t[n].indexOf("blocktool.highlight")>=0)&&(t[n]="delete"),t[n].indexOf("blocklygame")>=0&&(t[n]=t[n].replace("blocklygame","bg_nonehl"))}e="";for(n=0;n<t.length;n++)"delete"!=t[n]&&(e+=t[n]+"\n")}-1!=e.indexOf("settedMap(4")|-1!=e.indexOf("settedMap(6")&&-1!=e.indexOf("moveDirection")&&(e+="actor.isCirculationRight();\n"),-1==e.indexOf("settedMap(5)")&&-1!=e.indexOf("moveDirection")&&(e+="actor.isSuccess();\n"),this.programStatus.running=!0,uf.misceval.asyncToPromise((()=>uf.importMainWithBody("<stdin>",!1,e,!0))).then((()=>{this.programStatus.running=!1,this.#e.run("finished")})).catch((e=>{B.Debug.error(e),this.programStatus.running=!1,this.#e.run("error",e);var t=df(e);this.#e.run("finished"),-1===t.indexOf("TimeLimitError")&&this.executionEnd_()}))}setupEnvironment(e,t,n,i,r){var s=this.main.model;this._backup_execution=uf.afterSingleExecution,uf.afterSingleExecution=void 0,uf.builtins.get_output=new uf.builtin.func((function(){return uf.builtin.pyCheckArgs("get_output",arguments,0,0),uf.ffi.remapToPy(s.execution.output())})),uf.builtins.reset_output=new uf.builtin.func((function(){uf.builtin.pyCheckArgs("reset_output",arguments,0,0),s.execution.output.removeAll()})),uf.builtins.log=new uf.builtin.func((function(e){uf.builtin.pyCheckArgs("log",arguments,1,1),console.log(e)})),uf.builtins._trace=t,uf.builtins._final_values=r,uf.builtins.code=uf.ffi.remapToPy(e),uf.builtins.set_success=this.instructor_module.set_success,uf.builtins.set_feedback=this.instructor_module.set_feedback,uf.builtins.set_finished=this.instructor_module.set_finished,uf.builtins.count_components=this.instructor_module.count_components,uf.builtins.no_nonlist_nums=this.instructor_module.no_nonlist_nums,uf.builtins.only_printing_properties=this.instructor_module.only_printing_properties,uf.builtins.calls_function=this.instructor_module.calls_function,uf.builtins.get_property=this.instructor_module.get_property,uf.builtins.get_value_by_name=this.instructor_module.get_value_by_name,uf.builtins.get_value_by_type=this.instructor_module.get_value_by_type,uf.builtins.parse_json=this.instructor_module.parse_json,uf.skip_drawing=!0,s.settings.mute_printer(!0)}disposeEnvironment(){uf.afterSingleExecution=this._backup_execution,uf.builtins.get_output=void 0,uf.builtins.reset_output=void 0,uf.builtins.log=void 0,uf.builtins._trace=void 0,uf.builtins.trace=void 0,uf.builtins.code=void 0,uf.builtins.set_success=void 0,uf.builtins.set_feedback=void 0,uf.builtins.set_finished=void 0,uf.builtins.count_components=void 0,uf.builtins.calls_function=void 0,uf.builtins.get_property=void 0,uf.builtins.get_value_by_name=void 0,uf.builtins.get_value_by_type=void 0,uf.builtins.no_nonlist_nums=void 0,uf.builtins.only_printing_properties=void 0,uf.builtins.parse_json=void 0,uf.skip_drawing=!1,hf=void 0,this.main.model.settings.mute_printer(!1)}parseGlobals(e){var t=Array(),n=Array();for(var i in e){var r=e[i];if("__name__"!==i&&"__doc__"!==i){i=i.replace("_$rw$","").replace("_$rn$","");var s=this.parseValue(i,r);null!==s?t.push(s):r.constructor==uf.builtin.module&&n.push(r.$d.__name__.v)}}return{properties:t,modules:n}}parseValue(e,t){if(null==t)return{name:e,type:"Unknown",value:"Undefined"};switch(t.constructor){case uf.builtin.func:return{name:e,type:"Function",value:void 0!==t.func_code.co_varnames?" Arguments: "+t.func_code.co_varnames.join(", "):" No arguments"};case uf.builtin.module:return null;case uf.builtin.str:return{name:e,type:"String",value:t.$r().v};case uf.builtin.none:return{name:e,type:"None",value:"None"};case uf.builtin.bool:return{name:e,type:"Boolean",value:t.$r().v};case uf.builtin.nmber:return{name:e,type:"int"==t.skType?"Integer":"Float",value:t.$r().v};case uf.builtin.int_:return{name:e,type:"Integer",value:t.$r().v};case uf.builtin.float_:return{name:e,type:"Float",value:t.$r().v};case uf.builtin.tuple:return{name:e,type:"Tuple",value:t.$r().v};case uf.builtin.list:return t.v.length<=20?{name:e,type:"List",value:t.$r().v,exact_value:t}:{name:e,type:"List",value:"[... "+t.v.length+" elements ...]",exact_value:t};case uf.builtin.dict:return{name:e,type:"Dictionary",value:t.$r().v};case Number:return{name:e,type:t%1==0?"Integer":"Float",value:t};case String:return{name:e,type:"String",value:t};case Boolean:return{name:e,type:"Boolean",value:t?"True":"False"};default:return{name:e,type:null==t.tp$name?t:t.tp$name,value:null==t.$r?t:t.$r().v}}}}class _f extends B.PageBase{static{B.HTMLTemplate.add("html/statusbar/statusbar-image.html",new B.HTMLTemplate('<style>\r\n div[m-id="{{d.mId}}"] {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: center;\r\n align-items: flex-start;\r\n overflow-y: auto;\r\n }\r\n\r\n html[data-bs-theme=light] div[m-id="{{d.mId}}"] {\r\n background-color: #ffffff;\r\n }\r\n\r\n html[data-bs-theme=dark] div[m-id="{{d.mId}}"] {\r\n background-color: #1e1e1e;\r\n }\r\n\r\n div[m-id="{{d.mId}}"] > #output-img {\r\n width: 400px;\r\n height: fit-content;\r\n position: relative;\r\n }\r\n</style>\r\n<div m-id="{{d.mId}}" class="page-item mixly-scrollbar">\r\n <div id="output-img"></div>\r\n</div>')),this.init=function(){B.StatusBarsManager.typesRegistry.register(["images"],_f);const e=B.Workspace.getMain().getStatusBarsManager();e.add({type:"images",id:"images",name:F.Msg.MIXLY_MICROBIT_IMAGE,title:F.Msg.MIXLY_MICROBIT_IMAGE}),e.changeTo("output")}}constructor(){super();const e=af()(B.HTMLTemplate.get("html/statusbar/statusbar-image.html").render());this.setContent(e)}init(){super.init(),this.hideCloseBtn()}clean(){this.getContent().empty()}display(e){const t=this.getContent(),n=function(e){e.style.width="auto",e.style.height="auto",e.style.maxWidth="100%",e.style.maxHeight="100%"};this.clean();let i=e.content,r=null,s=null;switch(e.display_type){case"p5":i.style.width="100%",i.style.height="100%",i.style.display="flex",i.style.justifyContent="center",i.style.alignItems="center",new MutationObserver((function(e){e.forEach((e=>e.addedNodes.forEach((e=>{const t=e;null!=t.tagName&&["canvas","video"].includes(t.tagName.toLowerCase())&&n(t)}))))})).observe(i,{childList:!0}),i.querySelectorAll("canvas,video").forEach(n),t.append(i);break;case"matplotlib":r=i.querySelector("canvas"),r&&(i=r),i.style.width="",i.style.height="",i.style.maxWidth="100%",i.style.maxHeight="100%",t.append(i);break;case"ocaml-canvas":i.style.width="",i.style.height="",i.style.maxWidth="100%",i.style.maxHeight="100%",t.append(i);break;case"turtle":i.setAttribute("width","100%"),i.setAttribute("height","100%"),t.append(i.outerHTML);break;case"sympy":t.append(e.content),void 0===window.MathJax?(console.log("Loading MathJax (Sympy expression needs it)."),function(){let e=document.createElement("script");e.type="text/javascript",e.src="https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/tex-mml-chtml.js",document.getElementsByTagName("head")[0].appendChild(e)}()):window.MathJax.typeset();break;case"multiple":for(let n of["image/svg+xml","image/png","text/html","text/plain"])if(n in e.content){let i=e.content[n];"image/png"===n&&(i='<img src="data:image/png;base64,'+i+'" style="max-width: 100%; max-height: 100%;">'),t.append(i);break}break;case"tutor":if(t.append(af()(e.content.replace("overflow-y%3A%20hidden%3B",""))),s=this.getContent()[0].getElementsByTagName("iframe")[0],null==s)return;s.style.maxHeight=s.style.minHeight="100%",new IntersectionObserver(((e,t)=>{const n=e[0];n&&!n.isIntersecting||(s.contentWindow?.postMessage({type:"redraw"},"*"),t.disconnect())})).observe(s);break;default:console.error(`Not supported node type '${e.display_type}' in eval.display result processing.`)}}}const mf=_f;class bf{static{this.pythonShell=null,this.init=async function(){mf.init(),this.pythonShell=new bf},this.steprun=function(){const e=B.Workspace.getMain().getEditorsManager().getActive().getCode();return this.pythonShell.steprun(e)},this.run=function(){const e=B.Workspace.getMain().getEditorsManager().getActive().getCode();return this.pythonShell.run(e)},this.stop=function(){return this.pythonShell.stop()}}#t=null;#n=null;#i=null;#r={row:0,column:0};#s="";#o=null;#a=null;#l=!1;#u=!1;#c=null;#p=()=>this.#h();#d=[{name:"REPL-Enter",bindKey:"Enter",exec:e=>{if(e.getSession().selection.getCursor().row===this.#r.row){const e=this.#t.getEndPos();let t=this.#t.getValueRange(this.#r,e);return t=t.replace(this.#s,""),this.#o?.(t),this.#o=null,this.#a=null,this.#t.addValue("\n"),this.#f(),!0}return!1}},{name:"REPL-ChangeEditor",bindKey:"Delete|Ctrl-X|Backspace",exec:e=>{const t=e.getSession().selection.getCursor();return t.row<this.#r.row||t.column<=this.#r.column}}];constructor(){const e=B.Workspace.getMain();this.#i=e.getStatusBarsManager(),this.#t=this.#i.getStatusBarById("output"),this.#n=this.#i.getStatusBarById("images"),this.#c=new ff({},new lf),this.#c.loadEngine(this.#n.getContent().children()[0]),this.#_()}#_(){const e=this.#c.getEvents();e.bind("finished",(()=>{this.#u=!1,this.#t.addValue(`\n==${B.Msg.Lang["shell.finish"]}==`)})),e.bind("output",(e=>{this.#t.addValue(e.content)})),e.bind("error",(e=>{this.#u=!1,this.#t.addValue(`\n${e.toString()}\n`)})),e.bind("input",(e=>{const t=String(e?.content?.prompt);this.#t.addValue(`>>> ${t}`),this.#s=t,this.#o=e.resolve,this.#a=e.reject,this.#m()})),e.bind("display",(e=>{this.#i.changeTo("images"),this.#n.display(e)}))}#h(){const e=this.#t.getEditor(),t=e.getSession().selection.getCursor();e.setReadOnly(t.row<this.#r.row||t.column<this.#r.column)}#m(){if(!this.#u)return;this.#l=!0,this.#r=this.#t.getEndPos();const e=this.#t.getEditor();e.setReadOnly(!1),e.focus();e.getSession().selection.on("changeCursor",this.#p),e.commands.addCommands(this.#d)}#f(){this.#l=!1;const e=this.#t.getEditor();e.getSession().selection.off("changeCursor",this.#p),e.commands.removeCommands(this.#d),this.#s="",this.#o?.(""),this.cursor_={row:0,column:0},e.setReadOnly(!0)}addPrompt(e,t,n){this.#t.addValue(e),this.#s=e,this.#o=t,this.#a=n,this.#m()}async steprun(e){await this.stop(),this.#i.changeTo("output"),this.#i.show(),this.#t.setValue(`${B.Msg.Lang["shell.running"]}...\n`),this.#u=!0,-1===e.indexOf("import blocklygame")&&-1===e.indexOf("from blocklygame import")||this.#i.changeTo("images"),this.#c.steprun(e)}async run(e){await this.stop(),this.#i.changeTo("output"),this.#i.show(),this.#t.setValue(`${B.Msg.Lang["shell.running"]}...\n`),this.#u=!0,-1===e.indexOf("import blocklygame")&&-1===e.indexOf("from blocklygame import")||this.#i.changeTo("images"),this.#c.run(e)}async stop(){this.#l&&this.#f(),this.#u&&(this.#c.kill(),await this.sleep(500),this.#u=!1)}sleep(e){return new Promise((t=>setTimeout(t,e)))}}const gf=bf,Sf={},kf=['<xml>\n <block type="initSettedMap_1"></block>\n </xml>','<xml>\n <block type="initSettedMap_2"></block>\n </xml>','<xml>\n <block type="initSettedMap_3"></block>\n </xml>','<xml>\n <block type="initSettedMap_4"></block>\n </xml>','<xml>\n <block type="initSettedMap_5"></block>\n </xml>','<xml>\n <block type="initSettedMap_6"></block>\n </xml>','<xml>\n <block type="initSettedMap_7"></block>\n </xml>'];Sf.$shadow=af()('<div style="position:absolute;z-index:1000;width:100%;background:transparent;bottom:0px;top:var(--nav-height);"></div>'),Sf.count=0,Sf.init=function(){gf.init();const e=B.app.getNav();e.register({icon:"icon-play-circled",title:"",id:"python-steprun-btn",displayText:F.Msg.MSG.step_run,preconditionFn:()=>!0,callback:()=>{gf.steprun().catch(B.Debug.error)},scopeType:B.Nav.Scope.LEFT,weight:4}),e.register({icon:"icon-play-circled",title:"",id:"python-run-btn",displayText:F.Msg.MSG.run,preconditionFn:()=>!0,callback:()=>{gf.run().catch(B.Debug.error)},scopeType:B.Nav.Scope.LEFT,weight:5}),e.register({icon:"icon-cancel",title:"",id:"python-stop-btn",displayText:F.Msg.MSG.stop,preconditionFn:()=>!0,callback:()=>{gf.stop().catch(B.Debug.error)},scopeType:B.Nav.Scope.LEFT,weight:6});const t=new B.HTMLTemplate("<style>\r\n .select2-dropdown.mixly-{{d.mId}} {\r\n width: 100% !important;\r\n transform: translate(calc(-50% + 45px), calc((var(--nav-height) - var(--nav-select-height)) / 2));\r\n }\r\n\r\n body > .select2-container:has(.mixly-{{d.mId}}) {\r\n animation-duration: 0.3s;\r\n animation-fill-mode: both;\r\n animation-name: layui-upbit;\r\n }\r\n</style>\r\n<select m-id={{d.mId}}></select>"),n=af()(t.render());e.getBoardSelector().before(n),n.select2({width:"90px",minimumResultsForSearch:1/0,dropdownCssClass:`mixly-scrollbar mixly-${t.getId()}`,dropdownAutoWidth:!0,placeholder:"",language:B.Msg.nowLang});for(let e=0;e<kf.length;e++){const t=new Option(`关卡 ${e+1}`,e);n.append(t)}n.on("select2:select",(e=>{const{data:t}=e.params;B.Workspace.getMain().getEditorsManager().getActive().setValue(kf[parseInt(t.id)],".mix")})),n.on("select2:opening",(()=>{Sf.count+=1,af()(document.body).append(Sf.$shadow)})),n.on("select2:closing",(()=>{Sf.count-=1,!Sf.count&&Sf.$shadow.detach()})),n.trigger("change"),B.Storage.board("mix",kf[0]),B.Storage.board("path","")};Sf.init(),Object.assign(F.Variables,V),Object.assign(F.Procedures,Y),F.Python=H,F.generator=H,B.Profile.default={},Object.assign(F.Blocks,e,t,i,r,s,o,a,l,u,c,p,h,d,f,_,m,b,g),Object.assign(F.Python.forBlock,S,k,y,v,T,E,I,w,x,A,O,M,C,R,N,L,D,P)})()})(); |