From 43ea774c546cdc5bfebd633f17cbd4a1f9c193dd Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 27 Dec 2024 11:10:34 +0100 Subject: [PATCH] n --- .../capybara-jump-and-run/cajuanru.html | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/static/spiele/capybara-jump-and-run/cajuanru.html b/static/spiele/capybara-jump-and-run/cajuanru.html index 283c85f..684346e 100644 --- a/static/spiele/capybara-jump-and-run/cajuanru.html +++ b/static/spiele/capybara-jump-and-run/cajuanru.html @@ -160,7 +160,7 @@
-

Ready? LET'S GOOO!!!

+
@@ -197,10 +197,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */ /*! For license information please see scaffolding-min.js.LICENSE.txt */ -!function(e){function t(t){for(var n,i,s=t[0],o=t[1],a=0,c=[];a=e.length?void(M>x,C[I]=D,C[D++]=I;D{if("string"!=typeof e)return!1;for(let t=0;tr?1:0}return n===1/0&&r===1/0||n===-1/0&&r===-1/0?0:n-r}static isInt(e){return"number"==typeof e?!!isNaN(e)||e===Math.floor(e):"boolean"==typeof e||"string"==typeof e&&e.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(e,t,n){if("number"!=typeof e){if("all"===e)return n?s.LIST_ALL:s.LIST_INVALID;if("last"===e)return t>0?t:s.LIST_INVALID;if("random"===e||"any"===e)return t>0?1+Math.floor(Math.random()*t):s.LIST_INVALID}return(e=Math.floor(s.toNumber(e)))<1||e>t?s.LIST_INVALID:e}}e.exports=s},function(e,t){e.exports={BOOLEAN:"Boolean",BUTTON:"button",LABEL:"label",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",XML:"xml"}},function(e,t){e.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COSTUME:"costume",SOUND:"sound"}},function(e,t){e.exports=class{static degToRad(e){return e*Math.PI/180}static radToDeg(e){return 180*e/Math.PI}static clamp(e,t,n){return Math.min(Math.max(e,t),n)}static wrapClamp(e,t,n){const r=n-t+1;return e-Math.floor((e-t)/r)*r}static tan(e){switch(e%=360){case-270:case 90:return 1/0;case-90:case 270:return-1/0;default:return Math.round(1e10*Math.tan(Math.PI*e/180))/1e10}}static reducedSortOrdering(e){const t=e.slice(0).sort(((e,t)=>e-t));return e.map((e=>t.indexOf(e)))}static inclusiveRandIntWithout(e,t,n){const r=t-e,i=e+Math.floor(Math.random()*r);return i>=n?i+1:i}static scale(e,t,n,r,i){return(e-t)/(n-t)*(i-r)+r}}},function(e,t,n){"use strict";var r=n(128),i=n(129),s=n(70),o=n(69),a=n(68);function l(e,t){return Object.keys(t).forEach((function(n){e[n]=t[n]})),e}e.exports=function e(){var t=l({},a),n="en",c={},u=function(e){return e},d=null,h="warning",p={};function m(e,t,s){var o="string"==typeof e?e:e.default,a=y(o,"object"==typeof e&&e.id||u(o),s||n);return(a.format||(a.format=i(r(a.message),s||n,p)))(t)}m.rich=function(e,t,s){var o="string"==typeof e?e:e.default,a=y(o,"object"==typeof e&&e.id||u(o),s||n);return(a.toParts||(a.toParts=i.toParts(r(a.message,{tagsType:f}),s||n,p)))(t)};var f="<>";function g(e,t){var n=e[2];return function(e,t){var r="object"==typeof n?function(e,t){return Object.keys(e).reduce((function(n,r){return n[r]=e[r](t),n}),{})}(n,t):n;return"function"==typeof e?e(r):e}}function y(e,t,n){var r=o(n,c)||"en",i=c[r]||(c[r]={}),s=i[t];if("string"==typeof s&&(s=i[t]={message:s}),!s){var a='Translation for "'+t+'" in "'+r+'" is missing';if("warning"===h)"undefined"!=typeof console&&console.warn(a);else if("ignore"!==h)throw new Error(a);var l="function"==typeof d?d(e,t,r)||e:d||e;s=i[t]={message:l}}return s}function b(e,t,r,i,a){"object"==typeof r&&"object"!=typeof i&&(a=i,i=r,r=0);var l=o(a||n,s),c=l&&s[l][e]||v;return i["="+ +t]||i[c(t-r)]||i.other}function v(){return"other"}return p[f]=g,m.setup=function(e){return(e=e||{}).locale&&(n=e.locale),"translations"in e&&(c=e.translations||{}),e.generateId&&(u=e.generateId),"missingReplacement"in e&&(d=e.missingReplacement),e.missingTranslation&&(h=e.missingTranslation),e.formats&&(e.formats.number&&l(t.number,e.formats.number),e.formats.date&&l(t.date,e.formats.date),e.formats.time&&l(t.time,e.formats.time)),e.types&&((p=e.types)[f]=g),{locale:n,translations:c,generateId:u,missingReplacement:d,missingTranslation:h,formats:t,types:p}},m.number=function(e,r,i){var s=r&&t.number[r]||t.parseNumberPattern(r)||t.number.default;return new Intl.NumberFormat(i||n,s).format(e)},m.date=function(e,r,i){var s=r&&t.date[r]||t.parseDatePattern(r)||t.date.default;return new Intl.DateTimeFormat(i||n,s).format(e)},m.time=function(e,r,i){var s=r&&t.time[r]||t.parseDatePattern(r)||t.time.default;return new Intl.DateTimeFormat(i||n,s).format(e)},m.select=function(e,t){return t[e]||t.other},m.custom=function(e,t,n,r){return e[1]in p?p[e[1]](e,t)(n,r):n},m.plural=b.bind(null,"cardinal"),m.selectordinal=b.bind(null,"ordinal"),m.namespace=e,m}()},function(e,t,n){const r=n(1);class i{static withoutTrailingDigits(e){let t=e.length-1;for(;t>=0&&"0123456789".indexOf(e.charAt(t))>-1;)t--;return e.slice(0,t+1)}static unusedName(e,t){if(t.indexOf(e)<0)return e;e=i.withoutTrailingDigits(e);let n=2;for(;t.indexOf(e+n)>=0;)n++;return e+n}static caseInsensitiveUnusedName(e,t){const n=e=>t.some((t=>t.toLowerCase()===e.toLowerCase()));if(!n(e))return e;e=i.withoutTrailingDigits(e);let r=2;for(;n("".concat(e).concat(r));)r++;return"".concat(e).concat(r)}static splitFirst(e,t){const n=e.indexOf(t);return n>=0?[e.substring(0,n),e.substring(n+1)]:[e,null]}static stringify(e){return JSON.stringify(e,((e,t)=>"number"!=typeof t||t!==1/0&&t!==-1/0&&!isNaN(t)?t:0))}static replaceUnsafeChars(e){if("string"!=typeof e){if(!Array.isArray(e))return r.error("Unexpected input recieved in replaceUnsafeChars"),e;e=String(e)}return e.replace(/[<>&'"]/g,(e=>{switch(e){case"<":return"lt";case">":return"gt";case"&":return"amp";case"'":return"apos";case'"':return"quot"}}))}}e.exports=i},function(e,t){const n="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";e.exports=function(){const e=n.length,t=[];for(let r=0;r<20;r++)t[r]=n.charAt(Math.random()*e);return t.join("")}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){const r=n(8),i=n(33);class s{constructor(e,t,n,i){switch(this.id=e||r(),this.name=t,this.type=n,this.isCloud=i,this.type){case s.SCALAR_TYPE:this.value=0;break;case s.LIST_TYPE:this.value=[];break;case s.BROADCAST_MESSAGE_TYPE:this.value=this.name;break;default:throw new Error("Invalid variable type: ".concat(this.type))}}toXML(e){return e=!0===e,'').concat(i(this.name),"")}static get SCALAR_TYPE(){return""}static get LIST_TYPE(){return"list"}static get BROADCAST_MESSAGE_TYPE(){return"broadcast_msg"}}e.exports=s},function(e,t,n){var r;"undefined"!=typeof self&&self,r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},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=9)}([function(e,t,n){"use strict";t.__esModule=!0,t.copyExistingProperties=function(e,t){Object.keys(t).forEach((function(n){t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&(t[n]=e[n])}))},t.copyNamedProperties=function(e,t,n){e.forEach((function(e){var r=t[e];void 0!==r&&(n[e]=r)}))},t.isBuffer=function(e,t){return o||(o=e.createBuffer()),t instanceof o.constructor},t.isRenderbuffer=function(e,t){return a||(a=e.createRenderbuffer()),t instanceof a.constructor},t.isShader=function(e,t){return l||(l=e.createShader(e.VERTEX_SHADER)),t instanceof l.constructor},t.isTexture=function(e,t){return c||(c=e.createTexture()),t instanceof c.constructor},t.isSampler=function(e,t){if(!u){if(!e.createSampler)return!1;u=e.createSampler()}return t instanceof u.constructor},t.warn=t.error=void 0;var r,i=(r=n(2))&&r.__esModule?r:{default:r},s=i.default.console&&i.default.console.error&&"function"==typeof i.default.console.error?i.default.console.error.bind(i.default.console):function(){};t.error=s;var o,a,l,c,u,d=i.default.console&&i.default.console.warn&&"function"==typeof i.default.console.warn?i.default.console.warn.bind(i.default.console):function(){};t.warn=d},function(e,t,n){"use strict";t.__esModule=!0,t.getGLTypeForTypedArray=function(e){if(e instanceof Int8Array)return s;if(e instanceof Uint8Array)return o;if(e instanceof Uint8ClampedArray)return o;if(e instanceof Int16Array)return a;if(e instanceof Uint16Array)return l;if(e instanceof Int32Array)return c;if(e instanceof Uint32Array)return u;if(e instanceof Float32Array)return d;throw"unsupported typed array type"},t.getGLTypeForTypedArrayType=function(e){if(e===Int8Array)return s;if(e===Uint8Array)return o;if(e===Uint8ClampedArray)return o;if(e===Int16Array)return a;if(e===Uint16Array)return l;if(e===Int32Array)return c;if(e===Uint32Array)return u;if(e===Float32Array)return d;throw"unsupported typed array type"},t.getTypedArrayTypeForGLType=function(e){var t=h[e];if(!t)throw"unknown gl type";return t},t.isArrayBuffer=void 0;var r,i=(r=n(2))&&r.__esModule?r:{default:r},s=5120,o=5121,a=5122,l=5123,c=5124,u=5125,d=5126,h={},p=h;p[s]=Int8Array,p[o]=Uint8Array,p[a]=Int16Array,p[l]=Uint16Array,p[c]=Int32Array,p[u]=Uint32Array,p[d]=Float32Array,p[32819]=Uint16Array,p[32820]=Uint16Array,p[33635]=Uint16Array,p[5131]=Uint16Array,p[33640]=Uint32Array,p[35899]=Uint32Array,p[35902]=Uint32Array,p[36269]=Uint32Array,p[34042]=Uint32Array;var m=i.default.SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof i.default.SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};t.isArrayBuffer=m},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};t.default=r},function(e,t,n){"use strict";t.__esModule=!0,t.add=function(e,t,n){return(n=n||new r(3))[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n},t.copy=function(e,t){return(t=t||new r(3))[0]=e[0],t[1]=e[1],t[2]=e[2],t},t.create=function(e,t,n){var i=new r(3);return e&&(i[0]=e),t&&(i[1]=t),n&&(i[2]=n),i},t.cross=function(e,t,n){n=n||new r(3);var i=e[2]*t[0]-e[0]*t[2],s=e[0]*t[1]-e[1]*t[0];return n[0]=e[1]*t[2]-e[2]*t[1],n[1]=i,n[2]=s,n},t.distance=function(e,t){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},t.distanceSq=function(e,t){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i},t.divide=function(e,t,n){return(n=n||new r(3))[0]=e[0]/t[0],n[1]=e[1]/t[1],n[2]=e[2]/t[2],n},t.divScalar=function(e,t,n){return(n=n||new r(3))[0]=e[0]/t,n[1]=e[1]/t,n[2]=e[2]/t,n},t.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},t.lerp=function(e,t,n,i){return(i=i||new r(3))[0]=(1-n)*e[0]+n*t[0],i[1]=(1-n)*e[1]+n*t[1],i[2]=(1-n)*e[2]+n*t[2],i},t.length=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])},t.lengthSq=function(e){return e[0]*e[0]+e[1]*e[1]+e[2]*e[2]},t.mulScalar=function(e,t,n){return(n=n||new r(3))[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n},t.multiply=function(e,t,n){return(n=n||new r(3))[0]=e[0]*t[0],n[1]=e[1]*t[1],n[2]=e[2]*t[2],n},t.negate=function(e,t){return(t=t||new r(3))[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},t.normalize=function(e,t){t=t||new r(3);var n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=Math.sqrt(n);return i>1e-5?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=0,t[1]=0,t[2]=0),t},t.setDefaultType=function(e){var t=r;return r=e,t},t.subtract=function(e,t,n){return(n=n||new r(3))[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};var r=Float32Array},function(e,t,n){"use strict";t.__esModule=!0,t.isWebGL1=function(e){return!e.texStorage2D},t.isWebGL2=function(e){return!!e.texStorage2D},t.glEnumToString=void 0;var r,i,s=(r={},i={},function(e,t){return function(e){var t=e.constructor.name;if(!r[t]){for(var n in e)if("number"==typeof e[n]){var s=i[e[n]];i[e[n]]=s?"".concat(s," | ").concat(n):n}r[t]=!0}}(e),i[t]||"0x"+t.toString(16)});t.glEnumToString=s},function(e,t,n){"use strict";t.__esModule=!0,t.createAttributeSetters=H,t.createProgram=L,t.createProgramFromScripts=function(e,t,n,r,i){for(var s=N(n,r,i),o=[],a=0;a=0?I.FRAGMENT_SHADER:e.indexOf("vert")>=0?I.VERTEX_SHADER:void 0}function P(e,t){t.forEach((function(t){e.deleteShader(t)}))}function L(e,t,n,r,i){for(var o=N(n,r,i),a=[],l=[],c=0;c1&&"[0]"===r.name.substr(-3),a=r.type,l=f[a];if(!l)throw"unknown type: 0x"+a.toString(16);if(l.bindPoint){var c=n;n+=r.size,i=o?l.arraySetter(e,a,c,s,r.size):l.setter(e,a,c,s,r.size)}else i=l.arraySetter&&o?l.arraySetter(e,s):l.setter(e,s);return i.location=s,i}for(var i={},s=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;o0)throw"numComponents "+s+" not correct for length "+i;return o}(t),n},t.createBufferFromArray=b,t.createBufferFromTypedArray=l,t.createBufferInfoFromArrays=function(e,t){var n={attribs:g(e,t)},i=t.indices;if(i){var s=f(i,"indices");n.indices=l(e,s,e.ELEMENT_ARRAY_BUFFER),n.numElements=s.length,n.elementType=r.getGLTypeForTypedArray(s)}else n.numElements=function(e,t){var n,r;for(r=0;r0)throw"Can not guess numComponents for attribute '"+e+"'. Tried "+n+" but "+t+" values is not evenly divisible by "+n+". You should specify it.";return n}function m(e,t){return e.numComponents||e.size||p(t,u(e).length)}function f(e,t){if(r.isArrayBuffer(e))return e;if(r.isArrayBuffer(e.data))return e.data;Array.isArray(e)&&(e={data:e});var n=e.type;return n||(n=c(t)?Uint16Array:Float32Array),new n(e.data)}function g(e,t){var n={};return Object.keys(t).forEach((function(i){if(!c(i)){var s,a,u,d,h,g=t[i],y=g.attrib||g.name||g.attribName||o.attribPrefix+i;if("number"==typeof g||"number"==typeof g.data){h=g.data||g;var b=g.type||Float32Array,v=h*b.BYTES_PER_ELEMENT;a=r.getGLTypeForTypedArrayType(b),u=void 0!==g.normalize?g.normalize:(w=b)===Int8Array||w===Uint8Array,d=g.numComponents||g.size||p(i,h),s=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,v,g.drawType||e.STATIC_DRAW)}else{var S=f(g,i);s=l(e,S,void 0,g.drawType),a=r.getGLTypeForTypedArray(S),u=void 0!==g.normalize?g.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(S),d=m(g,i),h=S.length}n[y]={buffer:s,numComponents:d,type:a,normalize:u,stride:g.stride||0,offset:g.offset||0,divisor:void 0===g.divisor?void 0:g.divisor,drawType:g.drawType}}var w})),e.bindBuffer(e.ARRAY_BUFFER,null),n}var y=["position","positions","a_position"];function b(e,t,n){var r="indices"===n?e.ELEMENT_ARRAY_BUFFER:e.ARRAY_BUFFER;return l(e,f(t,n),r)}},function(e,t,n){"use strict";t.__esModule=!0,t.setTextureDefaults_=function(e){o.copyExistingProperties(e,c),e.textureColor&&q(e.textureColor)},t.createSampler=$,t.createSamplers=function(e,t){var n={};return Object.keys(t).forEach((function(r){n[r]=$(e,t[r])})),n},t.setSamplerParameters=J,t.createTexture=me,t.setEmptyTexture=pe,t.setTextureFromArray=he,t.loadTextureFromUrl=ce,t.setTextureFromElement=ie,t.setTextureFilteringForSize=ee,t.setTextureParameters=Z,t.setDefaultTextureColor=q,t.createTextures=function(e,t,n){n=n||se;var r=0,i=[],s={},o={};function a(){0===r&&setTimeout((function(){n(i.length?i:void 0,s,o)}),0)}return Object.keys(t).forEach((function(n){var l,c,u=t[n];("string"==typeof(c=u.src)||Array.isArray(c)&&"string"==typeof c[0])&&(l=function(e,t,s){o[n]=s,--r,e&&i.push(e),a()},++r),s[n]=me(e,u,l)})),a(),s},t.resizeTexture=function(e,t,n,r,i){r=r||n.width,i=i||n.height;var s=n.target||e.TEXTURE_2D;e.bindTexture(s,t);var o,a=n.level||0,l=n.internalFormat||n.format||e.RGBA,c=F(l),d=n.format||c.format,h=n.src;if(o=h&&(u(h)||Array.isArray(h)&&"number"==typeof h[0])?n.type||V(e,h,c.type):n.type||c.type,s===e.TEXTURE_CUBE_MAP)for(var p=0;p<6;++p)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,a,l,r,i,0,d,o,null);else e.texImage2D(s,a,l,r,i,0,d,o,null)},t.getNumComponentsForFormat=function(e){var t=L[e];if(!t)throw"unknown format: "+e;return t.numColorComponents},t.getBytesPerElementForInternalFormat=j;var r,i=l(n(4)),s=l(n(1)),o=l(n(0)),a=(r=n(2))&&r.__esModule?r:{default:r};function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}var c={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},u=s.isArrayBuffer,d=a.default.document&&a.default.document.createElement?a.default.document.createElement("canvas").getContext("2d"):null,h=6406,p=6407,m=6408,f=6409,g=6410,y=6402,b=34041,v=5120,S=5121,w=5122,k=5123,T=5124,x=5125,E=5126,A=5131,C=36193,I=33640,O=33319,M=33320,N=6403,R=36244,D=36248,P=36249,L={},B=L;B[6406]={numColorComponents:1},B[6409]={numColorComponents:1},B[6410]={numColorComponents:2},B[p]={numColorComponents:3},B[m]={numColorComponents:4},B[N]={numColorComponents:1},B[36244]={numColorComponents:1},B[O]={numColorComponents:2},B[33320]={numColorComponents:2},B[p]={numColorComponents:3},B[36248]={numColorComponents:3},B[m]={numColorComponents:4},B[36249]={numColorComponents:4},B[6402]={numColorComponents:1},B[34041]={numColorComponents:2};var z={},U=z;function j(e,t){var n=z[e];if(!n)throw"unknown internal format";var r=n.bytesPerElementMap[t];if(void 0===r)throw"unknown internal format";return r}function F(e){var t=z[e];if(!t)throw"unknown internal format";return{format:t.textureFormat,type:Array.isArray(t.type)?t.type[0]:t.type}}function W(e){return!(e&e-1)}function V(e,t,n){return u(t)?s.getGLTypeForTypedArray(t):n||e.UNSIGNED_BYTE}function G(e,t,n,r,i){if(i%1!=0)throw"can't guess dimensions";if(n||r){if(r){if(!n&&(n=i/r)%1)throw"can't guess dimensions"}else if((r=i/n)%1)throw"can't guess dimensions"}else{var s=Math.sqrt(i/(t===e.TEXTURE_CUBE_MAP?6:1));s%1==0?(n=s,r=s):(n=i,r=1)}return{width:n,height:r}}function q(e){c.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}U[6406]={textureFormat:h,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[S,A,C,E]},U[6409]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[S,A,C,E]},U[6410]={textureFormat:g,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[S,A,C,E]},U[p]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[S,A,C,E,33635]},U[m]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[S,A,C,E,32819,32820]},U[33321]={textureFormat:N,colorRenderable:!0,textureFilterable:!0,bytesPerElement:1,type:S},U[36756]={textureFormat:N,colorRenderable:!1,textureFilterable:!0,bytesPerElement:1,type:v},U[33325]={textureFormat:N,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[E,A]},U[33326]={textureFormat:N,colorRenderable:!1,textureFilterable:!1,bytesPerElement:4,type:E},U[33330]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:S},U[33329]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:v},U[33332]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:k},U[33331]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:w},U[33334]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:x},U[33333]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:T},U[33323]={textureFormat:O,colorRenderable:!0,textureFilterable:!0,bytesPerElement:2,type:S},U[36757]={textureFormat:O,colorRenderable:!1,textureFilterable:!0,bytesPerElement:2,type:v},U[33327]={textureFormat:O,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[E,A]},U[33328]={textureFormat:O,colorRenderable:!1,textureFilterable:!1,bytesPerElement:8,type:E},U[33336]={textureFormat:M,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:S},U[33335]={textureFormat:M,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:v},U[33338]={textureFormat:M,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:k},U[33337]={textureFormat:M,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:w},U[33340]={textureFormat:M,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:x},U[33339]={textureFormat:M,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:T},U[32849]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:3,type:S},U[35905]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:S},U[36194]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[S,33635]},U[36758]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:v},U[35898]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[E,A,35899]},U[35901]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[E,A,35902]},U[34843]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[E,A]},U[34837]={textureFormat:p,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:E},U[36221]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:S},U[36239]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:v},U[36215]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:k},U[36233]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:w},U[36209]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:x},U[36227]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:T},U[32856]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:S},U[35907]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:S},U[36759]={textureFormat:m,colorRenderable:!1,textureFilterable:!0,bytesPerElement:4,type:v},U[32855]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[S,32820,I]},U[32854]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[S,32819]},U[32857]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:I},U[34842]={textureFormat:m,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[E,A]},U[34836]={textureFormat:m,colorRenderable:!1,textureFilterable:!1,bytesPerElement:16,type:E},U[36220]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:S},U[36238]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:v},U[36975]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:I},U[36214]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:k},U[36232]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:w},U[36226]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:T},U[36208]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:x},U[33189]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[k,x]},U[33190]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:x},U[36012]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:E},U[35056]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:34042},U[36013]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:36269},Object.keys(U).forEach((function(e){var t=U[e];if(t.bytesPerElementMap={},Array.isArray(t.bytesPerElement))t.bytesPerElement.forEach((function(e,n){var r=t.type[n];t.bytesPerElementMap[r]=e}));else{var n=t.type;t.bytesPerElementMap[n]=t.bytesPerElement}}));var Y={};function H(e,t){void 0!==t.colorspaceConversion&&(Y.colorspaceConversion=e.getParameter(e.UNPACK_COLORSPACE_CONVERSION_WEBGL),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.colorspaceConversion)),void 0!==t.premultiplyAlpha&&(Y.premultiplyAlpha=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha)),void 0!==t.flipY&&(Y.flipY=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY))}function _(e,t){void 0!==t.colorspaceConversion&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Y.colorspaceConversion),void 0!==t.premultiplyAlpha&&e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),void 0!==t.flipY&&e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,Y.flipY)}function K(e){Y.unpackAlignment=e.getParameter(e.UNPACK_ALIGNMENT),i.isWebGL2(e)&&(Y.unpackRowLength=e.getParameter(e.UNPACK_ROW_LENGTH),Y.unpackImageHeight=e.getParameter(e.UNPACK_IMAGE_HEIGHT),Y.unpackSkipPixels=e.getParameter(e.UNPACK_SKIP_PIXELS),Y.unpackSkipRows=e.getParameter(e.UNPACK_SKIP_ROWS),Y.unpackSkipImages=e.getParameter(e.UNPACK_SKIP_IMAGES))}function Q(e){e.pixelStorei(e.UNPACK_ALIGNMENT,Y.unpackAlignment),i.isWebGL2(e)&&(e.pixelStorei(e.UNPACK_ROW_LENGTH,Y.unpackRowLength),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,Y.unpackImageHeight),e.pixelStorei(e.UNPACK_SKIP_PIXELS,Y.unpackSkipPixels),e.pixelStorei(e.UNPACK_SKIP_ROWS,Y.unpackSkipRows),e.pixelStorei(e.UNPACK_SKIP_IMAGES,Y.unpackSkipImages))}function X(e,t,n,r){r.minMag&&(n.call(e,t,e.TEXTURE_MIN_FILTER,r.minMag),n.call(e,t,e.TEXTURE_MAG_FILTER,r.minMag)),r.min&&n.call(e,t,e.TEXTURE_MIN_FILTER,r.min),r.mag&&n.call(e,t,e.TEXTURE_MAG_FILTER,r.mag),r.wrap&&(n.call(e,t,e.TEXTURE_WRAP_S,r.wrap),n.call(e,t,e.TEXTURE_WRAP_T,r.wrap),(t===e.TEXTURE_3D||o.isSampler(e,t))&&n.call(e,t,e.TEXTURE_WRAP_R,r.wrap)),r.wrapR&&n.call(e,t,e.TEXTURE_WRAP_R,r.wrapR),r.wrapS&&n.call(e,t,e.TEXTURE_WRAP_S,r.wrapS),r.wrapT&&n.call(e,t,e.TEXTURE_WRAP_T,r.wrapT),r.minLod&&n.call(e,t,e.TEXTURE_MIN_LOD,r.minLod),r.maxLod&&n.call(e,t,e.TEXTURE_MAX_LOD,r.maxLod),r.baseLevel&&n.call(e,t,e.TEXTURE_BASE_LEVEL,r.baseLevel),r.maxLevel&&n.call(e,t,e.TEXTURE_MAX_LEVEL,r.maxLevel)}function Z(e,t,n){var r=n.target||e.TEXTURE_2D;e.bindTexture(r,t),X(e,r,e.texParameteri,n)}function J(e,t,n){X(e,t,e.samplerParameteri,n)}function $(e,t){var n=e.createSampler();return J(e,n,t),n}function ee(e,t,n,r,s,o,a){n=n||c.textureOptions,o=o||e.RGBA,a=a||e.UNSIGNED_BYTE;var l=n.target||e.TEXTURE_2D;if(r=r||n.width,s=s||n.height,e.bindTexture(l,t),function(e,t,n,r){if(!i.isWebGL2(e))return W(t)&&W(n);var s=z[r];if(!s)throw"unknown internal format";return s.colorRenderable&&s.textureFilterable}(e,r,s,o))e.generateMipmap(l);else{var u=function(e){var t=z[e];if(!t)throw"unknown internal format";return t.textureFilterable}(o)?e.LINEAR:e.NEAREST;e.texParameteri(l,e.TEXTURE_MIN_FILTER,u),e.texParameteri(l,e.TEXTURE_MAG_FILTER,u),e.texParameteri(l,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(l,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}function te(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function ne(e,t){return(t=t||{}).cubeFaceOrder||[e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function re(e,t){var n=ne(e,t).map((function(e,t){return{face:e,ndx:t}}));return n.sort((function(e,t){return e.face-t.face})),n}function ie(e,t,n,r){var i=(r=r||c.textureOptions).target||e.TEXTURE_2D,s=r.level||0,o=n.width,l=n.height,u=r.internalFormat||r.format||e.RGBA,h=F(u),p=r.format||h.format,m=r.type||h.type;if(H(e,r),e.bindTexture(i,t),i===e.TEXTURE_CUBE_MAP){var f,g,y=n.width,b=n.height;if(y/6===b)f=b,g=[0,0,1,0,2,0,3,0,4,0,5,0];else if(b/6===y)f=y,g=[0,0,0,1,0,2,0,3,0,4,0,5];else if(y/3==b/2)f=y/3,g=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(y/2!=b/3)throw"can't figure out cube map from element: "+(n.src?n.src:n.nodeName);f=y/2,g=[0,0,1,0,0,1,1,1,0,2,1,2]}d?(d.canvas.width=f,d.canvas.height=f,o=f,l=f,re(e,r).forEach((function(t){var r=g[2*t.ndx+0]*f,i=g[2*t.ndx+1]*f;d.drawImage(n,r,i,f,f,0,0,f,f),e.texImage2D(t.face,s,u,p,m,d.canvas)})),d.canvas.width=1,d.canvas.height=1):a.default.createImageBitmap&&(o=f,l=f,re(e,r).forEach((function(c){var d=g[2*c.ndx+0]*f,h=g[2*c.ndx+1]*f;e.texImage2D(c.face,s,u,f,f,0,p,m,null),a.default.createImageBitmap(n,d,h,f,f,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(n){H(e,r),e.bindTexture(i,t),e.texImage2D(c.face,s,u,p,m,n),_(e,r),te(r)&&ee(e,t,r,o,l,u,m)}))})))}else if(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY){var v=Math.min(n.width,n.height),S=Math.max(n.width,n.height),w=S/v;if(w%1!=0)throw"can not compute 3D dimensions of element";var k=n.width===S?1:0,T=n.height===S?1:0;K(e),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_ROW_LENGTH,n.width),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),e.texImage3D(i,s,u,v,v,v,0,p,m,null);for(var x=0;x=0?b(r,t):n.indexOf("tan")>=0||n.indexOf("binorm")>=0?g(r,t):n.indexOf("norm")>=0&&y(r,t)})),e}function S(e,t,n){return e=e||2,{position:{numComponents:2,data:[(t=t||0)+-1*(e*=.5),(n=n||0)+-1*e,t+1*e,n+-1*e,t+-1*e,n+1*e,t+1*e,n+1*e]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function w(e,t,n,r,i){e=e||1,t=t||1,n=n||1,r=r||1,i=i||o.identity();for(var s=(n+1)*(r+1),a=h(3,s),l=h(3,s),c=h(2,s),u=0;u<=r;u++)for(var d=0;d<=n;d++){var p=d/n,m=u/r;a.push(e*p-.5*e,0,t*m-.5*t),l.push(0,1,0),c.push(p,m)}for(var f=n+1,g=h(3,n*r*2,Uint16Array),y=0;y 0");r=r||0,s=s||0;for(var a=(i=i||Math.PI)-r,l=(o=o||2*Math.PI)-s,c=(t+1)*(n+1),u=h(3,c),d=h(3,c),p=h(2,c),m=0;m<=n;m++)for(var f=0;f<=t;f++){var g=f/t,y=m/n,b=l*g,v=a*y,S=Math.sin(b),w=Math.cos(b),k=Math.sin(v),T=w*k,x=Math.cos(v),E=S*k;u.push(e*T,e*x,e*E),d.push(T,x,E),p.push(1-g,y)}for(var A=t+1,C=h(3,t*n*2,Uint16Array),I=0;Ii?(T=n,k=1,x=t):x=e+w/i*(t-e),-2!==w&&w!==i+2||(x=0,k=0),T-=n/2;for(var E=0;Ei?0:A*b,w<0?-1:w>i?1:v,w<0||w>i?0:C*b),m.push(E/r,1-k)}}for(var I=0;I 0");var l=(o=o||1)-(s=s||0),c=2*(i+1)*4,u=h(3,c),d=h(3,c),p=h(2,c);function m(e,t,n){return e+(t-e)*n}function f(t,n,o,c,h,f){for(var g=0;g<=i;g++){var y=n/1,b=g/i,v=2*(y-.5),S=(s+b*l)*Math.PI,w=Math.sin(S),k=Math.cos(S),T=m(e,t,w),x=v*r,E=k*e,A=w*T;u.push(x,E,A);var C=a.add(a.multiply([0,w,k],o),c);d.push(C),p.push(y*h+f,b)}}for(var g=0;g<2;g++){var y=2*(g/1-.5);f(t,g,[1,1,1],[0,0,0],1,0),f(t,g,[0,0,0],[y,0,0],0,0),f(n,g,[1,1,1],[0,0,0],1,0),f(n,g,[0,0,0],[y,0,0],0,1)}var b=h(3,2*i*4,Uint16Array);function v(e,t){for(var n=0;n0&&g!==t){var S=u+(g+1),w=u+g,k=u+g-p,T=u+(g+1)-p;c.push(S,w,k),c.push(S,k,T)}}u+=t+1}return{position:o,normal:a,texcoord:l,indices:c}}function R(e){return function(t){var n=e.apply(this,Array.prototype.slice.call(arguments,1));return r.createBuffersFromArrays(t,n)}}function D(e){return function(t){var n=e.apply(null,Array.prototype.slice.call(arguments,1));return r.createBufferInfoFromArrays(t,n)}}var P=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function L(e,t,n,r){r=r||0;for(var i=e.length,s=0;s0&&void 0!==arguments[0]?arguments[0]:n.nowObj;this.startTime=0,this.nowObj=e}static get USE_PERFORMANCE(){return!1}static get legacyDateCode(){return{now:function(){return(new Date).getTime()}}}static get nowObj(){return n.USE_PERFORMANCE&&"undefined"!=typeof self&&self.performance&&"now"in self.performance?self.performance:Date.now?Date:n.legacyDateCode}time(){return this.nowObj.now()}start(){this.startTime=this.nowObj.now()}timeElapsed(){return this.nowObj.now()-this.startTime}setTimeout(e,n){return t.setTimeout(e,n)}clearTimeout(e){t.clearTimeout(e)}}e.exports=n}).call(this,n(9))},function(e,t,n){const r=n(134),i=n(136);class s{static base64ToUint8Array(e){const t=r(e),n=t.length,i=new Uint8Array(n);for(let e=0;e1&&(r+=t);const i=n.inputs[r];return void 0===i?null:i.block}getOpcode(e){return void 0===e?null:e.opcode}getFields(e){return void 0===e?null:e.fields}getInputs(e){if(void 0===e)return null;let t=this._cache.inputs[e.id];if(void 0!==t)return t;t={};for(const n in e.inputs)n.substring(0,m.BRANCH_INPUT_PREFIX.length)!==m.BRANCH_INPUT_PREFIX&&(t[n]=e.inputs[n]);return this._cache.inputs[e.id]=t,t}getMutation(e){return void 0===e?null:e.mutation}getTopLevelScript(e){let t=this._blocks[e];if(void 0===t)return null;for(;null!==t.parent;)t=this._blocks[t.parent];return t.id}getProcedureDefinition(e){const t=this._cache.procedureDefinitions[e];if(void 0!==t)return t;for(const t in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,t))continue;const n=this._blocks[t];if("procedures_definition"===n.opcode){const r=this._getCustomBlockInternal(n);if(r&&r.mutation.proccode===e)return this._cache.procedureDefinitions[e]=t,t}}return this._cache.procedureDefinitions[e]=null,null}getProcedureParamNamesAndIds(e){return this.getProcedureParamNamesIdsAndDefaults(e).slice(0,2)}getProcedureParamNamesIdsAndDefaults(e){const t=this._cache.procedureParamNames[e];if(void 0!==t)return t;for(const t in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,t))continue;const n=this._blocks[t];if("procedures_prototype"===n.opcode&&n.mutation.proccode===e){const t=JSON.parse(n.mutation.argumentnames),r=JSON.parse(n.mutation.argumentids),i=JSON.parse(n.mutation.argumentdefaults);return this._cache.procedureParamNames[e]=[t,r,i],this._cache.procedureParamNames[e]}}const n=this.runtime.getAddonBlock(e);return n?(this._cache.procedureParamNames[e]=n.namesIdsDefaults,n.namesIdsDefaults):(this._cache.procedureParamNames[e]=null,null)}populateProcedureCache(){if(!this._cache.proceduresPopulated){for(const e in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,e))continue;const t=this._blocks[e];if("procedures_prototype"!==t.opcode){if("procedures_definition"===t.opcode){const n=this._getCustomBlockInternal(t);if(n){const t=n.mutation.proccode;this._cache.procedureDefinitions[t]||(this._cache.procedureDefinitions[t]=e);continue}}}else{const e=t.mutation.proccode;if(!this._cache.procedureParamNames[e]){const n=JSON.parse(t.mutation.argumentnames),r=JSON.parse(t.mutation.argumentids),i=JSON.parse(t.mutation.argumentdefaults);this._cache.procedureParamNames[e]=[n,r,i]}}}this._cache.proceduresPopulated=!0}}duplicate(){const e=new m(this.runtime,this.forceNoGlow);return e._blocks=a.simple(this._blocks),e._scripts=a.simple(this._scripts),e}blocklyListen(e){if("object"!=typeof e)return;if("string"!=typeof e.blockId&&"string"!=typeof e.varId&&"string"!=typeof e.commentId)return;const t=this.runtime.getTargetForStage(),n=this.runtime.getEditingTarget();if("stackclick"!==e.element)switch(e.type){case"create":{const t=r(e);for(let e=0;ee.isOriginal));for(const t of n)if(t.lookupVariableByNameAndType(e.varName,e.varType,!0))return;t.createVariable(e.varId,e.varName,e.varType,e.isCloud),this.emitProjectChanged()}break;case"var_rename":if(n&&Object.prototype.hasOwnProperty.call(n.variables,e.varId))n.renameVariable(e.varId,e.newName),n.blocks.updateBlocksAfterVarRename(e.varId,e.newName);else{t.renameVariable(e.varId,e.newName);const n=this.runtime.targets;for(let t=0;t0&&"data_variable"!==t.opcode&&"data_listcontents"!==t.opcode){const e=p(t.id,t.fields);let n=this.runtime.monitorBlocks.getBlock(e);n||(n=JSON.parse(JSON.stringify(t)),n.id=e,this.runtime.monitorBlocks.createBlock(n)),t=n}const n=t.isMonitored;t.isMonitored=e.value;let r=!1;"data_variable"===t.opcode?r=!this.runtime.getTargetForStage().variables[t.fields.VARIABLE.id]:"data_listcontents"===t.opcode&&(r=!this.runtime.getTargetForStage().variables[t.fields.LIST.id]);const i=r||Object.prototype.hasOwnProperty.call(this.runtime.monitorBlockInfo,t.opcode)&&this.runtime.monitorBlockInfo[t.opcode].isSpriteSpecific;t.targetId=i?t.targetId||this.runtime.getEditingTarget().id:null,n&&!t.isMonitored?this.runtime.requestHideMonitor(t.id):!n&&t.isMonitored&&(this.runtime.requestShowMonitor(t.id)||this.runtime.requestAddMonitor(o({id:t.id,targetId:t.targetId,spriteName:t.targetId?this.runtime.getTargetById(t.targetId).getName():null,opcode:t.opcode,params:this._getBlockParams(t),value:"",mode:"data_listcontents"===t.opcode?"list":"default"})));break}}this.emitProjectChanged(),this.resetCache()}}moveBlock(e){if(!Object.prototype.hasOwnProperty.call(this._blocks,e.id))return;const t=this._blocks[e.id];let n=!1;if(e.newCoordinate&&(n=t.x!==e.newCoordinate.x||t.y!==e.newCoordinate.y,t.x=e.newCoordinate.x,t.y=e.newCoordinate.y),void 0!==e.oldParent){const t=this._blocks[e.oldParent];void 0!==e.oldInput&&t.inputs[e.oldInput].block===e.id?t.inputs[e.oldInput].block=null:t.next===e.id&&(t.next=null),this._blocks[e.id].parent=null,n=!0}if(void 0===e.newParent)this._addScript(e.id);else{if(this._deleteScript(e.id),void 0===e.newInput)this._blocks[e.newParent].next=e.id;else{let t=null;Object.prototype.hasOwnProperty.call(this._blocks[e.newParent].inputs,e.newInput)&&(t=this._blocks[e.newParent].inputs[e.newInput].shadow),this._blocks[e.id].shadow&&(t=e.id),this._blocks[e.newParent].inputs[e.newInput]={name:e.newInput,block:e.id,shadow:t}}this._blocks[e.id].parent=e.newParent,n=!0}this.resetCache(),n&&this.emitProjectChanged()}runAllMonitored(e){null===this._cache._monitored&&(this._cache._monitored=Object.keys(this._blocks).filter((e=>this.getBlock(e).isMonitored)).map((t=>{const n=this.getBlock(t).targetId;return{blockId:t,target:n?e.getTargetById(n):null}})));const t=this._cache._monitored;for(let n=0;nthis.deleteBlock(e)))}getAllVariableAndListReferences(e,t){const n=e||this._blocks,r=Object.create(null);for(const e in n){let i=null,s=null;if(n[e].fields.VARIABLE?(i=n[e].fields.VARIABLE,s=h.SCALAR_TYPE):n[e].fields.LIST?(i=n[e].fields.LIST,s=h.LIST_TYPE):t&&n[e].fields.BROADCAST_OPTION&&(i=n[e].fields.BROADCAST_OPTION,s=h.BROADCAST_MESSAGE_TYPE),i){const e=i.id;r[e]?r[e].push({referencingField:i,type:s}):r[e]=[{referencingField:i,type:s}]}}return r}updateBlocksAfterVarRename(e,t){const n=this._blocks;for(const r in n){let i=null;if(n[r].fields.VARIABLE?i=n[r].fields.VARIABLE:n[r].fields.LIST&&(i=n[r].fields.LIST),i){e===i.id&&(i.value=t)}}}updateTargetSpecificBlocks(e){const t=this._blocks;for(const n in t)e&&"event_whenthisspriteclicked"===t[n].opcode?t[n].opcode="event_whenstageclicked":e||"event_whenstageclicked"!==t[n].opcode||(t[n].opcode="event_whenthisspriteclicked")}updateAssetName(e,t,n){let r;if("costume"===n)r=this._getCostumeField.bind(this);else if("sound"===n)r=this._getSoundField.bind(this);else if("backdrop"===n)r=this._getBackdropField.bind(this);else{if("sprite"!==n)return;r=this._getSpriteField.bind(this)}const i=this._blocks;for(const n in i){const i=r(n);i&&i.value===e&&(i.value=t)}this.resetCache()}updateSensingOfReference(e,t,n){const r=this._blocks;let i=!1;for(const s in r){const o=r[s];if("sensing_of"===o.opcode&&o.fields.PROPERTY.value===e&&o.inputs.OBJECT.block===o.inputs.OBJECT.shadow){this.getBlock(o.inputs.OBJECT.block).fields.OBJECT.value===n&&(o.fields.PROPERTY.value=t,i=!0)}}return i&&this.resetCache(),i}_getCostumeField(e){const t=this.getBlock(e);return t&&Object.prototype.hasOwnProperty.call(t.fields,"COSTUME")?t.fields.COSTUME:null}_getSoundField(e){const t=this.getBlock(e);return t&&Object.prototype.hasOwnProperty.call(t.fields,"SOUND_MENU")?t.fields.SOUND_MENU:null}_getBackdropField(e){const t=this.getBlock(e);return t&&Object.prototype.hasOwnProperty.call(t.fields,"BACKDROP")?t.fields.BACKDROP:null}_getSpriteField(e){const t=this.getBlock(e);if(!t)return null;const n=["TOWARDS","TO","OBJECT","VIDEOONMENU2","DISTANCETOMENU","TOUCHINGOBJECTMENU","CLONE_OPTION"];for(let e=0;ethis.blockToXML(t,e))).join()}blockToXML(e,t){const n=this._blocks[e];if(!n)return;const r=n.shadow?"shadow":"block";let i="<".concat(r,'\n id="').concat(s(n.id),'"\n type="').concat(s(n.opcode),'"\n ').concat(n.topLevel?'x="'.concat(n.x,'" y="').concat(n.y,'"'):"","\n >");const o=n.comment;o&&(t?Object.prototype.hasOwnProperty.call(t,o)?i+=t[o].toXML():d.warn("Could not find comment with id: ".concat(o," in provided comment descriptions.")):d.warn("Cannot serialize comment with id: ".concat(o,"; no comment descriptions provided."))),n.mutation&&(i+=this.mutationToXML(n.mutation));for(const e in n.inputs){if(!Object.prototype.hasOwnProperty.call(n.inputs,e))continue;const r=n.inputs[e];(r.block||r.shadow)&&(i+=''),r.block&&(i+=this.blockToXML(r.block,t)),r.shadow&&r.shadow!==r.block&&(i+=this.blockToXML(r.shadow,t)),i+="")}for(const e in n.fields){if(!Object.prototype.hasOwnProperty.call(n.fields,e))continue;const t=n.fields[e];i+='".concat(a,"")}return n.next&&(i+="".concat(this.blockToXML(n.next,t),"")),i+=""),i}mutationToXML(e){let t="<".concat(e.tagName);for(const n in e){if("children"===n||"tagName"===n)continue;let r="string"==typeof e[n]?s(e[n]):e[n];"blockInfo"===n&&(r=s(JSON.stringify(e[n]))),t+=" ".concat(n,'="').concat(r,'"')}t+=">";for(let n=0;n"),t}_getBlockParams(e){const t={};for(const n in e.fields)t[n]=e.fields[n].value;for(const n in e.inputs){const r=this._blocks[e.inputs[n].block];for(const e in r.fields)t[e]=r.fields[e].value}return t}_getCustomBlockInternal(e){if(e.inputs&&e.inputs.custom_block)return this._blocks[e.inputs.custom_block.block]}_addScript(e){this._scripts.indexOf(e)>-1||(this._scripts.push(e),this._blocks[e].topLevel=!0)}_deleteScript(e){const t=this._scripts.indexOf(e);t>-1&&this._scripts.splice(t,1),this._blocks[e]&&(this._blocks[e].topLevel=!1)}}c.getCached=function(e,t,n){let r=e._cache._executeCached[t];if(void 0!==r)return r;const i=e.getBlock(t);return void 0===i?null:(r=void 0===n?{id:t,opcode:e.getOpcode(i),fields:e.getFields(i),inputs:e.getInputs(i),mutation:e.getMutation(i)}:new n(e,{id:t,opcode:e.getOpcode(i),fields:e.getFields(i),inputs:e.getInputs(i),mutation:e.getMutation(i)}),e._cache._executeCached[t]=r,r)};const f=u._RuntimeScriptCache;u.getScripts=function(e,t){let n=e._cache.scripts[t];if(!n){n=e._cache.scripts[t]=[];const r=e._scripts;for(let i=0;i0&&this.scanner.lookupType(-1)===i?this.scanner.tokenIndex>1?this.scanner.getTokenStart(this.scanner.tokenIndex-1):this.scanner.firstCharOffset:this.scanner.tokenStart}function c(){return 0}e.exports={name:"Raw",structure:{value:String},parse:function(e,t,n){var r,i=this.scanner.getTokenStart(e);return this.scanner.skip(this.scanner.getRawLength(e,t||c)),r=n&&this.scanner.tokenStart>i?l.call(this):this.scanner.tokenStart,{type:"Raw",loc:this.getLocation(i,r),value:this.scanner.source.substring(i,r)}},generate:function(e){this.chunk(e.value)},mode:{default:c,leftCurlyBracket:function(e){return e===o?1:0},leftCurlyBracketOrSemicolon:function(e){return e===o||e===s?1:0},exclamationMarkOrSemicolon:function(e,t,n){return e===a&&33===t.charCodeAt(n)||e===s?1:0},semicolonIncluded:function(e){return e===s?2:0}}}},function(e,t,n){"use strict";(function(e){var r=n(120),i=n(121),s=n(122);function o(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return W(e).length;t=(""+t).toLowerCase(),r=!0}}function f(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){var s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(s=n;sa&&(n=a-l),s=n;s>=0;s--){for(var d=!0,h=0;hi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+d<=n)switch(d){case 1:c<128&&(u=c);break;case 2:128==(192&(s=e[i+1]))&&(l=(31&c)<<6|63&s)>127&&(u=l);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&c)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),c=this.slice(r,i),u=e.slice(t,n),d=0;di)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return S(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return k(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function I(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,i,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function P(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function B(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function z(e,t,n,r,s){return s||B(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,s){return s||B(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,s=0;++s=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||D(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+i]=e/s&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return z(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return z(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(9))},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,n)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var i,s,o,a;if(c(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function m(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=i[e];if(void 0===l)return!1;if("function"==typeof l)s(l,this,t);else{var c=l.length,u=g(l,c);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return m(this,e,!0)},a.prototype.rawListeners=function(e){return m(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t){function n(e){return{prev:null,next:null,data:e}}function r(e,t,n){var r;return null!==s?(r=s,s=s.cursor,r.prev=t,r.next=n,r.cursor=e.cursor):r={prev:t,next:n,cursor:e.cursor},e.cursor=r,r}function i(e){var t=e.cursor;e.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=s,s=t}var s=null,o=function(){this.cursor=null,this.head=null,this.tail=null};o.createItem=n,o.prototype.createItem=n,o.prototype.updateCursors=function(e,t,n,r){for(var i=this.cursor;null!==i;)i.prev===e&&(i.prev=t),i.next===n&&(i.next=r),i=i.cursor},o.prototype.getSize=function(){for(var e=0,t=this.head;t;)e++,t=t.next;return e},o.prototype.fromArray=function(e){var t=null;this.head=null;for(var r=0;r>2,a=(3&t)<<4|n>>4,l=1>6:64,c=2>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(l=s.indexOf(e.charAt(c++))),h[u++]=t,64!==a&&(h[u++]=n),64!==l&&(h[u++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,n){"use strict";var r=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){"use strict";var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){"use strict";var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a>>8^s[255&(e^t[a])];return~e}(0|t,e,e.length,0):function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a>>8^s[255&(e^t.charCodeAt(a))];return~e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({chunkSize:65536,raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){"use strict";function r(e,t){var n,r="";for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,h,p=e.file,m=e.compression,f=u!==a.utf8encode,g=s.transformTo("string",u(p.name)),y=s.transformTo("string",a.utf8encode(p.name)),b=p.comment,v=s.transformTo("string",u(b)),S=s.transformTo("string",a.utf8encode(b)),w=y.length!==p.name.length,k=S.length!==b.length,T="",x="",E="",A=p.dir,C=p.date,I={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(I.crc32=e.crc32,I.compressedSize=e.compressedSize,I.uncompressedSize=e.uncompressedSize);var O=0;t&&(O|=8),f||!w&&!k||(O|=2048);var M=0,N=0;A&&(M|=16),"UNIX"===o?(N=798,M|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,A)):(N=20,M|=function(e){return 63&(e||0)}(p.dosPermissions)),d=C.getUTCHours(),d<<=6,d|=C.getUTCMinutes(),d<<=5,d|=C.getUTCSeconds()/2,h=C.getUTCFullYear()-1980,h<<=4,h|=C.getUTCMonth()+1,h<<=5,h|=C.getUTCDate(),w&&(x=r(1,1)+r(l(g),4)+y,T+="up"+r(x.length,2)+x),k&&(E=r(1,1)+r(l(v),4)+S,T+="uc"+r(E.length,2)+E);var R="";return R+="\n\0",R+=r(O,2),R+=m.magic,R+=r(d,2),R+=r(h,2),R+=r(I.crc32,4),R+=r(I.compressedSize,4),R+=r(I.uncompressedSize,4),R+=r(g.length,2),R+=r(T.length,2),{fileRecord:c.LOCAL_FILE_HEADER+R+g+T,dirRecord:c.CENTRAL_FILE_HEADER+r(N,2)+R+r(v.length,2)+"\0\0\0\0"+r(M,4)+r(i,4)+g+T+v}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),c=e("../signature");function u(e,t,n,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return c.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){"use strict";var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){"use strict";var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){"use strict";var r=e("./ArrayReader"),i=e("./DataReader");function s(e){i.call(this,e)}e("../utils").inherits(s,r),s.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=s},{"../utils":32,"./ArrayReader":17,"./DataReader":18}],22:[function(e,t,n){"use strict";var r=e("../utils"),i=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(r.transformTo("uint8array",e)):new s(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../utils");function s(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,r),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,r),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+65536);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":case"nodebuffer":e=this.data.subarray(this.index,t);break;case"array":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=r},{}],29:[function(e,n,r){"use strict";var i=e("../utils"),s=e("./ConvertWorker"),o=e("./GenericWorker"),a=e("../base64"),l=e("../support"),c=e("../external"),u=null;if(l.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function d(e,n){return new c.Promise((function(r,s){var o=[],l=e._internalType,c=e._outputType,u=e._mimeType;e.on("data",(function(e,t){o.push(e),n&&n(t)})).on("error",(function(e){o=[],s(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),n);case"base64":return a.encode(t);default:return i.transformTo(e,t)}}(c,function(e,n){var r,i=0,s=null,o=0;for(r=0;r>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,s,o=e.length,l=new Array(2*o);for(t=n=0;t>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(c,o),c.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;o!==t.length&&(i.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var i=e("./support"),s=e("./base64"),o=e("./nodejsUtils"),a=e("./external");function l(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,c[r++]=56320|1023&i)}return l(c,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){for(var i=65535&e,s=e>>>16&65535,o=0;0!==n;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,n){"use strict";var r,i=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),c=0,u=4,d=0,h=-2,p=-1,m=4,f=2,g=8,y=9,b=286,v=30,S=19,w=2*b+1,k=15,T=3,x=258,E=x+T+1,A=42,C=113,I=1,O=2,M=3,N=4;function R(e,t){return e.msg=l[t],t}function D(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function B(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,L(e.strm)}function z(e,t){e.pending_buf[e.pending++]=t}function U(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function j(e,t){var n,r,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-E?e.strstart-(e.w_size-E):0,c=e.window,u=e.w_mask,d=e.prev,h=e.strstart+x,p=c[s+o-1],m=c[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(n=t)+o]===m&&c[n+o-1]===p&&c[n]===c[s]&&c[++n]===c[s+1]){s+=2,n++;do{}while(c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&sl&&0!=--i);return o<=e.lookahead?o:e.lookahead}function F(e){var t,n,r,s,l,c,u,d,h,p,m=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-E)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);s+=m}if(0===e.strm.avail_in)break;if(c=e.strm,u=e.window,d=e.strstart+e.lookahead,p=void 0,(h=s)<(p=c.avail_in)&&(p=h),n=0===p?0:(c.avail_in-=p,i.arraySet(u,c.input,c.next_in,p,d),1===c.state.wrap?c.adler=o(c.adler,u,p,d):2===c.state.wrap&&(c.adler=a(c.adler,u,p,d)),c.next_in+=p,c.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=T)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=T&&(e.ins_h=(e.ins_h<=T)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-T),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=T){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=T&&(e.ins_h=(e.ins_h<=T&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-T,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-T),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(F(e),0===e.lookahead&&t===c)return I;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,B(e,!1),0===e.strm.avail_out))return I;if(e.strstart-e.block_start>=e.w_size-E&&(B(e,!1),0===e.strm.avail_out))return I}return e.insert=0,t===u?(B(e,!0),0===e.strm.avail_out?M:N):(e.strstart>e.block_start&&(B(e,!1),e.strm.avail_out),I)})),new G(4,4,8,4,W),new G(4,5,16,8,W),new G(4,6,32,32,W),new G(4,4,16,16,V),new G(8,16,32,32,V),new G(8,16,128,128,V),new G(8,32,128,256,V),new G(32,128,258,1024,V),new G(32,258,258,4096,V)],n.deflateInit=function(e,t){return _(e,t,g,15,8,0)},n.deflateInit2=_,n.deflateReset=H,n.deflateResetKeep=Y,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?h:(e.state.gzhead=t,d):h},n.deflate=function(e,t){var n,i,o,l;if(!e||!e.state||5>8&255),z(i,i.gzhead.time>>16&255),z(i,i.gzhead.time>>24&255),z(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),z(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(z(i,255&i.gzhead.extra.length),z(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(z(i,0),z(i,0),z(i,0),z(i,0),z(i,0),z(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),z(i,3),i.status=C);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(p|=32),p+=31-p%31,i.status=C,U(i,p),0!==i.strstart&&(U(i,e.adler>>>16),U(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),L(e),o=i.pending,i.pending!==i.pending_buf_size));)z(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),L(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexo&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),L(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexo&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&L(e),i.pending+2<=i.pending_buf_size&&(z(i,255&e.adler),z(i,e.adler>>8&255),e.adler=0,i.status=C)):i.status=C),0!==i.pending){if(L(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&D(t)<=D(n)&&t!==u)return R(e,-5);if(666===i.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==c&&666!==i.status){var m=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(F(e),0===e.lookahead)){if(t===c)return I;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(B(e,!1),0===e.strm.avail_out))return I}return e.insert=0,t===u?(B(e,!0),0===e.strm.avail_out?M:N):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?I:O}(i,t):3===i.strategy?function(e,t){for(var n,r,i,o,a=e.window;;){if(e.lookahead<=x){if(F(e),e.lookahead<=x&&t===c)return I;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=T&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=T?(n=s._tr_tally(e,1,e.match_length-T),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(B(e,!1),0===e.strm.avail_out))return I}return e.insert=0,t===u?(B(e,!0),0===e.strm.avail_out?M:N):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?I:O}(i,t):r[i.level].func(i,t);if(m!==M&&m!==N||(i.status=666),m===I||m===M)return 0===e.avail_out&&(i.last_flush=-1),d;if(m===O&&(1===t?s._tr_align(i):5!==t&&(s._tr_stored_block(i,0,0,!1),3===t&&(P(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),L(e),0===e.avail_out))return i.last_flush=-1,d}return t!==u?d:i.wrap<=0?1:(2===i.wrap?(z(i,255&e.adler),z(i,e.adler>>8&255),z(i,e.adler>>16&255),z(i,e.adler>>24&255),z(i,255&e.total_in),z(i,e.total_in>>8&255),z(i,e.total_in>>16&255),z(i,e.total_in>>24&255)):(U(i,e.adler>>>16),U(i,65535&e.adler)),L(e),0=n.w_size&&(0===a&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),l=e.avail_in,c=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,F(n);n.lookahead>=T;){for(r=n.strstart,s=n.lookahead-(T-1);n.ins_h=(n.ins_h<>>=S=v>>>24,m-=S,0==(S=v>>>16&255))A[s++]=65535&v;else{if(!(16&S)){if(!(64&S)){v=f[(65535&v)+(p&(1<>>=S,m-=S),m<15&&(p+=E[r++]<>>=S=v>>>24,m-=S,!(16&(S=v>>>16&255))){if(!(64&S)){v=g[(65535&v)+(p&(1<>>=S,m-=S,(S=s-o)>3,p&=(1<<(m-=w<<3))-1,e.next_in=r,e.next_out=s,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=h,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function b(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,y(e)):d}function v(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(s=o.wsize-o.wnext)&&(s=i),r.arraySet(o.window,t,n-i,s,o.wnext),(i-=s)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=s(n.check,F,2,0),w=S=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&S)<<8)+(S>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&S)){e.msg="unknown compression method",n.mode=30;break}if(w-=4,L=8+(15&(S>>>=4)),0===n.wbits)n.wbits=L;else if(L>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(F[0]=255&S,F[1]=S>>>8&255,n.check=s(n.check,F,2,0)),w=S=0,n.mode=3;case 3:for(;w<32;){if(0===b)break e;b--,S+=p[g++]<>>8&255,F[2]=S>>>16&255,F[3]=S>>>24&255,n.check=s(n.check,F,4,0)),w=S=0,n.mode=4;case 4:for(;w<16;){if(0===b)break e;b--,S+=p[g++]<>8),512&n.flags&&(F[0]=255&S,F[1]=S>>>8&255,n.check=s(n.check,F,2,0)),w=S=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===b)break e;b--,S+=p[g++]<>>8&255,n.check=s(n.check,F,2,0)),w=S=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(b<(A=n.length)&&(A=b),A&&(n.head&&(L=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,A,L)),512&n.flags&&(n.check=s(n.check,p,A,g)),b-=A,g+=A,n.length-=A),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===b)break e;for(A=0;L=p[g+A++],n.head&&L&&n.length<65536&&(n.head.name+=String.fromCharCode(L)),L&&A>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;w<32;){if(0===b)break e;b--,S+=p[g++]<>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===b)break e;b--,S+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(x(n),n.mode=20,6!==t)break;S>>>=2,w-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}S>>>=2,w-=2;break;case 14:for(S>>>=7&w,w-=7&w;w<32;){if(0===b)break e;b--,S+=p[g++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&S,w=S=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(A=n.length){if(b>>=5,w-=5,n.ndist=1+(31&S),S>>>=5,w-=5,n.ncode=4+(15&S),S>>>=4,w-=4,286>>=3,w-=3}for(;n.have<19;)n.lens[W[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,z={bits:n.lenbits},B=a(0,n.lens,0,19,n.lencode,0,n.work,z),n.lenbits=z.bits,B){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,N=65535&j,!((O=j>>>24)<=w);){if(0===b)break e;b--,S+=p[g++]<>>=O,w-=O,n.lens[n.have++]=N;else{if(16===N){for(U=O+2;w>>=O,w-=O,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}L=n.lens[n.have-1],A=3+(3&S),S>>>=2,w-=2}else if(17===N){for(U=O+3;w>>=O)),S>>>=3,w-=3}else{for(U=O+7;w>>=O)),S>>>=7,w-=7}if(n.have+A>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;A--;)n.lens[n.have++]=L}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,z={bits:n.lenbits},B=a(l,n.lens,0,n.nlen,n.lencode,0,n.work,z),n.lenbits=z.bits,B){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,z={bits:n.distbits},B=a(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,z),n.distbits=z.bits,B){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=b&&258<=v){e.next_out=y,e.avail_out=v,e.next_in=g,e.avail_in=b,n.hold=S,n.bits=w,o(e,T),y=e.next_out,m=e.output,v=e.avail_out,g=e.next_in,p=e.input,b=e.avail_in,S=n.hold,w=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;M=(j=n.lencode[S&(1<>>16&255,N=65535&j,!((O=j>>>24)<=w);){if(0===b)break e;b--,S+=p[g++]<>R)])>>>16&255,N=65535&j,!(R+(O=j>>>24)<=w);){if(0===b)break e;b--,S+=p[g++]<>>=R,w-=R,n.back+=R}if(S>>>=O,w-=O,n.back+=O,n.length=N,0===M){n.mode=26;break}if(32&M){n.back=-1,n.mode=12;break}if(64&M){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&M,n.mode=22;case 22:if(n.extra){for(U=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;M=(j=n.distcode[S&(1<>>16&255,N=65535&j,!((O=j>>>24)<=w);){if(0===b)break e;b--,S+=p[g++]<>R)])>>>16&255,N=65535&j,!(R+(O=j>>>24)<=w);){if(0===b)break e;b--,S+=p[g++]<>>=R,w-=R,n.back+=R}if(S>>>=O,w-=O,n.back+=O,64&M){e.msg="invalid distance code",n.mode=30;break}n.offset=N,n.extra=15&M,n.mode=24;case 24:if(n.extra){for(U=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===v)break e;if(A=T-v,n.offset>A){if((A=n.offset-A)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}C=A>n.wnext?(A-=n.wnext,n.wsize-A):n.wnext-A,A>n.length&&(A=n.length),I=n.window}else I=m,C=y-n.offset,A=n.length;for(vb?(S=z[U+d[x]],D[P+d[x]]):(S=96,0),p=1<>O)+(m-=p)]=v<<24|S<<16|w,0!==m;);for(p=1<>=1;if(0!==p?(R&=p-1,R+=p):R=0,x++,0==--L[T]){if(T===A)break;T=t[n+d[x]]}if(C>>7)]}function z(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function U(e,t,n){e.bi_valid>f-n?(e.bi_buf|=t<>f-e.bi_valid,e.bi_valid+=n-f):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function W(e,t,n){var r,i,s=new Array(m+1),o=0;for(r=1;r<=m;r++)s[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=F(s[a]++,a))}}function V(e){var t;for(t=0;t>1;1<=n;n--)Y(e,s,n);for(i=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Y(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,s[2*i]=s[2*n]+s[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,s[2*n+1]=s[2*r+1]=i,e.heap[1]=i++,Y(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,s,o,a,l=t.dyn_tree,c=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,g=t.stat_desc.max_length,y=0;for(s=0;s<=m;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return i;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=n+5,n+4<=o&&-1!==t?Z(e,t,n,r):4===e.strategy||a===o?(U(e,2+(r?1:0),3),H(e,E,A)):(U(e,4+(r?1:0),3),function(e,t,n,r){var i;for(U(e,t-257,5),U(e,n-1,5),U(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(I[n]+c+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){U(e,2,3),j(e,y,E),function(e){16===e.bi_valid?(z(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var n,r,s,o,a=1,l={},c=!1,u=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,n="[object process]"==={}.toString.call(e.process)?function(e){i.nextTick((function(){p(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}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",m,!1):e.attachEvent("onmessage",m),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){p(e.data)},function(e){s.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(r=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(p,0,e)},d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r>24&255;return{r:e>>16&255,g:e>>8&255,b:255&e,a:t>0?t:255}}static hexToRgb(e){e.startsWith("#")&&(e=e.substring(1));const t=parseInt(e,16);if(isNaN(t))return null;if(6===e.length)return{r:t>>16&255,g:t>>8&255,b:255&t};if(3===e.length){const e=t>>8&15,n=t>>4&15,r=15&t;return{r:e<<4|e,g:n<<4|n,b:r<<4|r}}return null}static rgbToHex(e){return n.decimalToHex(n.rgbToDecimal(e))}static rgbToDecimal(e){return(e.r<<16)+(e.g<<8)+e.b}static hexToDecimal(e){return n.rgbToDecimal(n.hexToRgb(e))}static hsvToRgb(e){let t=e.h%360;t<0&&(t+=360);const n=Math.max(0,Math.min(e.s,1)),r=Math.max(0,Math.min(e.v,1)),i=Math.floor(t/60),s=t/60-i,o=r*(1-n),a=r*(1-n*s),l=r*(1-n*(1-s));let c,u,d;switch(i){default:case 0:c=r,u=l,d=o;break;case 1:c=a,u=r,d=o;break;case 2:c=o,u=r,d=l;break;case 3:c=o,u=a,d=r;break;case 4:c=l,u=o,d=r;break;case 5:c=r,u=o,d=a}return{r:Math.floor(255*c),g:Math.floor(255*u),b:Math.floor(255*d)}}static rgbToHsv(e){const t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(Math.min(t,n),r),s=Math.max(Math.max(t,n),r);let o=0,a=0;if(i!==s){o=60*((t===i?3:n===i?5:1)-(t===i?n-r:n===i?r-t:t-n)/(s-i))%360,a=(s-i)/s}return{h:o,s:a,v:s}}static mixRgb(e,t,n){if(n<=0)return e;if(n>=1)return t;const r=1-n;return{r:r*e.r+n*t.r,g:r*e.g+n*t.g,b:r*e.b+n*t.b}}}e.exports=n},function(e,t,n){e.exports=function(){"use strict";var e=Array.prototype.slice;function t(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function n(e){return o(e)?e:_(e)}function r(e){return a(e)?e:K(e)}function i(e){return l(e)?e:Q(e)}function s(e){return o(e)&&!c(e)?e:X(e)}function o(e){return!(!e||!e[d])}function a(e){return!(!e||!e[h])}function l(e){return!(!e||!e[p])}function c(e){return a(e)||l(e)}function u(e){return!(!e||!e[m])}t(r,n),t(i,n),t(s,n),n.isIterable=o,n.isKeyed=a,n.isIndexed=l,n.isAssociative=c,n.isOrdered=u,n.Keyed=r,n.Indexed=i,n.Set=s;var d="@@__IMMUTABLE_ITERABLE__@@",h="@@__IMMUTABLE_KEYED__@@",p="@@__IMMUTABLE_INDEXED__@@",m="@@__IMMUTABLE_ORDERED__@@",f="delete",g=5,y=1<>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?A(e)+t:t}function I(){return!0}function O(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function M(e,t){return R(e,t,0)}function N(e,t){return R(e,t,t)}function R(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var D=0,P=1,L=2,B="function"==typeof Symbol&&Symbol.iterator,z="@@iterator",U=B||z;function j(e){this.next=e}function F(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function W(){return{value:void 0,done:!0}}function V(e){return!!Y(e)}function G(e){return e&&"function"==typeof e.next}function q(e){var t=Y(e);return t&&t.call(e)}function Y(e){var t=e&&(B&&e[B]||e[z]);if("function"==typeof t)return t}function H(e){return e&&"number"==typeof e.length}function _(e){return null==e?oe():o(e)?e.toSeq():ce(e)}function K(e){return null==e?oe().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():ae(e)}function Q(e){return null==e?oe():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():le(e)}function X(e){return(null==e?oe():o(e)?a(e)?e.entrySeq():e:le(e)).toSetSeq()}j.prototype.toString=function(){return"[Iterator]"},j.KEYS=D,j.VALUES=P,j.ENTRIES=L,j.prototype.inspect=j.prototype.toSource=function(){return this.toString()},j.prototype[U]=function(){return this},t(_,n),_.of=function(){return _(arguments)},_.prototype.toSeq=function(){return this},_.prototype.toString=function(){return this.__toString("Seq {","}")},_.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},_.prototype.__iterate=function(e,t){return de(this,e,t,!0)},_.prototype.__iterator=function(e,t){return he(this,e,t,!0)},t(K,_),K.prototype.toKeyedSeq=function(){return this},t(Q,_),Q.of=function(){return Q(arguments)},Q.prototype.toIndexedSeq=function(){return this},Q.prototype.toString=function(){return this.__toString("Seq [","]")},Q.prototype.__iterate=function(e,t){return de(this,e,t,!1)},Q.prototype.__iterator=function(e,t){return he(this,e,t,!1)},t(X,_),X.of=function(){return X(arguments)},X.prototype.toSetSeq=function(){return this},_.isSeq=se,_.Keyed=K,_.Set=X,_.Indexed=Q;var Z,J,$,ee="@@__IMMUTABLE_SEQ__@@";function te(e){this._array=e,this.size=e.length}function ne(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function re(e){this._iterable=e,this.size=e.length||e.size}function ie(e){this._iterator=e,this._iteratorCache=[]}function se(e){return!(!e||!e[ee])}function oe(){return Z||(Z=new te([]))}function ae(e){var t=Array.isArray(e)?new te(e).fromEntrySeq():G(e)?new ie(e).fromEntrySeq():V(e)?new re(e).fromEntrySeq():"object"==typeof e?new ne(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function le(e){var t=ue(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function ce(e){var t=ue(e)||"object"==typeof e&&new ne(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function ue(e){return H(e)?new te(e):G(e)?new ie(e):V(e)?new re(e):void 0}function de(e,t,n,r){var i=e._cache;if(i){for(var s=i.length-1,o=0;o<=s;o++){var a=i[n?s-o:o];if(!1===t(a[1],r?a[0]:o,e))return o+1}return o}return e.__iterateUncached(t,n)}function he(e,t,n,r){var i=e._cache;if(i){var s=i.length-1,o=0;return new j((function(){var e=i[n?s-o:o];return o++>s?W():F(t,r?e[0]:o-1,e[1])}))}return e.__iteratorUncached(t,n)}function pe(e,t){return t?me(t,e,"",{"":e}):fe(e)}function me(e,t,n,r){return Array.isArray(t)?e.call(r,n,Q(t).map((function(n,r){return me(e,n,r,t)}))):ge(t)?e.call(r,n,K(t).map((function(n,r){return me(e,n,r,t)}))):t}function fe(e){return Array.isArray(e)?Q(e).map(fe).toList():ge(e)?K(e).map(fe).toMap():e}function ge(e){return e&&(e.constructor===Object||void 0===e.constructor)}function ye(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function be(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||l(e)!==l(t)||u(e)!==u(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!c(e);if(u(e)){var r=e.entries();return t.every((function(e,t){var i=r.next().value;return i&&ye(i[1],e)&&(n||ye(i[0],t))}))&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var s=e;e=t,t=s}var d=!0,h=t.__iterate((function(t,r){if(n?!e.has(t):i?!ye(t,e.get(r,v)):!ye(e.get(r,v),t))return d=!1,!1}));return d&&e.size===h}function ve(e,t){if(!(this instanceof ve))return new ve(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(J)return J;J=this}}function Se(e,t){if(!e)throw new Error(t)}function we(e,t,n){if(!(this instanceof we))return new we(e,t,n);if(Se(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),tr?W():F(e,i,n[t?r-i++:i++])}))},t(ne,K),ne.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},ne.prototype.has=function(e){return this._object.hasOwnProperty(e)},ne.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,s=0;s<=i;s++){var o=r[t?i-s:s];if(!1===e(n[o],o,this))return s+1}return s},ne.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,s=0;return new j((function(){var o=r[t?i-s:s];return s++>i?W():F(e,o,n[o])}))},ne.prototype[m]=!0,t(re,Q),re.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=q(this._iterable),r=0;if(G(n))for(var i;!(i=n.next()).done&&!1!==e(i.value,r++,this););return r},re.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=q(this._iterable);if(!G(n))return new j(W);var r=0;return new j((function(){var t=n.next();return t.done?t:F(e,r++,t.value)}))},t(ie,Q),ie.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n,r=this._iterator,i=this._iteratorCache,s=0;s=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return F(e,i,r[i++])}))},t(ve,Q),ve.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},ve.prototype.get=function(e,t){return this.has(e)?this._value:t},ve.prototype.includes=function(e){return ye(this._value,e)},ve.prototype.slice=function(e,t){var n=this.size;return O(e,t,n)?this:new ve(this._value,N(t,n)-M(e,n))},ve.prototype.reverse=function(){return this},ve.prototype.indexOf=function(e){return ye(this._value,e)?0:-1},ve.prototype.lastIndexOf=function(e){return ye(this._value,e)?this.size:-1},ve.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?W():F(e,s++,o)}))},we.prototype.equals=function(e){return e instanceof we?this._start===e._start&&this._end===e._end&&this._step===e._step:be(this,e)},t(ke,n),t(Te,ke),t(xe,ke),t(Ee,ke),ke.Keyed=Te,ke.Indexed=xe,ke.Set=Ee;var Ae="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var n=65535&(e|=0),r=65535&(t|=0);return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0};function Ce(e){return e>>>1&1073741824|3221225471&e}function Ie(e){if(!1===e||null==e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null==e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!=e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)n^=e/=4294967295;return Ce(n)}if("string"===t)return e.length>je?Oe(e):Me(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return Ne(e);if("function"==typeof e.toString)return Me(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function Oe(e){var t=Ve[e];return void 0===t&&(t=Me(e),We===Fe&&(We=0,Ve={}),We++,Ve[e]=t),t}function Me(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}var Le,Be="function"==typeof WeakMap;Be&&(Le=new WeakMap);var ze=0,Ue="__immutablehash__";"function"==typeof Symbol&&(Ue=Symbol(Ue));var je=16,Fe=255,We=0,Ve={};function Ge(e){Se(e!==1/0,"Cannot perform this action with an infinite size.")}function qe(e){return null==e?it():Ye(e)&&!u(e)?e:it().withMutations((function(t){var n=r(e);Ge(n.size),n.forEach((function(e,n){return t.set(n,e)}))}))}function Ye(e){return!(!e||!e[_e])}t(qe,Te),qe.of=function(){var t=e.call(arguments,0);return it().withMutations((function(e){for(var n=0;n=t.length)throw new Error("Missing value for key: "+t[n]);e.set(t[n],t[n+1])}}))},qe.prototype.toString=function(){return this.__toString("Map {","}")},qe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},qe.prototype.set=function(e,t){return st(this,e,t)},qe.prototype.setIn=function(e,t){return this.updateIn(e,v,(function(){return t}))},qe.prototype.remove=function(e){return st(this,e,v)},qe.prototype.deleteIn=function(e){return this.updateIn(e,(function(){return v}))},qe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},qe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=gt(this,kn(e),t,n);return r===v?void 0:r},qe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):it()},qe.prototype.merge=function(){return ht(this,void 0,arguments)},qe.prototype.mergeWith=function(t){return ht(this,t,e.call(arguments,1))},qe.prototype.mergeIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,it(),(function(e){return"function"==typeof e.merge?e.merge.apply(e,n):n[n.length-1]}))},qe.prototype.mergeDeep=function(){return ht(this,pt,arguments)},qe.prototype.mergeDeepWith=function(t){var n=e.call(arguments,1);return ht(this,mt(t),n)},qe.prototype.mergeDeepIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,it(),(function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,n):n[n.length-1]}))},qe.prototype.sort=function(e){return Vt(dn(this,e))},qe.prototype.sortBy=function(e,t){return Vt(dn(this,t,e))},qe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},qe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new x)},qe.prototype.asImmutable=function(){return this.__ensureOwner()},qe.prototype.wasAltered=function(){return this.__altered},qe.prototype.__iterator=function(e,t){return new et(this,e,t)},qe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate((function(t){return r++,e(t[1],t[0],n)}),t),r},qe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?rt(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},qe.isMap=Ye;var He,_e="@@__IMMUTABLE_MAP__@@",Ke=qe.prototype;function Qe(e,t){this.ownerID=e,this.entries=t}function Xe(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function Ze(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function Je(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function $e(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function et(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&nt(e._root)}function tt(e,t){return F(e,t[0],t[1])}function nt(e,t){return{node:e,index:0,__prev:t}}function rt(e,t,n,r){var i=Object.create(Ke);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function it(){return He||(He=rt(0))}function st(e,t,n){var r,i;if(e._root){var s=k(S),o=k(w);if(r=ot(e._root,e.__ownerID,0,void 0,t,n,s,o),!o.value)return e;i=e.size+(s.value?n===v?-1:1:0)}else{if(n===v)return e;i=1,r=new Qe(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?rt(i,r):it()}function ot(e,t,n,r,i,s,o,a){return e?e.update(t,n,r,i,s,o,a):s===v?e:(T(a),T(o),new $e(t,r,[i,s]))}function at(e){return e.constructor===$e||e.constructor===Je}function lt(e,t,n,r,i){if(e.keyHash===r)return new Je(t,r,[e.entry,i]);var s,o=(0===n?e.keyHash:e.keyHash>>>n)&b,a=(0===n?r:r>>>n)&b;return new Xe(t,1<>>=1)o[a]=1&n?t[s++]:void 0;return o[r]=i,new Ze(e,s+1,o)}function ht(e,t,n){for(var i=[],s=0;s>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function bt(e,t,n,r){var i=r?e:E(e);return i[t]=n,i}function vt(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var s=new Array(i),o=0,a=0;a=wt)return ct(e,l,r,i);var h=e&&e===this.ownerID,p=h?l:E(l);return d?a?c===u-1?p.pop():p[c]=p.pop():p[c]=[r,i]:p.push([r,i]),h?(this.entries=p,this):new Qe(e,p)}},Xe.prototype.get=function(e,t,n,r){void 0===t&&(t=Ie(n));var i=1<<((0===e?t:t>>>e)&b),s=this.bitmap;return s&i?this.nodes[yt(s&i-1)].get(e+g,t,n,r):r},Xe.prototype.update=function(e,t,n,r,i,s,o){void 0===n&&(n=Ie(r));var a=(0===t?n:n>>>t)&b,l=1<=kt)return dt(e,h,c,a,m);if(u&&!m&&2===h.length&&at(h[1^d]))return h[1^d];if(u&&m&&1===h.length&&at(m))return m;var f=e&&e===this.ownerID,y=u?m?c:c^l:c|l,S=u?m?bt(h,d,m,f):St(h,d,f):vt(h,d,m,f);return f?(this.bitmap=y,this.nodes=S,this):new Xe(e,y,S)},Ze.prototype.get=function(e,t,n,r){void 0===t&&(t=Ie(n));var i=(0===e?t:t>>>e)&b,s=this.nodes[i];return s?s.get(e+g,t,n,r):r},Ze.prototype.update=function(e,t,n,r,i,s,o){void 0===n&&(n=Ie(r));var a=(0===t?n:n>>>t)&b,l=i===v,c=this.nodes,u=c[a];if(l&&!u)return this;var d=ot(u,e,t+g,n,r,i,s,o);if(d===u)return this;var h=this.count;if(u){if(!d&&--h0&&r=0&&e>>t&b;if(r>=this.array.length)return new It([],e);var i,s=0===r;if(t>0){var o=this.array[r];if((i=o&&o.removeBefore(e,t-g,n))===o&&s)return this}if(s&&!i)return this;var a=zt(this,e);if(!s)for(var l=0;l>>t&b;if(i>=this.array.length)return this;if(t>0){var s=this.array[i];if((r=s&&s.removeAfter(e,t-g,n))===s&&i===this.array.length-1)return this}var o=zt(this,e);return o.array.splice(i+1),r&&(o.array[i]=r),o};var Ot,Mt,Nt={};function Rt(e,t){var n=e._origin,r=e._capacity,i=Wt(r),s=e._tail;return o(e._root,e._level,0);function o(e,t,n){return 0===t?a(e,n):l(e,t,n)}function a(e,o){var a=o===i?s&&s.array:e&&e.array,l=o>n?0:n-o,c=r-o;return c>y&&(c=y),function(){if(l===c)return Nt;var e=t?--c:l++;return a&&a[e]}}function l(e,i,s){var a,l=e&&e.array,c=s>n?0:n-s>>i,u=1+(r-s>>i);return u>y&&(u=y),function(){for(;;){if(a){var e=a();if(e!==Nt)return e;a=null}if(c===u)return Nt;var n=t?--u:c++;a=o(l&&l[n],i-g,s+(n<=e.size||t<0)return e.withMutations((function(e){t<0?jt(e,t).set(0,n):jt(e,0,t+1).set(t,n)}));t+=e._origin;var r=e._tail,i=e._root,s=k(w);return t>=Wt(e._capacity)?r=Bt(r,e.__ownerID,0,t,n,s):i=Bt(i,e.__ownerID,e._level,t,n,s),s.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Dt(e._origin,e._capacity,e._level,i,r):e}function Bt(e,t,n,r,i,s){var o,a=r>>>n&b,l=e&&a0){var c=e&&e.array[a],u=Bt(c,t,n-g,r,i,s);return u===c?e:((o=zt(e,t)).array[a]=u,o)}return l&&e.array[a]===i?e:(T(s),o=zt(e,t),void 0===i&&a===o.array.length-1?o.array.pop():o.array[a]=i,o)}function zt(e,t){return t&&e&&t===e.ownerID?e:new It(e?e.array.slice():[],t)}function Ut(e,t){if(t>=Wt(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&b],r-=g;return n}}function jt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new x,i=e._origin,s=e._capacity,o=i+t,a=void 0===n?s:n<0?s+n:i+n;if(o===i&&a===s)return e;if(o>=a)return e.clear();for(var l=e._level,c=e._root,u=0;o+u<0;)c=new It(c&&c.array.length?[void 0,c]:[],r),u+=1<<(l+=g);u&&(o+=u,i+=u,a+=u,s+=u);for(var d=Wt(s),h=Wt(a);h>=1<d?new It([],r):p;if(p&&h>d&&og;y-=g){var v=d>>>y&b;f=f.array[v]=zt(f.array[v],r)}f.array[d>>>g&b]=p}if(a=h)o-=h,a-=h,l=g,c=null,m=m&&m.removeBefore(r,0,o);else if(o>i||h>>l&b;if(S!==h>>>l&b)break;S&&(u+=(1<i&&(c=c.removeBefore(r,l,o-u)),c&&hs&&(s=c.size),o(l)||(c=c.map((function(e){return pe(e)}))),r.push(c)}return s>e.size&&(e=e.setSize(s)),ft(e,t,r)}function Wt(e){return e>>g<=y&&o.size>=2*s.size?(r=(i=o.filter((function(e,t){return void 0!==e&&a!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=s.remove(t),i=a===o.size-1?o.pop():o.set(a,void 0))}else if(l){if(n===o.get(a)[1])return e;r=s,i=o.set(a,[t,n])}else r=s.set(t,o.size),i=o.set(o.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):qt(r,i)}function _t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Kt(e){this._iter=e,this.size=e.size}function Qt(e){this._iter=e,this.size=e.size}function Xt(e){this._iter=e,this.size=e.size}function Zt(e){var t=vn(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Sn,t.__iterateUncached=function(t,n){var r=this;return e.__iterate((function(e,n){return!1!==t(n,e,r)}),n)},t.__iteratorUncached=function(t,n){if(t===L){var r=e.__iterator(t,n);return new j((function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(t===P?D:P,n)},t}function Jt(e,t,n){var r=vn(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var s=e.get(r,v);return s===v?i:t.call(n,s,r,e)},r.__iterateUncached=function(r,i){var s=this;return e.__iterate((function(e,i,o){return!1!==r(t.call(n,e,i,o),i,s)}),i)},r.__iteratorUncached=function(r,i){var s=e.__iterator(L,i);return new j((function(){var i=s.next();if(i.done)return i;var o=i.value,a=o[0];return F(r,a,t.call(n,o[1],a,e),i)}))},r}function $t(e,t){var n=vn(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Zt(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Sn,n.__iterate=function(t,n){var r=this;return e.__iterate((function(e,n){return t(e,n,r)}),!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function en(e,t,n,r){var i=vn(e);return r&&(i.has=function(r){var i=e.get(r,v);return i!==v&&!!t.call(n,i,r,e)},i.get=function(r,i){var s=e.get(r,v);return s!==v&&t.call(n,s,r,e)?s:i}),i.__iterateUncached=function(i,s){var o=this,a=0;return e.__iterate((function(e,s,l){if(t.call(n,e,s,l))return a++,i(e,r?s:a-1,o)}),s),a},i.__iteratorUncached=function(i,s){var o=e.__iterator(L,s),a=0;return new j((function(){for(;;){var s=o.next();if(s.done)return s;var l=s.value,c=l[0],u=l[1];if(t.call(n,u,c,e))return F(i,r?c:a++,u,s)}}))},i}function tn(e,t,n){var r=qe().asMutable();return e.__iterate((function(i,s){r.update(t.call(n,i,s,e),0,(function(e){return e+1}))})),r.asImmutable()}function nn(e,t,n){var r=a(e),i=(u(e)?Vt():qe()).asMutable();e.__iterate((function(s,o){i.update(t.call(n,s,o,e),(function(e){return(e=e||[]).push(r?[o,s]:s),e}))}));var s=bn(e);return i.map((function(t){return fn(e,s(t))}))}function rn(e,t,n,r){var i=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=i:n|=0),O(t,n,i))return e;var s=M(t,i),o=N(n,i);if(s!=s||o!=o)return rn(e.toSeq().cacheResult(),t,n,r);var a,l=o-s;l==l&&(a=l<0?0:l);var c=vn(e);return c.size=0===a?a:e.size&&a||void 0,!r&&se(e)&&a>=0&&(c.get=function(t,n){return(t=C(this,t))>=0&&ta)return W();var e=i.next();return r||t===P?e:F(t,l-1,t===D?void 0:e.value[1],e)}))},c}function sn(e,t,n){var r=vn(e);return r.__iterateUncached=function(r,i){var s=this;if(i)return this.cacheResult().__iterate(r,i);var o=0;return e.__iterate((function(e,i,a){return t.call(n,e,i,a)&&++o&&r(e,i,s)})),o},r.__iteratorUncached=function(r,i){var s=this;if(i)return this.cacheResult().__iterator(r,i);var o=e.__iterator(L,i),a=!0;return new j((function(){if(!a)return W();var e=o.next();if(e.done)return e;var i=e.value,l=i[0],c=i[1];return t.call(n,c,l,s)?r===L?e:F(r,l,c,e):(a=!1,W())}))},r}function on(e,t,n,r){var i=vn(e);return i.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=!0,l=0;return e.__iterate((function(e,s,c){if(!a||!(a=t.call(n,e,s,c)))return l++,i(e,r?s:l-1,o)})),l},i.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=e.__iterator(L,s),l=!0,c=0;return new j((function(){var e,s,u;do{if((e=a.next()).done)return r||i===P?e:F(i,c++,i===D?void 0:e.value[1],e);var d=e.value;s=d[0],u=d[1],l&&(l=t.call(n,u,s,o))}while(l);return i===L?e:F(i,s,u,e)}))},i}function an(e,t){var n=a(e),i=[e].concat(t).map((function(e){return o(e)?n&&(e=r(e)):e=n?ae(e):le(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===i.length)return e;if(1===i.length){var s=i[0];if(s===e||n&&a(s)||l(e)&&l(s))return s}var c=new te(i);return n?c=c.toKeyedSeq():l(e)||(c=c.toSetSeq()),(c=c.flatten(!0)).size=i.reduce((function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}}),0),c}function ln(e,t,n){var r=vn(e);return r.__iterateUncached=function(r,i){var s=0,a=!1;function l(e,c){var u=this;e.__iterate((function(e,i){return(!t||c0}function mn(e,t,r){var i=vn(e);return i.size=new te(r).map((function(e){return e.size})).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(P,t),i=0;!(n=r.next()).done&&!1!==e(n.value,i++,this););return i},i.__iteratorUncached=function(e,i){var s=r.map((function(e){return e=n(e),q(i?e.reverse():e)})),o=0,a=!1;return new j((function(){var n;return a||(n=s.map((function(e){return e.next()})),a=n.some((function(e){return e.done}))),a?W():F(e,o++,t.apply(null,n.map((function(e){return e.value}))))}))},i}function fn(e,t){return se(e)?t:e.constructor(t)}function gn(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function yn(e){return Ge(e.size),A(e)}function bn(e){return a(e)?r:l(e)?i:s}function vn(e){return Object.create((a(e)?K:l(e)?Q:X).prototype)}function Sn(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):_.prototype.cacheResult.call(this)}function wn(e,t){return e>t?1:e=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Kn(e,t)},Gn.prototype.pushAll=function(e){if(0===(e=i(e)).size)return this;Ge(e.size);var t=this.size,n=this._head;return e.reverse().forEach((function(e){t++,n={value:e,next:n}})),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Kn(t,n)},Gn.prototype.pop=function(){return this.slice(1)},Gn.prototype.unshift=function(){return this.push.apply(this,arguments)},Gn.prototype.unshiftAll=function(e){return this.pushAll(e)},Gn.prototype.shift=function(){return this.pop.apply(this,arguments)},Gn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Qn()},Gn.prototype.slice=function(e,t){if(O(e,t,this.size))return this;var n=M(e,this.size);if(N(t,this.size)!==this.size)return xe.prototype.slice.call(this,e,t);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Kn(r,i)},Gn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Kn(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Gn.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Gn.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new j((function(){if(r){var t=r.value;return r=r.next,F(e,n++,t)}return W()}))},Gn.isStack=qn;var Yn,Hn="@@__IMMUTABLE_STACK__@@",_n=Gn.prototype;function Kn(e,t,n,r){var i=Object.create(_n);return i.size=e,i._head=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Qn(){return Yn||(Yn=Kn(0))}function Xn(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}_n[Hn]=!0,_n.withMutations=Ke.withMutations,_n.asMutable=Ke.asMutable,_n.asImmutable=Ke.asImmutable,_n.wasAltered=Ke.wasAltered,n.Iterator=j,Xn(n,{toArray:function(){Ge(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate((function(t,n){e[n]=t})),e},toIndexedSeq:function(){return new Kt(this)},toJS:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJS?e.toJS():e})).__toJS()},toJSON:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e})).__toJS()},toKeyedSeq:function(){return new _t(this,!0)},toMap:function(){return qe(this.toKeyedSeq())},toObject:function(){Ge(this.size);var e={};return this.__iterate((function(t,n){e[n]=t})),e},toOrderedMap:function(){return Vt(this.toKeyedSeq())},toOrderedSet:function(){return zn(a(this)?this.valueSeq():this)},toSet:function(){return On(a(this)?this.valueSeq():this)},toSetSeq:function(){return new Qt(this)},toSeq:function(){return l(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Gn(a(this)?this.valueSeq():this)},toList:function(){return xt(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return fn(this,an(this,e.call(arguments,0)))},includes:function(e){return this.some((function(t){return ye(t,e)}))},entries:function(){return this.__iterator(L)},every:function(e,t){Ge(this.size);var n=!0;return this.__iterate((function(r,i,s){if(!e.call(t,r,i,s))return n=!1,!1})),n},filter:function(e,t){return fn(this,en(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return Ge(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ge(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate((function(r){n?n=!1:t+=e,t+=null!=r?r.toString():""})),t},keys:function(){return this.__iterator(D)},map:function(e,t){return fn(this,Jt(this,e,t))},reduce:function(e,t,n){var r,i;return Ge(this.size),arguments.length<2?i=!0:r=t,this.__iterate((function(t,s,o){i?(i=!1,r=t):r=e.call(n,r,t,s,o)})),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return fn(this,$t(this,!0))},slice:function(e,t){return fn(this,rn(this,e,t,!0))},some:function(e,t){return!this.every(tr(e),t)},sort:function(e){return fn(this,dn(this,e))},values:function(){return this.__iterator(P)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(e,t){return A(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return tn(this,e,t)},equals:function(e){return be(this,e)},entrySeq:function(){var e=this;if(e._cache)return new te(e._cache);var t=e.toSeq().map(er).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(tr(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate((function(n,i,s){if(e.call(t,n,i,s))return r=[i,n],!1})),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(I)},flatMap:function(e,t){return fn(this,cn(this,e,t))},flatten:function(e){return fn(this,ln(this,e,!0))},fromEntrySeq:function(){return new Xt(this)},get:function(e,t){return this.find((function(t,n){return ye(n,e)}),void 0,t)},getIn:function(e,t){for(var n,r=this,i=kn(e);!(n=i.next()).done;){var s=n.value;if((r=r&&r.get?r.get(s,v):v)===v)return t}return r},groupBy:function(e,t){return nn(this,e,t)},has:function(e){return this.get(e,v)!==v},hasIn:function(e){return this.getIn(e,v)!==v},isSubset:function(e){return e="function"==typeof e.includes?e:n(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:n(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return ye(t,e)}))},keySeq:function(){return this.toSeq().map($n).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return hn(this,e)},maxBy:function(e,t){return hn(this,t,e)},min:function(e){return hn(this,e?nr(e):sr)},minBy:function(e,t){return hn(this,t?nr(t):sr,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return fn(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return fn(this,on(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(tr(e),t)},sortBy:function(e,t){return fn(this,dn(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return fn(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return fn(this,sn(this,e,t))},takeUntil:function(e,t){return this.takeWhile(tr(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=or(this))}});var Zn=n.prototype;Zn[d]=!0,Zn[U]=Zn.values,Zn.__toJS=Zn.toArray,Zn.__toStringMapper=rr,Zn.inspect=Zn.toSource=function(){return this.toString()},Zn.chain=Zn.flatMap,Zn.contains=Zn.includes,Xn(r,{flip:function(){return fn(this,Zt(this))},mapEntries:function(e,t){var n=this,r=0;return fn(this,this.toSeq().map((function(i,s){return e.call(t,[s,i],r++,n)})).fromEntrySeq())},mapKeys:function(e,t){var n=this;return fn(this,this.toSeq().flip().map((function(r,i){return e.call(t,r,i,n)})).flip())}});var Jn=r.prototype;function $n(e,t){return t}function er(e,t){return[t,e]}function tr(e){return function(){return!e.apply(this,arguments)}}function nr(e){return function(){return-e.apply(this,arguments)}}function rr(e){return"string"==typeof e?JSON.stringify(e):String(e)}function ir(){return E(arguments)}function sr(e,t){return et?-1:0}function or(e){if(e.size===1/0)return 0;var t=u(e),n=a(e),r=t?1:0;return ar(e.__iterate(n?t?function(e,t){r=31*r+lr(Ie(e),Ie(t))|0}:function(e,t){r=r+lr(Ie(e),Ie(t))|0}:t?function(e){r=31*r+Ie(e)|0}:function(e){r=r+Ie(e)|0}),r)}function ar(e,t){return t=Ae(t,3432918353),t=Ae(t<<15|t>>>-15,461845907),t=Ae(t<<13|t>>>-13,5),t=Ae((t=t+3864292196^e)^t>>>16,2246822507),t=Ce((t=Ae(t^t>>>13,3266489909))^t>>>16)}function lr(e,t){return e^t+2654435769+(e<<6)+(e>>2)}return Jn[h]=!0,Jn[U]=Zn.entries,Jn.__toJS=Zn.toObject,Jn.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+rr(e)},Xn(i,{toKeyedSeq:function(){return new _t(this,!1)},filter:function(e,t){return fn(this,en(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return fn(this,$t(this,!1))},slice:function(e,t){return fn(this,rn(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=M(e,e<0?this.count():this.size);var r=this.slice(0,e);return fn(this,1===n?r:r.concat(E(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return fn(this,ln(this,e,!1))},get:function(e,t){return(e=C(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,n){return n===e}),void 0,t)},has:function(e){return(e=C(this,e))>=0&&(void 0!==this.size?this.size===1/0||e0&&void 0!==arguments[0]?arguments[0]:this.warpMode;return this.reset(),this.warpMode=Boolean(e),this}static create(e){const t=i.pop();return void 0!==t?(t.warpMode=Boolean(e),t):new s(e)}static release(e){void 0!==e&&i.push(e.reset())}}class o{constructor(e){this.topBlock=e,this.stack=[],this.stackFrames=[],this.status=0,this.isKilled=!1,this.target=null,this.blockContainer=null,this.requestScriptGlowInFrame=!1,this.blockGlowInFrame=null,this.warpTimer=null,this.justReported=null,this.triedToCompile=!1,this.isCompiled=!1,this.timer=null,this.generator=null,this.procedures=null,this.executableHat=!1,this.compatibilityStackFrame=null}static get STATUS_RUNNING(){return 0}static get STATUS_PROMISE_WAIT(){return 1}static get STATUS_YIELD(){return 2}static get STATUS_YIELD_TICK(){return 3}static get STATUS_DONE(){return 4}static getIdFromTargetAndBlock(e,t){return"".concat(e.id,"&").concat(t)}getId(){return o.getIdFromTargetAndBlock(this.target,this.topBlock)}pushStack(e){if(this.stack.push(e),this.stack.length>this.stackFrames.length){const e=this.stackFrames[this.stackFrames.length-1];this.stackFrames.push(s.create(void 0!==e&&e.warpMode))}}reuseStackForNextBlock(e){this.stack[this.stack.length-1]=e,this.stackFrames[this.stackFrames.length-1].reuse()}popStack(){return s.release(this.stackFrames.pop()),this.stack.pop()}stopThisScript(){let e=this.peekStack();for(;null!==e;){const t=this.target.blocks.getBlock(e);if(this.peekStackFrame().waitingReporter)break;if(void 0!==t&&"procedures_call"===t.opcode){this.goToNextBlock();break}this.popStack(),e=this.peekStack()}0===this.stack.length&&(this.requestScriptGlowInFrame=!1,this.status=o.STATUS_DONE)}peekStack(){return this.stack.length>0?this.stack[this.stack.length-1]:null}peekStackFrame(){return this.stackFrames.length>0?this.stackFrames[this.stackFrames.length-1]:null}peekParentStackFrame(){return this.stackFrames.length>1?this.stackFrames[this.stackFrames.length-2]:null}pushReportedValue(e){this.justReported=void 0===e?null:e}initParams(){const e=this.peekStackFrame();null===e.params&&(e.params={})}pushParam(e,t){this.peekStackFrame().params[e]=t}getParam(e){for(let t=this.stackFrames.length-1;t>=0;t--){const n=this.stackFrames[t];if(null!==n.params)return Object.prototype.hasOwnProperty.call(n.params,e)?n.params[e]:null}return null}getAllparams(){return this.peekStackFrame().params}atStackTop(){return this.peekStack()===this.topBlock}goToNextBlock(){const e=this.target.blocks.getNextBlock(this.peekStack());this.reuseStackForNextBlock(e)}isRecursiveCall(e){let t=5;for(let n=this.stackFrames.length-1-1;n>=0;n--){const r=this.target.blocks.getBlock(this.stackFrames[n].op.id)||this.target.runtime.flyoutBlocks.getBlock(this.stackFrames[n].op.id);if("procedures_call"===r.opcode&&r.mutation.proccode===e)return!0;if(--t<0)return!1}return!1}tryCompile(){if(!this.blockContainer)return;const e=n(208);this.triedToCompile=!0;const t=!this.stackClick,i=this.topBlock,s=this.blockContainer.getBlock(i)?this.blockContainer:this.target.runtime.flyoutBlocks,o=t&&s.getCachedCompileResult(i);if(o&&!o.success)return;let a;if(o)a=o.value;else try{a=e(this),t&&s.cacheCompileResult(i,a)}catch(e){return r.error("cannot compile script",this.target.getName(),e),t&&s.cacheCompileError(i,e),void this.target.runtime.emitCompileError(this.target,e)}this.procedures={};for(const e of Object.keys(a.procedures))this.procedures[e]=a.procedures[e](this);this.generator=a.startingFunction(this)(),this.executableHat=a.executableHat,this.blockContainer.forceNoGlow||(this.blockGlowInFrame=this.topBlock,this.requestScriptGlowInFrame=!0),this.isCompiled=!0}}o._StackFrame=s,e.exports=o},function(e,t,n){const r=n(253),i=n(265),s=n(89),o=n(85),a=n(267),l=n(88),c=n(55),u=n(86),d=n(367),h=n(54);e.exports={BitmapAdapter:i,convertFonts:u,inlineSvgFonts:s,loadSvgString:o,sanitizeSvg:a,serializeSvgToString:l,SvgElement:c,SVGRenderer:r,fixForVanilla:d,DOMPurify:h}},function(e,t,n){var r=n(91),i=r.isDigit,s=r.isHexDigit,o=r.isUppercaseLetter,a=r.isName,l=r.isWhiteSpace,c=r.isValidEscape;function u(e,t){return te.length)return!1;for(var i=t;i=0&&l(e.charCodeAt(t));t--);return t+1},findWhiteSpaceEnd:function(e,t){for(;t{if(!t.extensionManager)return null;const n=t.extensionManager.getExtensionURLs(),r={};for(const t of e){const e=n[t];"string"==typeof e&&(r[t]=e)}return 0===Object.keys(r).length?null:r},M=function(e){const t=Object.create(null),n=new Set;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;t[r]=A(e[r]);const i=I(e[r].opcode);i&&n.add(i)}for(const e in t){const n=t[e];t[e]=C(n,t)}for(const e in t){const n=t[e];Array.isArray(n)&&[k,T].indexOf(n[0])<0&&(u.warn("Found an unexpected top level primitive with block ID: ".concat(e,"; deleting it from serialized blocks.")),delete t[e])}return[t,Array.from(n)]},N=function(e){const t=Object.create(null);t.name=e.name;const n=e.broken||e;return t.bitmapResolution=n.bitmapResolution,t.dataFormat=n.dataFormat.toLowerCase(),t.assetId=n.assetId,t.md5ext=n.md5,t.rotationCenterX=n.rotationCenterX,t.rotationCenterY=n.rotationCenterY,t},R=function(e){const t=Object.create(null);t.name=e.name;const n=e.broken||e;return t.assetId=n.assetId,t.dataFormat=n.dataFormat.toLowerCase(),t.format=n.format,t.rate=n.rate,t.sampleCount=n.sampleCount,t.md5ext=n.md5,t},D=e=>"number"==typeof e||"string"==typeof e||"boolean"==typeof e,P=e=>{if(Array.isArray(e)){let t=null;for(let n=0;nE?(i.text=r.text.substring(0,E),i.extraText=r.text.substring(E)):i.text=r.text,t[n]=i}return t}(e.comments),(e.currentCostume<0||e.currentCostume>=e.costumes.length)&&(u.warn("currentCostume property for target ".concat(e.name," is out of range")),e.currentCostume=h.clamp(e.currentCostume,0,e.costumes.length-1)),n.currentCostume=e.currentCostume,n.costumes=e.costumes.map(N),n.sounds=e.sounds.map(R),Object.prototype.hasOwnProperty.call(e,"volume")&&(n.volume=e.volume),Object.prototype.hasOwnProperty.call(e,"layerOrder")&&(n.layerOrder=e.layerOrder),n.isStage?(Object.prototype.hasOwnProperty.call(e,"tempo")&&(n.tempo=e.tempo),Object.prototype.hasOwnProperty.call(e,"videoTransparency")&&(n.videoTransparency=e.videoTransparency),Object.prototype.hasOwnProperty.call(e,"videoState")&&(n.videoState=e.videoState),Object.prototype.hasOwnProperty.call(e,"textToSpeechLanguage")&&(n.textToSpeechLanguage=e.textToSpeechLanguage)):(n.visible=e.visible,n.x=e.x,n.y=e.y,n.size=e.size,n.direction=e.direction,n.draggable=e.draggable,n.rotationStyle=e.rotationStyle),r.forEach((e=>{t.add(e)})),n},B=(e,t)=>{const n={};let r=!0;for(const[i,s]of Object.entries(e))t.has(i)&&null!=s&&(r=!1,n[i]=e[i]);return r?null:n},z=function(e,t,n,r){if(!Array.isArray(e))return e;const i=Object.create(null),s=d();switch(i.id=s,i.next=null,i.parent=t,i.shadow=n,i.inputs=Object.create(null),e[0]){case 4:i.opcode="math_number",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 5:i.opcode="math_positive_number",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 6:i.opcode="math_whole_number",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 7:i.opcode="math_integer",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 8:i.opcode="math_angle",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 9:i.opcode="colour_picker",i.fields={COLOUR:{name:"COLOUR",value:e[1]}},i.topLevel=!1;break;case 10:i.opcode="text",i.fields={TEXT:{name:"TEXT",value:e[1]}},i.topLevel=!1;break;case 11:i.opcode="event_broadcast_menu",i.fields={BROADCAST_OPTION:{name:"BROADCAST_OPTION",value:e[1],id:e[2],variableType:o.BROADCAST_MESSAGE_TYPE}},i.topLevel=!1;break;case k:i.opcode="data_variable",i.fields={VARIABLE:{name:"VARIABLE",value:e[1],id:e[2],variableType:o.SCALAR_TYPE}},e.length>3&&(i.topLevel=!0,i.x=e[3],i.y=e[4]);break;case T:i.opcode="data_listcontents",i.fields={LIST:{name:"LIST",value:e[1],id:e[2],variableType:o.LIST_TYPE}},e.length>3&&(i.topLevel=!0,i.x=e[3],i.y=e[4]);break;default:return u.error("Found unknown primitive type during deserialization: ".concat(JSON.stringify(e))),null}return r[s]=i,s},U=function(e,t,n){const r={};for(const i in e){if(!S.call(e,i))continue;const s=e[i];if(!Array.isArray(s))continue;let o=null,a=null;const l=s[0];1===l?o=a=z(s[1],t,!0,n):2===l?o=z(s[1],t,!1,n):(o=z(s[1],t,!1,n),a=z(s[2],t,!0,n)),r[i]={name:i,block:o,shadow:a}}return r},j=function(e){const t={};for(const n in e){if(!S.call(e,n))continue;const r=e[n];Array.isArray(r)&&(t[n]={name:n,value:r[0]},r.length>1&&(t[n].id=r[1]),"BROADCAST_OPTION"===n?t[n].variableType=o.BROADCAST_MESSAGE_TYPE:"VARIABLE"===n?t[n].variableType=o.SCALAR_TYPE:"LIST"===n&&(t[n].variableType=o.LIST_TYPE))}return t},F=function(e){for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const n=e[t];Array.isArray(n)?(delete e[t],z(n,null,!1,e)):(n.id=t,n.inputs=U(n.inputs,t,e),n.fields=j(n.fields))}return e};e.exports={serialize:function(e,t){let{allowOptimization:n=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Object.create(null),i=new Set,s=t?[e.getTargetById(t)]:e.targets.filter((e=>e.isOriginal)),o=function(e){const t=e.map((e=>e.getLayerOrder()));return h.reducedSortOrdering(t)}(s),a=s.map((e=>e.toJSON()));e.renderer&&!t&&a.forEach(((e,t)=>{e.layerOrder=o[t]}));const l=a.map((e=>L(e,i))).map(((e,t)=>{const n=s[t],r=B(n.extensionStorage,i);return r&&(e.extensionStorage=r),e})),c=e.fontManager.serializeJSON();if(t){const t=l[0];i.size&&(t.extensions=Array.from(i));const n=O(i,e);return n&&(t.extensionURLs=n),c&&(t.customFonts=c),l[0]}const u=B(e.extensionStorage,i);u&&(r.extensionStorage=u),r.targets=l,r.monitors=function(e,t,n){const r=(t.stageWidth-480)/2,i=(t.stageHeight-360)/2;return e.valueSeq().filter((e=>{const t=I(e.opcode);return!t||!!e.visible&&(n.add(t),!0)})).map((e=>{const t={id:e.id,mode:e.mode,opcode:e.opcode,params:e.params,spriteName:e.spriteName,value:Array.isArray(e.value)?[]:0,width:e.width,height:e.height,x:e.x-r,y:e.y-i,visible:e.visible};return"list"!==e.mode&&(t.sliderMin=e.sliderMin,t.sliderMax=e.sliderMax,t.isDiscrete=e.isDiscrete),t})).toArray()}(e.getMonitorState(),e,i),r.extensions=Array.from(i);const d=O(i,e);d&&(r.extensionURLs=d),c&&(r.customFonts=c);const p=Object.create(null);return p.semver="3.0.0",p.vm="0.2.0",e.origin&&(p.origin=e.origin),p.agent="",p.platform=Object.assign({},e.platform),r.meta=p,n&&f(r),r},deserialize:async function(e,t,n,d){await((e,t)=>{if(!e.meta||!e.meta.platform)return;if(e.meta.platform.name===t.platform.name)return;let n=t.listenerCount(r.PLATFORM_MISMATCH);return 0!==n?new Promise((i=>{t.emit(r.PLATFORM_MISMATCH,e.meta.platform,(()=>{n--,0===n&&i()}))})):void 0})(e,t);const f={extensionIDs:new Set,extensionURLs:new Map};if(e.meta&&e.meta.origin?t.origin=e.meta.origin:t.origin=null,e.extensionURLs)for(const[t,n]of Object.entries(e.extensionURLs))f.extensionURLs.set(t,n);let S;S=e.customFonts?t.fontManager.deserialize(e.customFonts,n,d):Promise.resolve();const w=((d?[e]:e.targets)||[]).map(((e,t)=>Object.assign(e,{targetPaneOrder:t}))).sort(((e,t)=>e.layerOrder-t.layerOrder)),k=e.monitors||[];return S.then((()=>w.map((e=>function(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,"name"))return Promise.resolve(null);const r={costumePromises:null,soundPromises:null,soundBank:t.audioEngine&&t.audioEngine.createBank()};return r.costumePromises=(e.costumes||[]).map((e=>{const r={asset:e.asset,assetId:e.assetId,skinId:null,name:e.name,bitmapResolution:e.bitmapResolution,rotationCenterX:e.rotationCenterX,rotationCenterY:e.rotationCenterY},i=e.dataFormat||e.assetType&&e.assetType.runtimeFormat||"png",s=Object.prototype.hasOwnProperty.call(e,"md5ext")?e.md5ext:"".concat(e.assetId,".").concat(i);return r.md5=s,r.dataFormat=i,t.wrapAssetRequest((()=>b(r,t,n).then((()=>g(s,r,t)))))})),r.soundPromises=(e.sounds||[]).map((e=>{const i={assetId:e.assetId,format:e.format,rate:e.rate,sampleCount:e.sampleCount,name:e.name,md5:e.md5ext,dataFormat:e.dataFormat,data:null};return t.wrapAssetRequest((()=>v(i,t,n).then((()=>y(i,t,r.soundBank)))))})),r}(e,t,n))))).then((e=>Promise.resolve(e))).then((e=>Promise.all(w.map(((n,r)=>function(e,t,n,r,l){if(!Object.prototype.hasOwnProperty.call(e,"name"))return Promise.resolve(null);const u=new i(t),d=new s(u,t);if(Object.prototype.hasOwnProperty.call(e,"name")&&(d.name=e.name),Object.prototype.hasOwnProperty.call(e,"blocks")){F(e.blocks);for(const t in e.blocks){if(!Object.prototype.hasOwnProperty.call(e.blocks,t))continue;const r=e.blocks[t];u.createBlock(r);const i=I(r.opcode);i&&n.extensionIDs.add(i)}}const{costumePromises:p}=l,{soundBank:m,soundPromises:f}=l,g=d.createClone(e.isStage?c.BACKGROUND_LAYER:c.SPRITE_LAYER);if(Object.prototype.hasOwnProperty.call(e,"tempo")&&(g.tempo=e.tempo),Object.prototype.hasOwnProperty.call(e,"volume")&&(g.volume=e.volume),Object.prototype.hasOwnProperty.call(e,"videoTransparency")&&(g.videoTransparency=e.videoTransparency),Object.prototype.hasOwnProperty.call(e,"videoState")&&(g.videoState=e.videoState),Object.prototype.hasOwnProperty.call(e,"textToSpeechLanguage")&&(g.textToSpeechLanguage=e.textToSpeechLanguage),Object.prototype.hasOwnProperty.call(e,"variables"))for(const n in e.variables){const r=e.variables[n],i=3===r.length&&r[2]&&e.isStage&&t.canAddCloudVariable(),s=new o(n,r[0],o.SCALAR_TYPE,i);i&&t.addCloudVariable(),s.value=r[1],g.variables[s.id]=s}if(Object.prototype.hasOwnProperty.call(e,"lists"))for(const t in e.lists){const n=e.lists[t],r=new o(t,n[0],o.LIST_TYPE,!1);r.value=n[1],g.variables[r.id]=r}if(Object.prototype.hasOwnProperty.call(e,"broadcasts"))for(const t in e.broadcasts){const n=e.broadcasts[t],r=new o(t,n,o.BROADCAST_MESSAGE_TYPE,!1);g.variables[r.id]=r}if(Object.prototype.hasOwnProperty.call(e,"comments"))for(const t in e.comments){const n=e.comments[t],r=new a(t,n.text+("string"==typeof n.extraText?n.extraText:""),n.x,n.y,n.width,n.height,n.minimized);n.blockId&&(r.blockId=n.blockId),g.comments[r.id]=r}return Object.prototype.hasOwnProperty.call(e,"x")&&(g.x=e.x),Object.prototype.hasOwnProperty.call(e,"y")&&(g.y=e.y),Object.prototype.hasOwnProperty.call(e,"direction")&&(g.direction=h.wrapClamp(e.direction,-179,180)),Object.prototype.hasOwnProperty.call(e,"size")&&(g.size=e.size),Object.prototype.hasOwnProperty.call(e,"visible")&&(g.visible=e.visible),Object.prototype.hasOwnProperty.call(e,"currentCostume")&&(g.currentCostume=h.clamp(e.currentCostume,0,e.costumes.length-1)),Object.prototype.hasOwnProperty.call(e,"rotationStyle")&&(g.rotationStyle=e.rotationStyle),Object.prototype.hasOwnProperty.call(e,"isStage")&&(g.isStage=e.isStage),Object.prototype.hasOwnProperty.call(e,"targetPaneOrder")&&(g.targetPaneOrder=e.targetPaneOrder),Object.prototype.hasOwnProperty.call(e,"draggable")&&(g.draggable=e.draggable),Object.prototype.hasOwnProperty.call(e,"extensionStorage")&&(g.extensionStorage=e.extensionStorage),Promise.all(p).then((e=>{d.costumes=e})),Promise.all(f).then((e=>{d.sounds=e,d.soundBank=m||null})),Promise.all(p.concat(f)).then((()=>g))}(n,t,f,0,e[r])))))).then((e=>e.map(((e,t)=>(e.layerOrder=t,e))).sort(((e,t)=>e.targetPaneOrder-t.targetPaneOrder)).map((e=>(delete e.targetPaneOrder,e))))).then((e=>function(e){const t=m.getAllVarRefsForTargets(e,!0);e.forEach((e=>{Object.keys(e.variables).forEach((t=>{const n=p.replaceUnsafeChars(t);n!==t&&(e.variables[t].id=n,e.variables[n]=e.variables[t],delete e.variables[t])}))}));for(const e in t){const n=p.replaceUnsafeChars(e);e!==n&&m.updateVariableIdentifiers(t[e],n)}return e}(e))).then((n=>(k.map((e=>function(e,t,n,r){const i=(t.stageWidth-480)/2,s=(t.stageHeight-360)/2;if(e.x+=i,e.y+=s,e.x=h.clamp(e.x,0,t.stageWidth),e.y=h.clamp(e.y,0,t.stageHeight),e.spriteName){const t=n.filter((t=>t.sprite.name===e.spriteName));t&&t.length>0?e.targetId=t[0].id:u.warn("Tried to deserialize sprite specific monitor ".concat(e.opcode," but could not find sprite ").concat(e.spriteName,"."))}const a=t.monitorBlockInfo[e.opcode];if("data_listcontents"===e.opcode){const t=e.targetId?n.find((t=>t.id===e.targetId)):n.find((e=>e.isStage));t&&Object.prototype.hasOwnProperty.call(t.variables,e.id)&&(e.params.LIST=t.variables[e.id].name)}const c={};for(const t in e.params){const n={name:t,value:e.params[t]};c[t]=n}"data_variable"!==e.opcode&&"data_listcontents"!==e.opcode&&a&&a.isSpriteSpecific?e.id=a.getId(e.targetId,c):e.id=p.replaceUnsafeChars(e.id);const d=t.monitorBlocks._blocks[e.id];if(d)d.isMonitored=e.visible,d.targetId=e.targetId;else{const n={id:e.id,opcode:e.opcode,inputs:{},fields:c,topLevel:!0,next:null,parent:null,shadow:!1,x:0,y:0,isMonitored:e.visible,targetId:e.targetId};if("data_variable"===e.opcode){const t=n.fields.VARIABLE;t.id=e.id,t.variableType=o.SCALAR_TYPE}else if("data_listcontents"===e.opcode){const t=n.fields.LIST;t.id=e.id,t.variableType=o.LIST_TYPE}t.monitorBlocks.createBlock(n);const i=I(n.opcode);i&&r.extensionIDs.add(i)}t.requestAddMonitor(l(e))}(e,t,n,f))),Object.prototype.hasOwnProperty.call(e,"extensionStorage")&&(t.extensionStorage=e.extensionStorage),n))).then((e=>({targets:e,extensions:f})))},deserializeBlocks:F,serializeBlocks:M,deserializeStandaloneBlocks:e=>{if((e=JSON.parse(JSON.stringify(e))).extensionURLs){const t=new Map;for(const[n,r]of Object.entries(e.extensionURLs))t.set(n,r);return{blocks:e.blocks,extensionURLs:t}}return{blocks:e,extensionURLs:new Map}},serializeStandaloneBlocks:(e,t)=>{const n=new Set;for(const t of e){const e=I(t.opcode);e&&n.add(e)}const r=O(n,t);return r?{blocks:e,extensionURLs:r}:e},getExtensionIdForOpcode:I}},function(e,t,n){const r=n(11),i=n(38),s=n(384);e.exports=class{constructor(e,t){this._renderer=t,this._id=e,this._rotationCenter=r.v3.create(0,0),this._texture=null,this._uniforms={u_skinSize:[0,0],u_skin:null},this._silhouette=new s,this.private=!1}dispose(){this._id=i.ID_NONE}get id(){return this._id}get rotationCenter(){return this._rotationCenter}get size(){return[0,0]}useNearest(e,t){return!0}calculateRotationCenter(){return[this.size[0]/2,this.size[1]/2]}getTexture(e){return this._emptyImageTexture}getFenceBounds(e,t){return e.getAABB(t)}getUniforms(e){return this._uniforms.u_skin=this.getTexture(e),this._uniforms.u_skinSize=this.size,this._uniforms}emitWasAltered(){this._renderer.skinWasAltered(this)}updateSilhouette(){this._silhouette.unlazy()}_setTexture(e){const t=this._renderer.gl;t.bindTexture(t.TEXTURE_2D,this._texture),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this._silhouette.update(e)}setEmptyImageData(){if(this._texture=null,!this._emptyImageData){this._emptyImageData=new ImageData(1,1);const e=this._renderer.gl,t={auto:!0,wrap:e.CLAMP_TO_EDGE,src:this._emptyImageData};this._emptyImageTexture=r.createTexture(e,t)}this._rotationCenter[0]=0,this._rotationCenter[1]=0,this._silhouette.update(this._emptyImageData),this.emitWasAltered()}isTouchingNearest(e){return this._silhouette.isTouchingNearest(e)}isTouchingLinear(e){return this._silhouette.isTouchingLinear(e)}}},function(e,t,n){const r=n(11);class i{constructor(e){this._gl=e,this._shaderCache={};for(const e in i.DRAW_MODE)Object.prototype.hasOwnProperty.call(i.DRAW_MODE,e)&&(this._shaderCache[e]=[])}getShader(e,t){const n=this._shaderCache[e];e===i.DRAW_MODE.silhouette&&(t&=~(i.EFFECT_INFO.color.mask|i.EFFECT_INFO.brightness.mask));let r=n[t];return r||(r=n[t]=this._buildShader(e,t)),r}_buildShader(e,t){const s=i.EFFECTS.length,o=["#define DRAW_MODE_".concat(e)];for(let e=0;e{console.error(e);const t=e.match(/\*\*\* Error compiling shader: ([\s\S]+)/);u=t?t[1].trim():e}));if(!d)throw new Error("Failed to compile shader (mode ".concat(e,", effects ").concat(t,"): ").concat(u));return d}}i.EFFECT_INFO={color:{uniformName:"u_color",mask:1,converter:e=>e/200%1,shapeChanges:!1},fisheye:{uniformName:"u_fisheye",mask:2,converter:e=>Math.max(0,(e+100)/100),shapeChanges:!0},whirl:{uniformName:"u_whirl",mask:4,converter:e=>-e*Math.PI/180,shapeChanges:!0},pixelate:{uniformName:"u_pixelate",mask:8,converter:e=>Math.abs(e)/10,shapeChanges:!0},mosaic:{uniformName:"u_mosaic",mask:16,converter:e=>(e=Math.round((Math.abs(e)+10)/10),Math.max(1,Math.min(e,512))),shapeChanges:!0},brightness:{uniformName:"u_brightness",mask:32,converter:e=>Math.max(-100,Math.min(e,100))/100,shapeChanges:!1},ghost:{uniformName:"u_ghost",mask:64,converter:e=>1-Math.max(0,Math.min(e,100))/100,shapeChanges:!1}},i.EFFECTS=Object.keys(i.EFFECT_INFO),i.DRAW_MODE={default:"default",straightAlpha:"straightAlpha",silhouette:"silhouette",colorMask:"colorMask",line:"line",background:"background"},e.exports=i},function(e,t){const n="undefined"==typeof document,r=n?"":"",i=n?"":"",s=`${n?"":""}debug${r}`,o=`${n?"":""}info${r}`,a=`${n?"":""}warn${r}`,l=`${n?"":""}error${r}`,c=(e="")=>{const t=t=>c(e?`${e} ${t}`:t),n=e?[`${i}${e}${r}`]:[];return t.debug=t.log=console.debug.bind(console,...n,s),t.info=console.log.bind(console,...n,o),t.warn=t.warning=console.warn.bind(console,...n,a),t.error=console.error.bind(console,...n,l),t};c.enable=c.disable=()=>{},e.exports=c},function(e,t,n){const r=n(71);e.exports=class extends r{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(),this._socket=e.getScratchLinkSocket("BLE"),this._socket.setOnOpen(this.requestPeripheral.bind(this)),this._socket.setOnClose(this.handleDisconnectError.bind(this)),this._socket.setOnError(this._handleRequestError.bind(this)),this._socket.setHandleMessage(this._handleMessage.bind(this)),this._sendMessage=this._socket.sendMessage.bind(this._socket),this._availablePeripherals={},this._connectCallback=r,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=i,this._discoverTimeoutID=null,this._extensionId=t,this._peripheralOptions=n,this._runtime=e,this._socket.open()}requestPeripheral(){this._availablePeripherals={},this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._discoverTimeoutID=window.setTimeout(this._handleDiscoverTimeout.bind(this),15e3),this.sendRemoteRequest("discover",this._peripheralOptions).catch((e=>{this._handleRequestError(e)}))}connectPeripheral(e){this.sendRemoteRequest("connect",{peripheralId:e}).then((()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()})).catch((e=>{this._handleRequestError(e)}))}disconnect(){this._connected&&(this._connected=!1),this._socket.isOpen()&&this._socket.close(),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED)}isConnected(){return this._connected}startNotifications(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r={serviceId:e,characteristicId:t};return this._characteristicDidChangeCallback=n,this.sendRemoteRequest("startNotifications",r).catch((e=>{this.handleDisconnectError(e)}))}read(e,t){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r={serviceId:e,characteristicId:t};return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(r.startNotifications=!0),n&&(this._characteristicDidChangeCallback=n),this.sendRemoteRequest("read",r).catch((e=>{this.handleDisconnectError(e)}))}write(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const s={serviceId:e,characteristicId:t,message:n};return r&&(s.encoding=r),null!==i&&(s.withResponse=i),this.sendRemoteRequest("write",s).catch((e=>{this.handleDisconnectError(e)}))}didReceiveCall(e,t){switch(e){case"didDiscoverPeripheral":this._availablePeripherals[t.peripheralId]=t,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[t.peripheralId]=t,this._runtime.emit(this._runtime.constructor.USER_PICKED_PERIPHERAL,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidNotPickPeripheral":this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"characteristicDidChange":this._characteristicDidChangeCallback&&this._characteristicDidChangeCallback(t.message);break;case"ping":return 42}}handleDisconnectError(){this._connected&&(this.disconnect(),this._resetCallback&&this._resetCallback(),this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId}))}_handleRequestError(){this._runtime.emit(this._runtime.constructor.PERIPHERAL_REQUEST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId})}_handleDiscoverTimeout(){this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT)}}},function(e,t,n){const r=n(1);e.exports=function(e){if("string"!=typeof e){if(!Array.isArray(e))return r.error("Unexpected input recieved in replaceUnsafeChars"),e;e=String(e)}return e.replace(/[<>&'"]/g,(e=>{switch(e){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}}))}},function(e,t,n){const r=n(7),i=n(1),s=function(e,t,n,r){return e.assetId=t.assetId,n.audioEngine?n.audioEngine.decodeSoundPlayer(Object.assign({},e,{data:t.data})).then((t=>{e.soundId=t.id;const i=t.buffer;return e.rate=i.sampleRate,e.sampleCount=i.length,null!==r&&r.addSoundPlayer(t),n.isPackaged&&(e.asset=null),e})):(i.warn("No audio engine present; cannot load sound asset: ",e.md5),Promise.resolve(e))},o=function(e,t,n){const r=e.asset,i=e.assetId,o=e.sampleCount,a=e.rate,l=e.format,c=e.dataFormat;return e.assetId=t.storage.defaultAssetId.Sound,e.asset=t.storage.get(e.assetId),e.md5="".concat(e.assetId,".").concat(e.asset.dataFormat),s(e,e.asset,t,n).then((e=>(e.broken={},e.broken.assetId=i,e.broken.md5="".concat(i,".").concat(c),e.broken.asset=r,e.broken.sampleCount=o,e.broken.rate=a,e.broken.format=l,e.broken.dataFormat=c,e)))};e.exports={loadSound:function(e,t,n){if(!t.storage)return i.warn("No storage module present; cannot load sound asset: ",e.md5),Promise.resolve(e);const a=r.splitFirst(e.md5,"."),l=a[0],c=a[1].toLowerCase();return e.dataFormat=c,(e.asset&&Promise.resolve(e.asset)||t.storage.load(t.storage.AssetType.Sound,l,c)).then((r=>(e.asset=r,r?s(e,r,t,n):(i.warn("Failed to find sound data: ",e.md5),o(e,t,n))))).catch((r=>(i.warn("Failed to load sound: ".concat(e.md5," with error: ").concat(r)),o(e,t,n))))},loadSoundFromAsset:s}},function(e,t,n){const r=n(7),i=n(1),s=n(83),{loadSvgString:o,serializeSvgToString:a}=n(26),{parseVectorMetadata:l}=n(101),c=function(e,t,n,r){return new Promise((i=>{let s=e.asset.decodeText();if(void 0===n){const t=l(s);t&&(n=t,e.rotationCenterX=n[0],e.rotationCenterY=n[1])}if(r&&2===r){const n=a(o(s,!0));if(s!==n){s=n;const r=t.storage;e.asset.encodeTextData(n,r.DataFormat.SVG,!0),e.assetId=e.asset.assetId,e.md5="".concat(e.assetId,".").concat(e.dataFormat)}}e.skinId=t.renderer.createSVGSkin(s,n),e.size=t.renderer.getSkinSize(e.skinId),n||(n=t.renderer.getSkinRotationCenter(e.skinId),e.rotationCenterX=n[0],e.rotationCenterY=n[1],e.bitmapResolution=1),t.isPackaged&&(e.asset=null),i(e)}))},u=new class{constructor(){this.pool=[],this.clearSoon=null}clear(){this.clearSoon||(this.clearSoon=new Promise((e=>setTimeout(e,1e3))).then((()=>{this.pool.length=0,this.clearSoon=null})))}create(){return this.pool.pop()||document.createElement("canvas")}release(e){this.clear(),this.pool.push(e)}},d=e=>new Promise(((t,n)=>{const r=new Image;r.onload=function(){t(r),r.onload=null,r.onerror=null},r.onerror=function(){n(new Error("Costume load failed. Asset could not be read.")),r.onload=null,r.onerror=null},r.src=e})),h=new s((async e=>{let t;for(let n=0;n<3;n++)try{if("function"==typeof createImageBitmap){const t=await createImageBitmap(new Blob([e.data.buffer],{type:e.assetType.contentType}));if(!t)throw new Error("createImageBitmap resolved with ".concat(t));return t}return await d(e.encodeDataURI())}catch(e){t||(t=e),i.warn(e),await new Promise((e=>setTimeout(e,2e3*Math.random())))}throw t}),25),p=function(e,t,n){return function(e,t,n){return e&&e.asset?t.v2BitmapAdapter?Promise.all([e.asset,e.textLayerAsset].map((e=>e?h.do(e):null))).then((r=>{let[i,s]=r;if(!i)throw new Error("Loading bitmap costume base failed.");const o=1===e.bitmapResolution?2:1;let a,l;if(s){l=u.create(),l.width=i.width,l.height=i.height;const e=l.getContext("2d");e.drawImage(i,0,0),e.drawImage(s,0,0),a=l}else a=i;return 1!==o&&(a=t.v2BitmapAdapter.resize(a,a.width*o,a.height*o),l&&u.release(l)),a.reusable=!1,n&&(n[0]=n[0]*o,n[1]=n[1]*o,e.rotationCenterX=n[0],e.rotationCenterY=n[1]),e.bitmapResolution=2,delete e.textLayerMD5,delete e.textLayerAsset,{image:a,rotationCenter:n,assetMatchesBase:1===o&&!s}})).finally((()=>{delete e.textLayerMD5,delete e.textLayerAsset})):Promise.reject("No V2 Bitmap adapter present."):Promise.reject("Costume load failed. Assets were missing.")}(e,t,n).then((n=>(n.assetMatchesBase||function(n){if(!t.v2BitmapAdapter)return Promise.reject("No V2 Bitmap adapter present.");const r=t.storage;e.asset=r.createAsset(r.AssetType.ImageBitmap,r.DataFormat.PNG,t.v2BitmapAdapter.convertDataURIToBinary(n),null,!0),e.dataFormat=r.DataFormat.PNG,e.assetId=e.asset.assetId,e.md5="".concat(e.assetId,".").concat(e.dataFormat)}((e=>{if(e instanceof HTMLCanvasElement)return e.toDataURL();const t=u.create();t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0);const n=t.toDataURL();return u.release(t),n})(n.image)),n))).then((n=>{let r,{image:i,rotationCenter:s}=n;s&&(r=[s[0]/2,s[1]/2]),e.skinId=t.renderer.createBitmapSkin(i,e.bitmapResolution,r);const o=t.renderer.getSkinSize(e.skinId);return e.size=[2*o[0],2*o[1]],s||(s=t.renderer.getSkinRotationCenter(e.skinId),e.rotationCenterX=2*s[0],e.rotationCenterY=2*s[1],e.bitmapResolution=2),t.isPackaged&&(e.asset=null),e}))},m=function(e,t){const n=e.asset,r=e.assetId,i=e.rotationCenterX,s=e.rotationCenterY,o=e.bitmapResolution,a=e.dataFormat,l=t.storage.AssetType,u=e.dataFormat===l.ImageVector.runtimeFormat;e.assetId=u?t.storage.defaultAssetId.ImageVector:t.storage.defaultAssetId.ImageBitmap,e.asset=t.storage.get(e.assetId),e.md5="".concat(e.assetId,".").concat(e.asset.dataFormat);return(u?c(e,t):p(e,t)).then((e=>(e.broken={},e.broken.assetId=r,e.broken.md5="".concat(r,".").concat(a),e.broken.asset=n,e.broken.dataFormat=a,e.broken.rotationCenterX=i,e.broken.rotationCenterY=s,e.broken.bitmapResolution=o,e)))},f=function(e,t,n){e.assetId=e.asset.assetId;if(!t.renderer)return i.warn("No rendering module present; cannot load costume: ",e.name),Promise.resolve(e);const r=t.storage.AssetType;let s;return"number"!=typeof e.rotationCenterX||isNaN(e.rotationCenterX)||"number"!=typeof e.rotationCenterY||isNaN(e.rotationCenterY)||(s=[e.rotationCenterX,e.rotationCenterY]),e.asset.assetType.runtimeFormat===r.ImageVector.runtimeFormat?c(e,t,s,n).catch((n=>(i.warn("Error loading vector image: ".concat(n)),m(e,t)))):p(e,t,s).catch((n=>(i.warn("Error loading bitmap image: ".concat(n)),m(e,t))))};e.exports={loadCostume:function(e,t,n,s){const o=r.splitFirst(e,"."),a=o[0],l=o[1].toLowerCase();if(t.dataFormat=l,t.asset)return f(t,n,s);if(!n.storage)return i.warn("No storage module present; cannot load costume asset: ",e),Promise.resolve(t);if(!n.storage.defaultAssetId)return i.warn("No default assets found"),Promise.resolve(t);const c=n.storage.AssetType,u="svg"===l?c.ImageVector:c.ImageBitmap,d=n.storage.load(u,a,l);let h;return h=t.textLayerMD5?n.storage.load(c.ImageBitmap,t.textLayerMD5,"png"):Promise.resolve(null),Promise.all([d,h]).then((e=>e[0]?(t.asset=e[0],e[1]&&(t.textLayerAsset=e[1]),f(t,n,s)):m(t,n))).catch((e=>(i.warn("Error loading costume: ",e),m(t,n))))},loadCostumeFromAsset:f}},function(e,t,n){var r=n(37),i=r.TYPE,s=r.NAME,o=n(27).cmpStr,a=i.EOF,l=i.WhiteSpace,c=i.Comment,u=16777215,d=24,h=function(){this.offsetAndType=null,this.balance=null,this.reset()};h.prototype={reset:function(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset},lookupType:function(e){return(e+=this.tokenIndex)>d:a},lookupOffset:function(e){return(e+=this.tokenIndex)0?e>d,this.source,i)){case 1:break e;case 2:r++;break e;default:this.balance[n]===r&&(r=n),i=this.offsetAndType[r]&u}return r-this.tokenIndex},isBalanceEdge:function(e){return this.balance[this.tokenIndex]>d===l;e++,t++);t>0&&this.skip(t)},skipSC:function(){for(;this.tokenType===l||this.tokenType===c;)this.next()},skip:function(e){var t=this.tokenIndex+e;t>d,this.tokenEnd=t&u):(this.tokenIndex=this.tokenCount,this.next())},next:function(){var e=this.tokenIndex+1;e>d,this.tokenEnd=e&u):(this.tokenIndex=this.tokenCount,this.eof=!0,this.tokenType=a,this.tokenStart=this.tokenEnd=this.source.length)},forEachToken(e){for(var t=0,n=this.firstCharOffset;t>d,r,s,t)}},dump(){var e=new Array(this.tokenCount);return this.forEachToken(((t,n,r,i)=>{e[i]={idx:i,type:s[t],chunk:this.source.substring(n,r),balance:this.balance[i]}})),e}},e.exports=h},function(e,t){var n={EOF:0,Ident:1,Function:2,AtKeyword:3,Hash:4,String:5,BadString:6,Url:7,BadUrl:8,Delim:9,Number:10,Percentage:11,Dimension:12,WhiteSpace:13,CDO:14,CDC:15,Colon:16,Semicolon:17,Comma:18,LeftSquareBracket:19,RightSquareBracket:20,LeftParenthesis:21,RightParenthesis:22,LeftCurlyBracket:23,RightCurlyBracket:24,Comment:25},r=Object.keys(n).reduce((function(e,t){return e[n[t]]=t,e}),{});e.exports={TYPE:n,NAME:r}},function(e,t){e.exports={ID_NONE:-1,Events:{UseHighQualityRenderChanged:"UseHighQualityRenderChanged",AllowPrivateSkinAccessChanged:"AllowPrivateSkinAccessChanged",NativeSizeChanged:"NativeSizeChanged"}}},function(e,t,n){const r=n(31);r.enable(),e.exports=r("scratch-audioengine")},function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(374),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t){return new Md5(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t>2]|=e[s]<>6,l[i++]=128|63&r):r<55296||r>=57344?(l[i++]=224|r>>12,l[i++]=128|r>>6&63,l[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),l[i++]=240|r>>18,l[i++]=128|r>>12&63,l[i++]=128|r>>6&63,l[i++]=128|63&r);else for(i=this.start;s>2]|=r<>2]|=(192|r>>6)<>2]|=(128|63&r)<=57344?(a[i>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,i,s,o=this.blocks;this.first?t=((t=((e=((e=o[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+o[1]-117830708)<<12|r>>>20)+e|0)&(-271733879^e))+o[2]-1126478375)<<17|n>>>15)+r|0)&(r^e))+o[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((r=this.h3)^t&(n^r))+o[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[1]-389564586)<<12|r>>>20)+e|0)&(e^t))+o[2]+606105819)<<17|n>>>15)+r|0)&(r^e))+o[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(r^t&(n^r))+o[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[5]+1200080426)<<12|r>>>20)+e|0)&(e^t))+o[6]-1473231341)<<17|n>>>15)+r|0)&(r^e))+o[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+o[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[9]-1958414417)<<12|r>>>20)+e|0)&(e^t))+o[10]-42063)<<17|n>>>15)+r|0)&(r^e))+o[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+o[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[13]-40341101)<<12|r>>>20)+e|0)&(e^t))+o[14]-1502002290)<<17|n>>>15)+r|0)&(r^e))+o[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[1]-165796510)<<5|e>>>27)+t|0)^t))+o[6]-1069501632)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[11]+643717713)<<14|n>>>18)+r|0)^r))+o[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[5]-701558691)<<5|e>>>27)+t|0)^t))+o[10]+38016083)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[15]-660478335)<<14|n>>>18)+r|0)^r))+o[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[9]+568446438)<<5|e>>>27)+t|0)^t))+o[14]-1019803690)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[3]-187363961)<<14|n>>>18)+r|0)^r))+o[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[13]-1444681467)<<5|e>>>27)+t|0)^t))+o[2]-51403784)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[7]+1735328473)<<14|n>>>18)+r|0)^r))+o[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[5]-378558)<<4|e>>>28)+t|0))+o[8]-2022574463)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[11]+1839030562)<<16|n>>>16)+r|0))+o[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[1]-1530992060)<<4|e>>>28)+t|0))+o[4]+1272893353)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[7]-155497632)<<16|n>>>16)+r|0))+o[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[13]+681279174)<<4|e>>>28)+t|0))+o[0]-358537222)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[3]-722521979)<<16|n>>>16)+r|0))+o[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[9]-640364487)<<4|e>>>28)+t|0))+o[12]-421815835)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[15]+530742520)<<16|n>>>16)+r|0))+o[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[0]-198630844)<<6|e>>>26)+t|0)|~n))+o[7]+1126891415)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[14]-1416354905)<<15|n>>>17)+r|0)|~e))+o[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[12]+1700485571)<<6|e>>>26)+t|0)|~n))+o[3]-1894986606)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[10]-1051523)<<15|n>>>17)+r|0)|~e))+o[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[8]+1873313359)<<6|e>>>26)+t|0)|~n))+o[15]-30611744)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[6]-1560198380)<<15|n>>>17)+r|0)|~e))+o[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[4]-145523070)<<6|e>>>26)+t|0)|~n))+o[11]-1120210379)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[2]+718787259)<<15|n>>>17)+r|0)|~e))+o[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",i=this.array(),s=0;s<15;)e=i[s++],t=i[s++],n=i[s++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=i[s],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__(41),__webpack_require__(9))},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l,c=[],u=!1,d=-1;function h(){u&&l&&(u=!1,l.length?c=l.concat(c):d=-1,c.length&&p())}function p(){if(!u){var e=a(h);u=!0;for(var t=c.length;t;){for(l=c,c=[];++d1)for(var n=1;n0&&(this._lastUpdateTime=e),this._count=Math.min(this._maxTokens,this._count+n),this._count>0&&(this._count--,!0)}}},function(e,t,n){(function(t){let n=t.fetch;e.exports={fetchWithTimeout:(e,t,r)=>{let i=null;const s=window.AbortController?new window.AbortController:null,o=s?s.signal:null;return Promise.race([n(e,Object.assign({signal:o},t)).then((e=>(clearTimeout(i),e)),(e=>{throw clearTimeout(i),e})),new Promise(((e,t)=>{i=setTimeout((()=>{s&&s.abort(),t(new Error("Fetch timed out after ".concat(r," ms")))}),r)}))])},setFetch:e=>{n=e}}}).call(this,n(9))},function(e,t,n){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const s=n(19),{OrderedMap:o}=n(24),a=n(73),l=n(416),c=n(4),u=n(16),d=n(77),h=n(3),p=n(206),m=n(207),f=n(50),g=n(49),y=n(213),b=n(42),v=n(25),S=n(1),w=n(67),k=n(13),T=n(10),x=n(33),E=n(214),A=n(215),C=n(44),I=n(217),O=n(218),M=n(219),N=n(220),R=n(221),D=n(222),P=n(223),L=n(81),B=n(7),z=n(8),U={scratch3_control:n(224),scratch3_event:n(225),scratch3_looks:n(226),scratch3_motion:n(227),scratch3_operators:n(228),scratch3_sound:n(229),scratch3_sensing:n(230),scratch3_data:n(231),scratch3_procedures:n(232)},j=n(233),F=n(234),W=["#0FBD8C","#0DA57A","#0B8E69"],V=" // _twconfig_",G=(()=>{const e={};return e[c.ANGLE]={shadow:{type:"math_angle",fieldName:"NUM"}},e[c.COLOR]={shadow:{type:"colour_picker",fieldName:"COLOUR"}},e[c.NUMBER]={shadow:{type:"math_number",fieldName:"NUM"}},e[c.STRING]={shadow:{type:"text",fieldName:"TEXT"}},e[c.BOOLEAN]={check:"Boolean"},e[c.MATRIX]={shadow:{type:"matrix",fieldName:"MATRIX"}},e[c.NOTE]={shadow:{type:"note",fieldName:"NOTE"}},e[c.IMAGE]={fieldType:"field_image"},e[c.COSTUME]={shadow:{type:"looks_costume",fieldName:"COSTUME"}},e[c.SOUND]={shadow:{type:"sound_sounds_menu",fieldName:"SOUND_MENU"}},e})(),q=e=>{let t=0;return{canAddCloudVariable:()=>t{t++},removeCloudVariable:()=>{t--},hasCloudVariables:()=>t>0,getNumberOfCloudVariables:()=>t}};let Y=-1,H=-1,_=-1;class K extends s{constructor(){super(),this.targets=[],this.executableTargets=[],this.threads=[],this.threadMap=new Map,this.sequencer=new m(this),this.flyoutBlocks=new u(this,!0),this.monitorBlocks=new u(this,!0),this._editingTarget=null,this._primitives={},this._blockInfo=[],this._hats={},this._flowing={},this._scriptGlowsPreviousFrame=[],this._nonMonitorThreadCount=0,this._lastStepDoneThreads=null,this._cloneCounter=0,this._refreshTargets=!1,this.monitorBlockInfo={},this._monitorState=o({}),this._prevMonitorState=o({}),this.turboMode=!1,this.frameLoop=new F(this),this.currentStepTime=1e3/30,this.updateCurrentMSecs(),this.redrawRequested=!1,this._registerBlockPackages(),this.ioDevices={clock:new O(this),cloud:new M(this),keyboard:new N(this),mouse:new R(this),mouseWheel:new D(this),userData:new P,video:new L(this)},this.peripheralExtensions={},this.profiler=null,this.cloudOptions={limit:10};const e=q(this.cloudOptions);this.hasCloudData=e.hasCloudVariables,this.canAddCloudVariable=e.canAddCloudVariable,this.getNumberOfCloudVariables=e.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(e),this.removeCloudVariable=this._initializeRemoveCloudVariable(e),this.origin=null,this.platform=Object.assign({},I),this._initScratchLink(),this.resetRunId(),this._stageTarget=null,this.addonBlocks={},this.stageWidth=K.STAGE_WIDTH,this.stageHeight=K.STAGE_HEIGHT,this.runtimeOptions={maxClones:K.MAX_CLONES,miscLimits:!0,fencing:!0},this.compilerOptions={enabled:!0,warpTimer:!1},this.debug=!1,this._lastStepTime=Date.now(),this.interpolationEnabled=!1,this._defaultStoredSettings=this._generateAllProjectOptions(),this.isPackaged=!1,this.externalCommunicationMethods={cloudVariables:!1,customExtensions:!1},this.on(K.HAS_CLOUD_DATA_UPDATE,(e=>{this.setExternalCommunicationMethod("cloudVariables",e)})),this.enforcePrivacy=!0,this.extensionButtons=new Map,this.fontManager=new A(this),this.extensionStorage={},this.totalAssetRequests=0,this.finishedAssetRequests=0}static get STAGE_WIDTH(){return 480}static get STAGE_HEIGHT(){return 360}static get SCRIPT_GLOW_ON(){return"SCRIPT_GLOW_ON"}static get SCRIPT_GLOW_OFF(){return"SCRIPT_GLOW_OFF"}static get BLOCK_GLOW_ON(){return"BLOCK_GLOW_ON"}static get BLOCK_GLOW_OFF(){return"BLOCK_GLOW_OFF"}static get HAS_CLOUD_DATA_UPDATE(){return"HAS_CLOUD_DATA_UPDATE"}static get TURBO_MODE_ON(){return"TURBO_MODE_ON"}static get TURBO_MODE_OFF(){return"TURBO_MODE_OFF"}static get RUNTIME_OPTIONS_CHANGED(){return"RUNTIME_OPTIONS_CHANGED"}static get COMPILER_OPTIONS_CHANGED(){return"COMPILER_OPTIONS_CHANGED"}static get FRAMERATE_CHANGED(){return"FRAMERATE_CHANGED"}static get INTERPOLATION_CHANGED(){return"INTERPOLATION_CHANGED"}static get STAGE_SIZE_CHANGED(){return"STAGE_SIZE_CHANGED"}static get COMPILE_ERROR(){return"COMPILE_ERROR"}static get BEFORE_EXECUTE(){return"BEFORE_EXECUTE"}static get AFTER_EXECUTE(){return"AFTER_EXECUTE"}static get ASSET_PROGRESS(){return"ASSET_PROGRESS"}static get PROJECT_START(){return"PROJECT_START"}static get PROJECT_RUN_START(){return"PROJECT_RUN_START"}static get PROJECT_RUN_STOP(){return"PROJECT_RUN_STOP"}static get PROJECT_STOP_ALL(){return"PROJECT_STOP_ALL"}static get STOP_FOR_TARGET(){return"STOP_FOR_TARGET"}static get VISUAL_REPORT(){return"VISUAL_REPORT"}static get PROJECT_LOADED(){return"PROJECT_LOADED"}static get PROJECT_CHANGED(){return"PROJECT_CHANGED"}static get TOOLBOX_EXTENSIONS_NEED_UPDATE(){return"TOOLBOX_EXTENSIONS_NEED_UPDATE"}static get TARGETS_UPDATE(){return"TARGETS_UPDATE"}static get MONITORS_UPDATE(){return"MONITORS_UPDATE"}static get BLOCK_DRAG_UPDATE(){return"BLOCK_DRAG_UPDATE"}static get BLOCK_DRAG_END(){return"BLOCK_DRAG_END"}static get EXTENSION_ADDED(){return"EXTENSION_ADDED"}static get EXTENSION_FIELD_ADDED(){return"EXTENSION_FIELD_ADDED"}static get PERIPHERAL_LIST_UPDATE(){return"PERIPHERAL_LIST_UPDATE"}static get USER_PICKED_PERIPHERAL(){return"USER_PICKED_PERIPHERAL"}static get PERIPHERAL_CONNECTED(){return"PERIPHERAL_CONNECTED"}static get PERIPHERAL_DISCONNECTED(){return"PERIPHERAL_DISCONNECTED"}static get PERIPHERAL_REQUEST_ERROR(){return"PERIPHERAL_REQUEST_ERROR"}static get PERIPHERAL_CONNECTION_LOST_ERROR(){return"PERIPHERAL_CONNECTION_LOST_ERROR"}static get PERIPHERAL_SCAN_TIMEOUT(){return"PERIPHERAL_SCAN_TIMEOUT"}static get MIC_LISTENING(){return"MIC_LISTENING"}static get BLOCKSINFO_UPDATE(){return"BLOCKSINFO_UPDATE"}static get RUNTIME_STARTED(){return"RUNTIME_STARTED"}static get RUNTIME_STOPPED(){return"RUNTIME_STOPPED"}static get RUNTIME_DISPOSED(){return"RUNTIME_DISPOSED"}static get BLOCKS_NEED_UPDATE(){return"BLOCKS_NEED_UPDATE"}static get PLATFORM_MISMATCH(){return"PLATFORM_MISMATCH"}static get THREAD_STEP_INTERVAL(){return 1e3/60}static get THREAD_STEP_INTERVAL_COMPATIBILITY(){return 1e3/30}static get MAX_CLONES(){return 300}_initializeAddCloudVariable(e){return()=>{const t=this.hasCloudData();e.addCloudVariable(),!t&&this.hasCloudData()&&this.emit(K.HAS_CLOUD_DATA_UPDATE,!0)}}_initializeRemoveCloudVariable(e){return()=>{const t=this.hasCloudData();e.removeCloudVariable(),t&&!this.hasCloudData()&&this.emit(K.HAS_CLOUD_DATA_UPDATE,!1)}}_registerBlockPackages(){for(const e in U)if(Object.prototype.hasOwnProperty.call(U,e)){const t=new U[e](this);if(t.getPrimitives){const e=t.getPrimitives();for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._primitives[n]=e[n].bind(t))}if(t.getHats){const e=t.getHats();for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this._hats[t]=e[t])}t.getMonitored&&(this.monitorBlockInfo=Object.assign({},this.monitorBlockInfo,t.getMonitored())),this.compilerRegisterExtension(e,t)}}compilerRegisterExtension(e,t){this["ext_".concat(e)]=t}getMonitorState(){return this._monitorState}_makeExtensionMenuId(e,t){return"".concat(t,"_menu_").concat(e)}makeMessageContextForTarget(e){const t={};(e=e||this.getEditingTarget()||this.getTargetForStage())&&(t.targetType=e.isStage?b.STAGE:b.SPRITE)}_registerExtensionPrimitives(e){const t={id:e.id,name:w(e.name),showStatusButton:e.showStatusButton,blockIconURI:e.blockIconURI,menuIconURI:e.menuIconURI};e.color1?(t.color1=e.color1,t.color2=e.color2,t.color3=e.color3):(t.color1=W[0],t.color2=W[1],t.color3=W[2]),this._blockInfo.push(t),this._fillExtensionCategory(t,e);for(const n in t.customFieldTypes)if(Object.prototype.hasOwnProperty.call(e.customFieldTypes,n)){const e=t.customFieldTypes[n];this.emit(K.EXTENSION_FIELD_ADDED,{name:"field_".concat(e.extendedName),implementation:e.fieldImplementation})}this.emit(K.EXTENSION_ADDED,t)}_refreshExtensionPrimitives(e){const t=this._blockInfo.find((t=>t.id===e.id));t&&(t.name=w(e.name),this._fillExtensionCategory(t,e),this.emit(K.BLOCKSINFO_UPDATE,t))}_fillExtensionCategory(e,t){e.blocks=[],e.customFieldTypes={},e.menus=[],e.menuInfo={};for(const n in t.menus)if(Object.prototype.hasOwnProperty.call(t.menus,n)){const r=t.menus[n],i=this._buildMenuForScratchBlocks(n,r,e);e.menus.push(i),e.menuInfo[n]=r}for(const n in t.customFieldTypes)if(Object.prototype.hasOwnProperty.call(t.customFieldTypes,n)){const r=t.customFieldTypes[n],i=this._buildCustomFieldInfo(n,r,t.id,e);e.customFieldTypes[n]=i}if(t.docsURI){const n={info:{},xml:"')};e.blocks.push(n)}for(const n of t.blocks)try{const t=this._convertForScratchBlocks(n,e);if(e.blocks.push(t),t.json){const e=t.json.type;n.blockType!==h.EVENT&&(this._primitives[e]=t.info.func),n.blockType===h.EVENT||n.blockType===h.HAT?this._hats[e]={edgeActivated:n.isEdgeActivated,restartExistingThreads:n.shouldRestartExistingThreads}:n.blockType===h.CONDITIONAL?this._flowing[e]={conditional:!0,loop:!1}:n.blockType===h.LOOP&&(this._flowing[e]={conditional:!1,loop:!0})}}catch(e){S.error("Error parsing block: ",{block:n,error:e})}}_convertMenuItems(e){if("function"!=typeof e){const t=this.makeMessageContextForTarget();return e.map((e=>{const n=w(e,t);switch(typeof n){case"string":return[n,n];case"object":return[w(e.text,t),e.value];default:throw new Error("Can't interpret menu item: ".concat(JSON.stringify(e)))}}))}return e}_buildMenuForScratchBlocks(e,t,n){const r=this._makeExtensionMenuId(e,n.id),i=this._convertMenuItems(t.items);return{json:{message0:"%1",type:r,inputsInline:!0,output:"String",colour:n.color1,colourSecondary:n.color2,colourTertiary:n.color3,outputShape:t.acceptReporters?y.OUTPUT_SHAPE_ROUND:y.OUTPUT_SHAPE_SQUARE,args0:[{type:"field_dropdown",name:e,options:i}]}}}_buildCustomFieldInfo(e,t,n,r){const i="".concat(n,"_").concat(e);return{fieldName:e,extendedName:i,argumentTypeInfo:{shadow:{type:i,fieldName:"field_".concat(i)}},scratchBlocksDefinition:this._buildCustomFieldTypeForScratchBlocks(i,t.output,t.outputShape,r),fieldImplementation:t.implementation}}_buildCustomFieldTypeForScratchBlocks(e,t,n,r){return{json:{type:e,message0:"%1",inputsInline:!0,output:t,colour:r.color1,colourSecondary:r.color2,colourTertiary:r.color3,outputShape:n,args0:[{name:"field_".concat(e),type:"field_".concat(e)}]}}}_convertForScratchBlocks(e,t){return"---"===e?this._convertSeparatorForScratchBlocks(e):e.blockType===h.LABEL?this._convertLabelForScratchBlocks(e):e.blockType===h.BUTTON?this._convertButtonForScratchBlocks(e,t):e.blockType===h.XML?this._convertXmlForScratchBlocks(e):this._convertBlockForScratchBlocks(e,t)}_convertBlockForScratchBlocks(e,t){var n,r,i;const s="".concat(t.id,"_").concat(e.opcode),o={type:s,inputsInline:!0,category:t.name,extensions:[],colour:null!==(n=e.color1)&&void 0!==n?n:t.color1,colourSecondary:null!==(r=e.color2)&&void 0!==r?r:t.color2,colourTertiary:null!==(i=e.color3)&&void 0!==i?i:t.color3},a={argsMap:{},blockJSON:o,categoryInfo:t,blockInfo:e,inputList:[]},l=e.blockIconURI||t.blockIconURI;if(o.extensions.push("from_extension"),o.colour===W[0]&&o.colourSecondary===W[1]&&o.colourTertiary===W[2]&&o.extensions.push("default_extension_colors"),l){o.extensions.push("scratch_extension"),o.message0="%1 %2";const e={type:"field_image",src:l,width:40,height:40},t={type:"field_vertical_separator"};o.args0=[e,t]}switch(e.blockType){case h.COMMAND:o.outputShape=y.OUTPUT_SHAPE_SQUARE,o.previousStatement=null,e.isTerminal||(o.nextStatement=null);break;case h.REPORTER:o.output=e.allowDropAnywhere?null:"String",o.outputShape=y.OUTPUT_SHAPE_ROUND;break;case h.BOOLEAN:o.output="Boolean",o.outputShape=y.OUTPUT_SHAPE_HEXAGONAL;break;case h.HAT:case h.EVENT:Object.prototype.hasOwnProperty.call(e,"isEdgeActivated")||(e.isEdgeActivated=!0),o.outputShape=y.OUTPUT_SHAPE_SQUARE,o.nextStatement=null;break;case h.CONDITIONAL:case h.LOOP:e.branchCount=e.branchCount||1,o.outputShape=y.OUTPUT_SHAPE_SQUARE,o.previousStatement=null,e.isTerminal||(o.nextStatement=null)}const c=Array.isArray(e.text)?e.text:[e.text];let u=0,d=0,p=0;const m=this._convertPlaceholders.bind(this,a),f=this.makeMessageContextForTarget();for(;u0?d+1:"")}],++d,++p)}if(e.blockType===h.REPORTER||e.blockType===h.BOOLEAN)e.disableMonitor||0!==a.inputList.length||(o.checkboxInFlyout=!0);else if(e.branchIconURI||e.blockType===h.LOOP&&!Object.prototype.hasOwnProperty.call(e,"branchIconURI")){var g;o["lastDummyAlign".concat(p)]="RIGHT",o["message".concat(p)]="%1",o["args".concat(p)]=[{type:"field_image",src:null!==(g=e.branchIconURI)&&void 0!==g?g:"media://repeat.svg",width:24,height:24,alt:"*",flip_rtl:!0}],++p}const b=e.isDynamic?''):"",v=a.inputList.join(""),S='').concat(b).concat(v,"");if(e.extensions)for(const t of e.extensions)o.extensions.includes(t)||o.extensions.push(t);return{info:a.blockInfo,json:a.blockJSON,xml:S}}_convertSeparatorForScratchBlocks(e){return{info:e,xml:''}}_convertLabelForScratchBlocks(e){return{info:e,xml:'')}}_convertButtonForScratchBlocks(e,t){const n=this.makeMessageContextForTarget(),r=w(e.text,n);if(["MAKE_A_LIST","MAKE_A_PROCEDURE","MAKE_A_VARIABLE"].includes(e.func))return{info:e,xml:'')};const i="".concat(t.id,"_").concat(e.func);return this.extensionButtons.set(i,e.callFunc),{info:e,xml:'')}}_convertXmlForScratchBlocks(e){return{info:e,xml:e.xml}}handleExtensionButtonPress(e){this.extensionButtons.get(e)()}_constructInlineImageJson(e){return e.dataURI||S.warn("Missing data URI in extension block with argument type IMAGE"),{type:"field_image",src:e.dataURI||"",width:24,height:24,flip_rtl:e.flipRTL||!1}}_convertPlaceholders(e,t,n){const r=e.blockInfo.arguments[n]||{};let i,s=G[r.type]||{};if(!G[r.type]&&e.categoryInfo.customFieldTypes[r.type]&&(s=e.categoryInfo.customFieldTypes[r.type].argumentTypeInfo),"field_image"===s.fieldType)i=this._constructInlineImageJson(r);else{i={type:"input_value",name:n};const t=void 0===r.defaultValue?null:w(r.defaultValue,this.makeMessageContextForTarget()).toString();let o,a,l;if(s.check&&(i.check=s.check),r.menu){const t=e.categoryInfo.menuInfo[r.menu];t.acceptReporters?(o=n,a=this._makeExtensionMenuId(r.menu,e.categoryInfo.id),l=r.menu):(i.type="field_dropdown",i.options=this._convertMenuItems(t.items),o=null,a=null,l=n)}else o=n,a=s.shadow&&s.shadow.type||null,l=s.shadow&&s.shadow.fieldName||null;o&&e.inputList.push('')),a&&e.inputList.push('')),null!==t&&l&&e.inputList.push('').concat(x(t),"")),a&&e.inputList.push(""),o&&e.inputList.push("")}const o="args".concat(e.outLineNum),a=e.blockJSON[o]=e.blockJSON[o]||[];i&&a.push(i);const l=a.length;return e.argsMap[n]=l,"%".concat(l)}getBlocksXML(e){return this._blockInfo.map((t=>{const{name:n,color1:r,color2:i}=t,s=t.blocks.filter((t=>{let n=!0;return e&&t.info.filter&&(n=t.info.filter.includes(e.isStage?b.STAGE:b.SPRITE)),n&&!t.info.hideFromPalette})),o='colour="'.concat(x(r),'" secondaryColour="').concat(x(i),'"');let a="";t.menuIconURI?a=t.menuIconURI:t.blockIconURI&&(a=t.blockIconURI);const l=a?'iconURI="'.concat(x(a),'"'):"";let c="";t.showStatusButton&&(c='showStatusButton="true"');let u='"),u+=s.map((e=>e.xml)).join(""),u+="",{id:t.id,xml:u}}))}getBlocksJSON(){return this._blockInfo.reduce(((e,t)=>e.concat(t.blocks.map((e=>e.json)))),[])}_initScratchLink(){if("undefined"!=typeof self&&"undefined"!=typeof document&&document.getElementById&&self.origin&&"null"!==self.origin&&self.navigator&&self.navigator.userAgent&&!self.navigator.userAgent.includes("Node.js")&&!self.navigator.userAgent.includes("jsdom")){if(!document.getElementById("scratch-link-extension-script")){const e=document.createElement("script");e.id="scratch-link-extension-script",document.body.appendChild(e),self.postMessage("inject-scratch-link-script",self.origin)}}}getScratchLinkSocket(e){return(this._linkSocketFactory||this._defaultScratchLinkSocketFactory)(e)}configureScratchLinkSocketFactory(e){this._linkSocketFactory=e}_defaultScratchLinkSocketFactory(e){const t=self.Scratch,n=t&&t.ScratchLinkSafariSocket;return n&&n.isSafariHelperCompatible()?new n(e):new E(e)}registerPeripheralExtension(e,t){this.peripheralExtensions[e]=t}scanForPeripheral(e){this.peripheralExtensions[e]&&this.peripheralExtensions[e].scan()}connectPeripheral(e,t){this.peripheralExtensions[e]&&this.peripheralExtensions[e].connect(t)}disconnectPeripheral(e){this.peripheralExtensions[e]&&this.peripheralExtensions[e].disconnect()}getPeripheralIsConnected(e){let t=!1;return this.peripheralExtensions[e]&&(t=this.peripheralExtensions[e].isConnected()),t}emitMicListening(e){this.emit(K.MIC_LISTENING,e)}getOpcodeFunction(e){return this._primitives[e]}getIsHat(e){return Object.prototype.hasOwnProperty.call(this._hats,e)}getIsEdgeActivatedHat(e){return Object.prototype.hasOwnProperty.call(this._hats,e)&&this._hats[e].edgeActivated}attachAudioEngine(e){this.audioEngine=e}attachRenderer(e){this.renderer=e,this.renderer.setLayerGroupOrdering(k.LAYER_GROUPS),this.renderer.offscreenTouching=!this.runtimeOptions.fencing,this.updatePrivacy()}attachV2BitmapAdapter(e){this.v2BitmapAdapter=e}attachStorage(e){if(this.storage=e,this.isPackaged){const t=e.createAsset;let n=0;e.createAsset=function(e,r,i,s,o){return s||(s=(++n).toString()),t.call(this,e,r,i,s,!1)}}C.setFetch(e.scratchFetch.scratchFetch),this.resetRunId()}_pushThread(e,t,n){const r=new v(e);return r.target=t,r.stackClick=Boolean(n&&n.stackClick),r.updateMonitor=Boolean(n&&n.updateMonitor),r.blockContainer=r.updateMonitor?this.monitorBlocks:t.blocks,r.pushStack(e),this.threads.push(r),r.stackClick||r.updateMonitor||this.threadMap.set(r.getId(),r),n&&n.updateMonitor||!this.compilerOptions.enabled||r.tryCompile(),r}_stopThread(e){e.isKilled=!0,this.sequencer.retireThread(e)}_restartThread(e){const t=new v(e.topBlock);t.target=e.target,t.stackClick=e.stackClick,t.updateMonitor=e.updateMonitor,t.blockContainer=e.blockContainer,t.pushStack(e.topBlock),e.triedToCompile&&this.compilerOptions.enabled&&t.tryCompile(),t.stackClick||t.updateMonitor||this.threadMap.set(t.getId(),t);const n=this.threads.indexOf(e);return n>-1?(this.threads[n]=t,t):(this.threads.push(e),e)}emitCompileError(e,t){this.emit(K.COMPILE_ERROR,e,t)}isActiveThread(e){return e.stack.length>0&&e.status!==v.STATUS_DONE&&this.threads.indexOf(e)>-1}isWaitingThread(e){return e.status===v.STATUS_PROMISE_WAIT||e.status===v.STATUS_YIELD_TICK||!this.isActiveThread(e)}toggleScript(e,t){t=Object.assign({target:this._editingTarget,stackClick:!1},t);for(let n=0;n=0;t--){const r=n[t],i=r.blocks.getScripts();for(let t=0;t=0;n--){const i=r[n],s=d.getScripts(i.blocks,e);for(let e=0;e{const{blockId:o,fieldsOfInputs:a}=e;for(const e in t)if(a[e].value!==t[e])return;if(i.restartExistingThreads){const e=this.threadMap.get(v.getIdFromTargetAndBlock(n,o));if(e)return void r.push(this._restartThread(e))}else for(let e=0;e{e.isCompiled?e.executableHat&&(g.saveGlobalState(),g(e),g.restoreGlobalState()):(f(this.sequencer,e),e.goToNextBlock())})),r}dispose(){this.stopAll(),this.targets.forEach((e=>{e.isOriginal&&e.deleteMonitors()})),this.targets.map(this.disposeTarget,this),this.extensionStorage={};const e=o({});e.equals(this._monitorState)||(this._monitorState=e,this.emit(K.MONITORS_UPDATE,this._monitorState)),this.emit(K.RUNTIME_DISPOSED),this.ioDevices.clock.resetProjectTimer(),this.fontManager.clear(),this.hasCloudData()&&this.emit(K.HAS_CLOUD_DATA_UPDATE,!1),this.ioDevices.cloud.clear();const t=q(this.cloudOptions);this.hasCloudData=t.hasCloudVariables,this.canAddCloudVariable=t.canAddCloudVariable,this.getNumberOfCloudVariables=t.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(t),this.removeCloudVariable=this._initializeRemoveCloudVariable(t),this.resetProgress()}addTarget(e){this.targets.push(e),this.executableTargets.push(e),e.isStage&&!this._stageTarget&&(this._stageTarget=e)}moveExecutable(e,t){const n=this.executableTargets.indexOf(e);this.executableTargets.splice(n,1);let r=n+t;return r>this.executableTargets.length&&(r=this.executableTargets.length),r<=0&&(r=this.executableTargets.length>0&&this.executableTargets[0].isStage?1:0),this.executableTargets.splice(r,0,e),r}setExecutablePosition(e,t){const n=this.executableTargets.indexOf(e);return this.moveExecutable(e,t-n)}removeExecutable(e){const t=this.executableTargets.indexOf(e);t>-1&&this.executableTargets.splice(t,1)}disposeTarget(e){this.targets=this.targets.filter((t=>e!==t||(t.dispose(),!1))),this._stageTarget===e&&(this._stageTarget=null)}stopForTarget(e,t){this.emit(K.STOP_FOR_TARGET,e,t);for(let n=0;ne.clearEdgeActivatedValues()));for(let e=0;e!e.isKilled)),this.updateThreadMap();for(const e in this._hats){if(!Object.prototype.hasOwnProperty.call(this._hats,e))continue;this._hats[e].edgeActivated&&this.startHats(e)}this.redrawRequested=!1,this._pushMonitors(),null!==this.profiler&&(-1===H&&(H=this.profiler.idByName("Sequencer.stepThreads")),this.profiler.start(H)),this.emit(K.BEFORE_EXECUTE);const e=this.sequencer.stepThreads();null!==this.profiler&&this.profiler.stop(),this.emit(K.AFTER_EXECUTE),this._updateGlows(e),this._emitProjectRunStatus(this.threads.length+e.length-this._getMonitorThreadCount([...this.threads,...e])),this._lastStepDoneThreads=e,this.renderer&&(null!==this.profiler&&(-1===_&&(_=this.profiler.idByName("RenderWebGL.draw")),this.profiler.start(_)),document.hidden||this.frameLoop._interpolationAnimation||this.renderer.draw(),null!==this.profiler&&this.profiler.stop()),this._refreshTargets&&(this.emit(K.TARGETS_UPDATE,!1),this._refreshTargets=!1),this._prevMonitorState.equals(this._monitorState)||(this.emit(K.MONITORS_UPDATE,this._monitorState),this._prevMonitorState=this._monitorState),null!==this.profiler&&(this.profiler.stop(),this.profiler.reportFrames()),this.interpolationEnabled&&(this._lastStepTime=Date.now())}_getMonitorThreadCount(e){let t=0;return e.forEach((e=>{e.updateMonitor&&t++})),t}_pushMonitors(){this.monitorBlocks.runAllMonitored(this)}setEditingTarget(e){const t=this._editingTarget;this._editingTarget=e,this._scriptGlowsPreviousFrame=[],this._updateGlows(),t!==this._editingTarget&&this.requestToolboxExtensionsUpdate()}setCompatibilityMode(e){e?this.setFramerate(30):this.setFramerate(60)}setFramerate(e){e>250&&(e=250),e<0&&(e=1),this.frameLoop.setFramerate(e),this.emit(K.FRAMERATE_CHANGED,e)}setInterpolation(e){this.interpolationEnabled=e,this.frameLoop.setInterpolation(this.interpolationEnabled),this.emit(K.INTERPOLATION_CHANGED,e)}setRuntimeOptions(e){this.runtimeOptions=Object.assign({},this.runtimeOptions,e),this.emit(K.RUNTIME_OPTIONS_CHANGED,this.runtimeOptions),this.renderer&&(this.renderer.offscreenTouching=!this.runtimeOptions.fencing)}setCompilerOptions(e){this.compilerOptions=Object.assign({},this.compilerOptions,e),this.resetAllCaches(),this.emit(K.COMPILER_OPTIONS_CHANGED,this.compilerOptions)}setStageSize(e,t){if(e=Math.round(Math.max(1,e)),t=Math.round(Math.max(1,t)),this.stageWidth!==e||this.stageHeight!==t){const n=e-this.stageWidth,r=t-this.stageHeight;if(this._monitorState.size>0){const e=n/2,t=r/2;for(const n of this._monitorState.valueSeq()){const r=n.set("x",n.get("x")+e).set("y",n.get("y")+t);this.requestUpdateMonitor(r)}this.emit(K.MONITORS_UPDATE,this._monitorState)}this.stageWidth=e,this.stageHeight=t,this.renderer&&this.renderer.setStageSize(-e/2,e/2,-t/2,t/2),this.emit(K.STAGE_SIZE_CHANGED,e,t)}}setInEditor(e){}convertToPackagedRuntime(){if(this.storage)throw new Error("convertToPackagedRuntime must be called before attachStorage");this.isPackaged=!0}resetAllCaches(){for(const e of this.targets)e.isOriginal&&e.blocks.resetCache();this.flyoutBlocks.resetCache(),this.monitorBlocks.resetCache()}addAddonBlock(e){const t=e.procedureCode,n=e.arguments||[],s=n,o=n.map(((e,t)=>"arg".concat(t))),a=n.map((()=>""));if(this.addonBlocks[t]=function(e){for(var t=1;te.id===n));if(!r){const e='';r={id:n,name:w({id:"tw.blocks.addons",default:"Addons",description:"Name of the addon block category in the extension list"}),color1:"#29beb8",color2:"#3aa8a4",color3:"#3aa8a4",menuIconURI:"data:image/svg+xml;,".concat(encodeURIComponent(e)),blocks:[],customFieldTypes:{},menus:[]},this._blockInfo.unshift(r)}r.blocks.push({info:{},xml:'"})}this.resetAllCaches()}getAddonBlock(e){return Object.prototype.hasOwnProperty.call(this.addonBlocks,e)?this.addonBlocks[e]:null}findProjectOptionsComment(){const e=this.getTargetForStage().comments;for(const t of Object.values(e))if(t.text.includes(V))return t;return null}parseProjectOptions(){const e=this.findProjectOptionsComment();if(!e)return;const t=e.text.split("\n").find((e=>e.endsWith(V)));if(!t)return void S.warn("Config comment does not contain valid line");const n=t.substr(0,t.length-14);let r;try{if(r=a.parse(n),!r||"object"!=typeof r)throw new Error("Invalid object")}catch(e){return void S.warn("Config comment has invalid JSON",e)}"number"==typeof r.framerate&&this.setFramerate(r.framerate),r.turbo&&(this.turboMode=!0,this.emit(K.TURBO_MODE_ON)),r.interpolation&&this.setInterpolation(!0),r.runtimeOptions&&this.setRuntimeOptions(r.runtimeOptions),r.hq&&this.renderer&&this.renderer.setUseHighQualityRender(!0);const i=+r.width||this.stageWidth,s=+r.height||this.stageHeight;i===this.stageWidth&&s===this.stageHeight||this.setStageSize(i,s)}_generateAllProjectOptions(){return{framerate:this.frameLoop.framerate,runtimeOptions:this.runtimeOptions,interpolation:this.interpolationEnabled,turbo:this.turboMode,hq:!!this.renderer&&this.renderer.useHighQualityRender,width:this.stageWidth,height:this.stageHeight}}generateDifferingProjectOptions(){const e=(t,n)=>{const r={};for(const i of Object.keys(n)){const s=n[i],o=t[i];if("object"==typeof s&&s){const t=e(o,s);Object.keys(t).length>0&&(r[i]=t)}else s!==o&&(r[i]=s)}return r};return e(this._defaultStoredSettings,this._generateAllProjectOptions())}storeProjectOptions(){const e=this.generateDifferingProjectOptions(),t="Configuration for https://turbowarp.org/\nYou can move, resize, and minimize this comment, but don't edit it by hand. This comment can be deleted to remove the stored settings.\n".concat(a.stringify(e)).concat(V),n=this.findProjectOptionsComment();if(n)n.text=t;else{this.getTargetForStage().createComment(z(),null,t,50,50,350,170,!1)}this.emitProjectChanged()}precompile(){this.allScriptsDo(((e,t)=>{const n=t.blocks.getBlock(e);if(this.getIsHat(n.opcode)){const n=new v(e);n.target=t,n.blockContainer=t.blocks,n.tryCompile()}}))}enableDebug(){this.resetAllCaches(),this.debug=!0}_updateGlows(e){const t=[];t.push(...this.threads),e&&t.push(...e);const n=[],r=[];for(let e=0;e0&&this.emit(K.PROJECT_RUN_START),this._nonMonitorThreadCount>0&&0===e&&this.emit(K.PROJECT_RUN_STOP),this._nonMonitorThreadCount=e}quietGlow(e){const t=this._scriptGlowsPreviousFrame.indexOf(e);t>-1&&this._scriptGlowsPreviousFrame.splice(t,1)}glowBlock(e,t){t?this.emit(K.BLOCK_GLOW_ON,{id:e}):this.emit(K.BLOCK_GLOW_OFF,{id:e})}glowScript(e,t){t?this.emit(K.SCRIPT_GLOW_ON,{id:e}):this.emit(K.SCRIPT_GLOW_OFF,{id:e})}emitBlockDragUpdate(e){this.emit(K.BLOCK_DRAG_UPDATE,e)}emitBlockEndDrag(e,t){this.emit(K.BLOCK_DRAG_END,e,t)}visualReport(e,t){this.emit(K.VISUAL_REPORT,{id:e,value:String(t)})}requestAddMonitor(e){const t=e.get("id");this.requestUpdateMonitor(e)||(this._monitorState=this._monitorState.set(t,e))}requestUpdateMonitor(e){const t=e.get("id");return!!this._monitorState.has(t)&&(this._monitorState=this._monitorState.set(t,this._monitorState.get(t).mergeWith(((e,t)=>null==t?e:t),e)),!0)}requestRemoveMonitor(e){this._monitorState=this._monitorState.delete(e)}requestHideMonitor(e){return this.requestUpdateMonitor(new Map([["id",e],["visible",!1]]))}requestShowMonitor(e){return this.requestUpdateMonitor(new Map([["id",e],["visible",!0]]))}requestRemoveMonitorByTargetId(e){this._monitorState=this._monitorState.filterNot((t=>t.targetId===e))}getTargetById(e){for(let t=0;te.id===t));if(!r)return;const i=r.blocks.find((e=>e.info.opcode===n));return i?{category:"extension",label:"".concat(r.name,": ").concat(i.info.text)}:void 0}createNewGlobalVariable(e,t,n){const r="string"==typeof n?n:T.SCALAR_TYPE,i=this.getAllVarNamesOfType(r),s=B.unusedName(e,i),o=new T(t||z(),s,r);return this.getTargetForStage().variables[o.id]=o,o}requestRedraw(){this.redrawRequested=!0}requestTargetsUpdate(e){e.isOriginal&&(this._refreshTargets=!0)}requestBlocksUpdate(){this.emit(K.BLOCKS_NEED_UPDATE)}requestToolboxExtensionsUpdate(){this.emit(K.TOOLBOX_EXTENSIONS_NEED_UPDATE)}start(){this.frameLoop.running||(this.frameLoop.start(),this.emit(K.RUNTIME_STARTED))}stop(){this.quit()}quit(){this.frameLoop.running&&(this.frameLoop.stop(),this.emit(K.RUNTIME_STOPPED))}enableProfiling(e){p.available()&&(this.profiler=new p(e))}disableProfiling(){this.profiler=null}updateCurrentMSecs(){this.currentMSecs=Date.now()}updatePrivacy(){const e=this.enforcePrivacy&&Object.values(this.externalCommunicationMethods).some((e=>e));this.renderer&&this.renderer.setPrivateSkinAccess&&this.renderer.setPrivateSkinAccess(!e)}setEnforcePrivacy(e){this.enforcePrivacy=e,this.updatePrivacy()}setExternalCommunicationMethod(e,t){if(!Object.prototype.hasOwnProperty.call(this.externalCommunicationMethods,e))throw new Error("Unknown method: ".concat(e));this.externalCommunicationMethods[e]=t,this.updatePrivacy()}emitAssetProgress(){this.emit(K.ASSET_PROGRESS,this.finishedAssetRequests,this.totalAssetRequests)}resetProgress(){this.finishedAssetRequests=0,this.totalAssetRequests=0,this.emitAssetProgress()}wrapAssetRequest(e){this.totalAssetRequests++,this.emitAssetProgress();return e().then((e=>(this.finishedAssetRequests++,this.emitAssetProgress(),e)),(e=>{throw this.finishedAssetRequests++,this.emitAssetProgress(),e}))}}e.exports=K},function(e,t,n){const{Record:r}=n(24),i=r({id:null,spriteName:null,targetId:null,opcode:null,value:null,params:null,mode:"default",sliderMin:0,sliderMax:100,isDiscrete:!0,x:null,y:null,width:0,height:0,visible:!0});e.exports=i},function(e,t){e.exports=function(e,t){let n="";for(const e in t){let r=t[e].value;"CURRENTMENU"===e&&(r=r.toLowerCase()),n+="_".concat(r)}return"".concat(e).concat(n)}},function(e,t,n){const r=n(2),i=n(7),s=n(3),o=n(10),a=n(1),{IntermediateScript:l,IntermediateRepresentation:c}=n(78),u=n(209),d="",h="list",p=(e,t)=>({scope:e,id:t.id,name:t.name,isCloud:t.isCloud}),m=e=>e.substring(1);class f{constructor(e){this.thread=e,this.target=e.target,this.blocks=e.blockContainer,this.runtime=this.target.runtime,this.stage=this.runtime.getTargetForStage(),this.script=new l,this.script.warpTimer=this.target.runtime.compilerOptions.warpTimer,this.variableCache={},this.usesTimer=!1}setProcedureVariant(e){const t=m(e);this.script.procedureVariant=e,this.script.procedureCode=t,this.script.isProcedure=!0,this.script.yields=!1;const n=this.blocks.getProcedureParamNamesIdsAndDefaults(t);if(null===n)throw new Error("IR: cannot find procedure: ".concat(e));const[r,i,s]=n;this.script.arguments=r}enableWarp(){this.script.isWarp=!0}getBlockById(e){return this.blocks.getBlock(e)||this.blocks.runtime.flyoutBlocks.getBlock(e)}getBlockInfo(e){const[t,n]=i.splitFirst(e,"_");if(!t||!n)return null;const r=this.runtime._blockInfo.find((e=>e.id===t));if(!r)return null;const s=r.blocks.find((e=>e.info.opcode===n));return s||null}descendInputOfBlock(e,t){const n=e.inputs[t];if(!n)return a.warn("IR: ".concat(e.opcode,": missing input ").concat(t),e),{kind:"constant",value:0};const r=n.block,i=this.getBlockById(r);return i?this.descendInput(i):(a.warn("IR: ".concat(e.opcode,": could not find input ").concat(t," with ID ").concat(r)),{kind:"constant",value:0})}descendInput(e){switch(e.opcode){case"colour_picker":return{kind:"constant",value:e.fields.COLOUR.value};case"math_angle":case"math_integer":case"math_number":case"math_positive_number":case"math_whole_number":return{kind:"constant",value:e.fields.NUM.value};case"text":return{kind:"constant",value:e.fields.TEXT.value};case"argument_reporter_string_number":{const t=e.fields.VALUE.value,n=this.script.arguments.lastIndexOf(t);return-1===n&&"last key pressed"===t.toLowerCase()?{kind:"tw.lastKeyPressed"}:-1===n?{kind:"constant",value:0}:{kind:"procedures.argument",index:n}}case"argument_reporter_boolean":{const t=e.fields.VALUE.value,n=this.script.arguments.lastIndexOf(t);return-1===n?"is compiled?"===t.toLowerCase()||"is turbowarp?"===t.toLowerCase()?{kind:"constant",value:!0}:{kind:"constant",value:0}:{kind:"procedures.argument",index:n}}case"control_get_counter":return{kind:"counter.get"};case"data_variable":return{kind:"var.get",variable:this.descendVariable(e,"VARIABLE",d)};case"data_itemoflist":return{kind:"list.get",list:this.descendVariable(e,"LIST",h),index:this.descendInputOfBlock(e,"INDEX")};case"data_lengthoflist":return{kind:"list.length",list:this.descendVariable(e,"LIST",h)};case"data_listcontainsitem":return{kind:"list.contains",list:this.descendVariable(e,"LIST",h),item:this.descendInputOfBlock(e,"ITEM")};case"data_itemnumoflist":return{kind:"list.indexOf",list:this.descendVariable(e,"LIST",h),item:this.descendInputOfBlock(e,"ITEM")};case"data_listcontents":return{kind:"list.contents",list:this.descendVariable(e,"LIST",h)};case"event_broadcast_menu":{const t=e.fields.BROADCAST_OPTION,n=this.target.lookupBroadcastMsg(t.id,t.value);return{kind:"constant",value:n?n.name:""}}case"looks_backdropnumbername":return"number"===e.fields.NUMBER_NAME.value?{kind:"looks.backdropNumber"}:{kind:"looks.backdropName"};case"looks_costumenumbername":return"number"===e.fields.NUMBER_NAME.value?{kind:"looks.costumeNumber"}:{kind:"looks.costumeName"};case"looks_size":return{kind:"looks.size"};case"motion_direction":return{kind:"motion.direction"};case"motion_xposition":return{kind:"motion.x"};case"motion_yposition":return{kind:"motion.y"};case"operator_add":return{kind:"op.add",left:this.descendInputOfBlock(e,"NUM1"),right:this.descendInputOfBlock(e,"NUM2")};case"operator_and":return{kind:"op.and",left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")};case"operator_contains":return{kind:"op.contains",string:this.descendInputOfBlock(e,"STRING1"),contains:this.descendInputOfBlock(e,"STRING2")};case"operator_divide":return{kind:"op.divide",left:this.descendInputOfBlock(e,"NUM1"),right:this.descendInputOfBlock(e,"NUM2")};case"operator_equals":return{kind:"op.equals",left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")};case"operator_gt":return{kind:"op.greater",left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")};case"operator_join":return{kind:"op.join",left:this.descendInputOfBlock(e,"STRING1"),right:this.descendInputOfBlock(e,"STRING2")};case"operator_length":return{kind:"op.length",string:this.descendInputOfBlock(e,"STRING")};case"operator_letter_of":return{kind:"op.letterOf",letter:this.descendInputOfBlock(e,"LETTER"),string:this.descendInputOfBlock(e,"STRING")};case"operator_lt":return{kind:"op.less",left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")};case"operator_mathop":{const t=this.descendInputOfBlock(e,"NUM");switch(e.fields.OPERATOR.value.toLowerCase()){case"abs":return{kind:"op.abs",value:t};case"floor":return{kind:"op.floor",value:t};case"ceiling":return{kind:"op.ceiling",value:t};case"sqrt":return{kind:"op.sqrt",value:t};case"sin":return{kind:"op.sin",value:t};case"cos":return{kind:"op.cos",value:t};case"tan":return{kind:"op.tan",value:t};case"asin":return{kind:"op.asin",value:t};case"acos":return{kind:"op.acos",value:t};case"atan":return{kind:"op.atan",value:t};case"ln":return{kind:"op.ln",value:t};case"log":return{kind:"op.log",value:t};case"e ^":return{kind:"op.e^",value:t};case"10 ^":return{kind:"op.10^",value:t};default:return{kind:"constant",value:0}}}case"operator_mod":return{kind:"op.mod",left:this.descendInputOfBlock(e,"NUM1"),right:this.descendInputOfBlock(e,"NUM2")};case"operator_multiply":return{kind:"op.multiply",left:this.descendInputOfBlock(e,"NUM1"),right:this.descendInputOfBlock(e,"NUM2")};case"operator_not":return{kind:"op.not",operand:this.descendInputOfBlock(e,"OPERAND")};case"operator_or":return{kind:"op.or",left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")};case"operator_random":{const t=this.descendInputOfBlock(e,"FROM"),n=this.descendInputOfBlock(e,"TO");if("constant"===t.kind&&"constant"===n.kind){const e=t.value,i=n.value,s=r.toNumber(e),o=r.toNumber(i);return s===o?{kind:"constant",value:s}:r.isInt(e)&&r.isInt(i)?{kind:"op.random",low:s<=o?t:n,high:s<=o?n:t,useInts:!0,useFloats:!1}:{kind:"op.random",low:s<=o?t:n,high:s<=o?n:t,useInts:!1,useFloats:!0}}if("constant"===t.kind){if(!r.isInt(r.toNumber(t.value)))return{kind:"op.random",low:t,high:n,useInts:!1,useFloats:!0}}else if("constant"===n.kind&&!r.isInt(r.toNumber(n.value)))return{kind:"op.random",low:t,high:n,useInts:!1,useFloats:!0};return{kind:"op.random",low:t,high:n,useInts:!1,useFloats:!1}}case"operator_round":return{kind:"op.round",value:this.descendInputOfBlock(e,"NUM")};case"operator_subtract":return{kind:"op.subtract",left:this.descendInputOfBlock(e,"NUM1"),right:this.descendInputOfBlock(e,"NUM2")};case"procedures_call":return this.descendProcedure(e);case"sensing_answer":return{kind:"sensing.answer"};case"sensing_coloristouchingcolor":return{kind:"sensing.colorTouchingColor",target:this.descendInputOfBlock(e,"COLOR2"),mask:this.descendInputOfBlock(e,"COLOR")};case"sensing_current":switch(e.fields.CURRENTMENU.value.toLowerCase()){case"year":return{kind:"sensing.year"};case"month":return{kind:"sensing.month"};case"date":return{kind:"sensing.date"};case"dayofweek":return{kind:"sensing.dayofweek"};case"hour":return{kind:"sensing.hour"};case"minute":return{kind:"sensing.minute"};case"second":return{kind:"sensing.second"}}return{kind:"constant",value:0};case"sensing_dayssince2000":return{kind:"sensing.daysSince2000"};case"sensing_distanceto":return{kind:"sensing.distance",target:this.descendInputOfBlock(e,"DISTANCETOMENU")};case"sensing_keypressed":return{kind:"keyboard.pressed",key:this.descendInputOfBlock(e,"KEY_OPTION")};case"sensing_mousedown":return{kind:"mouse.down"};case"sensing_mousex":return{kind:"mouse.x"};case"sensing_mousey":return{kind:"mouse.y"};case"sensing_of":return{kind:"sensing.of",property:e.fields.PROPERTY.value,object:this.descendInputOfBlock(e,"OBJECT")};case"sensing_timer":return this.usesTimer=!0,{kind:"timer.get"};case"sensing_touchingcolor":return{kind:"sensing.touchingColor",color:this.descendInputOfBlock(e,"COLOR")};case"sensing_touchingobject":return{kind:"sensing.touching",object:this.descendInputOfBlock(e,"TOUCHINGOBJECTMENU")};case"sensing_username":return{kind:"sensing.username"};case"sound_sounds_menu":return{kind:"constant",value:e.fields.SOUND_MENU.value};case"tw_getLastKeyPressed":return{kind:"tw.lastKeyPressed"};default:{if(this.runtime.getOpcodeFunction(e.opcode)){if(u.inputs.includes(e.opcode))return this.descendCompatLayer(e);const t=this.getBlockInfo(e.opcode);if(t){const n=t.info.blockType;if(n===s.REPORTER||n===s.BOOLEAN)return this.descendCompatLayer(e)}}const t=Object.keys(e.inputs),n=Object.keys(e.fields);if(0===t.length&&1===n.length)return{kind:"constant",value:e.fields[n[0]].value};throw a.warn("IR: Unknown input: ".concat(e.opcode),e),new Error("IR: Unknown input: ".concat(e.opcode))}}}descendStackedBlock(e){switch(e.opcode){case"control_all_at_once":return{kind:"control.if",condition:{kind:"constant",value:!0},whenTrue:this.descendSubstack(e,"SUBSTACK"),whenFalse:[]};case"control_clear_counter":return{kind:"counter.clear"};case"control_create_clone_of":return{kind:"control.createClone",target:this.descendInputOfBlock(e,"CLONE_OPTION")};case"control_delete_this_clone":return this.script.yields=!0,{kind:"control.deleteClone"};case"control_forever":return this.analyzeLoop(),{kind:"control.while",condition:{kind:"constant",value:!0},do:this.descendSubstack(e,"SUBSTACK")};case"control_for_each":return this.analyzeLoop(),{kind:"control.for",variable:this.descendVariable(e,"VARIABLE",d),count:this.descendInputOfBlock(e,"VALUE"),do:this.descendSubstack(e,"SUBSTACK")};case"control_if":return{kind:"control.if",condition:this.descendInputOfBlock(e,"CONDITION"),whenTrue:this.descendSubstack(e,"SUBSTACK"),whenFalse:[]};case"control_if_else":return{kind:"control.if",condition:this.descendInputOfBlock(e,"CONDITION"),whenTrue:this.descendSubstack(e,"SUBSTACK"),whenFalse:this.descendSubstack(e,"SUBSTACK2")};case"control_incr_counter":return{kind:"counter.increment"};case"control_repeat":return this.analyzeLoop(),{kind:"control.repeat",times:this.descendInputOfBlock(e,"TIMES"),do:this.descendSubstack(e,"SUBSTACK")};case"control_repeat_until":{this.analyzeLoop(),this.usesTimer=!1;const t=this.descendInputOfBlock(e,"CONDITION"),n=this.usesTimer;return n&&(this.script.yields=!0),{kind:"control.while",condition:{kind:"op.not",operand:t},do:this.descendSubstack(e,"SUBSTACK"),warpTimer:n}}case"control_stop":{const t=e.fields.STOP_OPTION.value;return"all"===t?(this.script.yields=!0,{kind:"control.stopAll"}):"other scripts in sprite"===t||"other scripts in stage"===t?{kind:"control.stopOthers"}:"this script"===t?{kind:"control.stopScript"}:{kind:"noop"}}case"control_wait":return this.script.yields=!0,{kind:"control.wait",seconds:this.descendInputOfBlock(e,"DURATION")};case"control_wait_until":return this.script.yields=!0,{kind:"control.waitUntil",condition:this.descendInputOfBlock(e,"CONDITION")};case"control_while":return this.analyzeLoop(),{kind:"control.while",condition:this.descendInputOfBlock(e,"CONDITION"),do:this.descendSubstack(e,"SUBSTACK"),warpTimer:!1};case"data_addtolist":return{kind:"list.add",list:this.descendVariable(e,"LIST",h),item:this.descendInputOfBlock(e,"ITEM")};case"data_changevariableby":{const t=this.descendVariable(e,"VARIABLE",d);return{kind:"var.set",variable:t,value:{kind:"op.add",left:{kind:"var.get",variable:t},right:this.descendInputOfBlock(e,"VALUE")}}}case"data_deletealloflist":return{kind:"list.deleteAll",list:this.descendVariable(e,"LIST",h)};case"data_deleteoflist":{const t=this.descendInputOfBlock(e,"INDEX");return"constant"===t.kind&&"all"===t.value?{kind:"list.deleteAll",list:this.descendVariable(e,"LIST",h)}:{kind:"list.delete",list:this.descendVariable(e,"LIST",h),index:t}}case"data_hidelist":return{kind:"list.hide",list:this.descendVariable(e,"LIST",h)};case"data_hidevariable":return{kind:"var.hide",variable:this.descendVariable(e,"VARIABLE",d)};case"data_insertatlist":return{kind:"list.insert",list:this.descendVariable(e,"LIST",h),index:this.descendInputOfBlock(e,"INDEX"),item:this.descendInputOfBlock(e,"ITEM")};case"data_replaceitemoflist":return{kind:"list.replace",list:this.descendVariable(e,"LIST",h),index:this.descendInputOfBlock(e,"INDEX"),item:this.descendInputOfBlock(e,"ITEM")};case"data_setvariableto":return{kind:"var.set",variable:this.descendVariable(e,"VARIABLE",d),value:this.descendInputOfBlock(e,"VALUE")};case"data_showlist":return{kind:"list.show",list:this.descendVariable(e,"LIST",h)};case"data_showvariable":return{kind:"var.show",variable:this.descendVariable(e,"VARIABLE",d)};case"event_broadcast":return{kind:"event.broadcast",broadcast:this.descendInputOfBlock(e,"BROADCAST_INPUT")};case"event_broadcastandwait":return this.script.yields=!0,{kind:"event.broadcastAndWait",broadcast:this.descendInputOfBlock(e,"BROADCAST_INPUT")};case"looks_changeeffectby":return{kind:"looks.changeEffect",effect:e.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(e,"CHANGE")};case"looks_changesizeby":return{kind:"looks.changeSize",size:this.descendInputOfBlock(e,"CHANGE")};case"looks_cleargraphiceffects":return{kind:"looks.clearEffects"};case"looks_goforwardbackwardlayers":return"forward"===e.fields.FORWARD_BACKWARD.value?{kind:"looks.forwardLayers",layers:this.descendInputOfBlock(e,"NUM")}:{kind:"looks.backwardLayers",layers:this.descendInputOfBlock(e,"NUM")};case"looks_gotofrontback":return"front"===e.fields.FRONT_BACK.value?{kind:"looks.goToFront"}:{kind:"looks.goToBack"};case"looks_hide":return{kind:"looks.hide"};case"looks_nextbackdrop":return{kind:"looks.nextBackdrop"};case"looks_nextcostume":return{kind:"looks.nextCostume"};case"looks_seteffectto":return{kind:"looks.setEffect",effect:e.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(e,"VALUE")};case"looks_setsizeto":return{kind:"looks.setSize",size:this.descendInputOfBlock(e,"SIZE")};case"looks_show":return{kind:"looks.show"};case"looks_switchbackdropto":return{kind:"looks.switchBackdrop",backdrop:this.descendInputOfBlock(e,"BACKDROP")};case"looks_switchcostumeto":return{kind:"looks.switchCostume",costume:this.descendInputOfBlock(e,"COSTUME")};case"motion_changexby":return{kind:"motion.changeX",dx:this.descendInputOfBlock(e,"DX")};case"motion_changeyby":return{kind:"motion.changeY",dy:this.descendInputOfBlock(e,"DY")};case"motion_gotoxy":return{kind:"motion.setXY",x:this.descendInputOfBlock(e,"X"),y:this.descendInputOfBlock(e,"Y")};case"motion_ifonedgebounce":return{kind:"motion.ifOnEdgeBounce"};case"motion_movesteps":return{kind:"motion.step",steps:this.descendInputOfBlock(e,"STEPS")};case"motion_pointindirection":return{kind:"motion.setDirection",direction:this.descendInputOfBlock(e,"DIRECTION")};case"motion_setrotationstyle":return{kind:"motion.setRotationStyle",style:e.fields.STYLE.value};case"motion_setx":return{kind:"motion.setX",x:this.descendInputOfBlock(e,"X")};case"motion_sety":return{kind:"motion.setY",y:this.descendInputOfBlock(e,"Y")};case"motion_turnleft":return{kind:"motion.setDirection",direction:{kind:"op.subtract",left:{kind:"motion.direction"},right:this.descendInputOfBlock(e,"DEGREES")}};case"motion_turnright":return{kind:"motion.setDirection",direction:{kind:"op.add",left:{kind:"motion.direction"},right:this.descendInputOfBlock(e,"DEGREES")}};case"pen_clear":return{kind:"pen.clear"};case"pen_changePenColorParamBy":return{kind:"pen.changeParam",param:this.descendInputOfBlock(e,"COLOR_PARAM"),value:this.descendInputOfBlock(e,"VALUE")};case"pen_changePenHueBy":return{kind:"pen.legacyChangeHue",hue:this.descendInputOfBlock(e,"HUE")};case"pen_changePenShadeBy":return{kind:"pen.legacyChangeShade",shade:this.descendInputOfBlock(e,"SHADE")};case"pen_penDown":return{kind:"pen.down"};case"pen_penUp":return{kind:"pen.up"};case"pen_setPenColorParamTo":return{kind:"pen.setParam",param:this.descendInputOfBlock(e,"COLOR_PARAM"),value:this.descendInputOfBlock(e,"VALUE")};case"pen_setPenColorToColor":return{kind:"pen.setColor",color:this.descendInputOfBlock(e,"COLOR")};case"pen_setPenHueToNumber":return{kind:"pen.legacySetHue",hue:this.descendInputOfBlock(e,"HUE")};case"pen_setPenShadeToNumber":return{kind:"pen.legacySetShade",shade:this.descendInputOfBlock(e,"SHADE")};case"pen_setPenSizeTo":return{kind:"pen.setSize",size:this.descendInputOfBlock(e,"SIZE")};case"pen_changePenSizeBy":return{kind:"pen.changeSize",size:this.descendInputOfBlock(e,"SIZE")};case"pen_stamp":return{kind:"pen.stamp"};case"procedures_call":{const t=e.mutation.proccode;if(e.mutation.return){const t=this.descendVisualReport(e);if(t)return t}return"tw:debugger;"===t?{kind:"tw.debugger"}:this.descendProcedure(e)}case"procedures_return":return{kind:"procedures.return",value:this.descendInputOfBlock(e,"VALUE")};case"sensing_resettimer":return{kind:"timer.reset"};default:{if(this.runtime.getOpcodeFunction(e.opcode)){if(u.stacked.includes(e.opcode))return this.descendCompatLayer(e);const t=this.getBlockInfo(e.opcode);if(t){const n=t.info.blockType;if(n===s.COMMAND||n===s.CONDITIONAL||n===s.LOOP)return this.descendCompatLayer(e)}}const t=this.descendVisualReport(e);if(t)return t;throw a.warn("IR: Unknown stacked block: ".concat(e.opcode),e),new Error("IR: Unknown stacked block: ".concat(e.opcode))}}}descendSubstack(e,t){const n=e.inputs[t];if(!n)return[];const r=n.block;return this.walkStack(r)}walkStack(e){const t=[];let n=e;for(;null!==n;){const e=this.getBlockById(n);if(!e)break;const r=this.descendStackedBlock(e);t.push(r),n=e.next}return t}descendVariable(e,t,n){const r=e.fields[t],i=r.id;if(Object.prototype.hasOwnProperty.call(this.variableCache,i))return this.variableCache[i];const s=this._descendVariable(i,r.value,n);return this.variableCache[i]=s,s}_descendVariable(e,t,n){const r=this.target,i=this.stage;if(Object.prototype.hasOwnProperty.call(r.variables,e))return p("target",r.variables[e]);if(!r.isStage&&i&&Object.prototype.hasOwnProperty.call(i.variables,e))return p("stage",i.variables[e]);for(const e in r.variables)if(Object.prototype.hasOwnProperty.call(r.variables,e)){const i=r.variables[e];if(i.name===t&&i.type===n)return p("target",i)}if(!r.isStage&&i)for(const e in i.variables)if(Object.prototype.hasOwnProperty.call(i.variables,e)){const r=i.variables[e];if(r.name===t&&r.type===n)return p("stage",r)}const s=new o(e,t,n,!1);if(r.variables[e]=s,r.sprite)for(const i of r.sprite.clones)Object.prototype.hasOwnProperty.call(i.variables,e)||(i.variables[e]=new o(e,t,n,!1));return p("target",s)}descendProcedure(e){const t=e.mutation.proccode,n=this.blocks.getProcedureParamNamesIdsAndDefaults(t);if(null===n)return{kind:"noop"};const[r,i,s]=n;if(this.runtime.getAddonBlock(t)){this.script.yields=!0;const n={};for(let t=0;t0;){this.compilingProcedures=this.proceduresToCompile,this.proceduresToCompile=new Map;for(const[e,n]of this.compilingProcedures.entries())if(t[e]){const n=t[e];this.procedures[e]=n,this.addProcedureDependencies(n.dependedProcedures)}else{const r="W"===e.charAt(0),i=new f(this.thread);i.setProcedureVariant(e),r&&i.enableWarp();const s=this.generateScriptTree(i,n);this.procedures[e]=s,t[e]=s}}for(;this.analyzeScript(e););const n=new c;return n.entry=e,n.procedures=this.procedures,n}}}},function(e,t,n){const r={Timer:n(14),Cast:n(2),log:n(1),blockUtility:n(211),thread:null};let i="";const s={};i+="let stuckCounter = 0;\nconst isStuck = () => {\n // The real time is not checked on every call for performance.\n stuckCounter++;\n if (stuckCounter === 100) {\n stuckCounter = 0;\n return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n }\n return false;\n};",s.startHats="const startHats = (requestedHat, optMatchFields) => {\n const thread = globalState.thread;\n const threads = thread.target.runtime.startHats(requestedHat, optMatchFields);\n return threads;\n}",s.waitThreads="const waitThreads = function*(threads) {\n const thread = globalState.thread;\n const runtime = thread.target.runtime;\n\n while (true) {\n // determine whether any threads are running\n let anyRunning = false;\n for (let i = 0; i < threads.length; i++) {\n if (runtime.threads.indexOf(threads[i]) !== -1) {\n anyRunning = true;\n break;\n }\n }\n if (!anyRunning) {\n // all threads are finished, can resume\n return;\n }\n\n let allWaiting = true;\n for (let i = 0; i < threads.length; i++) {\n if (!runtime.isWaitingThread(threads[i])) {\n allWaiting = false;\n break;\n }\n }\n if (allWaiting) {\n thread.status = 3; // STATUS_YIELD_TICK\n }\n\n yield;\n }\n}",s.executeInCompatibilityLayer="let hasResumedFromPromise = false;\nconst waitPromise = function*(promise) {\n const thread = globalState.thread;\n let returnValue;\n\n // enter STATUS_PROMISE_WAIT and yield\n // this will stop script execution until the promise handlers reset the thread status\n // because promise handlers might execute immediately, configure thread.status here\n thread.status = 1; // STATUS_PROMISE_WAIT\n\n promise\n .then(value => {\n returnValue = value;\n thread.status = 0; // STATUS_RUNNING\n }, error => {\n globalState.log.warn('Promise rejected in compiled script:', error);\n returnValue = '' + error;\n thread.status = 0; // STATUS_RUNNING\n });\n\n yield;\n\n return returnValue;\n};\nconst isPromise = value => (\n // see engine/execute.js\n value !== null &&\n typeof value === 'object' &&\n typeof value.then === 'function'\n);\nconst executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags, blockId, branchInfo) {\n const thread = globalState.thread;\n const blockUtility = globalState.blockUtility;\n const stackFrame = branchInfo ? branchInfo.stackFrame : {};\n\n const finish = (returnValue) => {\n if (branchInfo) {\n if (typeof returnValue === 'undefined' && blockUtility._startedBranch) {\n branchInfo.isLoop = blockUtility._startedBranch[1];\n return blockUtility._startedBranch[0];\n }\n branchInfo.isLoop = branchInfo.defaultIsLoop;\n return returnValue;\n }\n return returnValue;\n };\n\n const executeBlock = () => {\n blockUtility.init(thread, blockId, stackFrame);\n return blockFunction(inputs, blockUtility);\n };\n\n let returnValue = executeBlock();\n if (isPromise(returnValue)) {\n returnValue = finish(yield* waitPromise(returnValue));\n if (useFlags) hasResumedFromPromise = true;\n return returnValue;\n }\n\n if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n // Something external is forcing us to stop\n yield;\n // Make up a return value because whatever is forcing us to stop can't specify one\n return '';\n }\n\n while (thread.status === 2 /* STATUS_YIELD */ || thread.status === 3 /* STATUS_YIELD_TICK */) {\n // Yielded threads will run next iteration.\n if (thread.status === 2 /* STATUS_YIELD */) {\n thread.status = 0; // STATUS_RUNNING\n // Yield back to the event loop when stuck or not in warp mode.\n if (!isWarp || isStuck()) {\n yield;\n }\n } else {\n // status is STATUS_YIELD_TICK, always yield to the event loop\n yield;\n }\n\n returnValue = executeBlock();\n if (isPromise(returnValue)) {\n returnValue = finish(yield* waitPromise(returnValue));\n if (useFlags) hasResumedFromPromise = true;\n return returnValue;\n }\n\n if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n yield;\n return finish('');\n }\n }\n\n return finish(returnValue);\n}",s.createBranchInfo="const createBranchInfo = (isLoop) => ({\n defaultIsLoop: isLoop,\n isLoop: false,\n branch: 0,\n stackFrame: {}\n});",s.retire="const retire = () => {\n const thread = globalState.thread;\n thread.target.runtime.sequencer.retireThread(thread);\n}",s.toBoolean="const toBoolean = value => {\n if (typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'string') {\n if (value === '' || value === '0' || value.toLowerCase() === 'false') {\n return false;\n }\n return true;\n }\n return !!value;\n}",s.limitPrecision="const limitPrecision = value => {\n const rounded = Math.round(value);\n const delta = value - rounded;\n return (Math.abs(delta) < 1e-9) ? rounded : value;\n}",i+="const isNotActuallyZero = val => {\n if (typeof val !== 'string') return false;\n for (let i = 0; i < val.length; i++) {\n const code = val.charCodeAt(i);\n if (code === 48 || code === 9) {\n return false;\n }\n }\n return true;\n};",i+="const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);",s.compareGreaterThan="const compareGreaterThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isNotActuallyZero(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isNotActuallyZero(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || isNaN(n2)) {\n const s1 = ('' + v1).toLowerCase();\n const s2 = ('' + v2).toLowerCase();\n return s1 > s2;\n }\n return n1 > n2;\n};\nconst compareGreaterThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) ? v1 > v2 : compareGreaterThanSlow(v1, v2)",s.compareLessThan="const compareLessThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isNotActuallyZero(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isNotActuallyZero(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || isNaN(n2)) {\n const s1 = ('' + v1).toLowerCase();\n const s2 = ('' + v2).toLowerCase();\n return s1 < s2;\n }\n return n1 < n2;\n};\nconst compareLessThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v2) ? v1 < v2 : compareLessThanSlow(v1, v2)",s.randomInt="const randomInt = (low, high) => low + Math.floor(Math.random() * ((high + 1) - low))",s.randomFloat="const randomFloat = (low, high) => (Math.random() * (high - low)) + low",s.timer="const timer = () => {\n const t = new globalState.Timer({\n now: () => globalState.thread.target.runtime.currentMSecs\n });\n t.start();\n return t;\n}",s.daysSince2000="const daysSince2000 = () => (Date.now() - 946684800000) / (24 * 60 * 60 * 1000)",s.distance="const distance = menu => {\n const thread = globalState.thread;\n if (thread.target.isStage) return 10000;\n\n let targetX = 0;\n let targetY = 0;\n if (menu === '_mouse_') {\n targetX = thread.target.runtime.ioDevices.mouse.getScratchX();\n targetY = thread.target.runtime.ioDevices.mouse.getScratchY();\n } else {\n const distTarget = thread.target.runtime.getSpriteTargetByName(menu);\n if (!distTarget) return 10000;\n targetX = distTarget.x;\n targetY = distTarget.y;\n }\n\n const dx = thread.target.x - targetX;\n const dy = thread.target.y - targetY;\n return Math.sqrt((dx * dx) + (dy * dy));\n}",i+="const listIndexSlow = (index, length) => {\n if (index === 'last') {\n return length - 1;\n } else if (index === 'random' || index === 'any') {\n if (length > 0) {\n return (Math.random() * length) | 0;\n }\n return -1;\n }\n index = (+index || 0) | 0;\n if (index < 1 || index > length) {\n return -1;\n }\n return index - 1;\n};\nconst listIndex = (index, length) => {\n if (typeof index !== 'number') {\n return listIndexSlow(index, length);\n }\n index = index | 0;\n return index < 1 || index > length ? -1 : index - 1;\n};",s.listGet="const listGet = (list, idx) => {\n const index = listIndex(idx, list.length);\n if (index === -1) {\n return '';\n }\n return list[index];\n}",s.listReplace="const listReplace = (list, idx, value) => {\n const index = listIndex(idx, list.value.length);\n if (index === -1) {\n return;\n }\n list.value[index] = value;\n list._monitorUpToDate = false;\n}",s.listInsert="const listInsert = (list, idx, value) => {\n const index = listIndex(idx, list.value.length + 1);\n if (index === -1) {\n return;\n }\n list.value.splice(index, 0, value);\n list._monitorUpToDate = false;\n}",s.listDelete="const listDelete = (list, idx) => {\n if (idx === 'all') {\n list.value = [];\n return;\n }\n const index = listIndex(idx, list.value.length);\n if (index === -1) {\n return;\n }\n list.value.splice(index, 1);\n list._monitorUpToDate = false;\n}",s.listContains="const listContains = (list, item) => {\n // TODO: evaluate whether indexOf is worthwhile here\n if (list.value.indexOf(item) !== -1) {\n return true;\n }\n for (let i = 0; i < list.value.length; i++) {\n if (compareEqual(list.value[i], item)) {\n return true;\n }\n }\n return false;\n}",s.listIndexOf="const listIndexOf = (list, item) => {\n for (let i = 0; i < list.value.length; i++) {\n if (compareEqual(list.value[i], item)) {\n return i + 1;\n }\n }\n return 0;\n}",s.listContents="const listContents = list => {\n for (let i = 0; i < list.value.length; i++) {\n const listItem = list.value[i];\n // this is an intentional break from what scratch 3 does to address our automatic string -> number conversions\n // it fixes more than it breaks\n if ((listItem + '').length !== 1) {\n return list.value.join(' ');\n }\n }\n return list.value.join('');\n}",s.colorToList="const colorToList = color => globalState.Cast.toRgbColorList(color)",s.mod="const mod = (n, modulus) => {\n let result = n % modulus;\n if (result / modulus < 0) result += modulus;\n return result;\n}",s.tan="const tan = (angle) => {\n switch (angle % 360) {\n case -270: case 90: return Infinity;\n case -90: case 270: return -Infinity;\n }\n return Math.round(Math.tan((Math.PI * angle) / 180) * 1e10) / 1e10;\n}",s.yieldThenCall="const yieldThenCall = function* (callback, ...args) {\n yield;\n return callback(...args);\n}",s.yieldThenCallGenerator="const yieldThenCallGenerator = function* (callback, ...args) {\n yield;\n return yield* callback(...args);\n}";const o=e=>{r.thread=e,e.generator.next()},a=[];o.scopedEval=e=>{const t=(e=>{let t="let stuckCounter = 0;\nconst isStuck = () => {\n // The real time is not checked on every call for performance.\n stuckCounter++;\n if (stuckCounter === 100) {\n stuckCounter = 0;\n return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n }\n return false;\n};const isNotActuallyZero = val => {\n if (typeof val !== 'string') return false;\n for (let i = 0; i < val.length; i++) {\n const code = val.charCodeAt(i);\n if (code === 48 || code === 9) {\n return false;\n }\n }\n return true;\n};const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);const listIndexSlow = (index, length) => {\n if (index === 'last') {\n return length - 1;\n } else if (index === 'random' || index === 'any') {\n if (length > 0) {\n return (Math.random() * length) | 0;\n }\n return -1;\n }\n index = (+index || 0) | 0;\n if (index < 1 || index > length) {\n return -1;\n }\n return index - 1;\n};\nconst listIndex = (index, length) => {\n if (typeof index !== 'number') {\n return listIndexSlow(index, length);\n }\n index = index | 0;\n return index < 1 || index > length ? -1 : index - 1;\n};";for(const n of Object.keys(s))e.includes(n)&&(t+="".concat(s[n],";"));return t+="return ".concat(e),t})(e);try{return new Function("globalState",t)(r)}catch(e){throw r.log.error("was unable to compile script",t),e}},o.runtimeFunctions=s,o.saveGlobalState=()=>{a.push(r.thread)},o.restoreGlobalState=()=>{r.thread=a.pop()},e.exports=o},function(e,t,n){const r=n(80),i=n(76),s=n(1),o=n(25),{Map:a}=n(24),l=n(2),c=new r;let u=-1;const d=function(e,t,n,r,i){const s=r.id,c=r.opcode,u=r._isHat,d=r._isConditional,h=r._isLoop;if(n.pushReportedValue(e),u)if(n.stackClick)n.status=o.STATUS_RUNNING;else if(t.runtime.getIsEdgeActivatedHat(c)){const r=n.target.hasEdgeActivatedValue(s),i=n.target.updateEdgeActivatedValue(s,e);(r?!i&&e:e)?n.status=o.STATUS_RUNNING:t.retireThread(n)}else e?n.status=o.STATUS_RUNNING:t.retireThread(n);else if((d||h)&&void 0!==e)t.stepToBranch(n,l.toNumber(e),h);else{if(i&&void 0!==e&&n.atStackTop()&&(n.stackClick&&t.runtime.visualReport(s,e),n.updateMonitor)){const n=t.runtime.monitorBlocks.getBlock(s).targetId;if(n&&!t.runtime.getTargetById(n))return;t.runtime.requestUpdateMonitor(a({id:s,spriteName:n?t.runtime.getTargetById(n).getName():null,value:e}))}n.status=o.STATUS_RUNNING}},h=(e,t,n,r,i)=>{if(d(e,t,n,r,i),i&&(!r._isHat||n.stackClick)){let e,t;do{const r=n.popStack();if(null===r)return;if(t=n.target.blocks.getNextBlock(r),null!==t)break;e=n.peekStackFrame()}while(null!==e&&!e.isLoop);n.pushStack(t)}},p=(e,t,n,r,i)=>{n.status===o.STATUS_RUNNING&&(n.status=o.STATUS_PROMISE_WAIT),e.then((e=>{h(e,t,n,r,i)}),(e=>{s.warn("Primitive rejected promise: ",e),h("".concat(e),t,n,r,i)}))};class m{constructor(e,t){this.id=t.id,this.opcode=t.opcode,this.fields=t.fields,this.inputs=t.inputs,this.mutation=t.mutation,this._profiler=null,this._profilerFrame=null,this._isHat=!1,this._blockFunction=null,this._definedBlockFunction=!1,this._isShadowBlock=!1,this._shadowValue=null,this._fields=Object.assign({},this.fields),this._inputs=Object.assign({},this.inputs),this._argValues={mutation:this.mutation},this._parentKey=null,this._parentValues=null,this._ops=[];const{runtime:n}=c.sequencer,{opcode:r,fields:s,inputs:o}=this;this._isHat=n.getIsHat(r),this._blockFunction=n.getOpcodeFunction(r),this._definedBlockFunction=void 0!==this._blockFunction;const a=n._flowing[r];this._isConditional=!(!a||!a.conditional),this._isLoop=!(!a||!a.loop);const l=Object.keys(s);this._isShadowBlock=!this._definedBlockFunction&&1===l.length&&0===Object.keys(o).length,this._shadowValue=this._isShadowBlock&&s[l[0]].value;for(const e in s)this._argValues[e]="VARIABLE"===e||"LIST"===e||"BROADCAST_OPTION"===e?{id:s[e].id,name:s[e].value}:s[e].value;if(delete this._inputs.custom_block,"BROADCAST_INPUT"in this._inputs){this._argValues.BROADCAST_OPTION={id:null,name:null};const t=this._inputs.BROADCAST_INPUT;if(t.block===t.shadow){const n=e.getBlock(t.shadow).fields.BROADCAST_OPTION;this._argValues.BROADCAST_OPTION.id=n.id,this._argValues.BROADCAST_OPTION.name=n.value,delete this._inputs.BROADCAST_INPUT}}for(const t in this._inputs){const n=this._inputs[t];if(n.block){const r=i.getCached(e,n.block,m);if(r._isHat)continue;this._ops.push(...r._ops),r._parentKey=t,r._parentValues=this._argValues,r._isShadowBlock&&(this._argValues[t]=r._shadowValue)}}this._definedBlockFunction&&this._ops.push(this)}}e.exports=function(e,t){const n=e.runtime;c.sequencer=e,c.thread=t;const r=t.peekStack(),s=t.peekStackFrame();let a=t.blockContainer,h=i.getCached(a,r,m);if(null===h&&(a=n.flyoutBlocks,h=i.getCached(a,r,m),null===h))return void e.retireThread(t);const f=h._ops,g=f.length;let y=0;if(null!==s.reported){const e=s.reported;for(;ye.id===t));if(r){const e=r._parentKey,t=r._parentValues;"BROADCAST_INPUT"===e?(t.BROADCAST_OPTION.id=null,t.BROADCAST_OPTION.name=l.toString(n)):t[e]=n}}if(e.length>0){const t=e.reverse().find((e=>f.find((t=>t.id===e.opCached))));y=t?f.findIndex((e=>e.id===t.opCached))+1:0}if(null!==t.justReported&&f[y]&&f[y].id===s.reporting){const e=f[y],n=t.justReported;t.justReported=null;const r=e._parentKey,i=e._parentValues;"BROADCAST_INPUT"===r?(i.BROADCAST_OPTION.id=null,i.BROADCAST_OPTION.name=l.toString(n)):i[r]=n,y+=1}s.reporting=null,s.reported=null,s.waitingReporter=!1}const b=y;for(;y{const t=e._parentKey,n=e._parentValues;return"BROADCAST_INPUT"===t?{opCached:e.id,inputValue:n[t].BROADCAST_OPTION.name}:{opCached:e.id,inputValue:n[t]}}));break}if(t.status===o.STATUS_RUNNING)if(n)d(h,e,t,r,n);else{const e=r._parentKey,t=r._parentValues;"BROADCAST_INPUT"===e?(t.BROADCAST_OPTION.id=null,t.BROADCAST_OPTION.name=l.toString(h)):t[e]=h}else if(t.status===o.STATUS_DONE)break}var v;if(null!==n.profiler){h._profiler!==n.profiler&&function(e,t){t._profiler=e,-1===u&&(u=e.idByName("blockFunction"));const n=t._ops;for(let t=0;te.play(this,t)};return Object.defineProperty(this,"audioPlayer",{configurable:!1,enumerable:!0,writable:!1,value:t}),t}initAudio(){}static get ROTATION_STYLE_ALL_AROUND(){return"all around"}static get ROTATION_STYLE_LEFT_RIGHT(){return"left-right"}static get ROTATION_STYLE_NONE(){return"don't rotate"}static get VIDEO_STATE(){return{OFF:"off",ON:"on",ON_FLIPPED:"on-flipped"}}emitVisualChange(){this.onTargetVisualChange&&this.onTargetVisualChange(this)}setXY(e,t,n){if(this.isStage)return;if(this.dragging&&!n)return;const r=this.x,i=this.y;if(this.renderer){const n=this.runtime.runtimeOptions.fencing?this.renderer.getFencedPositionOfDrawable(this.drawableID,[e,t]):[e,t];this.x=n[0],this.y=n[1],this.renderer.updateDrawablePosition(this.drawableID,n),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.x=e,this.y=t;this.onTargetMoved&&this.onTargetMoved(this,r,i,n),this.runtime.requestTargetsUpdate(this)}_getRenderedDirectionAndScale(){let e=this.direction,t=[this.size,this.size];if(this.rotationStyle===c.ROTATION_STYLE_NONE)e=90;else if(this.rotationStyle===c.ROTATION_STYLE_LEFT_RIGHT){e=90;t=[(this.direction<0?-1:1)*this.size,this.size]}return{direction:e,scale:t}}setDirection(e){if(!this.isStage&&isFinite(e)){if(this.direction=r.wrapClamp(e,-179,180),this.renderer){const{direction:e,scale:t}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,e,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}}setDraggable(e){this.isStage||(this.draggable=!!e,this.runtime.requestTargetsUpdate(this))}setVisible(e){this.isStage||(this.visible=!!e,this.renderer&&(this.renderer.updateDrawableVisible(this.drawableID,this.visible),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())),this.runtime.requestTargetsUpdate(this))}setSize(e){if(!this.isStage){if(this.renderer){const t=this.renderer.getCurrentSkinSize(this.drawableID),n=t[0],i=t[1],s=this.runtime.runtimeOptions.fencing,o=s?Math.min(1,Math.max(5/n,5/i)):0,a=s?Math.min(1.5*this.runtime.stageWidth/n,1.5*this.runtime.stageHeight/i):1/0;this.size=100*r.clamp(e/100,o,a);const{direction:l,scale:c}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,l,c),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.size=e;this.runtime.requestTargetsUpdate(this)}}setEffect(e,t){Object.prototype.hasOwnProperty.call(this.effects,e)&&(this.effects[e]=t,this.renderer&&(this.renderer.updateDrawableEffect(this.drawableID,e,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())))}clearEffects(){for(const e in this.effects)Object.prototype.hasOwnProperty.call(this.effects,e)&&(this.effects[e]=0);if(this.renderer){for(const e in this.effects)Object.prototype.hasOwnProperty.call(this.effects,e)&&this.renderer.updateDrawableEffect(this.drawableID,e,0);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}}setCostume(e){if((e=Math.round(e))!==1/0&&e!==-1/0&&e||(e=0),this.currentCostume=r.wrapClamp(e,0,this.sprite.costumes.length-1),this.renderer){const e=this.sprite.costumes[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,e.skinId),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}addCostume(e,t){"number"!=typeof t||isNaN(t)?this.sprite.addCostumeAt(e,this.sprite.costumes.length):this.sprite.addCostumeAt(e,t)}renameCostume(e,t){const n=this.sprite.costumes.filter(((t,n)=>e!==n)).map((e=>e.name)),r=this.getCostumes()[e].name,s=i.unusedName(t,n);if(this.getCostumes()[e].name=s,this.isStage){const e=this.runtime.targets;for(let t=0;t=t)return null;const n=this.sprite.deleteCostumeAt(e);return e===this.currentCostume&&e===t-1?this.setCostume(e-1):ee.name));e.name=i.unusedName(e.name,n),"number"!=typeof t||isNaN(t)?this.sprite.sounds.push(e):this.sprite.sounds.splice(t,0,e)}renameSound(e,t){const n=this.sprite.sounds.filter(((t,n)=>e!==n)).map((e=>e.name)),r=this.sprite.sounds[e].name,s=i.unusedName(t,n);this.sprite.sounds[e].name=s,this.blocks.updateAssetName(r,s,"sound")}deleteSound(e){if(e<0||e>=this.sprite.sounds.length)return null;const t=this.sprite.sounds.splice(e,1)[0];return this.runtime.requestTargetsUpdate(this),t}setRotationStyle(e){if(e===c.ROTATION_STYLE_NONE?this.rotationStyle=c.ROTATION_STYLE_NONE:e===c.ROTATION_STYLE_ALL_AROUND?this.rotationStyle=c.ROTATION_STYLE_ALL_AROUND:e===c.ROTATION_STYLE_LEFT_RIGHT&&(this.rotationStyle=c.ROTATION_STYLE_LEFT_RIGHT),this.renderer){const{direction:e,scale:t}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,e,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getCostumeIndexByName(e){const t=this.getCostumes();for(let n=0;ne/2||n.top>t/2||n.bottom<-t/2)return!0}return!1}isTouchingSprite(e){e=s.toString(e);const t=this.runtime.getSpriteTargetByName(e);if(!t||!this.renderer)return!1;const n=t.sprite.clones.filter((e=>!e.dragging)).map((e=>e.drawableID));return this.renderer.isTouchingDrawables(this.drawableID,n)}isTouchingColor(e){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,e)}colorIsTouchingColor(e,t){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,e,t)}getLayerOrder(){return this.renderer?this.renderer.getDrawableOrder(this.drawableID):null}goToFront(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,1/0,l.SPRITE_LAYER),this.runtime.setExecutablePosition(this,1/0)}goToBack(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-1/0,l.SPRITE_LAYER,!1),this.runtime.setExecutablePosition(this,-1/0)}goForwardLayers(e){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,e,l.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,e)}goBackwardLayers(e){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-e,l.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,-e)}goBehindOther(e){if(this.renderer){const t=this.renderer.setDrawableOrder(e.drawableID,0,l.SPRITE_LAYER,!0);this.renderer.setDrawableOrder(this.drawableID,t,l.SPRITE_LAYER)}const t=this.runtime.executableTargets.indexOf(e);this.runtime.setExecutablePosition(this,t)}keepInFence(e,t,n){let r=n;r||(r={left:-this.runtime.stageWidth/2,right:this.runtime.stageWidth/2,top:this.runtime.stageHeight/2,bottom:-this.runtime.stageHeight/2});const i=this.getBounds();if(!i)return;i.left+=e-this.x,i.right+=e-this.x,i.top+=t-this.y,i.bottom+=t-this.y;let s=0,o=0;return i.leftr.right&&(s+=r.right-i.right),i.top>r.top&&(o+=r.top-i.top),i.bottom{const t=e.createClone();return t.x=400*(Math.random()-.5)/2,t.y=300*(Math.random()-.5)/2,t.direction=this.direction,t.draggable=this.draggable,t.visible=this.visible,t.size=this.size,t.currentCostume=this.currentCostume,t.rotationStyle=this.rotationStyle,t.effects=JSON.parse(JSON.stringify(this.effects)),t.variables=this.duplicateVariables(t.blocks),t.updateAllDrawableProperties(),t}))}onGreenFlag(){this.clearEffects()}onStopAll(){this.clearEffects()}postSpriteInfo(e){const t=Object.prototype.hasOwnProperty.call(e,"force")?e.force:null,n=Object.prototype.hasOwnProperty.call(e,"x"),r=Object.prototype.hasOwnProperty.call(e,"y");(n||r)&&this.setXY(n?e.x:this.x,r?e.y:this.y,t),Object.prototype.hasOwnProperty.call(e,"direction")&&this.setDirection(e.direction),Object.prototype.hasOwnProperty.call(e,"draggable")&&this.setDraggable(e.draggable),Object.prototype.hasOwnProperty.call(e,"rotationStyle")&&this.setRotationStyle(e.rotationStyle),Object.prototype.hasOwnProperty.call(e,"visible")&&this.setVisible(e.visible),Object.prototype.hasOwnProperty.call(e,"size")&&this.setSize(e.size)}startDrag(){this.dragging=!0}stopDrag(){this.dragging=!1}toJSON(){const e=this.getCostumes();return{id:this.id,name:this.getName(),isStage:this.isStage,x:this.x,y:this.y,size:this.size,direction:this.direction,draggable:this.draggable,currentCostume:this.currentCostume,costume:e[this.currentCostume],costumeCount:e.length,visible:this.visible,rotationStyle:this.rotationStyle,comments:this.comments,blocks:this.blocks._blocks,variables:this.variables,costumes:e,sounds:this.getSounds(),textToSpeechLanguage:this.textToSpeechLanguage,tempo:this.tempo,volume:this.volume,videoTransparency:this.videoTransparency,videoState:this.videoState}}dispose(){this.isOriginal||this.runtime.changeCloneCounter(-1),this.runtime.stopForTarget(this),this.runtime.removeExecutable(this),this.sprite.removeClone(this),this.renderer&&null!==this.drawableID&&(this.renderer.destroyDrawable(this.drawableID,this.isStage?l.BACKGROUND_LAYER:l.SPRITE_LAYER),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw()))}}e.exports=c},function(e,t,n){const r=n(8),i=n(33);class s{constructor(e,t,n,i,o,a,l){this.id=e||r(),this.text=t,this.x=n,this.y=i,this.width=Math.max(Number(o),s.MIN_WIDTH),this.height=Math.max(Number(a),s.MIN_HEIGHT),this.minimized=l||!1,this.blockId=null}toXML(){return'').concat(i(this.text),"")}static get MIN_WIDTH(){return 20}static get MIN_HEIGHT(){return 20}static get DEFAULT_WIDTH(){return 100}static get DEFAULT_HEIGHT(){return 100}}e.exports=s},function(e,t,n){const r=n(51),i=n(16),{loadSoundFromAsset:s}=n(34),{loadCostumeFromAsset:o}=n(35),a=n(102),l=n(7),c=n(13);class u{constructor(e,t){this.runtime=t,e||(e=new i(t)),this.blocks=e,this.name="",this.costumes_=[],this.sounds=[],this.clones=[],this.soundBank=null,this.runtime&&this.runtime.audioEngine&&(this.soundBank=this.runtime.audioEngine.createBank())}set costumes(e){this.costumes_=[];for(const t of e)this.addCostumeAt(t,this.costumes_.length)}get costumes(){return this.costumes_}addCostumeAt(e,t){e.name||(e.name="");const n=this.costumes_.map((e=>e.name));e.name=l.unusedName(e.name,n),this.costumes_.splice(t,0,e)}deleteCostumeAt(e){return this.costumes.splice(e,1)[0]}createClone(e){const t=new r(this,this.runtime);if(t.isOriginal=0===this.clones.length,this.clones.push(t),t.initAudio(),t.isOriginal){const n="string"==typeof e?e:c.SPRITE_LAYER;t.initDrawable(n),this.runtime.fireTargetWasCreated(t)}else this.runtime.fireTargetWasCreated(t,this.clones[0]);return t}removeClone(e){this.runtime.fireTargetWasRemoved(e);const t=this.clones.indexOf(e);t>=0&&this.clones.splice(t,1)}duplicate(){const e=new u(null,this.runtime),t=this.blocks._blocks,n=Object.keys(t).map((e=>t[e])),r=JSON.parse(JSON.stringify(n));a(r),r.forEach((t=>{e.blocks.createBlock(t)}));const i=this.runtime.targets.map((e=>e.sprite.name));e.name=l.unusedName(this.name,i);const c=[];return e.costumes=this.costumes_.map((e=>{const t=Object.assign({},e);return c.push(o(t,this.runtime)),t})),e.sounds=this.sounds.map((t=>{const n=Object.assign({},t),r=t.asset;return c.push(s(n,r,this.runtime,e.soundBank)),n})),Promise.all(c).then((()=>e))}dispose(){this.soundBank&&this.soundBank.dispose()}}e.exports=u},function(e,t,n){e.exports=function(){"use strict";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},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,i,s){return r=n()?Reflect.construct:function(e,n,r){var i=[null];i.push.apply(i,n);var s=new(Function.bind.apply(e,i));return r&&t(s,r.prototype),s},r.apply(null,arguments)}function i(e){return s(e)||o(e)||a(e)||c()}function s(e){if(Array.isArray(e))return l(e)}function o(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e,t){if(e){if("string"==typeof e)return l(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)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),i=1;i/gm),X=g(/\${[\w\W]*}/gm),Z=g(/^data-[\-\w.\u00B7-\uFFFF]/),J=g(/^aria-[\-\w]+$/),$=g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ee=g(/^(?:\w+script|data):/i),te=g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ne=g(/^html$/i),re=g(/^[a-z][.\w]*(-[.\w]+)+$/i),ie=function(){return"undefined"==typeof window?null:window},se=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function oe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie(),n=function(e){return oe(e)};if(n.version="2.5.6",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,s=t.document,o=t.DocumentFragment,a=t.HTMLTemplateElement,l=t.Node,c=t.Element,u=t.NodeFilter,d=t.NamedNodeMap,h=void 0===d?t.NamedNodeMap||t.MozNamedAttrMap:d,p=t.HTMLFormElement,m=t.DOMParser,g=t.trustedTypes,y=c.prototype,b=B(y,"cloneNode"),v=B(y,"nextSibling"),S=B(y,"childNodes"),R=B(y,"parentNode");if("function"==typeof a){var D=s.createElement("template");D.content&&D.content.ownerDocument&&(s=D.content.ownerDocument)}var ae=se(g,r),le=ae?ae.createHTML(""):"",ce=s,ue=ce.implementation,de=ce.createNodeIterator,he=ce.createDocumentFragment,pe=ce.getElementsByTagName,me=r.importNode,fe={};try{fe=L(s).documentMode?s.documentMode:{}}catch(e){}var ge={};n.isSupported="function"==typeof R&&ue&&void 0!==ue.createHTMLDocument&&9!==fe;var ye,be,ve=K,Se=Q,we=X,ke=Z,Te=J,xe=ee,Ee=te,Ae=re,Ce=$,Ie=null,Oe=P({},[].concat(i(z),i(U),i(j),i(W),i(G))),Me=null,Ne=P({},[].concat(i(q),i(Y),i(H),i(_))),Re=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),De=null,Pe=null,Le=!0,Be=!0,ze=!1,Ue=!0,je=!1,Fe=!0,We=!1,Ve=!1,Ge=!1,qe=!1,Ye=!1,He=!1,_e=!0,Ke=!1,Qe="user-content-",Xe=!0,Ze=!1,Je={},$e=null,et=P({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),tt=null,nt=P({},["audio","video","img","source","image","track"]),rt=null,it=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),st="http://www.w3.org/1998/Math/MathML",ot="http://www.w3.org/2000/svg",at="http://www.w3.org/1999/xhtml",lt=at,ct=!1,ut=null,dt=P({},[st,ot,at],E),ht=["application/xhtml+xml","text/html"],pt="text/html",mt=null,ft=s.createElement("form"),gt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(t){mt&&mt===t||(t&&"object"===e(t)||(t={}),t=L(t),ye=ye=-1===ht.indexOf(t.PARSER_MEDIA_TYPE)?pt:t.PARSER_MEDIA_TYPE,be="application/xhtml+xml"===ye?E:x,Ie="ALLOWED_TAGS"in t?P({},t.ALLOWED_TAGS,be):Oe,Me="ALLOWED_ATTR"in t?P({},t.ALLOWED_ATTR,be):Ne,ut="ALLOWED_NAMESPACES"in t?P({},t.ALLOWED_NAMESPACES,E):dt,rt="ADD_URI_SAFE_ATTR"in t?P(L(it),t.ADD_URI_SAFE_ATTR,be):it,tt="ADD_DATA_URI_TAGS"in t?P(L(nt),t.ADD_DATA_URI_TAGS,be):nt,$e="FORBID_CONTENTS"in t?P({},t.FORBID_CONTENTS,be):et,De="FORBID_TAGS"in t?P({},t.FORBID_TAGS,be):{},Pe="FORBID_ATTR"in t?P({},t.FORBID_ATTR,be):{},Je="USE_PROFILES"in t&&t.USE_PROFILES,Le=!1!==t.ALLOW_ARIA_ATTR,Be=!1!==t.ALLOW_DATA_ATTR,ze=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ue=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,je=t.SAFE_FOR_TEMPLATES||!1,Fe=!1!==t.SAFE_FOR_XML,We=t.WHOLE_DOCUMENT||!1,qe=t.RETURN_DOM||!1,Ye=t.RETURN_DOM_FRAGMENT||!1,He=t.RETURN_TRUSTED_TYPE||!1,Ge=t.FORCE_BODY||!1,_e=!1!==t.SANITIZE_DOM,Ke=t.SANITIZE_NAMED_PROPS||!1,Xe=!1!==t.KEEP_CONTENT,Ze=t.IN_PLACE||!1,Ce=t.ALLOWED_URI_REGEXP||Ce,lt=t.NAMESPACE||at,Re=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&>(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Re.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&>(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Re.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Re.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),je&&(Be=!1),Ye&&(qe=!0),Je&&(Ie=P({},i(G)),Me=[],!0===Je.html&&(P(Ie,z),P(Me,q)),!0===Je.svg&&(P(Ie,U),P(Me,Y),P(Me,_)),!0===Je.svgFilters&&(P(Ie,j),P(Me,Y),P(Me,_)),!0===Je.mathMl&&(P(Ie,W),P(Me,H),P(Me,_))),t.ADD_TAGS&&(Ie===Oe&&(Ie=L(Ie)),P(Ie,t.ADD_TAGS,be)),t.ADD_ATTR&&(Me===Ne&&(Me=L(Me)),P(Me,t.ADD_ATTR,be)),t.ADD_URI_SAFE_ATTR&&P(rt,t.ADD_URI_SAFE_ATTR,be),t.FORBID_CONTENTS&&($e===et&&($e=L($e)),P($e,t.FORBID_CONTENTS,be)),Xe&&(Ie["#text"]=!0),We&&P(Ie,["html","head","body"]),Ie.table&&(P(Ie,["tbody"]),delete De.tbody),f&&f(t),mt=t)},bt=P({},["mi","mo","mn","ms","mtext"]),vt=P({},["foreignobject","annotation-xml"]),St=P({},["title","style","font","a","script"]),wt=P({},U);P(wt,j),P(wt,F);var kt=P({},W);P(kt,V);var Tt=function(e){var t=R(e);t&&t.tagName||(t={namespaceURI:lt,tagName:"template"});var n=x(e.tagName),r=x(t.tagName);return!!ut[e.namespaceURI]&&(e.namespaceURI===ot?t.namespaceURI===at?"svg"===n:t.namespaceURI===st?"svg"===n&&("annotation-xml"===r||bt[r]):Boolean(wt[n]):e.namespaceURI===st?t.namespaceURI===at?"math"===n:t.namespaceURI===ot?"math"===n&&vt[r]:Boolean(kt[n]):e.namespaceURI===at?!(t.namespaceURI===ot&&!vt[r])&&!(t.namespaceURI===st&&!bt[r])&&!kt[n]&&(St[n]||!wt[n]):!("application/xhtml+xml"!==ye||!ut[e.namespaceURI]))},xt=function(e){T(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=le}catch(t){e.remove()}}},Et=function(e,t){try{T(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){T(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Me[e])if(qe||Ye)try{xt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},At=function(e){var t,n;if(Ge)e=""+e;else{var r=A(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ye&<===at&&(e=''+e+"");var i=ae?ae.createHTML(e):e;if(lt===at)try{t=(new m).parseFromString(i,ye)}catch(e){}if(!t||!t.documentElement){t=ue.createDocument(lt,"template",null);try{t.documentElement.innerHTML=ct?le:i}catch(e){}}var o=t.body||t.documentElement;return e&&n&&o.insertBefore(s.createTextNode(n),o.childNodes[0]||null),lt===at?pe.call(t,We?"html":"body")[0]:We?t.documentElement:o},Ct=function(e){return de.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null,!1)},It=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ot=function(t){return"object"===e(l)?t instanceof l:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Mt=function(e,t,r){ge[e]&&w(ge[e],(function(e){e.call(n,t,r,mt)}))},Nt=function(e){var t;if(Mt("beforeSanitizeElements",e,null),It(e))return xt(e),!0;if(M(/[\u0080-\uFFFF]/,e.nodeName))return xt(e),!0;var r=be(e.nodeName);if(Mt("uponSanitizeElement",e,{tagName:r,allowedTags:Ie}),e.hasChildNodes()&&!Ot(e.firstElementChild)&&(!Ot(e.content)||!Ot(e.content.firstElementChild))&&M(/<[/\w]/g,e.innerHTML)&&M(/<[/\w]/g,e.textContent))return xt(e),!0;if("select"===r&&M(/