scratch-storage 5.0.11 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci-cd.yml +10 -3
- package/dist/node/chunks/fetch-worker.7afe4ade866d6f6a3cb3.js +383 -0
- package/dist/node/chunks/fetch-worker.7afe4ade866d6f6a3cb3.js.map +1 -0
- package/dist/node/scratch-storage.js +316 -821
- package/dist/node/scratch-storage.js.map +1 -1
- package/dist/types/HostQueues.d.ts +20 -0
- package/dist/types/ScratchStorage.d.ts +2 -15
- package/dist/types/scratchFetch.d.ts +37 -15
- package/dist/web/chunks/fetch-worker.9fbe108071a9c5d6e70b.js +2 -0
- package/dist/web/chunks/{fetch-worker.4277f33a97fe995aa7dd.js.map → fetch-worker.9fbe108071a9c5d6e70b.js.map} +1 -1
- package/dist/web/chunks/fetch-worker.efebf27d479ab0f0d98c.js +394 -0
- package/dist/web/chunks/fetch-worker.efebf27d479ab0f0d98c.js.map +1 -0
- package/dist/web/scratch-storage.js +316 -821
- package/dist/web/scratch-storage.js.map +1 -1
- package/dist/web/scratch-storage.min.js +1 -1
- package/package.json +7 -5
- package/src/FetchTool.ts +3 -2
- package/src/FetchWorkerTool.worker.ts +94 -0
- package/src/HostQueues.ts +33 -0
- package/src/ScratchStorage.ts +1 -1
- package/src/{scratchFetch.js → scratchFetch.ts} +53 -34
- package/src/types.d.ts +4 -3
- package/test/build/api.test.js +60 -0
- package/test/build/scratchFetch.test.js +40 -0
- package/test/fixtures/known-assets.js +30 -2
- package/test/{__mocks__/cross-fetch.js → fixtures/mockFetch.js} +18 -17
- package/test/integration/download-known-assets.test.js +6 -3
- package/test/unit/fetch-tool.test.js +8 -7
- package/test/unit/metadata.test.js +9 -8
- package/tsconfig.json +0 -1
- package/tsconfig.test.json +1 -0
- package/dist/node/chunks/fetch-worker.56da39b0f4bad6747138.js +0 -809
- package/dist/node/chunks/fetch-worker.56da39b0f4bad6747138.js.map +0 -1
- package/dist/web/chunks/fetch-worker.4277f33a97fe995aa7dd.js +0 -2
- package/dist/web/chunks/fetch-worker.c813c32be403f91001ba.js +0 -820
- package/dist/web/chunks/fetch-worker.c813c32be403f91001ba.js.map +0 -1
- package/src/FetchWorkerTool.worker.js +0 -67
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see scratch-storage.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ScratchStorage=e():t.ScratchStorage=e()}(self,()=>(()=>{var __webpack_modules__={9(t,e,r){t.exports=r(14)("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAAAAADmVT4XAAADZElEQVR42u3a70vbQBgH8O/7vOibvsmbFUEEWUGGUhQ25nDuhSKIUFDxlYi0SAd94atRmFiHCH2x4W8iiNtwowXRgd1QipJYY3N/1F4kTQ6XLKS9yyHcvWyO8MnT5y53Tw5EcIMESIAESIAESIAESIAEPFVAq/6l8G4oAQCp4aniwbUVJ6BVzafwqKXy1VZMgNb+CHzbyK4ZB+Bi0nnk0VyhsDiSoAmvvnMHmGUVAF6UG+0ffsxRhsRHky/AyCsAUpumX0wAAIs6T4CxDADDtcdZsal6gjmdH8AsAEC6+s8Fa48SFExeAKusAEju+V367AmUCi9ANQ0AU3pwcOw2cMEH0FwAAKz5X228pRLR5AI4TgIAtIDL24oLUE94AB6W7LsH/cONN14Ilh44AOqD9s2LQR1KHiB9zgGgOSGeuA3ocPrME1Q4ANaceyePAzrcjHmAZYs9IBeW4/fzHiAwTCwAgTle9ACZK44ALDT9e6x7gL4aT0BQCHb4AqgA5/1TTOMLoJ7vZSMM0H/GHnCeDnu+CrU8vGYPcN5FADBYD0vCaYPDy+i0p337GSMsS1Z4vA3t9QgAZTt0IuIxFRPSKicAQHlvhk3FXF5GhBByMa8qo/sBO6BarwuYbYrYnFKDYEvE7phKgcxvEQBqnvhgiQCUOgoAO4C3JOS3L/hv23UXxVldBECfcueAqpAa0WGy/QeULREAY6aTXRFDgBuA13+ElOncAERMAGaA9hBQD4gQQHsIRE1AZoD2xrgQS5nOZyHgFKmWDSIG4GRAVidiAE4GRB6AzAB2AKIPQFaA5myHA5AV4ESNugZhC7BLR50lIBPAebrzBGQCKAFQNSIMcDvRTQIwAHxNApM3RBygGK0uyhxwOwGsPAgEnPWj5ycRCNiJtBHlAChGKQVwANzPY+CXSMDNWISiLA9AfRA5IhJQ68UnoQAt+AtOPIBKhJosF8B6UM0yLkAxQk2WCyDX9SiUh1gkQAIkoCuAvjGuquMbuijAtwG7MPL8yBICOHSPk3W8Ne8KcEUdmBi6FADYos+QleIH0N/ogOxd7AD6uAS6WRU8WcBdlgZMG/EnYUlwEpLLoQ4PjzGbiA5UsRMRsbQ+5ziDJmYqJuR6NaMomdXuFuZyPSABEiABEiABEiABEiAc8Bd6VyvCEKGqcQAAAABJRU5ErkJggg==")},14(t,e,r){"use strict";var n=r(287).hp;t.exports=function(t){for(var e="undefined"!=typeof window&&"function"==typeof window.atob?window.atob(t):n.from(t,"base64").toString("binary"),r=new Uint8Array(e.length),o=0;o<e.length;++o)r[o]=e.charCodeAt(o);return r.buffer}},15(t,e,r){var n=r(408),o=r(84),i=new n,s=Array.prototype.slice;e=t.exports=function(t){var r=function(){return i.write(t,void 0,s.call(arguments)),r};return r.debug=function(){return i.write(t,"debug",s.call(arguments)),r},r.info=function(){return i.write(t,"info",s.call(arguments)),r},r.warn=function(){return i.write(t,"warn",s.call(arguments)),r},r.error=function(){return i.write(t,"error",s.call(arguments)),r},r.log=r.debug,r.suggest=e.suggest,r.format=i.format,r},e.defaultBackend=e.defaultFormatter=null,e.pipe=function(t){return i.pipe(t)},e.end=e.unpipe=e.disable=function(t){return i.unpipe(t)},e.Transform=n,e.Filter=o,e.suggest=new o,e.enable=function(){return e.defaultFormatter?i.pipe(e.suggest).pipe(e.defaultFormatter).pipe(e.defaultBackend):i.pipe(e.suggest).pipe(e.defaultBackend)}},84(t,e,r){var n=r(408),o={debug:1,info:2,warn:3,error:4};function i(){this.enabled=!0,this.defaultResult=!0,this.clear()}function s(t,e){return t.n.test?t.n.test(e):t.n==e}n.mixin(i),i.prototype.allow=function(t,e){return this._white.push({n:t,l:o[e]}),this},i.prototype.deny=function(t,e){return this._black.push({n:t,l:o[e]}),this},i.prototype.clear=function(){return this._white=[],this._black=[],this},i.prototype.test=function(t,e){var r,n=Math.max(this._white.length,this._black.length);for(r=0;r<n;r++){if(this._white[r]&&s(this._white[r],t)&&o[e]>=this._white[r].l)return!0;if(this._black[r]&&s(this._black[r],t)&&o[e]<=this._black[r].l)return!1}return this.defaultResult},i.prototype.write=function(t,e,r){if(!this.enabled||this.test(t,e))return this.emit("item",t,e,r)},t.exports=i},113(t,e,r){var n=r(408),o=!1,i=new n;i.write=function(t,e,r){if("undefined"!=typeof window&&"undefined"!=typeof JSON&&JSON.stringify&&JSON.parse)try{o||(o=window.localStorage.minilog?JSON.parse(window.localStorage.minilog):[]),o.push([(new Date).toString(),t,e,r]),window.localStorage.minilog=JSON.stringify(o)}catch(t){}},t.exports=i},173(t){function e(){this._events={}}e.prototype={on:function(t,e){this._events||(this._events={});var r=this._events;return(r[t]||(r[t]=[])).push(e),this},removeListener:function(t,e){var r,n=this._events[t]||[];for(r=n.length-1;r>=0&&n[r];r--)n[r]!==e&&n[r].cb!==e||n.splice(r,1)},removeAllListeners:function(t){t?this._events[t]&&(this._events[t]=[]):this._events={}},listeners:function(t){return this._events&&this._events[t]||[]},emit:function(t){this._events||(this._events={});var e,r=Array.prototype.slice.call(arguments,1),n=this._events[t]||[];for(e=n.length-1;e>=0&&n[e];e--)n[e].apply(this,r);return this},when:function(t,e){return this.once(t,e,!0)},once:function(t,e,r){if(!e)return this;function n(){r||this.removeListener(t,n),e.apply(this,arguments)&&r&&this.removeListener(t,n)}return n.cb=e,this.on(t,n),this}},e.mixin=function(t){var r,n=e.prototype;for(r in n)n.hasOwnProperty(r)&&(t.prototype[r]=n[r])},t.exports=e},193(t){var e={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};t.exports=function(t,r){return r?"color: #fff; background: "+e[t]+";":"color: "+e[t]+";"}},251(t,e){e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,f=u>>1,c=-7,h=r?o-1:0,l=r?-1:1,p=t[e+h];for(h+=l,i=p&(1<<-c)-1,p>>=-c,c+=a;c>0;i=256*i+t[e+h],h+=l,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,f=8*i-o-1,c=(1<<f)-1,h=c>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*u-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,f+=o;f>0;t[r+p]=255&s,p+=d,s/=256,f-=8);t[r+p-d]|=128*y}},260(t,e,r){var n=r(408),o=/\n+$/,i=new n;i.write=function(t,e,r){var n=r.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[t,e].concat(r));if(JSON&&JSON.stringify){r[n]&&"string"==typeof r[n]&&(r[n]=r[n].replace(o,""));try{for(n=0;n<r.length;n++)r[n]=JSON.stringify(r[n])}catch(t){}console.log(r.join(" "))}}},i.formatters=["color","minilog"],i.color=r(638),i.minilog=r(658),t.exports=i},287(t,e,r){"use strict";const n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=a(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const o=function(t){if(u.isBuffer(t)){const e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||z(t.length)?a(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return c(t),a(t<0?0:0|d(t))}function l(t){const e=t.length<0?0:0|d(t.length),r=a(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(o)return n?-1:J(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,o){let i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(f(t,i)===f(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===u)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){let r=!0;for(let n=0;n<u;n++)if(f(t,i+n)!==f(e,n)){r=!1;break}if(r)return i}return-1}function m(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(z(n))return s;t[r+s]=n}return s}function A(t,e,r,n){return V(J(e,t.length-r),t,r,n)}function v(t,e,r,n){return V(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return V(Q(e),t,r,n)}function S(t,e,r,n){return V(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(i=u));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))o+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)b(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)b(this,e,e+3),b(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)b(this,e,e+7),b(this,e+1,e+6),b(this,e+2,e+5),b(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?O(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(i,s),f=this.slice(n,o),c=t.slice(e,r);for(let t=0;t<a;++t)if(f[t]!==c[t]){i=f[t],s=c[t];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":case"latin1":case"binary":return v(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function I(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function x(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=$[t[n]];return o}function U(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function H(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,o){q(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function P(t,e,r,n,o){q(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function k(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||H(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||H(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||H(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||H(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||H(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||H(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||H(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))}),u.prototype.readBigUInt64BE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)}),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||H(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||H(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return t>>>=0,e||H(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||H(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||H(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||H(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||H(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),u.prototype.readBigInt64BE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)}),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||H(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||H(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||H(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||H(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){j(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){j(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Z(function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Z(function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);j(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i|0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);j(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Z(function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Z(function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=u.isBuffer(t)?t:u.from(t,n),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%s]}return this};const F={};function N(t,e,r){F[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function L(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function q(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new F.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){G(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||W(e,t.length-(r+1))}(n,o,i)}function G(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,r){if(Math.floor(t)!==t)throw G(t,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}N("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),N("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),N("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=L(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=L(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Q(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}const $=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Z(t){return"undefined"==typeof BigInt?K:t}function K(){throw new Error("BigInt not supported")}},386(module,exports,__webpack_require__){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=__webpack_require__.g:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&module.exports,AMD=__webpack_require__.amdO,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(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e<OUTPUT_TYPES.length;++e){var r=OUTPUT_TYPES[e];t[r]=createOutputMethod(r)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw ERROR;if(null===t)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw ERROR;e=!0}for(var n,o,i=0,s=t.length,a=this.blocks,u=this.buffer8;i<s;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(ARRAY_BUFFER)for(o=this.start;i<s&&o<64;++i)u[o++]=t[i];else for(o=this.start;i<s&&o<64;++i)a[o>>2]|=t[i]<<SHIFT[3&o++];else if(ARRAY_BUFFER)for(o=this.start;i<s&&o<64;++i)(n=t.charCodeAt(i))<128?u[o++]=n:n<2048?(u[o++]=192|n>>6,u[o++]=128|63&n):n<55296||n>=57344?(u[o++]=224|n>>12,u[o++]=128|n>>6&63,u[o++]=128|63&n):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++i)),u[o++]=240|n>>18,u[o++]=128|n>>12&63,u[o++]=128|n>>6&63,u[o++]=128|63&n);else for(o=this.start;i<s&&o<64;++i)(n=t.charCodeAt(i))<128?a[o>>2]|=n<<SHIFT[3&o++]:n<2048?(a[o>>2]|=(192|n>>6)<<SHIFT[3&o++],a[o>>2]|=(128|63&n)<<SHIFT[3&o++]):n<55296||n>=57344?(a[o>>2]|=(224|n>>12)<<SHIFT[3&o++],a[o>>2]|=(128|n>>6&63)<<SHIFT[3&o++],a[o>>2]|=(128|63&n)<<SHIFT[3&o++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++i)),a[o>>2]|=(240|n>>18)<<SHIFT[3&o++],a[o>>2]|=(128|n>>12&63)<<SHIFT[3&o++],a[o>>2]|=(128|n>>6&63)<<SHIFT[3&o++],a[o>>2]|=(128|63&n)<<SHIFT[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}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 t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,r,n,o,i,s=this.blocks;this.first?e=((e=((t=((t=s[0]-680876937)<<7|t>>>25)-271733879|0)^(r=((r=(-271733879^(n=((n=(-1732584194^2004318071&t)+s[1]-117830708)<<12|n>>>20)+t|0)&(-271733879^t))+s[2]-1126478375)<<17|r>>>15)+n|0)&(n^t))+s[3]-1316259209)<<22|e>>>10)+r|0:(t=this.h0,e=this.h1,r=this.h2,e=((e+=((t=((t+=((n=this.h3)^e&(r^n))+s[0]-680876936)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[1]-389564586)<<12|n>>>20)+t|0)&(t^e))+s[2]+606105819)<<17|r>>>15)+n|0)&(n^t))+s[3]-1044525330)<<22|e>>>10)+r|0),e=((e+=((t=((t+=(n^e&(r^n))+s[4]-176418897)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[5]+1200080426)<<12|n>>>20)+t|0)&(t^e))+s[6]-1473231341)<<17|r>>>15)+n|0)&(n^t))+s[7]-45705983)<<22|e>>>10)+r|0,e=((e+=((t=((t+=(n^e&(r^n))+s[8]+1770035416)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[9]-1958414417)<<12|n>>>20)+t|0)&(t^e))+s[10]-42063)<<17|r>>>15)+n|0)&(n^t))+s[11]-1990404162)<<22|e>>>10)+r|0,e=((e+=((t=((t+=(n^e&(r^n))+s[12]+1804603682)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[13]-40341101)<<12|n>>>20)+t|0)&(t^e))+s[14]-1502002290)<<17|r>>>15)+n|0)&(n^t))+s[15]+1236535329)<<22|e>>>10)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[1]-165796510)<<5|t>>>27)+e|0)^e))+s[6]-1069501632)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[11]+643717713)<<14|r>>>18)+n|0)^n))+s[0]-373897302)<<20|e>>>12)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[5]-701558691)<<5|t>>>27)+e|0)^e))+s[10]+38016083)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[15]-660478335)<<14|r>>>18)+n|0)^n))+s[4]-405537848)<<20|e>>>12)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[9]+568446438)<<5|t>>>27)+e|0)^e))+s[14]-1019803690)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[3]-187363961)<<14|r>>>18)+n|0)^n))+s[8]+1163531501)<<20|e>>>12)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[13]-1444681467)<<5|t>>>27)+e|0)^e))+s[2]-51403784)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[7]+1735328473)<<14|r>>>18)+n|0)^n))+s[12]-1926607734)<<20|e>>>12)+r|0,e=((e+=((i=(n=((n+=((o=e^r)^(t=((t+=(o^n)+s[5]-378558)<<4|t>>>28)+e|0))+s[8]-2022574463)<<11|n>>>21)+t|0)^t)^(r=((r+=(i^e)+s[11]+1839030562)<<16|r>>>16)+n|0))+s[14]-35309556)<<23|e>>>9)+r|0,e=((e+=((i=(n=((n+=((o=e^r)^(t=((t+=(o^n)+s[1]-1530992060)<<4|t>>>28)+e|0))+s[4]+1272893353)<<11|n>>>21)+t|0)^t)^(r=((r+=(i^e)+s[7]-155497632)<<16|r>>>16)+n|0))+s[10]-1094730640)<<23|e>>>9)+r|0,e=((e+=((i=(n=((n+=((o=e^r)^(t=((t+=(o^n)+s[13]+681279174)<<4|t>>>28)+e|0))+s[0]-358537222)<<11|n>>>21)+t|0)^t)^(r=((r+=(i^e)+s[3]-722521979)<<16|r>>>16)+n|0))+s[6]+76029189)<<23|e>>>9)+r|0,e=((e+=((i=(n=((n+=((o=e^r)^(t=((t+=(o^n)+s[9]-640364487)<<4|t>>>28)+e|0))+s[12]-421815835)<<11|n>>>21)+t|0)^t)^(r=((r+=(i^e)+s[15]+530742520)<<16|r>>>16)+n|0))+s[2]-995338651)<<23|e>>>9)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[0]-198630844)<<6|t>>>26)+e|0)|~r))+s[7]+1126891415)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[14]-1416354905)<<15|r>>>17)+n|0)|~t))+s[5]-57434055)<<21|e>>>11)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[12]+1700485571)<<6|t>>>26)+e|0)|~r))+s[3]-1894986606)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[10]-1051523)<<15|r>>>17)+n|0)|~t))+s[1]-2054922799)<<21|e>>>11)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[8]+1873313359)<<6|t>>>26)+e|0)|~r))+s[15]-30611744)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[6]-1560198380)<<15|r>>>17)+n|0)|~t))+s[13]+1309151649)<<21|e>>>11)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[4]-145523070)<<6|t>>>26)+e|0)|~r))+s[11]-1120210379)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[2]+718787259)<<15|r>>>17)+n|0)|~t))+s[9]-343485551)<<21|e>>>11)+r|0,this.first?(this.h0=t+1732584193|0,this.h1=e-271733879|0,this.h2=r-1732584194|0,this.h3=n+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+e|0,this.h2=this.h2+r|0,this.h3=this.h3+n|0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3;return 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[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[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]+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]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,r,n="",o=this.array(),i=0;i<15;)t=o[i++],e=o[i++],r=o[i++],n+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|r>>>6)]+BASE64_ENCODE_CHAR[63&r];return t=o[i],n+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<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__)))})()},408(t,e,r){function n(){}r(173).mixin(n),n.prototype.write=function(t,e,r){this.emit("item",t,e,r)},n.prototype.end=function(){this.emit("end"),this.removeAllListeners()},n.prototype.pipe=function(t){var e=this;function r(){t.write.apply(t,Array.prototype.slice.call(arguments))}function n(){!t._isStdio&&t.end()}return e.emit("unpipe",t),t.emit("pipe",e),e.on("item",r),e.on("end",n),e.when("unpipe",function(o){var i=o===t||void 0===o;return i&&(e.removeListener("item",r),e.removeListener("end",n),t.emit("unpipe")),i}),t},n.prototype.unpipe=function(t){return this.emit("unpipe",t),this},n.prototype.format=function(t){throw new Error(["Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:","var Minilog = require('minilog');","Minilog"," .pipe(Minilog.backends.console.formatClean)"," .pipe(Minilog.backends.console);"].join("\n"))},n.mixin=function(t){var e,r=n.prototype;for(e in r)r.hasOwnProperty(e)&&(t.prototype[e]=r[e])},t.exports=n},526(t,e){"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=a(t),s=i[0],u=i[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),c=0,h=u>0?s-4:s;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[c++]=255&e);1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e);return f},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(f(t,a,a+s>u?u:a+s));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(u(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},557(t,e,r){var n=r(15),o=n.enable,i=n.disable,s="undefined"!=typeof navigator&&/chrome/i.test(navigator.userAgent),a=r(260);if(n.defaultBackend=s?a.minilog:a,"undefined"!=typeof window){try{n.enable(JSON.parse(window.localStorage.minilogSettings))}catch(t){}if(window.location&&window.location.search){var u=RegExp("[?&]minilog=([^&]*)").exec(window.location.search);u&&n.enable(decodeURIComponent(u[1]))}}n.enable=function(){o.call(n,!0);try{window.localStorage.minilogSettings=JSON.stringify(!0)}catch(t){}return this},n.disable=function(){i.call(n);try{delete window.localStorage.minilogSettings}catch(t){}return this},(t.exports=n).backends={array:r(692),browser:n.defaultBackend,localStorage:r(113),jQuery:r(740)}},638(t,e,r){var n=r(408),o=r(193),i={debug:["cyan"],info:["purple"],warn:["yellow",!0],error:["red",!0]},s=new n;s.write=function(t,e,r){console.log;console[e]&&console[e].apply&&console[e].apply(console,["%c"+t+" %c"+e,o("gray"),o.apply(o,i[e])].concat(r))},s.pipe=function(){},t.exports=s},658(t,e,r){var n=r(408),o=r(193),i={debug:["gray"],info:["purple"],warn:["yellow",!0],error:["red",!0]},s=new n;s.write=function(t,e,r){var n=console.log;"debug"!=e&&console[e]&&(n=console[e]);var s=0;if("info"!=e){for(;s<r.length&&"string"==typeof r[s];s++);n.apply(console,["%c"+t+" "+r.slice(0,s).join(" "),o.apply(o,i[e])].concat(r.slice(s)))}else n.apply(console,["%c"+t,o.apply(o,i[e])].concat(r))},s.pipe=function(){},t.exports=s},680(t,e,r){t.exports=r(14)("UklGRiYAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQIAAAAAAA==")},692(t,e,r){var n=r(408),o=[],i=new n;i.write=function(t,e,r){o.push([t,e,r])},i.get=function(){return o},i.empty=function(){o=[]},t.exports=i},740(t,e,r){var n=r(408),o=(new Date).valueOf().toString(36);function i(t){this.url=t.url||"",this.cache=[],this.timer=null,this.interval=t.interval||3e4,this.enabled=!0,this.jQuery=window.jQuery,this.extras={}}n.mixin(i),i.prototype.write=function(t,e,r){this.timer||this.init(),this.cache.push([t,e].concat(r))},i.prototype.init=function(){if(this.enabled&&this.jQuery){var t=this;this.timer=setTimeout(function(){var e,r,n=[],i=t.url;if(0==t.cache.length)return t.init();for(e=0;e<t.cache.length;e++)try{JSON.stringify(t.cache[e]),n.push(t.cache[e])}catch(t){}t.jQuery.isEmptyObject(t.extras)?(r=JSON.stringify({logs:n}),i=t.url+"?client_id="+o):r=JSON.stringify(t.jQuery.extend({logs:n},t.extras)),t.jQuery.ajax(i,{type:"POST",cache:!1,processData:!1,data:r,contentType:"application/json",timeout:1e4}).success(function(e,r,n){e.interval&&(t.interval=Math.max(1e3,e.interval))}).error(function(){t.interval=3e4}).always(function(){t.init()}),t.cache=[]},this.interval)}},i.prototype.end=function(){},i.jQueryWait=function(t){if("undefined"!=typeof window&&(window.jQuery||window.$))return t(window.jQuery||window.$);"undefined"!=typeof window&&setTimeout(function(){i.jQueryWait(t)},200)},t.exports=i},767(t,e,r){"use strict";!function(t){function e(){}function r(){}var n=String.fromCharCode,o={}.toString,i=o.call(t.SharedArrayBuffer),s=o(),a=t.Uint8Array,u=a||Array,f=a?ArrayBuffer:u,c=f.isView||function(t){return t&&"length"in t},h=o.call(f.prototype);f=r.prototype;var l=t.TextEncoder,p=new(a?Uint16Array:u)(32);e.prototype.decode=function(t){if(!c(t)){var e=o.call(t);if(e!==h&&e!==i&&e!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");t=a?new u(t):t||[]}for(var r,f,l,d=e="",y=0,g=0|t.length,b=g-32|0,w=0,_=0,m=0,A=-1;y<g;){for(r=y<=b?32:g-y|0;m<r;y=y+1|0,m=m+1|0){switch((f=255&t[y])>>4){case 15:if(2!=(l=255&t[y=y+1|0])>>6||247<f){y=y-1|0;break}w=(7&f)<<6|63&l,_=5,f=256;case 14:w<<=6,w|=(15&f)<<6|63&(l=255&t[y=y+1|0]),_=2==l>>6?_+4|0:24,f=f+256&768;case 13:case 12:w<<=6,w|=(31&f)<<6|63&(l=255&t[y=y+1|0]),_=_+7|0,y<g&&2==l>>6&&w>>_&&1114112>w?(f=w,0<=(w=w-65536|0)&&(A=55296+(w>>10)|0,f=56320+(1023&w)|0,31>m?(p[m]=A,m=m+1|0,A=-1):(l=A,A=f,f=l))):(y=y-(f>>=8)-1|0,f=65533),w=_=0,r=y<=b?32:g-y|0;default:p[m]=f;continue;case 11:case 10:case 9:case 8:}p[m]=65533}if(d+=n(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]),32>m&&(d=d.slice(0,m-32|0)),y<g){if(p[0]=A,m=~A>>>31,A=-1,d.length<e.length)continue}else-1!==A&&(d+=n(A));e+=d,d=""}return e},f.encode=function(t){var e,r=0|(t=void 0===t?"":""+t).length,n=new u(8+(r<<1)|0),o=0,i=!a;for(e=0;e<r;e=e+1|0,o=o+1|0){var s=0|t.charCodeAt(e);if(127>=s)n[o]=s;else{if(2047>=s)n[o]=192|s>>6;else{t:{if(55296<=s)if(56319>=s){var f=0|t.charCodeAt(e=e+1|0);if(56320<=f&&57343>=f){if(65535<(s=(s<<10)+f-56613888|0)){n[o]=240|s>>18,n[o=o+1|0]=128|s>>12&63,n[o=o+1|0]=128|s>>6&63,n[o=o+1|0]=128|63&s;continue}break t}s=65533}else 57343>=s&&(s=65533);!i&&e<<1<o&&e<<1<(o-7|0)&&(i=!0,(f=new u(3*r)).set(n),n=f)}n[o]=224|s>>12,n[o=o+1|0]=128|s>>6&63}n[o=o+1|0]=128|63&s}}return a?n.subarray(0,o):n.slice(0,o)},l||(t.TextDecoder=e,t.TextEncoder=r)}(""+void 0==typeof r.g?""+void 0==typeof self?this:self:r.g)},914(t,e,r){t.exports=r(14)("PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8Zz4KICA8cmVjdCBmaWxsPSIjQ0NDIiBoZWlnaHQ9IjEyOCIgd2lkdGg9IjEyOCIvPgogIDx0ZXh0IGZpbGw9ImJsYWNrIiB5PSIxMDciIHg9IjM1LjUiIGZvbnQtc2l6ZT0iMTI4Ij4/PC90ZXh0PgogPC9nPgo8L3N2Zz4K")},945(t,e,r){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,o=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n=void 0!==t&&t||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},o="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,s="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in n,u="ArrayBuffer"in n;if(u)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&f.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function y(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function g(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function b(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function w(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:s&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&s&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=w(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=w(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=y(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=y(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(s)return this.blob().then(b);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,n,o,i=y(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8",e.readAsText(t,o),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=h(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[h(t)]},d.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},d.prototype.set=function(t,e){this.map[h(t)]=l(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),p(t)},d.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),p(t)},d.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),p(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function A(t,e){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,o,i=(e=e||{}).body;if(t instanceof A){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(r=e.method||this.method||"GET",o=r.toUpperCase(),m.indexOf(o)>-1?o:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in n)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function v(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function E(t,e){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},_.call(A.prototype),_.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var S=[301,302,303,307,308];E.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},e.DOMException=n.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function B(t,r){return new Promise(function(o,i){var a=new A(t,r);if(a.signal&&a.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var f=new XMLHttpRequest;function c(){f.abort()}if(f.onload=function(){var t,e,r={statusText:f.statusText,headers:(t=f.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();try{e.append(n,o)}catch(t){console.warn("Response "+t.message)}}}),e)};0===a.url.indexOf("file://")&&(f.status<200||f.status>599)?r.status=200:r.status=f.status,r.url="responseURL"in f?f.responseURL:r.headers.get("X-Request-URL");var n="response"in f?f.response:f.responseText;setTimeout(function(){o(new E(n,r))},0)},f.onerror=function(){setTimeout(function(){i(new TypeError("Network request failed"))},0)},f.ontimeout=function(){setTimeout(function(){i(new TypeError("Network request timed out"))},0)},f.onabort=function(){setTimeout(function(){i(new e.DOMException("Aborted","AbortError"))},0)},f.open(a.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(e){return t}}(a.url),!0),"include"===a.credentials?f.withCredentials=!0:"omit"===a.credentials&&(f.withCredentials=!1),"responseType"in f&&(s?f.responseType="blob":u&&(f.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof d||n.Headers&&r.headers instanceof n.Headers)){var p=[];Object.getOwnPropertyNames(r.headers).forEach(function(t){p.push(h(t)),f.setRequestHeader(t,l(r.headers[t]))}),a.headers.forEach(function(t,e){-1===p.indexOf(e)&&f.setRequestHeader(e,t)})}else a.headers.forEach(function(t,e){f.setRequestHeader(e,t)});a.signal&&(a.signal.addEventListener("abort",c),f.onreadystatechange=function(){4===f.readyState&&a.signal.removeEventListener("abort",c)}),f.send(void 0===a._bodyInit?null:a._bodyInit)})}B.polyfill=!0,n.fetch||(n.fetch=B,n.Headers=d,n.Request=A,n.Response=E),e.Headers=d,e.Request=A,e.Response=E,e.fetch=B}({})}(o),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var i=n.fetch?n:o;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},953(t,e,r){const n=r(945),o=new n.Headers,i=t=>{if((()=>{if(!("undefined"!=typeof self&&self&&self.location&&self.location.search&&self.location.search.split(/[?&]/)||[]).includes("scratchMetadata=1"))return!1;for(const t of o)return!0;return!1})()){const e=Object.assign({},t);if(e.headers=new n.Headers(o),t&&t.headers){const r=t.headers instanceof n.Headers?t.headers:new n.Headers(t.headers);for(const[t,n]of r.entries())e.headers.set(t,n)}return e}return t};t.exports={Headers:n.Headers,RequestMetadata:{ProjectId:"X-Project-ID",RunId:"X-Run-ID"},applyMetadata:i,scratchFetch:(t,e)=>{const r=i(e);return n(t,r)},setMetadata:(t,e)=>{o.set(t,e)},unsetMetadata:t=>{o.delete(t)},getMetadata:t=>o.get(t)}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdO={},__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var r in e)__webpack_require__.o(e,r)&&!__webpack_require__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__webpack_require__.u=t=>"chunks/fetch-worker.4277f33a97fe995aa7dd.js",__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.p="/",__webpack_require__.b="undefined"!=typeof document&&document.baseURI||self.location.href;var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Asset:()=>f,AssetType:()=>h,DataFormat:()=>c,Helper:()=>p,ScratchStorage:()=>L});var t=__webpack_require__(557),e=__webpack_require__.n(t);e().enable();const r=e()("storage");var n=__webpack_require__(386),o=__webpack_require__.n(n);let i,s;if("undefined"==typeof TextDecoder||"undefined"==typeof TextEncoder){const t=__webpack_require__(767);i=t.TextDecoder,s=t.TextEncoder}else i=TextDecoder,s=TextEncoder;const a=function(){let t=null;const e={};return(r,n)=>{if(!Object.prototype.hasOwnProperty.call(e,r))if("undefined"==typeof btoa){const t=__webpack_require__(526);e[r]=t.fromByteArray(n)}else{if(null===t){t=new Array(256);for(let e=0;e<256;e++)t[e]=String.fromCharCode(e)}const{length:o}=n;let i="";for(let e=0,r=0;e<o;e=r){r=Math.min(r+32766,o);let s="";for(let o=e;o<r;o+=1)s+=t[n[o]];i+=btoa(s)}e[r]=i}return e[r]}}();function u(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class f{constructor(t,e,r,n,o){u(this,"assetType",void 0),u(this,"assetId",void 0),u(this,"data",void 0),u(this,"dataFormat",void 0),u(this,"dependencies",void 0),u(this,"clean",void 0),this.assetType=t,this.assetId=e,this.setData(n,r||t.runtimeFormat,o),this.dependencies=[]}setData(t,e,r){if(t&&!e)throw new Error("Data provided without specifying its format");this.dataFormat=e,this.data=t,r&&(this.assetId=o()(t)),this.clean=!r}decodeText(){return(new i).decode(this.data)}encodeTextData(t,e,r){const n=new s;this.setData(n.encode(t),e,r)}encodeDataURI(t){return t=t||this.assetType.contentType,"data:".concat(t,";base64,").concat(a(this.assetId,this.data))}}const c={JPG:"jpg",JSON:"json",MP3:"mp3",PNG:"png",SB2:"sb2",SB3:"sb3",SVG:"svg",WAV:"wav"},h={ImageBitmap:{contentType:"image/png",name:"ImageBitmap",runtimeFormat:c.PNG,immutable:!0},ImageVector:{contentType:"image/svg+xml",name:"ImageVector",runtimeFormat:c.SVG,immutable:!0},Project:{contentType:"application/json",name:"Project",runtimeFormat:c.JSON,immutable:!1},Sound:{contentType:"audio/x-wav",name:"Sound",runtimeFormat:c.WAV,immutable:!0},Sprite:{contentType:"application/json",name:"Sprite",runtimeFormat:c.JSON,immutable:!0}};function l(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class p{constructor(t){l(this,"parent",void 0),this.parent=t}load(t,e,r){return Promise.reject(new Error("No asset of type ".concat(t," for ID ").concat(e," with format ").concat(r)))}}var d=__webpack_require__(9),y=__webpack_require__.n(d),g=__webpack_require__(680),b=__webpack_require__.n(g),w=__webpack_require__(914),_=__webpack_require__.n(w),m=__webpack_require__(287);function A(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const v=[{type:h.ImageBitmap,format:c.PNG,id:null,data:m.hp.from(y())},{type:h.Sound,format:c.WAV,id:null,data:m.hp.from(b())},{type:h.ImageVector,format:c.SVG,id:null,data:m.hp.from(_())}],E=v.concat([]);class S extends p{constructor(t){super(t),A(this,"assets",void 0),this.assets={},E.forEach(t=>{t.id=this._store(t.type,t.format,t.data,t.id)})}registerDefaultAssets(){const t=v.length;for(let e=0;e<t;++e){const t=v[e];this.parent.setDefaultAssetId(t.type,t.id)}}get(t){let e=null;if(Object.prototype.hasOwnProperty.call(this.assets,t)){const r=this.assets[t];e=new f(r.type,r.id,r.format,r.data)}return e}cache(t,e,n,o){return r.warn("Deprecation: BuiltinHelper.cache has been replaced with BuiltinHelper.store."),this.store(t,e,n,o)}store(t,e,n,o){return r.warn("Deprecation: use Storage.createAsset. BuiltinHelper is for internal use only."),this._store(t,e,n,o)}_store(t,e,r,n){let i=n;if(!e)throw new Error("Data cached without specifying its format");if(""!==i&&null!=i){if(Object.prototype.hasOwnProperty.call(this.assets,i)&&t.immutable)return i}else{if(!t.immutable)throw new Error("Tried to cache data without an id");i=o()(r)}return this.assets[i]={type:t,format:e,id:i,data:r},i}load(t,e){return this.get(e)?Promise.resolve(this.get(e)):null}}var B=__webpack_require__(953),O=__webpack_require__.n(B);const R=["url"];function I(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class T{constructor(){I(this,"_workerSupport",void 0),I(this,"_supportError",void 0),I(this,"worker",void 0),I(this,"jobs",void 0),this._workerSupport={fetch:"undefined"!=typeof fetch},this._supportError=null,this.worker=null,this.jobs={};try{if(this.isGetSupported){const t=new Worker(new URL(__webpack_require__.p+__webpack_require__.u(836),__webpack_require__.b));t.addEventListener("message",t=>{let{data:e}=t;if(e.support)this._workerSupport=e.support;else for(const t of e){const e=this.jobs[t.id];e&&(t.error?e.reject(t.error):e.resolve(t.buffer),delete this.jobs[t.id])}}),this.worker=t}}catch(t){this._supportError=t}}get isGetSupported(){return"undefined"!=typeof Worker&&this._workerSupport.fetch&&!this._supportError}get(t){let{url:e}=t,r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,R);const n=this.worker;return n?new Promise((t,o)=>{const i=Math.random().toString(16).substring(2),s=(0,B.applyMetadata)(Object.assign({method:"GET"},r));s&&s.headers instanceof B.Headers&&(s.headers=Array.from(s.headers.entries())),n.postMessage({id:i,url:e,options:s}),this.jobs[i]={id:i,resolve:t,reject:o}}).then(t=>t?new Uint8Array(t):null):Promise.reject(new Error("The worker could not be initialized"))}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}static get instance(){return this._instance||(this._instance=new T),this._instance}}I(T,"_instance",void 0);class x{constructor(){I(this,"inner",void 0),this.inner=T.instance}get isGetSupported(){return this.inner.isGetSupported}get(t){return this.inner.get(t)}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}}const U=["url"],H=["url","withCredentials"];function j(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}class C{get isGetSupported(){return!0}get(t){let{url:e}=t,r=j(t,U);return(0,B.scratchFetch)(e,Object.assign({method:"GET"},r)).then(t=>t.ok?t.arrayBuffer().then(t=>new Uint8Array(t)):404===t.status?null:Promise.reject(t.status))}get isSendSupported(){return!0}send(t){let{url:e,withCredentials:r=!1}=t,n=j(t,H);return(0,B.scratchFetch)(e,Object.assign({credentials:r?"include":"omit"},n)).then(t=>t.ok?t.text():Promise.reject(t.status))}}function P(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class k{constructor(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k.TOOL_FILTER.ALL;P(this,"tools",void 0),t=e===k.TOOL_FILTER.READY?[new C]:[new x,new C],this.tools=t}get isGetSupported(){return this.tools.some(t=>t.isGetSupported)}get(t){let e=0;const r=n=>{const o=this.tools[e++];if(!o)throw n;return o.isGetSupported?o.get(t).catch(r):r(n)};return r()}get isSendSupported(){return this.tools.some(t=>t.isSendSupported)}send(t){let e=0;const r=n=>{const o=this.tools[e++];if(!o)throw n;return o.isSendSupported?o.send(t).catch(r):r(n)};return r()}}function D(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}P(k,"TOOL_FILTER",{ALL:"all",READY:"ready"});const M=t=>"string"==typeof t?{url:t}:t;class F extends p{constructor(t){super(t),D(this,"stores",void 0),D(this,"assetTool",void 0),D(this,"projectTool",void 0),this.stores=[],this.assetTool=new k,this.projectTool=new k(k.TOOL_FILTER.READY)}addSource(t,e){r.warn("Deprecation: WebHelper.addSource has been replaced with WebHelper.addStore."),this.addStore(t,e)}addStore(t,e,r,n){this.stores.push({types:t.map(t=>t.name),get:e,create:r,update:n})}load(t,e,r){const n=[],o=this.stores.slice().filter(e=>e.types.indexOf(t.name)>=0),i=new f(t,e,r);let s=this.assetTool;"Project"===t.name&&(s=this.projectTool);let a=0;const u=t=>{t&&n.push(t);const e=o[a++],f=e&&e.get;if(f){const t=M(f(i));return!1===t?u():s.get(t).then(t=>t?(i.setData(t,r),i):u()).catch(u)}return n.length>0?Promise.reject(n):Promise.resolve(null)};return u()}store(t,e,r,n){const o=new f(t,n,e),i=""===n||null==n,s=this.stores.filter(e=>-1!==e.types.indexOf(t.name)&&(i&&e.create||e.update))[0],a=i?"post":"put";if(!s)return Promise.reject(new Error("No appropriate stores"));let u=this.assetTool;"Project"===t.name&&(u=this.projectTool);const c=M(i?s.create(o):s.update(o)),h=Object.assign({body:r,method:a},c);return u.send(h).then(t=>{if("string"==typeof t)try{t=JSON.parse(t)}catch(e){return t}return Object.assign({id:t["content-name"]||n},t)})}}function N(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class L{constructor(){N(this,"defaultAssetId",void 0),N(this,"builtinHelper",void 0),N(this,"webHelper",void 0),N(this,"_helpers",void 0),this.defaultAssetId={},this.builtinHelper=new S(this),this.webHelper=new F(this),this.builtinHelper.registerDefaultAssets(),this._helpers=[{helper:this.builtinHelper,priority:100},{helper:this.webHelper,priority:-100}]}get Asset(){return f}get AssetType(){return h}get DataFormat(){return c}get scratchFetch(){return O()}static get Asset(){return f}static get AssetType(){return h}addHelper(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._helpers.push({helper:t,priority:e}),this._helpers.sort((t,e)=>e.priority-t.priority)}get(t){return this.builtinHelper.get(t)}cache(t,e,n,o){return r.warn("Deprecation: Storage.cache is deprecated. Use Storage.createAsset, and store assets externally."),this.builtinHelper._store(t,e,n,o)}createAsset(t,e,r,n,o){if(!e)throw new Error("Tried to create asset without a dataFormat");return new f(t,n,e,r,o)}addWebStore(t,e,r,n){this.webHelper.addStore(t,e,r,n)}addWebSource(t,e){r.warn("Deprecation: Storage.addWebSource has been replaced by addWebStore."),this.addWebStore(t,e)}getDefaultAssetId(t){if(Object.prototype.hasOwnProperty.call(this.defaultAssetId,t.name))return this.defaultAssetId[t.name]}setDefaultAssetId(t,e){this.defaultAssetId[t.name]=e}load(t,e,r){const n=this._helpers.map(t=>t.helper),o=[];r=r||t.runtimeFormat;let i,s=0;const a=u=>{if(u&&o.push(u),i=n[s++],i){const n=i.load(t,e,r);return null===n?a():n.catch(a)}return o.length>0?Promise.reject(o):Promise.resolve(null)};return a()}store(t,e,r,n){return e=e||t.runtimeFormat,this.webHelper.store(t,e,r,n).then(n=>{const o="string"==typeof n?void 0:n.id;return this.builtinHelper._store(t,e,r,o),n})}}})(),__webpack_exports__})());
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ScratchStorage=e():t.ScratchStorage=e()}(self,()=>(()=>{var __webpack_modules__={9(t,e,r){t.exports=r(14)("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAAAAADmVT4XAAADZElEQVR42u3a70vbQBgH8O/7vOibvsmbFUEEWUGGUhQ25nDuhSKIUFDxlYi0SAd94atRmFiHCH2x4W8iiNtwowXRgd1QipJYY3N/1F4kTQ6XLKS9yyHcvWyO8MnT5y53Tw5EcIMESIAESIAESIAESIAEPFVAq/6l8G4oAQCp4aniwbUVJ6BVzafwqKXy1VZMgNb+CHzbyK4ZB+Bi0nnk0VyhsDiSoAmvvnMHmGUVAF6UG+0ffsxRhsRHky/AyCsAUpumX0wAAIs6T4CxDADDtcdZsal6gjmdH8AsAEC6+s8Fa48SFExeAKusAEju+V367AmUCi9ANQ0AU3pwcOw2cMEH0FwAAKz5X228pRLR5AI4TgIAtIDL24oLUE94AB6W7LsH/cONN14Ilh44AOqD9s2LQR1KHiB9zgGgOSGeuA3ocPrME1Q4ANaceyePAzrcjHmAZYs9IBeW4/fzHiAwTCwAgTle9ACZK44ALDT9e6x7gL4aT0BQCHb4AqgA5/1TTOMLoJ7vZSMM0H/GHnCeDnu+CrU8vGYPcN5FADBYD0vCaYPDy+i0p337GSMsS1Z4vA3t9QgAZTt0IuIxFRPSKicAQHlvhk3FXF5GhBByMa8qo/sBO6BarwuYbYrYnFKDYEvE7phKgcxvEQBqnvhgiQCUOgoAO4C3JOS3L/hv23UXxVldBECfcueAqpAa0WGy/QeULREAY6aTXRFDgBuA13+ElOncAERMAGaA9hBQD4gQQHsIRE1AZoD2xrgQS5nOZyHgFKmWDSIG4GRAVidiAE4GRB6AzAB2AKIPQFaA5myHA5AV4ESNugZhC7BLR50lIBPAebrzBGQCKAFQNSIMcDvRTQIwAHxNApM3RBygGK0uyhxwOwGsPAgEnPWj5ycRCNiJtBHlAChGKQVwANzPY+CXSMDNWISiLA9AfRA5IhJQ68UnoQAt+AtOPIBKhJosF8B6UM0yLkAxQk2WCyDX9SiUh1gkQAIkoCuAvjGuquMbuijAtwG7MPL8yBICOHSPk3W8Ne8KcEUdmBi6FADYos+QleIH0N/ogOxd7AD6uAS6WRU8WcBdlgZMG/EnYUlwEpLLoQ4PjzGbiA5UsRMRsbQ+5ziDJmYqJuR6NaMomdXuFuZyPSABEiABEiABEiABEiAc8Bd6VyvCEKGqcQAAAABJRU5ErkJggg==")},14(t,e,r){"use strict";var n=r(287).hp;t.exports=function(t){for(var e="undefined"!=typeof window&&"function"==typeof window.atob?window.atob(t):n.from(t,"base64").toString("binary"),r=new Uint8Array(e.length),i=0;i<e.length;++i)r[i]=e.charCodeAt(i);return r.buffer}},15(t,e,r){var n=r(408),i=r(84),o=new n,s=Array.prototype.slice;e=t.exports=function(t){var r=function(){return o.write(t,void 0,s.call(arguments)),r};return r.debug=function(){return o.write(t,"debug",s.call(arguments)),r},r.info=function(){return o.write(t,"info",s.call(arguments)),r},r.warn=function(){return o.write(t,"warn",s.call(arguments)),r},r.error=function(){return o.write(t,"error",s.call(arguments)),r},r.log=r.debug,r.suggest=e.suggest,r.format=o.format,r},e.defaultBackend=e.defaultFormatter=null,e.pipe=function(t){return o.pipe(t)},e.end=e.unpipe=e.disable=function(t){return o.unpipe(t)},e.Transform=n,e.Filter=i,e.suggest=new i,e.enable=function(){return e.defaultFormatter?o.pipe(e.suggest).pipe(e.defaultFormatter).pipe(e.defaultBackend):o.pipe(e.suggest).pipe(e.defaultBackend)}},84(t,e,r){var n=r(408),i={debug:1,info:2,warn:3,error:4};function o(){this.enabled=!0,this.defaultResult=!0,this.clear()}function s(t,e){return t.n.test?t.n.test(e):t.n==e}n.mixin(o),o.prototype.allow=function(t,e){return this._white.push({n:t,l:i[e]}),this},o.prototype.deny=function(t,e){return this._black.push({n:t,l:i[e]}),this},o.prototype.clear=function(){return this._white=[],this._black=[],this},o.prototype.test=function(t,e){var r,n=Math.max(this._white.length,this._black.length);for(r=0;r<n;r++){if(this._white[r]&&s(this._white[r],t)&&i[e]>=this._white[r].l)return!0;if(this._black[r]&&s(this._black[r],t)&&i[e]<=this._black[r].l)return!1}return this.defaultResult},o.prototype.write=function(t,e,r){if(!this.enabled||this.test(t,e))return this.emit("item",t,e,r)},t.exports=o},113(t,e,r){var n=r(408),i=!1,o=new n;o.write=function(t,e,r){if("undefined"!=typeof window&&"undefined"!=typeof JSON&&JSON.stringify&&JSON.parse)try{i||(i=window.localStorage.minilog?JSON.parse(window.localStorage.minilog):[]),i.push([(new Date).toString(),t,e,r]),window.localStorage.minilog=JSON.stringify(i)}catch(t){}},t.exports=o},173(t){function e(){this._events={}}e.prototype={on:function(t,e){this._events||(this._events={});var r=this._events;return(r[t]||(r[t]=[])).push(e),this},removeListener:function(t,e){var r,n=this._events[t]||[];for(r=n.length-1;r>=0&&n[r];r--)n[r]!==e&&n[r].cb!==e||n.splice(r,1)},removeAllListeners:function(t){t?this._events[t]&&(this._events[t]=[]):this._events={}},listeners:function(t){return this._events&&this._events[t]||[]},emit:function(t){this._events||(this._events={});var e,r=Array.prototype.slice.call(arguments,1),n=this._events[t]||[];for(e=n.length-1;e>=0&&n[e];e--)n[e].apply(this,r);return this},when:function(t,e){return this.once(t,e,!0)},once:function(t,e,r){if(!e)return this;function n(){r||this.removeListener(t,n),e.apply(this,arguments)&&r&&this.removeListener(t,n)}return n.cb=e,this.on(t,n),this}},e.mixin=function(t){var r,n=e.prototype;for(r in n)n.hasOwnProperty(r)&&(t.prototype[r]=n[r])},t.exports=e},193(t){var e={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};t.exports=function(t,r){return r?"color: #fff; background: "+e[t]+";":"color: "+e[t]+";"}},251(t,e){e.read=function(t,e,r,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=u;c>0;o=256*o+t[e+h],h+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,u,a,f=8*o-i-1,c=(1<<f)-1,h=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+h>=1?l/a:l*Math.pow(2,1-h))*a>=2&&(s++,a/=2),s+h>=c?(u=0,s=c):s+h>=1?(u=(e*a-1)*Math.pow(2,i),s+=h):(u=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&u,p+=d,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;t[r+p]=255&s,p+=d,s/=256,f-=8);t[r+p-d]|=128*y}},260(t,e,r){var n=r(408),i=/\n+$/,o=new n;o.write=function(t,e,r){var n=r.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[t,e].concat(r));if(JSON&&JSON.stringify){r[n]&&"string"==typeof r[n]&&(r[n]=r[n].replace(i,""));try{for(n=0;n<r.length;n++)r[n]=JSON.stringify(r[n])}catch(t){}console.log(r.join(" "))}}},o.formatters=["color","minilog"],o.color=r(638),o.minilog=r(658),t.exports=o},287(t,e,r){"use strict";const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=a,e.IS=50;const s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=u(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(V(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(V(t,ArrayBuffer)||t&&V(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(V(t,SharedArrayBuffer)||t&&V(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);const i=function(t){if(a.isBuffer(t)){const e=0|d(t.length),r=u(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||z(t.length)?u(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return c(t),u(t<0?0:0|d(t))}function l(t){const e=t.length<0?0:0|d(t.length),r=u(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,a.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||V(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(t).length;default:if(i)return n?-1:Q(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,i){let o,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<u;o++)if(f(t,o)===f(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===a)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+a>u&&(r=u-a),o=r;o>=0;o--){let r=!0;for(let n=0;n<a;n++)if(f(t,o+n)!==f(e,n)){r=!1;break}if(r)return o}return-1}function m(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(z(n))return s;t[r+s]=n}return s}function A(t,e,r,n){return Y(Q(e,t.length-r),t,r,n)}function v(t,e,r,n){return Y(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return Y(J(e),t,r,n)}function S(t,e,r,n){return Y(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,u,a;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(a=(31&e)<<6|63&r,a>127&&(o=a));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(a=(15&e)<<12|(63&r)<<6|63&n,a>2047&&(a<55296||a>57343)&&(o=a));break;case 4:r=t[i+1],n=t[i+2],u=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&u)&&(a=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&u,a>65535&&a<1114112&&(o=a))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}a.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?u(t):void 0!==e?"string"==typeof r?u(t).fill(e,r):u(t).fill(e):u(t)}(t,e,r)},a.allocUnsafe=function(t){return h(t)},a.allocUnsafeSlow=function(t){return h(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(V(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),V(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=a.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(V(e,Uint8Array))i+e.length>n.length?(a.isBuffer(e)||(e=a.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!a.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)w(this,e,e+1);return this},a.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},a.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},a.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?R(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,i){if(V(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const u=Math.min(o,s),f=this.slice(n,i),c=t.slice(e,r);for(let t=0;t<u;++t)if(f[t]!==c[t]){o=f[t],s=c[t];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":case"latin1":case"binary":return v(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function O(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function k(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Z[t[n]];return i}function C(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function H(t,e,r,n,i){q(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function j(t,e,r,n,i){q(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,o){return e=+e,r>>>=0,o||P(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||P(t,0,r,8),i.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readBigUInt64LE=$(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))}),a.prototype.readBigUInt64BE=$(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},a.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||U(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readBigInt64LE=$(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),a.prototype.readBigInt64BE=$(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||W(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)}),a.prototype.readFloatLE=function(t,e){return t>>>=0,e||U(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){x(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){x(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigUInt64LE=$(function(t,e=0){return H(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=$(function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);x(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);x(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeBigInt64LE=$(function(t,e=0){return H(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=$(function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=a.isBuffer(t)?t:a.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const D={};function N(t,e,r){D[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function q(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new D.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){G(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||W(e,t.length-(r+1))}(n,i,o)}function G(t,e){if("number"!=typeof t)throw new D.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,r){if(Math.floor(t)!==t)throw G(t,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}N("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),N("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),N("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function Q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function J(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function V(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function $(t){return"undefined"==typeof BigInt?K:t}function K(){throw new Error("BigInt not supported")}},386(module,exports,__webpack_require__){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=__webpack_require__.g:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&module.exports,AMD=__webpack_require__.amdO,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(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e<OUTPUT_TYPES.length;++e){var r=OUTPUT_TYPES[e];t[r]=createOutputMethod(r)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw ERROR;if(null===t)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw ERROR;e=!0}for(var n,i,o=0,s=t.length,u=this.blocks,a=this.buffer8;o<s;){if(this.hashed&&(this.hashed=!1,u[0]=u[16],u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),e)if(ARRAY_BUFFER)for(i=this.start;o<s&&i<64;++o)a[i++]=t[o];else for(i=this.start;o<s&&i<64;++o)u[i>>2]|=t[o]<<SHIFT[3&i++];else if(ARRAY_BUFFER)for(i=this.start;o<s&&i<64;++o)(n=t.charCodeAt(o))<128?a[i++]=n:n<2048?(a[i++]=192|n>>6,a[i++]=128|63&n):n<55296||n>=57344?(a[i++]=224|n>>12,a[i++]=128|n>>6&63,a[i++]=128|63&n):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),a[i++]=240|n>>18,a[i++]=128|n>>12&63,a[i++]=128|n>>6&63,a[i++]=128|63&n);else for(i=this.start;o<s&&i<64;++o)(n=t.charCodeAt(o))<128?u[i>>2]|=n<<SHIFT[3&i++]:n<2048?(u[i>>2]|=(192|n>>6)<<SHIFT[3&i++],u[i>>2]|=(128|63&n)<<SHIFT[3&i++]):n<55296||n>=57344?(u[i>>2]|=(224|n>>12)<<SHIFT[3&i++],u[i>>2]|=(128|n>>6&63)<<SHIFT[3&i++],u[i>>2]|=(128|63&n)<<SHIFT[3&i++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),u[i>>2]|=(240|n>>18)<<SHIFT[3&i++],u[i>>2]|=(128|n>>12&63)<<SHIFT[3&i++],u[i>>2]|=(128|n>>6&63)<<SHIFT[3&i++],u[i>>2]|=(128|63&n)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=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 t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,r,n,i,o,s=this.blocks;this.first?e=((e=((t=((t=s[0]-680876937)<<7|t>>>25)-271733879|0)^(r=((r=(-271733879^(n=((n=(-1732584194^2004318071&t)+s[1]-117830708)<<12|n>>>20)+t|0)&(-271733879^t))+s[2]-1126478375)<<17|r>>>15)+n|0)&(n^t))+s[3]-1316259209)<<22|e>>>10)+r|0:(t=this.h0,e=this.h1,r=this.h2,e=((e+=((t=((t+=((n=this.h3)^e&(r^n))+s[0]-680876936)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[1]-389564586)<<12|n>>>20)+t|0)&(t^e))+s[2]+606105819)<<17|r>>>15)+n|0)&(n^t))+s[3]-1044525330)<<22|e>>>10)+r|0),e=((e+=((t=((t+=(n^e&(r^n))+s[4]-176418897)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[5]+1200080426)<<12|n>>>20)+t|0)&(t^e))+s[6]-1473231341)<<17|r>>>15)+n|0)&(n^t))+s[7]-45705983)<<22|e>>>10)+r|0,e=((e+=((t=((t+=(n^e&(r^n))+s[8]+1770035416)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[9]-1958414417)<<12|n>>>20)+t|0)&(t^e))+s[10]-42063)<<17|r>>>15)+n|0)&(n^t))+s[11]-1990404162)<<22|e>>>10)+r|0,e=((e+=((t=((t+=(n^e&(r^n))+s[12]+1804603682)<<7|t>>>25)+e|0)^(r=((r+=(e^(n=((n+=(r^t&(e^r))+s[13]-40341101)<<12|n>>>20)+t|0)&(t^e))+s[14]-1502002290)<<17|r>>>15)+n|0)&(n^t))+s[15]+1236535329)<<22|e>>>10)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[1]-165796510)<<5|t>>>27)+e|0)^e))+s[6]-1069501632)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[11]+643717713)<<14|r>>>18)+n|0)^n))+s[0]-373897302)<<20|e>>>12)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[5]-701558691)<<5|t>>>27)+e|0)^e))+s[10]+38016083)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[15]-660478335)<<14|r>>>18)+n|0)^n))+s[4]-405537848)<<20|e>>>12)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[9]+568446438)<<5|t>>>27)+e|0)^e))+s[14]-1019803690)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[3]-187363961)<<14|r>>>18)+n|0)^n))+s[8]+1163531501)<<20|e>>>12)+r|0,e=((e+=((n=((n+=(e^r&((t=((t+=(r^n&(e^r))+s[13]-1444681467)<<5|t>>>27)+e|0)^e))+s[2]-51403784)<<9|n>>>23)+t|0)^t&((r=((r+=(t^e&(n^t))+s[7]+1735328473)<<14|r>>>18)+n|0)^n))+s[12]-1926607734)<<20|e>>>12)+r|0,e=((e+=((o=(n=((n+=((i=e^r)^(t=((t+=(i^n)+s[5]-378558)<<4|t>>>28)+e|0))+s[8]-2022574463)<<11|n>>>21)+t|0)^t)^(r=((r+=(o^e)+s[11]+1839030562)<<16|r>>>16)+n|0))+s[14]-35309556)<<23|e>>>9)+r|0,e=((e+=((o=(n=((n+=((i=e^r)^(t=((t+=(i^n)+s[1]-1530992060)<<4|t>>>28)+e|0))+s[4]+1272893353)<<11|n>>>21)+t|0)^t)^(r=((r+=(o^e)+s[7]-155497632)<<16|r>>>16)+n|0))+s[10]-1094730640)<<23|e>>>9)+r|0,e=((e+=((o=(n=((n+=((i=e^r)^(t=((t+=(i^n)+s[13]+681279174)<<4|t>>>28)+e|0))+s[0]-358537222)<<11|n>>>21)+t|0)^t)^(r=((r+=(o^e)+s[3]-722521979)<<16|r>>>16)+n|0))+s[6]+76029189)<<23|e>>>9)+r|0,e=((e+=((o=(n=((n+=((i=e^r)^(t=((t+=(i^n)+s[9]-640364487)<<4|t>>>28)+e|0))+s[12]-421815835)<<11|n>>>21)+t|0)^t)^(r=((r+=(o^e)+s[15]+530742520)<<16|r>>>16)+n|0))+s[2]-995338651)<<23|e>>>9)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[0]-198630844)<<6|t>>>26)+e|0)|~r))+s[7]+1126891415)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[14]-1416354905)<<15|r>>>17)+n|0)|~t))+s[5]-57434055)<<21|e>>>11)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[12]+1700485571)<<6|t>>>26)+e|0)|~r))+s[3]-1894986606)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[10]-1051523)<<15|r>>>17)+n|0)|~t))+s[1]-2054922799)<<21|e>>>11)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[8]+1873313359)<<6|t>>>26)+e|0)|~r))+s[15]-30611744)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[6]-1560198380)<<15|r>>>17)+n|0)|~t))+s[13]+1309151649)<<21|e>>>11)+r|0,e=((e+=((n=((n+=(e^((t=((t+=(r^(e|~n))+s[4]-145523070)<<6|t>>>26)+e|0)|~r))+s[11]-1120210379)<<10|n>>>22)+t|0)^((r=((r+=(t^(n|~e))+s[2]+718787259)<<15|r>>>17)+n|0)|~t))+s[9]-343485551)<<21|e>>>11)+r|0,this.first?(this.h0=t+1732584193|0,this.h1=e-271733879|0,this.h2=r-1732584194|0,this.h3=n+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+e|0,this.h2=this.h2+r|0,this.h3=this.h3+n|0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3;return 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[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[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]+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]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,r,n="",i=this.array(),o=0;o<15;)t=i[o++],e=i[o++],r=i[o++],n+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|r>>>6)]+BASE64_ENCODE_CHAR[63&r];return t=i[o],n+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<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__)))})()},408(t,e,r){function n(){}r(173).mixin(n),n.prototype.write=function(t,e,r){this.emit("item",t,e,r)},n.prototype.end=function(){this.emit("end"),this.removeAllListeners()},n.prototype.pipe=function(t){var e=this;function r(){t.write.apply(t,Array.prototype.slice.call(arguments))}function n(){!t._isStdio&&t.end()}return e.emit("unpipe",t),t.emit("pipe",e),e.on("item",r),e.on("end",n),e.when("unpipe",function(i){var o=i===t||void 0===i;return o&&(e.removeListener("item",r),e.removeListener("end",n),t.emit("unpipe")),o}),t},n.prototype.unpipe=function(t){return this.emit("unpipe",t),this},n.prototype.format=function(t){throw new Error(["Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:","var Minilog = require('minilog');","Minilog"," .pipe(Minilog.backends.console.formatClean)"," .pipe(Minilog.backends.console);"].join("\n"))},n.mixin=function(t){var e,r=n.prototype;for(e in r)r.hasOwnProperty(e)&&(t.prototype[e]=r[e])},t.exports=n},526(t,e){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),s=o[0],a=o[1],f=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),c=0,h=a>0?s-4:s;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[c++]=255&e);1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e);return f},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,u=0,a=n-i;u<a;u+=s)o.push(f(t,u,u+s>a?a:u+s));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(a(n));return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},557(t,e,r){var n=r(15),i=n.enable,o=n.disable,s="undefined"!=typeof navigator&&/chrome/i.test(navigator.userAgent),u=r(260);if(n.defaultBackend=s?u.minilog:u,"undefined"!=typeof window){try{n.enable(JSON.parse(window.localStorage.minilogSettings))}catch(t){}if(window.location&&window.location.search){var a=RegExp("[?&]minilog=([^&]*)").exec(window.location.search);a&&n.enable(decodeURIComponent(a[1]))}}n.enable=function(){i.call(n,!0);try{window.localStorage.minilogSettings=JSON.stringify(!0)}catch(t){}return this},n.disable=function(){o.call(n);try{delete window.localStorage.minilogSettings}catch(t){}return this},(t.exports=n).backends={array:r(692),browser:n.defaultBackend,localStorage:r(113),jQuery:r(740)}},638(t,e,r){var n=r(408),i=r(193),o={debug:["cyan"],info:["purple"],warn:["yellow",!0],error:["red",!0]},s=new n;s.write=function(t,e,r){console.log;console[e]&&console[e].apply&&console[e].apply(console,["%c"+t+" %c"+e,i("gray"),i.apply(i,o[e])].concat(r))},s.pipe=function(){},t.exports=s},658(t,e,r){var n=r(408),i=r(193),o={debug:["gray"],info:["purple"],warn:["yellow",!0],error:["red",!0]},s=new n;s.write=function(t,e,r){var n=console.log;"debug"!=e&&console[e]&&(n=console[e]);var s=0;if("info"!=e){for(;s<r.length&&"string"==typeof r[s];s++);n.apply(console,["%c"+t+" "+r.slice(0,s).join(" "),i.apply(i,o[e])].concat(r.slice(s)))}else n.apply(console,["%c"+t,i.apply(i,o[e])].concat(r))},s.pipe=function(){},t.exports=s},680(t,e,r){t.exports=r(14)("UklGRiYAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQIAAAAAAA==")},692(t,e,r){var n=r(408),i=[],o=new n;o.write=function(t,e,r){i.push([t,e,r])},o.get=function(){return i},o.empty=function(){i=[]},t.exports=o},740(t,e,r){var n=r(408),i=(new Date).valueOf().toString(36);function o(t){this.url=t.url||"",this.cache=[],this.timer=null,this.interval=t.interval||3e4,this.enabled=!0,this.jQuery=window.jQuery,this.extras={}}n.mixin(o),o.prototype.write=function(t,e,r){this.timer||this.init(),this.cache.push([t,e].concat(r))},o.prototype.init=function(){if(this.enabled&&this.jQuery){var t=this;this.timer=setTimeout(function(){var e,r,n=[],o=t.url;if(0==t.cache.length)return t.init();for(e=0;e<t.cache.length;e++)try{JSON.stringify(t.cache[e]),n.push(t.cache[e])}catch(t){}t.jQuery.isEmptyObject(t.extras)?(r=JSON.stringify({logs:n}),o=t.url+"?client_id="+i):r=JSON.stringify(t.jQuery.extend({logs:n},t.extras)),t.jQuery.ajax(o,{type:"POST",cache:!1,processData:!1,data:r,contentType:"application/json",timeout:1e4}).success(function(e,r,n){e.interval&&(t.interval=Math.max(1e3,e.interval))}).error(function(){t.interval=3e4}).always(function(){t.init()}),t.cache=[]},this.interval)}},o.prototype.end=function(){},o.jQueryWait=function(t){if("undefined"!=typeof window&&(window.jQuery||window.$))return t(window.jQuery||window.$);"undefined"!=typeof window&&setTimeout(function(){o.jQueryWait(t)},200)},t.exports=o},767(t,e,r){"use strict";!function(t){function e(){}function r(){}var n=String.fromCharCode,i={}.toString,o=i.call(t.SharedArrayBuffer),s=i(),u=t.Uint8Array,a=u||Array,f=u?ArrayBuffer:a,c=f.isView||function(t){return t&&"length"in t},h=i.call(f.prototype);f=r.prototype;var l=t.TextEncoder,p=new(u?Uint16Array:a)(32);e.prototype.decode=function(t){if(!c(t)){var e=i.call(t);if(e!==h&&e!==o&&e!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");t=u?new a(t):t||[]}for(var r,f,l,d=e="",y=0,g=0|t.length,w=g-32|0,b=0,_=0,m=0,A=-1;y<g;){for(r=y<=w?32:g-y|0;m<r;y=y+1|0,m=m+1|0){switch((f=255&t[y])>>4){case 15:if(2!=(l=255&t[y=y+1|0])>>6||247<f){y=y-1|0;break}b=(7&f)<<6|63&l,_=5,f=256;case 14:b<<=6,b|=(15&f)<<6|63&(l=255&t[y=y+1|0]),_=2==l>>6?_+4|0:24,f=f+256&768;case 13:case 12:b<<=6,b|=(31&f)<<6|63&(l=255&t[y=y+1|0]),_=_+7|0,y<g&&2==l>>6&&b>>_&&1114112>b?(f=b,0<=(b=b-65536|0)&&(A=55296+(b>>10)|0,f=56320+(1023&b)|0,31>m?(p[m]=A,m=m+1|0,A=-1):(l=A,A=f,f=l))):(y=y-(f>>=8)-1|0,f=65533),b=_=0,r=y<=w?32:g-y|0;default:p[m]=f;continue;case 11:case 10:case 9:case 8:}p[m]=65533}if(d+=n(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]),32>m&&(d=d.slice(0,m-32|0)),y<g){if(p[0]=A,m=~A>>>31,A=-1,d.length<e.length)continue}else-1!==A&&(d+=n(A));e+=d,d=""}return e},f.encode=function(t){var e,r=0|(t=void 0===t?"":""+t).length,n=new a(8+(r<<1)|0),i=0,o=!u;for(e=0;e<r;e=e+1|0,i=i+1|0){var s=0|t.charCodeAt(e);if(127>=s)n[i]=s;else{if(2047>=s)n[i]=192|s>>6;else{t:{if(55296<=s)if(56319>=s){var f=0|t.charCodeAt(e=e+1|0);if(56320<=f&&57343>=f){if(65535<(s=(s<<10)+f-56613888|0)){n[i]=240|s>>18,n[i=i+1|0]=128|s>>12&63,n[i=i+1|0]=128|s>>6&63,n[i=i+1|0]=128|63&s;continue}break t}s=65533}else 57343>=s&&(s=65533);!o&&e<<1<i&&e<<1<(i-7|0)&&(o=!0,(f=new a(3*r)).set(n),n=f)}n[i]=224|s>>12,n[i=i+1|0]=128|s>>6&63}n[i=i+1|0]=128|63&s}}return u?n.subarray(0,i):n.slice(0,i)},l||(t.TextDecoder=e,t.TextEncoder=r)}(""+void 0==typeof r.g?""+void 0==typeof self?this:self:r.g)},914(t,e,r){t.exports=r(14)("PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8Zz4KICA8cmVjdCBmaWxsPSIjQ0NDIiBoZWlnaHQ9IjEyOCIgd2lkdGg9IjEyOCIvPgogIDx0ZXh0IGZpbGw9ImJsYWNrIiB5PSIxMDciIHg9IjM1LjUiIGZvbnQtc2l6ZT0iMTI4Ij4/PC90ZXh0PgogPC9nPgo8L3N2Zz4K")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdO={},__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var r in e)__webpack_require__.o(e,r)&&!__webpack_require__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__webpack_require__.u=t=>"chunks/fetch-worker.9fbe108071a9c5d6e70b.js",__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.p="/",__webpack_require__.b="undefined"!=typeof document&&document.baseURI||self.location.href;var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Asset:()=>c,AssetType:()=>l,DataFormat:()=>h,Helper:()=>d,ScratchStorage:()=>it});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{Headers:()=>j,RequestMetadata:()=>P,applyMetadata:()=>D,getMetadata:()=>G,hasMetadata:()=>L,scratchFetch:()=>N,setMetadata:()=>F,unsetMetadata:()=>q});var e=__webpack_require__(557),r=__webpack_require__.n(e);r().enable();const n=r()("storage");var i=__webpack_require__(386),o=__webpack_require__.n(i);let s,u;if("undefined"==typeof TextDecoder||"undefined"==typeof TextEncoder){const t=__webpack_require__(767);s=t.TextDecoder,u=t.TextEncoder}else s=TextDecoder,u=TextEncoder;const a=function(){let t=null;const e={};return(r,n)=>{if(!Object.prototype.hasOwnProperty.call(e,r))if("undefined"==typeof btoa){const t=__webpack_require__(526);e[r]=t.fromByteArray(n)}else{if(null===t){t=new Array(256);for(let e=0;e<256;e++)t[e]=String.fromCharCode(e)}const{length:i}=n;let o="";for(let e=0,r=0;e<i;e=r){r=Math.min(r+32766,i);let s="";for(let i=e;i<r;i+=1)s+=t[n[i]];o+=btoa(s)}e[r]=o}return e[r]}}();function f(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class c{constructor(t,e,r,n,i){f(this,"assetType",void 0),f(this,"assetId",void 0),f(this,"data",void 0),f(this,"dataFormat",void 0),f(this,"dependencies",void 0),f(this,"clean",void 0),this.assetType=t,this.assetId=e,this.setData(n,r||t.runtimeFormat,i),this.dependencies=[]}setData(t,e,r){if(t&&!e)throw new Error("Data provided without specifying its format");this.dataFormat=e,this.data=t,r&&(this.assetId=o()(t)),this.clean=!r}decodeText(){return(new s).decode(this.data)}encodeTextData(t,e,r){const n=new u;this.setData(n.encode(t),e,r)}encodeDataURI(t){return t=t||this.assetType.contentType,"data:".concat(t,";base64,").concat(a(this.assetId,this.data))}}const h={JPG:"jpg",JSON:"json",MP3:"mp3",PNG:"png",SB2:"sb2",SB3:"sb3",SVG:"svg",WAV:"wav"},l={ImageBitmap:{contentType:"image/png",name:"ImageBitmap",runtimeFormat:h.PNG,immutable:!0},ImageVector:{contentType:"image/svg+xml",name:"ImageVector",runtimeFormat:h.SVG,immutable:!0},Project:{contentType:"application/json",name:"Project",runtimeFormat:h.JSON,immutable:!1},Sound:{contentType:"audio/x-wav",name:"Sound",runtimeFormat:h.WAV,immutable:!0},Sprite:{contentType:"application/json",name:"Sprite",runtimeFormat:h.JSON,immutable:!0}};function p(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class d{constructor(t){p(this,"parent",void 0),this.parent=t}load(t,e,r){return Promise.reject(new Error("No asset of type ".concat(t," for ID ").concat(e," with format ").concat(r)))}}var y=__webpack_require__(9),g=__webpack_require__.n(y),w=__webpack_require__(680),b=__webpack_require__.n(w),_=__webpack_require__(914),m=__webpack_require__.n(_),A=__webpack_require__(287);function v(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const E=[{type:l.ImageBitmap,format:h.PNG,id:null,data:A.hp.from(g())},{type:l.Sound,format:h.WAV,id:null,data:A.hp.from(b())},{type:l.ImageVector,format:h.SVG,id:null,data:A.hp.from(m())}],S=E.concat([]);class B extends d{constructor(t){super(t),v(this,"assets",void 0),this.assets={},S.forEach(t=>{t.id=this._store(t.type,t.format,t.data,t.id)})}registerDefaultAssets(){const t=E.length;for(let e=0;e<t;++e){const t=E[e];this.parent.setDefaultAssetId(t.type,t.id)}}get(t){let e=null;if(Object.prototype.hasOwnProperty.call(this.assets,t)){const r=this.assets[t];e=new c(r.type,r.id,r.format,r.data)}return e}cache(t,e,r,i){return n.warn("Deprecation: BuiltinHelper.cache has been replaced with BuiltinHelper.store."),this.store(t,e,r,i)}store(t,e,r,i){return n.warn("Deprecation: use Storage.createAsset. BuiltinHelper is for internal use only."),this._store(t,e,r,i)}_store(t,e,r,n){let i=n;if(!e)throw new Error("Data cached without specifying its format");if(""!==i&&null!=i){if(Object.prototype.hasOwnProperty.call(this.assets,i)&&t.immutable)return i}else{if(!t.immutable)throw new Error("Tried to cache data without an id");i=o()(r)}return this.assets[i]={type:t,format:e,id:i,data:r},i}load(t,e){return this.get(e)?Promise.resolve(this.get(e)):null}}const R="Queue cost limit exceeded",I="Task aborted",O="Task cancelled",T="Task cost exceeds maximum bucket size";function k(){let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}}var C=class{cost;promise;run;cancel;constructor(t,e={}){this.cost=e.cost??1;let{promise:r,resolve:n,reject:i}=k();this.promise=r,this.cancel=t=>{i(t)},this.run=async()=>{try{n(await t())}catch(t){i(t)}}}},U=class{burstLimit;sustainRate;queueCostLimit;concurrencyLimit;tokenCount;runningTasks=0;pendingTaskRecords=[];lastRefillTime=Date.now();onTaskAdded=k().resolve;onTaskFinished=k().resolve;constructor(t){this.burstLimit=t.burstLimit,this.sustainRate=t.sustainRate,this.tokenCount=t.startingTokens??t.burstLimit,this.queueCostLimit=t.queueCostLimit??1/0,this.concurrencyLimit=t.concurrency??1,this.runTasks()}get length(){return this.pendingTaskRecords.length}get options(){return{burstLimit:this.burstLimit,sustainRate:this.sustainRate,startingTokens:this.tokenCount,queueCostLimit:this.queueCostLimit,concurrency:this.concurrencyLimit}}do(t,e={}){let r=new C(t,e);return r.cost>this.burstLimit?Promise.reject(Error(T)):this.queueCostLimit<1/0&&this.pendingTaskRecords.reduce((t,e)=>t+e.cost,r.cost)>this.queueCostLimit?Promise.reject(Error(R)):(this.pendingTaskRecords.push(r),e.signal?.addEventListener("abort",()=>{this.cancel(r.promise,Error(I))}),this.onTaskAdded(),r.promise)}cancel(t,e){let r=this.pendingTaskRecords.findIndex(e=>e.promise===t);if(-1!==r){let[t]=this.pendingTaskRecords.splice(r,1);return t.cancel(e??Error(O)),!0}return!1}cancelAll(t){let e=this.pendingTaskRecords;return this.pendingTaskRecords=[],t??=Error(O),e.forEach(e=>{e.cancel(t)}),e.length}refillAndSpend(t){return this.refill(),this.spend(t)}refill(){let t=Date.now(),e=t-this.lastRefillTime;if(e<=0)return;this.lastRefillTime=t;let r=e/1e3*this.sustainRate;this.tokenCount=Math.min(this.burstLimit,this.tokenCount+r)}spend(t){return this.tokenCount>=t&&(this.tokenCount-=t,!0)}async runTasks(){for(;;){let t=this.pendingTaskRecords.shift();if(!t){let{promise:t,resolve:e}=k();this.onTaskAdded=e,await t;continue}if(t.cost>this.burstLimit)t.cancel(Error(T));else if(this.refillAndSpend(t.cost)){if(this.runningTasks>=this.concurrencyLimit){let{promise:t,resolve:e}=k();this.onTaskFinished=e,await t}this.runTask(t)}else{this.pendingTaskRecords.unshift(t);let e=Math.max(t.cost-this.tokenCount,0),r=Math.ceil(1e3*e/this.sustainRate);await new Promise(t=>setTimeout(t,r))}}}async runTask(t){this.runningTasks++;try{await t.run()}finally{this.runningTasks--,this.onTaskFinished()}}};const x={burstLimit:64,sustainRate:64,concurrency:64},H=new class{queues;defaultOptions;constructor(t,e){this.queues=new Map(e),this.defaultOptions=t}create(t,e={}){let r=new U({...this.defaultOptions,...e});return this.queues.set(t,r),r}get(t){return this.queues.get(t)}getOrCreate(t,e={}){return this.get(t)??this.create(t,e)}options(){return{...this.defaultOptions}}}({burstLimit:5,sustainRate:1,concurrency:1}),j=globalThis.Headers;var P;!function(t){t.ProjectId="X-Project-ID",t.RunId="X-Run-ID"}(P||(P={}));const M=new j,L=()=>{if(!("undefined"!=typeof self&&self&&self.location&&self.location.search&&self.location.search.split(/[?&]/)||[]).includes("scratchMetadata=1"))return!1;for(const t of M)return!0;return!1},D=t=>{if(L()){const e=Object.assign({},t);if(e.headers=new j(M),t&&t.headers){const r=t.headers instanceof j?t.headers:new j(t.headers);for(const[t,n]of r.entries())e.headers.set(t,n)}return e}return t},N=(t,e,r)=>{e=D(e);let n=null==r?void 0:r.queueName;n||(t=new Request(t,e),n=new URL(t.url).hostname);return H.getOrCreate(n,null==r?void 0:r.queueOptions).do(()=>fetch(t,e))},F=(t,e)=>{M.set(t,e)},q=t=>{M.delete(t)},G=t=>M.get(t),W=["url"];function X(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Q{constructor(){X(this,"_workerSupport",void 0),X(this,"_supportError",void 0),X(this,"worker",void 0),X(this,"jobs",void 0),this._workerSupport={fetch:"undefined"!=typeof fetch},this._supportError=null,this.worker=null,this.jobs={};try{if(this.isGetSupported){const t=new Worker(new URL(__webpack_require__.p+__webpack_require__.u(836),__webpack_require__.b));t.addEventListener("message",t=>{let{data:e}=t;if(e.support)this._workerSupport=e.support;else for(const t of e){const e=this.jobs[t.id];e&&(t.error?e.reject(t.error):e.resolve(t.buffer),delete this.jobs[t.id])}}),this.worker=t}}catch(t){this._supportError=t}}get isGetSupported(){return"undefined"!=typeof Worker&&this._workerSupport.fetch&&!this._supportError}get(t){let{url:e}=t,r=function(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}(t,W);const n=this.worker;return n?new Promise((t,i)=>{const o=Math.random().toString(16).substring(2),s=D(Object.assign({method:"GET"},r));s&&s.headers instanceof j&&(s.headers=Array.from(s.headers.entries())),n.postMessage({id:o,url:e,options:s}),this.jobs[o]={id:o,resolve:t,reject:i}}).then(t=>t?new Uint8Array(t):null):Promise.reject(new Error("The worker could not be initialized"))}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}static get instance(){return this._instance||(this._instance=new Q),this._instance}}X(Q,"_instance",void 0);class J{constructor(){X(this,"inner",void 0),this.inner=Q.instance}get isGetSupported(){return this.inner.isGetSupported}get(t){return this.inner.get(t)}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}}const Y=["url"],V=["url","withCredentials"];function z(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}class Z{get isGetSupported(){return!0}get(t){let{url:e}=t,r=z(t,Y);return N(e,Object.assign({method:"GET"},r),{queueOptions:x}).then(t=>t.ok?t.arrayBuffer().then(t=>new Uint8Array(t)):404===t.status?null:Promise.reject(t.status))}get isSendSupported(){return!0}send(t){let{url:e,withCredentials:r=!1}=t,n=z(t,V);return N(e,Object.assign({credentials:r?"include":"omit"},n),{queueOptions:x}).then(t=>t.ok?t.text():Promise.reject(t.status))}}function $(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class K{constructor(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K.TOOL_FILTER.ALL;$(this,"tools",void 0),t=e===K.TOOL_FILTER.READY?[new Z]:[new J,new Z],this.tools=t}get isGetSupported(){return this.tools.some(t=>t.isGetSupported)}get(t){let e=0;const r=n=>{const i=this.tools[e++];if(!i)throw n;return i.isGetSupported?i.get(t).catch(r):r(n)};return r()}get isSendSupported(){return this.tools.some(t=>t.isSendSupported)}send(t){let e=0;const r=n=>{const i=this.tools[e++];if(!i)throw n;return i.isSendSupported?i.send(t).catch(r):r(n)};return r()}}function tt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}$(K,"TOOL_FILTER",{ALL:"all",READY:"ready"});const et=t=>"string"==typeof t?{url:t}:t;class rt extends d{constructor(t){super(t),tt(this,"stores",void 0),tt(this,"assetTool",void 0),tt(this,"projectTool",void 0),this.stores=[],this.assetTool=new K,this.projectTool=new K(K.TOOL_FILTER.READY)}addSource(t,e){n.warn("Deprecation: WebHelper.addSource has been replaced with WebHelper.addStore."),this.addStore(t,e)}addStore(t,e,r,n){this.stores.push({types:t.map(t=>t.name),get:e,create:r,update:n})}load(t,e,r){const n=[],i=this.stores.slice().filter(e=>e.types.indexOf(t.name)>=0),o=new c(t,e,r);let s=this.assetTool;"Project"===t.name&&(s=this.projectTool);let u=0;const a=t=>{t&&n.push(t);const e=i[u++],f=e&&e.get;if(f){const t=et(f(o));return!1===t?a():s.get(t).then(t=>t?(o.setData(t,r),o):a()).catch(a)}return n.length>0?Promise.reject(n):Promise.resolve(null)};return a()}store(t,e,r,n){const i=new c(t,n,e),o=""===n||null==n,s=this.stores.filter(e=>-1!==e.types.indexOf(t.name)&&(o&&e.create||e.update))[0],u=o?"post":"put";if(!s)return Promise.reject(new Error("No appropriate stores"));let a=this.assetTool;"Project"===t.name&&(a=this.projectTool);const f=et(o?s.create(i):s.update(i)),h=Object.assign({body:r,method:u},f);return a.send(h).then(t=>{if("string"==typeof t)try{t=JSON.parse(t)}catch(e){return t}return Object.assign({id:t["content-name"]||n},t)})}}function nt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class it{constructor(){nt(this,"defaultAssetId",void 0),nt(this,"builtinHelper",void 0),nt(this,"webHelper",void 0),nt(this,"_helpers",void 0),this.defaultAssetId={},this.builtinHelper=new B(this),this.webHelper=new rt(this),this.builtinHelper.registerDefaultAssets(),this._helpers=[{helper:this.builtinHelper,priority:100},{helper:this.webHelper,priority:-100}]}get Asset(){return c}get AssetType(){return l}get DataFormat(){return h}get scratchFetch(){return t}static get Asset(){return c}static get AssetType(){return l}addHelper(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._helpers.push({helper:t,priority:e}),this._helpers.sort((t,e)=>e.priority-t.priority)}get(t){return this.builtinHelper.get(t)}cache(t,e,r,i){return n.warn("Deprecation: Storage.cache is deprecated. Use Storage.createAsset, and store assets externally."),this.builtinHelper._store(t,e,r,i)}createAsset(t,e,r,n,i){if(!e)throw new Error("Tried to create asset without a dataFormat");return new c(t,n,e,r,i)}addWebStore(t,e,r,n){this.webHelper.addStore(t,e,r,n)}addWebSource(t,e){n.warn("Deprecation: Storage.addWebSource has been replaced by addWebStore."),this.addWebStore(t,e)}getDefaultAssetId(t){if(Object.prototype.hasOwnProperty.call(this.defaultAssetId,t.name))return this.defaultAssetId[t.name]}setDefaultAssetId(t,e){this.defaultAssetId[t.name]=e}load(t,e,r){const n=this._helpers.map(t=>t.helper),i=[];r=r||t.runtimeFormat;let o,s=0;const u=a=>{if(a&&i.push(a),o=n[s++],o){const n=o.load(t,e,r);return null===n?u():n.catch(u)}return i.length>0?Promise.reject(i):Promise.resolve(null)};return u()}store(t,e,r,n){return e=e||t.runtimeFormat,this.webHelper.store(t,e,r,n).then(n=>{const i="string"==typeof n?void 0:n.id;return this.builtinHelper._store(t,e,r,i),n})}}})(),__webpack_exports__})());
|
|
3
3
|
//# sourceMappingURL=scratch-storage.min.js.map
|
package/package.json
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scratch-storage",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Load and store project and asset files for Scratch 3.0",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"homepage": "https://github.com/scratchfoundation/scratch-storage#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/scratchfoundation/scratch-storage.git",
|
|
10
|
-
"sha": "
|
|
10
|
+
"sha": "ca9bec18592523c09d0882379ba2b5ff75ea436f"
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/node/scratch-storage.js",
|
|
13
13
|
"browser": "./dist/web/scratch-storage.js",
|
|
14
14
|
"types": "./dist/types/index.d.ts",
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "
|
|
16
|
+
"build": "npm run clean && webpack --mode=production",
|
|
17
|
+
"clean": "rimraf dist",
|
|
17
18
|
"commitmsg": "commitlint -e $GIT_PARAMS",
|
|
18
19
|
"coverage": "tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",
|
|
19
20
|
"prepare": "husky",
|
|
20
21
|
"semantic-release": "semantic-release",
|
|
21
22
|
"test": "npm run test:lint && jest \"test[\\\\/](unit|integration)\"",
|
|
23
|
+
"test:build": "jest \"test[\\\\/]build\"",
|
|
22
24
|
"test:clearCache": "jest --clearCache",
|
|
23
25
|
"test:integration": "jest \"test[\\\\/]integration\"",
|
|
24
26
|
"test:lint": "eslint",
|
|
@@ -31,10 +33,10 @@
|
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
35
|
"@babel/runtime": "^7.21.0",
|
|
36
|
+
"@scratch/task-herder": "12.3.1",
|
|
34
37
|
"arraybuffer-loader": "^1.0.3",
|
|
35
38
|
"base64-js": "^1.3.0",
|
|
36
39
|
"buffer": "6.0.3",
|
|
37
|
-
"cross-fetch": "^4.1.0",
|
|
38
40
|
"fastestsmallesttextencoderdecoder": "^1.0.7",
|
|
39
41
|
"js-md5": "^0.7.3",
|
|
40
42
|
"minilog": "^3.1.0"
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"@types/jest": "29.5.14",
|
|
51
53
|
"babel-loader": "9.2.1",
|
|
52
54
|
"eslint": "9.39.2",
|
|
53
|
-
"eslint-config-scratch": "12.0.
|
|
55
|
+
"eslint-config-scratch": "12.0.47",
|
|
54
56
|
"file-loader": "6.2.0",
|
|
55
57
|
"husky": "9.1.7",
|
|
56
58
|
"jest": "29.7.0",
|
package/src/FetchTool.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {AssetQueueOptions} from './HostQueues';
|
|
1
2
|
import {scratchFetch} from './scratchFetch';
|
|
2
3
|
import {ScratchGetRequest, ScratchSendRequest, Tool} from './Tool';
|
|
3
4
|
|
|
@@ -24,7 +25,7 @@ export class FetchTool implements Tool {
|
|
|
24
25
|
* @returns {Promise.<Uint8Array?>} Resolve to Buffer of data from server.
|
|
25
26
|
*/
|
|
26
27
|
get ({url, ...options}: ScratchGetRequest): Promise<Uint8Array | null> {
|
|
27
|
-
return scratchFetch(url, Object.assign({method: 'GET'}, options))
|
|
28
|
+
return scratchFetch(url, Object.assign({method: 'GET'}, options), {queueOptions: AssetQueueOptions})
|
|
28
29
|
.then((result: Response) => {
|
|
29
30
|
if (result.ok) return result.arrayBuffer().then(b => new Uint8Array(b));
|
|
30
31
|
if (result.status === 404) return null;
|
|
@@ -49,7 +50,7 @@ export class FetchTool implements Tool {
|
|
|
49
50
|
send ({url, withCredentials = false, ...options}: ScratchSendRequest): Promise<string> {
|
|
50
51
|
return scratchFetch(url, Object.assign({
|
|
51
52
|
credentials: withCredentials ? 'include' : 'omit'
|
|
52
|
-
}, options))
|
|
53
|
+
}, options), {queueOptions: AssetQueueOptions})
|
|
53
54
|
.then(response => {
|
|
54
55
|
if (response.ok) return response.text();
|
|
55
56
|
return Promise.reject(response.status);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* eslint-env worker */
|
|
2
|
+
/* eslint-disable-next-line spaced-comment */
|
|
3
|
+
/// <reference lib="webworker" />
|
|
4
|
+
|
|
5
|
+
// This worker won't share the same queue as the main thread, but throttling should be okay
|
|
6
|
+
// as long as we don't use FetchTool and FetchWorkerTool at the same time.
|
|
7
|
+
// TODO: Communicate metadata from the main thread to workers or move the worker boundary "into" `scratchFetch`.
|
|
8
|
+
// Make sure to benchmark any changes to avoid performance regressions, especially for large project loads.
|
|
9
|
+
import {AssetQueueOptions} from './HostQueues';
|
|
10
|
+
import {scratchFetch} from './scratchFetch';
|
|
11
|
+
|
|
12
|
+
interface JobMessage {
|
|
13
|
+
id: string;
|
|
14
|
+
url: string;
|
|
15
|
+
options: RequestInit | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface CompletionMessage {
|
|
19
|
+
id: string;
|
|
20
|
+
buffer?: ArrayBuffer | null;
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let jobsActive = 0;
|
|
25
|
+
const complete: CompletionMessage[] = [];
|
|
26
|
+
|
|
27
|
+
let intervalId: ReturnType<typeof setInterval> | undefined = void 0;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Register a step function.
|
|
31
|
+
*
|
|
32
|
+
* Step checks if there are completed jobs and if there are sends them to the
|
|
33
|
+
* parent. Then it checks the jobs count. If there are no further jobs, clear
|
|
34
|
+
* the step.
|
|
35
|
+
*/
|
|
36
|
+
const registerStep = function () {
|
|
37
|
+
intervalId = setInterval(() => {
|
|
38
|
+
if (complete.length) {
|
|
39
|
+
// Send our chunk of completed requests and instruct postMessage to
|
|
40
|
+
// transfer the buffers instead of copying them.
|
|
41
|
+
postMessage(
|
|
42
|
+
complete.slice(),
|
|
43
|
+
// Instruct postMessage that these buffers in the sent message
|
|
44
|
+
// should use their Transferable trait. After the postMessage
|
|
45
|
+
// call the "buffers" will still be in complete if you looked,
|
|
46
|
+
// but they will all be length 0 as the data they reference has
|
|
47
|
+
// been sent to the window. This lets us send a lot of data
|
|
48
|
+
// without the normal postMessage behaviour of making a copy of
|
|
49
|
+
// all of the data for the window.
|
|
50
|
+
complete.map(response => response.buffer).filter(Boolean) as Transferable[]
|
|
51
|
+
);
|
|
52
|
+
complete.length = 0;
|
|
53
|
+
}
|
|
54
|
+
if (jobsActive === 0) {
|
|
55
|
+
clearInterval(intervalId);
|
|
56
|
+
intervalId = void 0;
|
|
57
|
+
}
|
|
58
|
+
}, 1);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Receive a job from the parent and fetch the requested data.
|
|
63
|
+
* @param message The message from the parent.
|
|
64
|
+
* @param message.data A job id, url, and options descriptor to perform.
|
|
65
|
+
*/
|
|
66
|
+
const onMessage = async ({data: job}: MessageEvent<JobMessage>) => {
|
|
67
|
+
if (jobsActive === 0 && !intervalId) {
|
|
68
|
+
registerStep();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
jobsActive++;
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const response = await scratchFetch(job.url, job.options, {queueOptions: AssetQueueOptions});
|
|
75
|
+
|
|
76
|
+
const result: CompletionMessage = {id: job.id};
|
|
77
|
+
if (response.ok) {
|
|
78
|
+
result.buffer = await response.arrayBuffer();
|
|
79
|
+
} else if (response.status === 404) {
|
|
80
|
+
result.buffer = null;
|
|
81
|
+
} else {
|
|
82
|
+
throw response.status;
|
|
83
|
+
}
|
|
84
|
+
complete.push(result);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
complete.push({id: job.id, error: ((error as Error)?.message) || `Failed request: ${job.url}`});
|
|
87
|
+
} finally {
|
|
88
|
+
jobsActive--;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// "fetch" is supported in Node.js as of 16.15 and our target browsers as of ~2017
|
|
93
|
+
postMessage({support: {fetch: true}});
|
|
94
|
+
self.addEventListener('message', onMessage);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {QueueManager, type QueueOptions} from '@scratch/task-herder';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @summary A set of generous limits, for things like downloading assets from CDN.
|
|
5
|
+
* @description
|
|
6
|
+
* In practice, these limits seem to lead to slightly better performance than no limits at all, mostly due to the
|
|
7
|
+
* concurrency limit. For example, on my development computer & my relatively fast residential connection, a
|
|
8
|
+
* concurrency limit of 4 loads a particular test project in 21 seconds, as opposed to 25 seconds when I bypass the
|
|
9
|
+
* queue and call `fetch` directly. In that test, my setup downloads about 50 assets per second, so this set of options
|
|
10
|
+
* only affects concurrency and doesn't actually throttle the downloads. Limiting concurrency also fixes the issue
|
|
11
|
+
* where very large projects (thousands of assets) can lead to browser failures like `net::ERR_INSUFFICIENT_RESOURCES`.
|
|
12
|
+
* The exact concurrency limit doesn't seem to matter much since the browser limits parallel connections itself. It
|
|
13
|
+
* just needs to be high enough to avoid bubbles in the download pipeline and low enough to avoid resource exhaustion.
|
|
14
|
+
* @see {@link https://github.com/scratchfoundation/scratch-gui/issues/7111}
|
|
15
|
+
*/
|
|
16
|
+
export const AssetQueueOptions: QueueOptions = {
|
|
17
|
+
burstLimit: 64,
|
|
18
|
+
sustainRate: 64,
|
|
19
|
+
// WARNING: asset download concurrency >=5 can lead to corrupted buffers on Chrome (December 2025, Chrome 142.0)
|
|
20
|
+
// when using Scratch's bitmap load pipeline. Marking the canvas context as `{willReadFrequently: true}` seems to
|
|
21
|
+
// eliminate that issue, so maybe the problem is related to hardware acceleration.
|
|
22
|
+
concurrency: 64
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Central registry of per-host queues.
|
|
27
|
+
* Uses strict limits by default. Override these strict limits as needed for specific hosts.
|
|
28
|
+
*/
|
|
29
|
+
export const hostQueueManager = new QueueManager({
|
|
30
|
+
burstLimit: 5,
|
|
31
|
+
sustainRate: 1,
|
|
32
|
+
concurrency: 1
|
|
33
|
+
});
|
package/src/ScratchStorage.ts
CHANGED
|
@@ -6,7 +6,7 @@ import WebHelper, {UrlFunction} from './WebHelper';
|
|
|
6
6
|
import _Asset, {AssetData, AssetId} from './Asset';
|
|
7
7
|
import {AssetType as _AssetType, AssetType} from './AssetType';
|
|
8
8
|
import {DataFormat as _DataFormat, DataFormat} from './DataFormat';
|
|
9
|
-
import _scratchFetch from './scratchFetch';
|
|
9
|
+
import * as _scratchFetch from './scratchFetch';
|
|
10
10
|
import Helper from './Helper';
|
|
11
11
|
|
|
12
12
|
interface HelperWithPriority {
|