scratch-storage 6.0.1 → 6.1.0
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/dist/node/chunks/{fetch-worker.7afe4ade866d6f6a3cb3.js → fetch-worker.35b372c60d5dbced60fa.js} +16 -3
- package/dist/node/chunks/fetch-worker.35b372c60d5dbced60fa.js.map +1 -0
- package/dist/node/scratch-storage.js +15 -1
- package/dist/node/scratch-storage.js.map +1 -1
- package/dist/types/scratchFetch.d.ts +11 -0
- package/dist/web/chunks/{fetch-worker.9fbe108071a9c5d6e70b.js → fetch-worker.881578c221a680573772.js} +1 -1
- package/dist/web/chunks/{fetch-worker.9fbe108071a9c5d6e70b.js.map → fetch-worker.881578c221a680573772.js.map} +1 -1
- package/dist/web/chunks/{fetch-worker.efebf27d479ab0f0d98c.js → fetch-worker.f865243047f8d2a9ab59.js} +16 -3
- package/dist/web/chunks/fetch-worker.f865243047f8d2a9ab59.js.map +1 -0
- package/dist/web/scratch-storage.js +15 -1
- package/dist/web/scratch-storage.js.map +1 -1
- package/dist/web/scratch-storage.min.js +1 -1
- package/package.json +2 -2
- package/src/scratchFetch.ts +14 -0
- package/dist/node/chunks/fetch-worker.7afe4ade866d6f6a3cb3.js.map +0 -1
- package/dist/web/chunks/fetch-worker.efebf27d479ab0f0d98c.js.map +0 -1
|
@@ -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),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__})());
|
|
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.881578c221a680573772.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:()=>ot});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{Headers:()=>j,RequestMetadata:()=>P,applyMetadata:()=>D,createQueue:()=>F,getMetadata:()=>W,hasMetadata:()=>L,scratchFetch:()=>N,setMetadata:()=>q,unsetMetadata:()=>G});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)=>{H.create(t,e)},q=(t,e)=>{M.set(t,e)},G=t=>{M.delete(t)},W=t=>M.get(t),X=["url"];function Q(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 J{constructor(){Q(this,"_workerSupport",void 0),Q(this,"_supportError",void 0),Q(this,"worker",void 0),Q(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,X);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 J),this._instance}}Q(J,"_instance",void 0);class Y{constructor(){Q(this,"inner",void 0),this.inner=J.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 V=["url"],z=["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 ${get isGetSupported(){return!0}get(t){let{url:e}=t,r=Z(t,V);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,z);return N(e,Object.assign({credentials:r?"include":"omit"},n),{queueOptions:x}).then(t=>t.ok?t.text():Promise.reject(t.status))}}function K(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 tt{constructor(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tt.TOOL_FILTER.ALL;K(this,"tools",void 0),t=e===tt.TOOL_FILTER.READY?[new $]:[new Y,new $],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 et(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(tt,"TOOL_FILTER",{ALL:"all",READY:"ready"});const rt=t=>"string"==typeof t?{url:t}:t;class nt extends d{constructor(t){super(t),et(this,"stores",void 0),et(this,"assetTool",void 0),et(this,"projectTool",void 0),this.stores=[],this.assetTool=new tt,this.projectTool=new tt(tt.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=rt(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=rt(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 it(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 ot{constructor(){it(this,"defaultAssetId",void 0),it(this,"builtinHelper",void 0),it(this,"webHelper",void 0),it(this,"_helpers",void 0),this.defaultAssetId={},this.builtinHelper=new B(this),this.webHelper=new nt(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,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scratch-storage",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
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": "70588fed9b252f2d8c3b0967f3cd805943034418"
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/node/scratch-storage.js",
|
|
13
13
|
"browser": "./dist/web/scratch-storage.js",
|
package/src/scratchFetch.ts
CHANGED
|
@@ -112,6 +112,20 @@ export const scratchFetch = (
|
|
|
112
112
|
return queue.do(() => fetch(resource, requestOptions));
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Create a new fetch queue with the given identifier and option overrides.
|
|
117
|
+
* If a queue with that identifier already exists, it will be replaced.
|
|
118
|
+
* Queues are automatically created as needed with default options, so
|
|
119
|
+
* there's no need to call this unless you need to override the default queue options.
|
|
120
|
+
* WARNING: If the old queue has is not empty, it may continue to run its tasks in the background.
|
|
121
|
+
* If you need to cancel fetch tasks in that queue before replacing it, do so manually first.
|
|
122
|
+
* @param queueName The name of the queue to create.
|
|
123
|
+
* @param overrides Optional overrides for the default QueueOptions for this specific queue.
|
|
124
|
+
*/
|
|
125
|
+
export const createQueue = (queueName: string, overrides: Partial<QueueOptions>): void => {
|
|
126
|
+
hostQueueManager.create(queueName, overrides);
|
|
127
|
+
};
|
|
128
|
+
|
|
115
129
|
/**
|
|
116
130
|
* Set the value of a named request metadata item.
|
|
117
131
|
* Setting the value to `null` or `undefined` will NOT remove the item.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/fetch-worker.7afe4ade866d6f6a3cb3.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrJA;AAEA;;;;;;;;;;;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;;AC/BA;AAEA;AAEA;;;;AAIA;AAAA;AACA;AACA;AACA;AACA;AACA;AAiBA;;;AAGA;AAEA;;;;AAIA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASA;AAKA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;AAOA;AACA;AACA;AAEA;;;;AAIA;AACA;AACA;AAEA;;;;;;AAMA;;AC3IA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AAEA;AAEA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;AAKA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA","sources":["webpack://scratch-storage/./node_modules/@scratch/task-herder/dist/task-herder.js","webpack://scratch-storage/./src/HostQueues.ts","webpack://scratch-storage/./src/scratchFetch.ts","webpack://scratch-storage/./src/FetchWorkerTool.worker.ts"],"sourcesContent":["const CancelReason = {\n\tQueueCostLimitExceeded: \"Queue cost limit exceeded\",\n\tAborted: \"Task aborted\",\n\tCancel: \"Task cancelled\",\n\tTaskTooExpensive: \"Task cost exceeds maximum bucket size\"\n};\nfunction PromiseWithResolvers() {\n\tlet e, t;\n\treturn {\n\t\tpromise: new Promise((n, r) => {\n\t\t\te = n, t = r;\n\t\t}),\n\t\tresolve: e,\n\t\treject: t\n\t};\n}\nvar TaskRecord = class {\n\tcost;\n\tpromise;\n\trun;\n\tcancel;\n\tconstructor(e, n = {}) {\n\t\tthis.cost = n.cost ?? 1;\n\t\tlet { promise: r, resolve: i, reject: a } = PromiseWithResolvers();\n\t\tthis.promise = r, this.cancel = (e) => {\n\t\t\ta(e);\n\t\t}, this.run = async () => {\n\t\t\ttry {\n\t\t\t\ti(await e());\n\t\t\t} catch (e) {\n\t\t\t\ta(e);\n\t\t\t}\n\t\t};\n\t}\n}, TaskQueue = class {\n\tburstLimit;\n\tsustainRate;\n\tqueueCostLimit;\n\tconcurrencyLimit;\n\ttokenCount;\n\trunningTasks = 0;\n\tpendingTaskRecords = [];\n\tlastRefillTime = Date.now();\n\tonTaskAdded = PromiseWithResolvers().resolve;\n\tonTaskFinished = PromiseWithResolvers().resolve;\n\tconstructor(e) {\n\t\tthis.burstLimit = e.burstLimit, this.sustainRate = e.sustainRate, this.tokenCount = e.startingTokens ?? e.burstLimit, this.queueCostLimit = e.queueCostLimit ?? Infinity, this.concurrencyLimit = e.concurrency ?? 1, this.runTasks();\n\t}\n\tget length() {\n\t\treturn this.pendingTaskRecords.length;\n\t}\n\tget options() {\n\t\treturn {\n\t\t\tburstLimit: this.burstLimit,\n\t\t\tsustainRate: this.sustainRate,\n\t\t\tstartingTokens: this.tokenCount,\n\t\t\tqueueCostLimit: this.queueCostLimit,\n\t\t\tconcurrency: this.concurrencyLimit\n\t\t};\n\t}\n\tdo(t, r = {}) {\n\t\tlet i = new TaskRecord(t, r);\n\t\treturn i.cost > this.burstLimit ? Promise.reject(Error(CancelReason.TaskTooExpensive)) : this.queueCostLimit < Infinity && this.pendingTaskRecords.reduce((e, t) => e + t.cost, i.cost) > this.queueCostLimit ? Promise.reject(Error(CancelReason.QueueCostLimitExceeded)) : (this.pendingTaskRecords.push(i), r.signal?.addEventListener(\"abort\", () => {\n\t\t\tthis.cancel(i.promise, Error(CancelReason.Aborted));\n\t\t}), this.onTaskAdded(), i.promise);\n\t}\n\tcancel(t, n) {\n\t\tlet r = this.pendingTaskRecords.findIndex((e) => e.promise === t);\n\t\tif (r !== -1) {\n\t\t\tlet [t] = this.pendingTaskRecords.splice(r, 1);\n\t\t\treturn t.cancel(n ?? Error(CancelReason.Cancel)), !0;\n\t\t}\n\t\treturn !1;\n\t}\n\tcancelAll(t) {\n\t\tlet n = this.pendingTaskRecords;\n\t\treturn this.pendingTaskRecords = [], t ??= Error(CancelReason.Cancel), n.forEach((e) => {\n\t\t\te.cancel(t);\n\t\t}), n.length;\n\t}\n\trefillAndSpend(e) {\n\t\treturn this.refill(), this.spend(e);\n\t}\n\trefill() {\n\t\tlet e = Date.now(), t = e - this.lastRefillTime;\n\t\tif (t <= 0) return;\n\t\tthis.lastRefillTime = e;\n\t\tlet n = t / 1e3 * this.sustainRate;\n\t\tthis.tokenCount = Math.min(this.burstLimit, this.tokenCount + n);\n\t}\n\tspend(e) {\n\t\treturn this.tokenCount >= e ? (this.tokenCount -= e, !0) : !1;\n\t}\n\tasync runTasks() {\n\t\tfor (;;) {\n\t\t\tlet n = this.pendingTaskRecords.shift();\n\t\t\tif (!n) {\n\t\t\t\tlet { promise: e, resolve: n } = PromiseWithResolvers();\n\t\t\t\tthis.onTaskAdded = n, await e;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (n.cost > this.burstLimit) {\n\t\t\t\tn.cancel(Error(CancelReason.TaskTooExpensive));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (this.refillAndSpend(n.cost)) {\n\t\t\t\tif (this.runningTasks >= this.concurrencyLimit) {\n\t\t\t\t\tlet { promise: e, resolve: n } = PromiseWithResolvers();\n\t\t\t\t\tthis.onTaskFinished = n, await e;\n\t\t\t\t}\n\t\t\t\tthis.runTask(n);\n\t\t\t} else {\n\t\t\t\tthis.pendingTaskRecords.unshift(n);\n\t\t\t\tlet e = Math.max(n.cost - this.tokenCount, 0), t = Math.ceil(1e3 * e / this.sustainRate);\n\t\t\t\tawait new Promise((e) => setTimeout(e, t));\n\t\t\t}\n\t\t}\n\t}\n\tasync runTask(e) {\n\t\tthis.runningTasks++;\n\t\ttry {\n\t\t\tawait e.run();\n\t\t} finally {\n\t\t\tthis.runningTasks--, this.onTaskFinished();\n\t\t}\n\t}\n}, QueueManager = class {\n\tqueues;\n\tdefaultOptions;\n\tconstructor(e, t) {\n\t\tthis.queues = new Map(t), this.defaultOptions = e;\n\t}\n\tcreate(e, t = {}) {\n\t\tlet n = new TaskQueue({\n\t\t\t...this.defaultOptions,\n\t\t\t...t\n\t\t});\n\t\treturn this.queues.set(e, n), n;\n\t}\n\tget(e) {\n\t\treturn this.queues.get(e);\n\t}\n\tgetOrCreate(e, t = {}) {\n\t\treturn this.get(e) ?? this.create(e, t);\n\t}\n\toptions() {\n\t\treturn { ...this.defaultOptions };\n\t}\n};\nexport { CancelReason, QueueManager, TaskQueue };\n","import {QueueManager, type QueueOptions} from '@scratch/task-herder';\n\n/**\n * @summary A set of generous limits, for things like downloading assets from CDN.\n * @description\n * In practice, these limits seem to lead to slightly better performance than no limits at all, mostly due to the\n * concurrency limit. For example, on my development computer & my relatively fast residential connection, a\n * concurrency limit of 4 loads a particular test project in 21 seconds, as opposed to 25 seconds when I bypass the\n * queue and call `fetch` directly. In that test, my setup downloads about 50 assets per second, so this set of options\n * only affects concurrency and doesn't actually throttle the downloads. Limiting concurrency also fixes the issue\n * where very large projects (thousands of assets) can lead to browser failures like `net::ERR_INSUFFICIENT_RESOURCES`.\n * The exact concurrency limit doesn't seem to matter much since the browser limits parallel connections itself. It\n * just needs to be high enough to avoid bubbles in the download pipeline and low enough to avoid resource exhaustion.\n * @see {@link https://github.com/scratchfoundation/scratch-gui/issues/7111}\n */\nexport const AssetQueueOptions: QueueOptions = {\n burstLimit: 64,\n sustainRate: 64,\n // WARNING: asset download concurrency >=5 can lead to corrupted buffers on Chrome (December 2025, Chrome 142.0)\n // when using Scratch's bitmap load pipeline. Marking the canvas context as `{willReadFrequently: true}` seems to\n // eliminate that issue, so maybe the problem is related to hardware acceleration.\n concurrency: 64\n};\n\n/**\n * Central registry of per-host queues.\n * Uses strict limits by default. Override these strict limits as needed for specific hosts.\n */\nexport const hostQueueManager = new QueueManager({\n burstLimit: 5,\n sustainRate: 1,\n concurrency: 1\n});\n","import {type QueueOptions} from '@scratch/task-herder';\nimport {hostQueueManager} from './HostQueues';\n\nexport const Headers = globalThis.Headers;\n\n/**\n * Metadata header names.\n * The enum value is the name of the associated header.\n */\nexport enum RequestMetadata {\n /** The ID of the project associated with this request */\n ProjectId = 'X-Project-ID',\n /** The ID of the project run associated with this request */\n RunId = 'X-Run-ID'\n}\n\nexport type ScratchFetchOptions = {\n /**\n * The name of the queue to use for this request.\n * If absent, the hostname of the requested URL will be used as the queue name.\n * This is a Scratch-specific extension to the standard RequestInit type.\n */\n queueName?: string;\n\n /**\n * The options to use when creating the queue for this request.\n * Ignored if a queue with the specified name already exists.\n */\n queueOptions?: QueueOptions;\n};\n\n/**\n * Metadata headers for requests.\n */\nconst metadata = new Headers();\n\n/**\n * Check if there is any metadata to apply.\n * @returns {boolean} true if `metadata` has contents, or false if it is empty.\n */\nexport const hasMetadata = (): boolean => {\n const searchParams = (\n typeof self !== 'undefined' &&\n self &&\n self.location &&\n self.location.search &&\n self.location.search.split(/[?&]/)\n ) || [];\n if (!searchParams.includes('scratchMetadata=1')) {\n // for now, disable this feature unless scratchMetadata=1\n // TODO: remove this check once we're sure the feature works correctly in production\n return false;\n }\n for (const _ of metadata) {\n return true;\n }\n return false;\n};\n\n/**\n * Non-destructively merge any metadata state (if any) with the provided options object (if any).\n * If there is metadata state but no options object is provided, make a new object.\n * If there is no metadata state, return the provided options parameter without modification.\n * If there is metadata and an options object is provided, modify a copy and return it.\n * Headers in the provided options object may override headers generated from metadata state.\n * @param {RequestInit} [options] The initial request options. May be null or undefined.\n * @returns {RequestInit|undefined} the provided options parameter without modification, or a new options object.\n */\nexport const applyMetadata = (options?: globalThis.RequestInit): globalThis.RequestInit | undefined => {\n if (hasMetadata()) {\n const augmentedOptions = Object.assign({}, options);\n augmentedOptions.headers = new Headers(metadata);\n if (options && options.headers) {\n // the Fetch spec says options.headers could be:\n // \"A Headers object, an object literal, or an array of two-item arrays to set request's headers.\"\n // turn it into a Headers object to be sure of how to interact with it\n const overrideHeaders = options.headers instanceof Headers ?\n options.headers : new Headers(options.headers);\n for (const [name, value] of overrideHeaders.entries()) {\n augmentedOptions.headers.set(name, value);\n }\n }\n return augmentedOptions;\n }\n return options;\n};\n\n/**\n * Make a network request.\n * This is a wrapper for the global fetch method, adding some Scratch-specific functionality.\n * @param {RequestInfo|URL} resource The resource to fetch.\n * @param {RequestInit} [requestOptions] Optional object containing custom settings for this request.\n * @param {ScratchFetchOptions} [scratchOptions] Optional Scratch-specific settings for this request.\n * @see {@link https://developer.mozilla.org/docs/Web/API/fetch} for more about the fetch API.\n * @returns {Promise<Response>} A promise for the response to the request.\n */\nexport const scratchFetch = (\n resource: RequestInfo | URL,\n requestOptions?: globalThis.RequestInit,\n scratchOptions?: ScratchFetchOptions\n): Promise<Response> => {\n requestOptions = applyMetadata(requestOptions);\n\n let queueName = scratchOptions?.queueName;\n if (!queueName) {\n // Normalize resource to a Request object. The `fetch` call will do this anyway, so it's not much extra work,\n // but it guarantees availability of the URL for queue naming.\n resource = new Request(resource, requestOptions);\n queueName = new URL(resource.url).hostname;\n }\n const queue = hostQueueManager.getOrCreate(queueName, scratchOptions?.queueOptions);\n return queue.do(() => fetch(resource, requestOptions));\n};\n\n/**\n * Set the value of a named request metadata item.\n * Setting the value to `null` or `undefined` will NOT remove the item.\n * Use `unsetMetadata` for that.\n * @param {RequestMetadata} name The name of the metadata item to set.\n * @param {any} value The value to set (will be converted to a string).\n */\nexport const setMetadata = (name: RequestMetadata, value: any): void => {\n metadata.set(name, value);\n};\n\n/**\n * Remove a named request metadata item.\n * @param {RequestMetadata} name The name of the metadata item to remove.\n */\nexport const unsetMetadata = (name: RequestMetadata): void => {\n metadata.delete(name);\n};\n\n/**\n * Retrieve a named request metadata item.\n * Only for use in tests. At the time of writing, used in scratch-vm tests.\n * @param {RequestMetadata} name The name of the metadata item to retrieve.\n * @returns {string|null} The value of the metadata item, or `null` if it was not found.\n */\nexport const getMetadata = (name: RequestMetadata): string | null => metadata.get(name);\n","/* eslint-env worker */\n/* eslint-disable-next-line spaced-comment */\n/// <reference lib=\"webworker\" />\n\n// This worker won't share the same queue as the main thread, but throttling should be okay\n// as long as we don't use FetchTool and FetchWorkerTool at the same time.\n// TODO: Communicate metadata from the main thread to workers or move the worker boundary \"into\" `scratchFetch`.\n// Make sure to benchmark any changes to avoid performance regressions, especially for large project loads.\nimport {AssetQueueOptions} from './HostQueues';\nimport {scratchFetch} from './scratchFetch';\n\ninterface JobMessage {\n id: string;\n url: string;\n options: RequestInit | undefined;\n}\n\ninterface CompletionMessage {\n id: string;\n buffer?: ArrayBuffer | null;\n error?: string;\n}\n\nlet jobsActive = 0;\nconst complete: CompletionMessage[] = [];\n\nlet intervalId: ReturnType<typeof setInterval> | undefined = void 0;\n\n/**\n * Register a step function.\n *\n * Step checks if there are completed jobs and if there are sends them to the\n * parent. Then it checks the jobs count. If there are no further jobs, clear\n * the step.\n */\nconst registerStep = function () {\n intervalId = setInterval(() => {\n if (complete.length) {\n // Send our chunk of completed requests and instruct postMessage to\n // transfer the buffers instead of copying them.\n postMessage(\n complete.slice(),\n // Instruct postMessage that these buffers in the sent message\n // should use their Transferable trait. After the postMessage\n // call the \"buffers\" will still be in complete if you looked,\n // but they will all be length 0 as the data they reference has\n // been sent to the window. This lets us send a lot of data\n // without the normal postMessage behaviour of making a copy of\n // all of the data for the window.\n complete.map(response => response.buffer).filter(Boolean) as Transferable[]\n );\n complete.length = 0;\n }\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = void 0;\n }\n }, 1);\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param message The message from the parent.\n * @param message.data A job id, url, and options descriptor to perform.\n */\nconst onMessage = async ({data: job}: MessageEvent<JobMessage>) => {\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n\n try {\n const response = await scratchFetch(job.url, job.options, {queueOptions: AssetQueueOptions});\n\n const result: CompletionMessage = {id: job.id};\n if (response.ok) {\n result.buffer = await response.arrayBuffer();\n } else if (response.status === 404) {\n result.buffer = null;\n } else {\n throw response.status;\n }\n complete.push(result);\n } catch (error) {\n complete.push({id: job.id, error: ((error as Error)?.message) || `Failed request: ${job.url}`});\n } finally {\n jobsActive--;\n }\n};\n\n// \"fetch\" is supported in Node.js as of 16.15 and our target browsers as of ~2017\npostMessage({support: {fetch: true}});\nself.addEventListener('message', onMessage);\n"],"names":[],"ignoreList":[],"sourceRoot":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/fetch-worker.efebf27d479ab0f0d98c.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrJA;AAEA;;;;;;;;;;;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;;AC/BA;AAEA;AAEA;;;;AAIA;AAAA;AACA;AACA;AACA;AACA;AACA;AAiBA;;;AAGA;AAEA;;;;AAIA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASA;AAKA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;AAOA;AACA;AACA;AAEA;;;;AAIA;AACA;AACA;AAEA;;;;;;AAMA;;AC3IA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AAEA;AAEA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;AAKA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA","sources":["webpack://ScratchStorage/webpack/universalModuleDefinition","webpack://ScratchStorage/./node_modules/@scratch/task-herder/dist/task-herder.js","webpack://ScratchStorage/./src/HostQueues.ts","webpack://ScratchStorage/./src/scratchFetch.ts","webpack://ScratchStorage/./src/FetchWorkerTool.worker.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ScratchStorage\"] = factory();\n\telse\n\t\troot[\"ScratchStorage\"] = factory();\n})(self, () => {\nreturn ","const CancelReason = {\n\tQueueCostLimitExceeded: \"Queue cost limit exceeded\",\n\tAborted: \"Task aborted\",\n\tCancel: \"Task cancelled\",\n\tTaskTooExpensive: \"Task cost exceeds maximum bucket size\"\n};\nfunction PromiseWithResolvers() {\n\tlet e, t;\n\treturn {\n\t\tpromise: new Promise((n, r) => {\n\t\t\te = n, t = r;\n\t\t}),\n\t\tresolve: e,\n\t\treject: t\n\t};\n}\nvar TaskRecord = class {\n\tcost;\n\tpromise;\n\trun;\n\tcancel;\n\tconstructor(e, n = {}) {\n\t\tthis.cost = n.cost ?? 1;\n\t\tlet { promise: r, resolve: i, reject: a } = PromiseWithResolvers();\n\t\tthis.promise = r, this.cancel = (e) => {\n\t\t\ta(e);\n\t\t}, this.run = async () => {\n\t\t\ttry {\n\t\t\t\ti(await e());\n\t\t\t} catch (e) {\n\t\t\t\ta(e);\n\t\t\t}\n\t\t};\n\t}\n}, TaskQueue = class {\n\tburstLimit;\n\tsustainRate;\n\tqueueCostLimit;\n\tconcurrencyLimit;\n\ttokenCount;\n\trunningTasks = 0;\n\tpendingTaskRecords = [];\n\tlastRefillTime = Date.now();\n\tonTaskAdded = PromiseWithResolvers().resolve;\n\tonTaskFinished = PromiseWithResolvers().resolve;\n\tconstructor(e) {\n\t\tthis.burstLimit = e.burstLimit, this.sustainRate = e.sustainRate, this.tokenCount = e.startingTokens ?? e.burstLimit, this.queueCostLimit = e.queueCostLimit ?? Infinity, this.concurrencyLimit = e.concurrency ?? 1, this.runTasks();\n\t}\n\tget length() {\n\t\treturn this.pendingTaskRecords.length;\n\t}\n\tget options() {\n\t\treturn {\n\t\t\tburstLimit: this.burstLimit,\n\t\t\tsustainRate: this.sustainRate,\n\t\t\tstartingTokens: this.tokenCount,\n\t\t\tqueueCostLimit: this.queueCostLimit,\n\t\t\tconcurrency: this.concurrencyLimit\n\t\t};\n\t}\n\tdo(t, r = {}) {\n\t\tlet i = new TaskRecord(t, r);\n\t\treturn i.cost > this.burstLimit ? Promise.reject(Error(CancelReason.TaskTooExpensive)) : this.queueCostLimit < Infinity && this.pendingTaskRecords.reduce((e, t) => e + t.cost, i.cost) > this.queueCostLimit ? Promise.reject(Error(CancelReason.QueueCostLimitExceeded)) : (this.pendingTaskRecords.push(i), r.signal?.addEventListener(\"abort\", () => {\n\t\t\tthis.cancel(i.promise, Error(CancelReason.Aborted));\n\t\t}), this.onTaskAdded(), i.promise);\n\t}\n\tcancel(t, n) {\n\t\tlet r = this.pendingTaskRecords.findIndex((e) => e.promise === t);\n\t\tif (r !== -1) {\n\t\t\tlet [t] = this.pendingTaskRecords.splice(r, 1);\n\t\t\treturn t.cancel(n ?? Error(CancelReason.Cancel)), !0;\n\t\t}\n\t\treturn !1;\n\t}\n\tcancelAll(t) {\n\t\tlet n = this.pendingTaskRecords;\n\t\treturn this.pendingTaskRecords = [], t ??= Error(CancelReason.Cancel), n.forEach((e) => {\n\t\t\te.cancel(t);\n\t\t}), n.length;\n\t}\n\trefillAndSpend(e) {\n\t\treturn this.refill(), this.spend(e);\n\t}\n\trefill() {\n\t\tlet e = Date.now(), t = e - this.lastRefillTime;\n\t\tif (t <= 0) return;\n\t\tthis.lastRefillTime = e;\n\t\tlet n = t / 1e3 * this.sustainRate;\n\t\tthis.tokenCount = Math.min(this.burstLimit, this.tokenCount + n);\n\t}\n\tspend(e) {\n\t\treturn this.tokenCount >= e ? (this.tokenCount -= e, !0) : !1;\n\t}\n\tasync runTasks() {\n\t\tfor (;;) {\n\t\t\tlet n = this.pendingTaskRecords.shift();\n\t\t\tif (!n) {\n\t\t\t\tlet { promise: e, resolve: n } = PromiseWithResolvers();\n\t\t\t\tthis.onTaskAdded = n, await e;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (n.cost > this.burstLimit) {\n\t\t\t\tn.cancel(Error(CancelReason.TaskTooExpensive));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (this.refillAndSpend(n.cost)) {\n\t\t\t\tif (this.runningTasks >= this.concurrencyLimit) {\n\t\t\t\t\tlet { promise: e, resolve: n } = PromiseWithResolvers();\n\t\t\t\t\tthis.onTaskFinished = n, await e;\n\t\t\t\t}\n\t\t\t\tthis.runTask(n);\n\t\t\t} else {\n\t\t\t\tthis.pendingTaskRecords.unshift(n);\n\t\t\t\tlet e = Math.max(n.cost - this.tokenCount, 0), t = Math.ceil(1e3 * e / this.sustainRate);\n\t\t\t\tawait new Promise((e) => setTimeout(e, t));\n\t\t\t}\n\t\t}\n\t}\n\tasync runTask(e) {\n\t\tthis.runningTasks++;\n\t\ttry {\n\t\t\tawait e.run();\n\t\t} finally {\n\t\t\tthis.runningTasks--, this.onTaskFinished();\n\t\t}\n\t}\n}, QueueManager = class {\n\tqueues;\n\tdefaultOptions;\n\tconstructor(e, t) {\n\t\tthis.queues = new Map(t), this.defaultOptions = e;\n\t}\n\tcreate(e, t = {}) {\n\t\tlet n = new TaskQueue({\n\t\t\t...this.defaultOptions,\n\t\t\t...t\n\t\t});\n\t\treturn this.queues.set(e, n), n;\n\t}\n\tget(e) {\n\t\treturn this.queues.get(e);\n\t}\n\tgetOrCreate(e, t = {}) {\n\t\treturn this.get(e) ?? this.create(e, t);\n\t}\n\toptions() {\n\t\treturn { ...this.defaultOptions };\n\t}\n};\nexport { CancelReason, QueueManager, TaskQueue };\n","import {QueueManager, type QueueOptions} from '@scratch/task-herder';\n\n/**\n * @summary A set of generous limits, for things like downloading assets from CDN.\n * @description\n * In practice, these limits seem to lead to slightly better performance than no limits at all, mostly due to the\n * concurrency limit. For example, on my development computer & my relatively fast residential connection, a\n * concurrency limit of 4 loads a particular test project in 21 seconds, as opposed to 25 seconds when I bypass the\n * queue and call `fetch` directly. In that test, my setup downloads about 50 assets per second, so this set of options\n * only affects concurrency and doesn't actually throttle the downloads. Limiting concurrency also fixes the issue\n * where very large projects (thousands of assets) can lead to browser failures like `net::ERR_INSUFFICIENT_RESOURCES`.\n * The exact concurrency limit doesn't seem to matter much since the browser limits parallel connections itself. It\n * just needs to be high enough to avoid bubbles in the download pipeline and low enough to avoid resource exhaustion.\n * @see {@link https://github.com/scratchfoundation/scratch-gui/issues/7111}\n */\nexport const AssetQueueOptions: QueueOptions = {\n burstLimit: 64,\n sustainRate: 64,\n // WARNING: asset download concurrency >=5 can lead to corrupted buffers on Chrome (December 2025, Chrome 142.0)\n // when using Scratch's bitmap load pipeline. Marking the canvas context as `{willReadFrequently: true}` seems to\n // eliminate that issue, so maybe the problem is related to hardware acceleration.\n concurrency: 64\n};\n\n/**\n * Central registry of per-host queues.\n * Uses strict limits by default. Override these strict limits as needed for specific hosts.\n */\nexport const hostQueueManager = new QueueManager({\n burstLimit: 5,\n sustainRate: 1,\n concurrency: 1\n});\n","import {type QueueOptions} from '@scratch/task-herder';\nimport {hostQueueManager} from './HostQueues';\n\nexport const Headers = globalThis.Headers;\n\n/**\n * Metadata header names.\n * The enum value is the name of the associated header.\n */\nexport enum RequestMetadata {\n /** The ID of the project associated with this request */\n ProjectId = 'X-Project-ID',\n /** The ID of the project run associated with this request */\n RunId = 'X-Run-ID'\n}\n\nexport type ScratchFetchOptions = {\n /**\n * The name of the queue to use for this request.\n * If absent, the hostname of the requested URL will be used as the queue name.\n * This is a Scratch-specific extension to the standard RequestInit type.\n */\n queueName?: string;\n\n /**\n * The options to use when creating the queue for this request.\n * Ignored if a queue with the specified name already exists.\n */\n queueOptions?: QueueOptions;\n};\n\n/**\n * Metadata headers for requests.\n */\nconst metadata = new Headers();\n\n/**\n * Check if there is any metadata to apply.\n * @returns {boolean} true if `metadata` has contents, or false if it is empty.\n */\nexport const hasMetadata = (): boolean => {\n const searchParams = (\n typeof self !== 'undefined' &&\n self &&\n self.location &&\n self.location.search &&\n self.location.search.split(/[?&]/)\n ) || [];\n if (!searchParams.includes('scratchMetadata=1')) {\n // for now, disable this feature unless scratchMetadata=1\n // TODO: remove this check once we're sure the feature works correctly in production\n return false;\n }\n for (const _ of metadata) {\n return true;\n }\n return false;\n};\n\n/**\n * Non-destructively merge any metadata state (if any) with the provided options object (if any).\n * If there is metadata state but no options object is provided, make a new object.\n * If there is no metadata state, return the provided options parameter without modification.\n * If there is metadata and an options object is provided, modify a copy and return it.\n * Headers in the provided options object may override headers generated from metadata state.\n * @param {RequestInit} [options] The initial request options. May be null or undefined.\n * @returns {RequestInit|undefined} the provided options parameter without modification, or a new options object.\n */\nexport const applyMetadata = (options?: globalThis.RequestInit): globalThis.RequestInit | undefined => {\n if (hasMetadata()) {\n const augmentedOptions = Object.assign({}, options);\n augmentedOptions.headers = new Headers(metadata);\n if (options && options.headers) {\n // the Fetch spec says options.headers could be:\n // \"A Headers object, an object literal, or an array of two-item arrays to set request's headers.\"\n // turn it into a Headers object to be sure of how to interact with it\n const overrideHeaders = options.headers instanceof Headers ?\n options.headers : new Headers(options.headers);\n for (const [name, value] of overrideHeaders.entries()) {\n augmentedOptions.headers.set(name, value);\n }\n }\n return augmentedOptions;\n }\n return options;\n};\n\n/**\n * Make a network request.\n * This is a wrapper for the global fetch method, adding some Scratch-specific functionality.\n * @param {RequestInfo|URL} resource The resource to fetch.\n * @param {RequestInit} [requestOptions] Optional object containing custom settings for this request.\n * @param {ScratchFetchOptions} [scratchOptions] Optional Scratch-specific settings for this request.\n * @see {@link https://developer.mozilla.org/docs/Web/API/fetch} for more about the fetch API.\n * @returns {Promise<Response>} A promise for the response to the request.\n */\nexport const scratchFetch = (\n resource: RequestInfo | URL,\n requestOptions?: globalThis.RequestInit,\n scratchOptions?: ScratchFetchOptions\n): Promise<Response> => {\n requestOptions = applyMetadata(requestOptions);\n\n let queueName = scratchOptions?.queueName;\n if (!queueName) {\n // Normalize resource to a Request object. The `fetch` call will do this anyway, so it's not much extra work,\n // but it guarantees availability of the URL for queue naming.\n resource = new Request(resource, requestOptions);\n queueName = new URL(resource.url).hostname;\n }\n const queue = hostQueueManager.getOrCreate(queueName, scratchOptions?.queueOptions);\n return queue.do(() => fetch(resource, requestOptions));\n};\n\n/**\n * Set the value of a named request metadata item.\n * Setting the value to `null` or `undefined` will NOT remove the item.\n * Use `unsetMetadata` for that.\n * @param {RequestMetadata} name The name of the metadata item to set.\n * @param {any} value The value to set (will be converted to a string).\n */\nexport const setMetadata = (name: RequestMetadata, value: any): void => {\n metadata.set(name, value);\n};\n\n/**\n * Remove a named request metadata item.\n * @param {RequestMetadata} name The name of the metadata item to remove.\n */\nexport const unsetMetadata = (name: RequestMetadata): void => {\n metadata.delete(name);\n};\n\n/**\n * Retrieve a named request metadata item.\n * Only for use in tests. At the time of writing, used in scratch-vm tests.\n * @param {RequestMetadata} name The name of the metadata item to retrieve.\n * @returns {string|null} The value of the metadata item, or `null` if it was not found.\n */\nexport const getMetadata = (name: RequestMetadata): string | null => metadata.get(name);\n","/* eslint-env worker */\n/* eslint-disable-next-line spaced-comment */\n/// <reference lib=\"webworker\" />\n\n// This worker won't share the same queue as the main thread, but throttling should be okay\n// as long as we don't use FetchTool and FetchWorkerTool at the same time.\n// TODO: Communicate metadata from the main thread to workers or move the worker boundary \"into\" `scratchFetch`.\n// Make sure to benchmark any changes to avoid performance regressions, especially for large project loads.\nimport {AssetQueueOptions} from './HostQueues';\nimport {scratchFetch} from './scratchFetch';\n\ninterface JobMessage {\n id: string;\n url: string;\n options: RequestInit | undefined;\n}\n\ninterface CompletionMessage {\n id: string;\n buffer?: ArrayBuffer | null;\n error?: string;\n}\n\nlet jobsActive = 0;\nconst complete: CompletionMessage[] = [];\n\nlet intervalId: ReturnType<typeof setInterval> | undefined = void 0;\n\n/**\n * Register a step function.\n *\n * Step checks if there are completed jobs and if there are sends them to the\n * parent. Then it checks the jobs count. If there are no further jobs, clear\n * the step.\n */\nconst registerStep = function () {\n intervalId = setInterval(() => {\n if (complete.length) {\n // Send our chunk of completed requests and instruct postMessage to\n // transfer the buffers instead of copying them.\n postMessage(\n complete.slice(),\n // Instruct postMessage that these buffers in the sent message\n // should use their Transferable trait. After the postMessage\n // call the \"buffers\" will still be in complete if you looked,\n // but they will all be length 0 as the data they reference has\n // been sent to the window. This lets us send a lot of data\n // without the normal postMessage behaviour of making a copy of\n // all of the data for the window.\n complete.map(response => response.buffer).filter(Boolean) as Transferable[]\n );\n complete.length = 0;\n }\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = void 0;\n }\n }, 1);\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param message The message from the parent.\n * @param message.data A job id, url, and options descriptor to perform.\n */\nconst onMessage = async ({data: job}: MessageEvent<JobMessage>) => {\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n\n try {\n const response = await scratchFetch(job.url, job.options, {queueOptions: AssetQueueOptions});\n\n const result: CompletionMessage = {id: job.id};\n if (response.ok) {\n result.buffer = await response.arrayBuffer();\n } else if (response.status === 404) {\n result.buffer = null;\n } else {\n throw response.status;\n }\n complete.push(result);\n } catch (error) {\n complete.push({id: job.id, error: ((error as Error)?.message) || `Failed request: ${job.url}`});\n } finally {\n jobsActive--;\n }\n};\n\n// \"fetch\" is supported in Node.js as of 16.15 and our target browsers as of ~2017\npostMessage({support: {fetch: true}});\nself.addEventListener('message', onMessage);\n"],"names":[],"ignoreList":[],"sourceRoot":""}
|