@robotical/martyblocks
Version:
MartyBlocks based on Scratch for Marty the Robot by Robotical
2 lines • 67 kB
JavaScript
/*! For license information please see extension-worker.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VirtualMachine=e():t.VirtualMachine=e()}(self,()=>(()=>{var t={"./src/dispatch/shared-dispatch.js"(t,e,r){function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,s,i,a=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}const s=r("./src/util/log.js");t.exports=class{constructor(){this.callbacks=[],this.nextResponseId=0}call(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return this.transferCall(t,e,null,...n)}transferCall(t,e,r){try{const i=this._getServiceProvider(t),a=i.provider,l=i.isRemote;if(a){for(var n=arguments.length,o=new Array(n>3?n-3:0),s=3;s<n;s++)o[s-3]=arguments[s];if(l)return this._remoteTransferCall(a,t,e,r,...o);const i=a[e].apply(a,o);return Promise.resolve(i)}return Promise.reject(new Error("Service not found: ".concat(t)))}catch(t){return Promise.reject(t)}}_isRemoteService(t){return this._getServiceProvider(t).isRemote}_remoteCall(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),s=3;s<n;s++)o[s-3]=arguments[s];return this._remoteTransferCall(t,e,r,null,...o)}_remoteTransferCall(t,e,r,n){for(var o=arguments.length,s=new Array(o>4?o-4:0),i=4;i<o;i++)s[i-4]=arguments[i];return new Promise((o,i)=>{const a=this._storeCallbacks(o,i);s.length>0&&"function"==typeof s[s.length-1].yield&&s.pop(),n?t.postMessage({service:e,method:r,responseId:a,args:s},n):t.postMessage({service:e,method:r,responseId:a,args:s})})}_storeCallbacks(t,e){const r=this.nextResponseId++;return this.callbacks[r]=[t,e],r}_deliverResponse(t,e){try{const r=n(this.callbacks[t],2),o=r[0],s=r[1];delete this.callbacks[t],e.error?s(e.error):o(e.result)}catch(t){s.error("Dispatch callback failed: ".concat(JSON.stringify(t)))}}_onMessage(t,e){const r=e.data;let n;r.args=r.args||[],r.service?n="dispatch"===r.service?this._onDispatchMessage(t,r):this.call(r.service,r.method,...r.args):void 0===r.responseId?s.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(e))):this._deliverResponse(r.responseId,r),n&&(void 0===r.responseId?s.error("Dispatch message missing required response ID: ".concat(JSON.stringify(e))):n.then(e=>t.postMessage({responseId:r.responseId,result:e}),e=>t.postMessage({responseId:r.responseId,error:e})))}_getServiceProvider(t){throw new Error("Could not get provider for ".concat(t,": _getServiceProvider not implemented"))}_onDispatchMessage(t,e){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(e.method," method"))}}},"./src/dispatch/worker-dispatch.js"(t,e,r){const n=r("./src/dispatch/shared-dispatch.js"),o=r("./src/util/log.js");t.exports=new class extends n{constructor(){super(),this._connectionPromise=new Promise(t=>{this._onConnect=t}),this.services={},this._onMessage=this._onMessage.bind(this,self),"undefined"!=typeof self&&(self.onmessage=this._onMessage)}get waitForConnection(){return this._connectionPromise}setService(t,e){return Object.prototype.hasOwnProperty.call(this.services,t)&&o.warn("Worker dispatch replacing existing service provider for ".concat(t)),this.services[t]=e,this.waitForConnection.then(()=>this._remoteCall(self,"dispatch","setService",t))}_getServiceProvider(t){const e=this.services[t];return{provider:e||self,isRemote:!e}}_onDispatchMessage(t,e){let r;switch(e.method){case"handshake":r=this._onConnect();break;case"terminate":setTimeout(()=>self.close(),0),r=Promise.resolve();break;default:o.error("Worker dispatch received message for unknown method: ".concat(e.method))}return r}}},"./src/extension-support/argument-type.js"(t){t.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COG_COLOR:"cog_color",LED_EYE_MATRIX:"led_eye_matrix",TUNE_COMPOSER:"tune_composer"}},"./src/extension-support/block-type.js"(t){t.exports={BOOLEAN:"Boolean",BUTTON:"button",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",HIDDEN:"hidden"}},"./src/extension-support/target-type.js"(t){t.exports={SPRITE:"sprite",STAGE:"stage"}},"./src/util/log.js"(t,e,r){const n=r("../../node_modules/tslog/cjs/index.js").Logger;t.exports=new n({name:"scratch-vm"})},"../../node_modules/base64-js/index.js"(t,e){"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,s=a(t),i=s[0],l=s[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,i,l)),c=0,f=l>0?i-4:i;for(r=0;r<f;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)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===l&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[c++]=255&e);1===l&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,s=[],i=16383,a=0,l=n-o;a<l;a+=i)s.push(u(t,a,a+i>l?l:a+i));1===o?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return s.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=s[i],n[s.charCodeAt(i)]=i;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function u(t,e,r){for(var n,o=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(l(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},"../../node_modules/buffer/index.js"(t,e,r){"use strict";const n=r("../../node_modules/base64-js/index.js"),o=r("../../node_modules/ieee754/index.js"),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(t){+t!=t&&(t=0);return l.alloc(+t)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(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 f(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|d(t,e);let n=a(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(J(t,Uint8Array)){const e=new Uint8Array(t);return g(e.buffer,e.byteOffset,e.byteLength)}return h(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(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return g(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(J(t,SharedArrayBuffer)||t&&J(t.buffer,SharedArrayBuffer)))return g(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 l.from(n,e,r);const o=function(t){if(l.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||H(t.length)?a(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.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 f(t){return c(t),a(t<0?0:0|p(t))}function h(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function g(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,l.prototype),n}function p(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(t).length;default:if(o)return n?-1:G(t).length;e=(""+e).toLowerCase(),o=!0}}function y(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 I(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),H(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,o){let s,i=1,a=t.length,l=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;i=2,a/=2,l/=2,r/=2}function u(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}if(o){let n=-1;for(s=r;s<a;s++)if(u(t,s)===u(e,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===l)return n*i}else-1!==n&&(s-=s-n),n=-1}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){let r=!0;for(let n=0;n<l;n++)if(u(t,s+n)!==u(e,n)){r=!1;break}if(r)return s}return-1}function v(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const s=e.length;let i;for(n>s/2&&(n=s/2),i=0;i<n;++i){const n=parseInt(e.substr(2*i,2),16);if(H(n))return i;t[r+i]=n}return i}function E(t,e,r,n){return Y(G(e,t.length-r),t,r,n)}function j(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 O(t,e,r,n){return Y(K(e),t,r,n)}function B(t,e,r,n){return Y(function(t,e){let r,n,o;const s=[];for(let i=0;i<t.length&&!((e-=2)<0);++i)r=t.charCodeAt(i),n=r>>8,o=r%256,s.push(o),s.push(n);return s}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let s=null,i=e>239?4:e>223?3:e>191?2:1;if(o+i<=r){let r,n,a,l;switch(i){case 1:e<128&&(s=e);break;case 2:r=t[o+1],128==(192&r)&&(l=(31&e)<<6|63&r,l>127&&(s=l));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(l=(15&e)<<12|(63&r)<<6|63&n,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(l=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,i=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=i}return function(t){const e=t.length;if(e<=_)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=_));return r}(n)}e.kMaxLength=i,l.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}}(),l.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(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},l.allocUnsafe=function(t){return f(t)},l.allocUnsafeSlow=function(t){return f(t)},l.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==l.prototype},l.compare=function(t,e){if(J(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,s=Math.min(r,n);o<s;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},l.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}},l.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=l.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if(J(e,Uint8Array))o+e.length>n.length?(l.isBuffer(e)||(e=l.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!l.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},l.byteLength=d,l.prototype._isBuffer=!0,l.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)m(this,e,e+1);return this},l.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)m(this,e,e+3),m(this,e+1,e+2);return this},l.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)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},l.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):y.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(t,e,r,n,o){if(J(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(e>>>=0);const a=Math.min(s,i),u=this.slice(n,o),c=t.slice(e,r);for(let t=0;t<a;++t)if(u[t]!==c[t]){s=u[t],i=c[t];break}return s<i?-1:i<s?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},l.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return j(this,t,e,r);case"base64":return O(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function L(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function I(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=q[t[n]];return o}function k(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function x(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 N(t,e,r,n,o,s){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n,o){W(e,n,o,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let i=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,r}function M(t,e,r,n,o){W(e,n,o,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let i=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=i,i>>=8,t[r+2]=i,i>>=8,t[r+1]=i,i>>=8,t[r]=i,r+8}function C(t,e,r,n,o,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,s){return e=+e,r>>>=0,s||C(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,s){return e=+e,r>>>=0,s||C(t,0,r,8),o.write(t,e,r,n,52,8),r+8}l.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,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=this[t],o=1,s=0;for(;++s<e&&(o*=256);)n+=this[t+s]*o;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readBigUInt64LE=X(function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))}),l.prototype.readBigUInt64BE=X(function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)}),l.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=this[t],o=1,s=0;for(;++s<e&&(o*=256);)n+=this[t+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=e,o=1,s=this[t+--n];for(;n>0&&(o*=256);)s+=this[t+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s},l.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readBigInt64LE=X(function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(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)}),l.prototype.readBigInt64BE=X(function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(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)}),l.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,s=0;for(this[e]=255&t;++s<r&&(o*=256);)this[e+s]=t/o&255;return e+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(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},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(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},l.prototype.writeBigUInt64LE=X(function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=X(function(t,e=0){return M(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let o=0,s=1,i=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===i&&0!==this[e+o-1]&&(i=1),this[e+o]=(t/s|0)-i&255;return e+r},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let o=r-1,s=1,i=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===i&&0!==this[e+o+1]&&(i=1),this[e+o]=(t/s|0)-i&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(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},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(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},l.prototype.writeBigInt64LE=X(function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=X(function(t,e=0){return M(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,n){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},l.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&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const s=l.isBuffer(t)?t:l.from(t,n),i=s.length;if(0===i)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%i]}return this};const $={};function D(t,e,r){$[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 W(t,e,r,n,o,s){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new $.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||V(e,t.length-(r+1))}(n,o,s)}function z(t,e){if("number"!=typeof t)throw new $.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),D("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),D("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=F(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);const Z=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let o=null;const s=[];for(let i=0;i<n;++i){if(r=t.charCodeAt(i),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(i+1===n){(e-=3)>-1&&s.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&s.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function K(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function J(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function H(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function X(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},"../../node_modules/ieee754/index.js"(t,e){e.read=function(t,e,r,n,o){var s,i,a=8*o-n-1,l=(1<<a)-1,u=l>>1,c=-7,f=r?o-1:0,h=r?-1:1,g=t[e+f];for(f+=h,s=g&(1<<-c)-1,g>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=h,c-=8);for(i=s&(1<<-c)-1,s>>=-c,c+=n;c>0;i=256*i+t[e+f],f+=h,c-=8);if(0===s)s=1-u;else{if(s===l)return i?NaN:1/0*(g?-1:1);i+=Math.pow(2,n),s-=u}return(g?-1:1)*i*Math.pow(2,s-n)},e.write=function(t,e,r,n,o,s){var i,a,l,u=8*s-o-1,c=(1<<u)-1,f=c>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,p=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=c):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),(e+=i+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(i++,l/=2),i+f>=c?(a=0,i=c):i+f>=1?(a=(e*l-1)*Math.pow(2,o),i+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),i=0));o>=8;t[r+g]=255&a,g+=p,a/=256,o-=8);for(i=i<<o|a,u+=o;u>0;t[r+g]=255&i,g+=p,i/=256,u-=8);t[r+g-p]|=128*d}},"../../node_modules/tslog/cjs/BaseLogger.js"(t,e,r){"use strict";var n=r("../../node_modules/buffer/index.js").Buffer,o=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||o(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseLogger=e.loggerEnvironment=void 0,e.createLoggerEnvironment=p;const i=r("../../node_modules/tslog/cjs/urlToObj.js"),a=r("../../node_modules/tslog/cjs/internal/metaFormatting.js"),l=r("../../node_modules/tslog/cjs/internal/errorUtils.js"),u=r("../../node_modules/tslog/cjs/formatTemplate.js"),c=r("../../node_modules/tslog/cjs/internal/util.inspect.polyfill.js"),f=r("../../node_modules/tslog/cjs/internal/stackTrace.js"),h=r("../../node_modules/tslog/cjs/internal/environment.js"),g=r("../../node_modules/tslog/cjs/internal/jsonStringifyRecursive.js");function p(){const t=function(){if((0,h.isBrowserEnvironment)()){const t=globalThis.navigator;return{name:"browser",userAgent:t?.userAgent}}const t=globalThis;if("function"==typeof t.importScripts)return{name:"worker",userAgent:t.navigator?.userAgent};const e=globalThis;if(null!=e.Bun){const t=e.Bun.version;return{name:"bun",version:null!=t?`bun/${t}`:void 0,hostname:A(e.process,e.Deno,e.Bun,e.location)}}if(null!=e.Deno){const t=function(t){try{if("function"==typeof t?.hostname){const e=t.hostname();if(null!=e&&e.length>0)return e}}catch{}const e=globalThis.location?.hostname;if(null!=e&&e.length>0)return e;return}(e.Deno),r=e.Deno?.version?.deno;return{name:"deno",version:null!=r?`deno/${r}`:void 0,hostname:t??A(e.process,e.Deno,e.Bun,e.location)}}if(null!=e.process?.versions?.node||null!=e.process?.version)return{name:"node",version:e.process?.versions?.node??e.process?.version,hostname:A(e.process,e.Deno,e.Bun,e.location)};if(null!=e.process)return{name:"node",version:"unknown",hostname:A(e.process,e.Deno,e.Bun,e.location)};return{name:"unknown"}}(),e=function(e){if("browser"===e.name||"worker"===e.name)return{runtime:e.name,browser:e.userAgent};const r={runtime:e.name};"node"!==t.name&&"deno"!==t.name&&"bun"!==t.name||(r.runtimeVersion=e.version??"unknown");"node"!==t.name&&"deno"!==t.name&&"bun"!==t.name||(r.hostname=e.hostname??"unknown");return r}(t),r="browser"===t.name||"worker"===t.name,o=r?[...(0,f.getDefaultIgnorePatterns)(),/node_modules[\\/].*tslog/i]:[...(0,f.getDefaultIgnorePatterns)(),/node:(?:internal|vm)/i,/\binternal[\\/]/i];let s;const i={getMeta:(t,r,n,o,s,a)=>Object.assign({},e,{name:s,parentNames:a,date:new Date,logLevelId:t,logLevelName:r,path:o?void 0:i.getCallerStackFrame(n)}),getCallerStackFrame(t,e=new Error){const r=(0,f.buildStackTrace)(e,t=>p(t));if(0===r.length)return{};const n=(0,f.findFirstExternalFrameIndex)(r,o);return r[Number.isFinite(t)&&t>=0?(0,f.clampIndex)(t,r.length):(0,f.clampIndex)(n,r.length)]??{}},getErrorTrace:t=>(0,f.buildStackTrace)(t,t=>p(t)),isError:t=>function(t){if(t instanceof Error)return!0;if(null!=t&&"object"==typeof t){const e=Object.prototype.toString.call(t);if(/\[object .*Error\]/.test(e))return!0;const r=t.name;if("string"==typeof r&&r.endsWith("Error"))return!0}return!1}(t),isBuffer:t=>void 0!==n&&"function"==typeof n.isBuffer&&n.isBuffer(t),prettyFormatLogObj:(t,e)=>t.reduce((t,r)=>(i.isError(r)?t.errors.push(i.prettyFormatErrorObj(r,e)):t.args.push(r),t),{args:[],errors:[]}),prettyFormatErrorObj(t,e){const r=w(i.getErrorTrace(t),e),n=(0,l.collectErrorCauses)(t).map((t,r)=>[`Caused by (${r+1}): ${t.name??"Error"}${t.message?`: ${t.message}`:""}`,...w((0,f.buildStackTrace)(t,t=>p(t)),e)].join("\n")),o={errorName:` ${t.name} `,errorMessage:v(t),errorStack:[...r,...n].join("\n")};return(0,u.formatTemplate)(e,e.prettyErrorTemplate,o)},transportFormatted(e,r,n,o,s){const i=!1!==s.stylePrettyLogs,l=(n.length>0&&r.length>0?"\n":"")+n.join("\n"),u=e.replace(d,"");const c=i?e:u;if(function(e){return e&&("browser"===t.name||"worker"===t.name)&&(0,h.consoleSupportsCssStyling)()}(i)){s.prettyInspectOptions.colors=!1;const t=B(s.prettyInspectOptions,r),e=null!=o?function(t,e){if(null==e)return{text:"",styles:[]};const{template:r,placeholders:n}=(0,a.buildPrettyMeta)(t,e),o=[],s=[];let i=0;const l=/{{(.+?)}}/g;let u;for(;null!=(u=l.exec(r));){u.index>i&&o.push(r.slice(i,u.index));const e=u[1],a=null!=n[e]?String(n[e]):"",c=j(E(t.prettyLogStyles?.[e],a));c.length>0?(o.push(`%c${a}%c`),s.push(c,"")):o.push(a),i=l.lastIndex}i<r.length&&o.push(r.slice(i));return{text:o.join(""),styles:s}}(s,o):{text:u,styles:[]},n=e.text.length>0&&e.styles.length>0,i=(n?e.text:u)+t+l;return void(n?console.log(i,...e.styles):console.log(i))}s.prettyInspectOptions.colors=i;const f=B(s.prettyInspectOptions,r);console.log(c+f+l)},transportJSON(t){console.log((0,g.jsonStringifyRecursive)(t))}};return"test"===function(){const t=globalThis?.process;return t?.env?.NODE_ENV}()&&(i.__resetWorkingDirectoryCacheForTests=()=>{s=void 0}),i;function p(t){return r?function(t){const e=globalThis.location?.origin;if(null==t)return;const r=t.match(b);if(!r)return;const n=r[1]?.replace(/\?.*$/,"");if(null==n)return;const o=n.split("/"),s=r[2],i=r[3],a=o[o.length-1];return{fullFilePath:e?`${e}${n}`:n,fileName:a,fileNameWithLine:a&&s?`${a}:${s}`:void 0,fileColumn:i,fileLine:s,filePath:n,filePathWithLine:s?`${n}:${s}`:void 0,method:void 0}}(t):function(t){if("string"!=typeof t||0===t.length)return;const e=t.trim();if(!e.includes(" at ")&&!e.startsWith("at "))return;const r=e.replace(/^at\s+/,"");let n,o=r;const i=r.match(/^(.*?)\s+\((.*)\)$/);i&&(n=i[1],o=i[2]);const a=o.replace(/^\(/,"").replace(/\)$/,""),l=a.replace(/\?.*$/,"");let u,c,f=l;const g=l.split(":");g.length>=3&&/^\d+$/.test(g[g.length-1]??"")?(c=g.pop(),u=g.pop(),f=g.join(":")):g.length>=2&&/^\d+$/.test(g[g.length-1]??"")&&(u=g.pop(),f=g.join(":"));let p=f.replace(/^file:\/\//,"");const d=function(){void 0===s&&(s=(0,h.safeGetCwd)()??null);return s??void 0}();null!=d&&p.startsWith(d)&&(p=p.slice(d.length),p=p.replace(/^[\\/]/,""));0===p.length&&(p=f);const y=function(t){if("string"!=typeof t||0===t.length)return t;const e=t.replace(/\\+/g,"\\").replace(/\\/g,"/"),r=e.startsWith("//"),n=e.startsWith("/")&&!r,o=e.match(/^[A-Za-z]:/),s=o?o[0]:"",i=(s?e.slice(s.length):e).split("/"),a=[];for(const t of i)""!==t&&"."!==t&&(".."!==t?a.push(t):a.length>0&&a.pop());let l=a.join("/");r?l=`//${l}`:n?l=`/${l}`:""!==s&&(l=`${s}${l.length>0?`/${l}`:""}`);if(0===l.length)return t;return l}(p),m=y.length>0?y:p,b=m.split(/\\|\//),w=b[b.length-1],v=w&&u?`${w}:${u}`:void 0,E=m&&u?`${m}:${u}`:void 0;return{fullFilePath:a,fileName:w,fileNameWithLine:v,fileColumn:c,fileLine:u,filePath:m,filePathWithLine:E,method:n}}(t)}function w(t,e){return t.map(t=>(0,u.formatTemplate)(e,e.prettyErrorStackTemplate,{...t},!0))}function v(t){return Object.getOwnPropertyNames(t).filter(t=>"stack"!==t&&"cause"!==t).reduce((e,r)=>{const n=t[r];return"function"==typeof n||e.push(String(n)),e},[]).join(", ")}function E(t,e){if(null==t)return[];if("string"==typeof t)return[t];if(Array.isArray(t))return t.flatMap(t=>E(t,e));if("object"==typeof t){const r=t[e.trim()]??t["*"];return null==r?[]:E(r,e)}return[]}function j(t){const e=new Set,r=[];for(const n of t){const t=O(n);null!=t&&t.length>0&&!e.has(t)&&(e.add(t),r.push(t))}return r.join("; ")}function O(t){const e=y[t];if(null!=e)return`color: ${e}`;const r=m[t];if(null!=r)return`background-color: ${r}`;switch(t){case"bold":return"font-weight: bold";case"dim":return"opacity: 0.75";case"italic":return"font-style: italic";case"underline":return"text-decoration: underline";case"overline":return"text-decoration: overline";case"inverse":return"filter: invert(1)";case"hidden":return"visibility: hidden";case"strikethrough":return"text-decoration: line-through";default:return}}function B(t,e){try{return(0,c.formatWithOptions)(t,...e)}catch{return e.map(S).join(" ")}}function S(t){if("string"==typeof t)return t;try{return JSON.stringify(t)}catch{return String(t)}}function A(t,e,r,n){const o=t?.env?.HOSTNAME??t?.env?.HOST??t?.env?.COMPUTERNAME;if(null!=o&&o.length>0)return o;const s=r?.env?.HOSTNAME??r?.env?.HOST??r?.env?.COMPUTERNAME;if(null!=s&&s.length>0)return s;try{const t=e?.env?.get;if("function"==typeof t){const e=t("HOSTNAME");if(null!=e&&e.length>0)return e}}catch{}return null!=n?.hostname&&n.hostname.length>0?n.hostname:void 0}}const d=/\u001b\[[0-9;]*m/g,y={black:"#000000",red:"#ef5350",green:"#66bb6a",yellow:"#fdd835",blue:"#42a5f5",magenta:"#ab47bc",cyan:"#26c6da",white:"#fafafa",blackBright:"#424242",redBright:"#ff7043",greenBright:"#81c784",yellowBright:"#ffe082",blueBright:"#64b5f6",magentaBright:"#ce93d8",cyanBright:"#4dd0e1",whiteBright:"#ffffff"},m={bgBlack:"#000000",bgRed:"#ef5350",bgGreen:"#66bb6a",bgYellow:"#fdd835",bgBlue:"#42a5f5",bgMagenta:"#ab47bc",bgCyan:"#26c6da",bgWhite:"#fafafa",bgBlackBright:"#424242",bgRedBright:"#ff7043",bgGreenBright:"#81c784",bgYellowBright:"#ffe082",bgBlueBright:"#64b5f6",bgMagentaBright:"#ce93d8",bgCyanBright:"#4dd0e1",bgWhiteBright:"#ffffff"},b=/(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/,w=p();e.loggerEnvironment=w,s(r("../../node_modules/tslog/cjs/interfaces.js"),e);e.BaseLogger=class{constructor(t,e,r=Number.NaN){this.logObj=e,this.stackDepthLevel=r,this.runtime=w,this.maxErrorCauseDepth=5,this.settings={type:t?.type??"pretty",name:t?.name,parentNames:t?.parentNames,minLevel:t?.minLevel??0,argumentsArrayName:t?.argumentsArrayName,hideLogPositionForProduction:t?.hideLogPositionForProduction??!1,prettyLogTemplate:t?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t{{filePathWithLine}}{{nameWithDelimiterPrefix}}\t",prettyErrorTemplate:t?.prettyErrorTemplate??"\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}",prettyErrorStackTemplate:t?.prettyErrorStackTemplate??" • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}",prettyErrorParentNamesSeparator:t?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:t?.prettyErrorLoggerNameDelimiter??"\t",stylePrettyLogs:t?.stylePrettyLogs??!0,prettyLogTimeZone:t?.prettyLogTimeZone??"UTC",prettyLogStyles:t?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:t?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:t?.metaProperty??"_meta",maskPlaceholder:t?.maskPlaceholder??"[***]",maskValuesOfKeys:t?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:t?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:t?.maskValuesRegEx,prefix:[...t?.prefix??[]],attachedTransports:[...t?.attachedTransports??[]],overwrite:{mask:t?.overwrite?.mask,toLogObj:t?.overwrite?.toLogObj,addMeta:t?.overwrite?.addMeta,addPlaceholders:t?.overwrite?.addPlaceholders,formatMeta:t?.overwrite?.formatMeta,formatLogObj:t?.overwrite?.formatLogObj,transportFormatted:t?.overwrite?.transportFormatted,transportJSON:t?.overwrite?.transportJSON}},this.captureStackForMeta=this._shouldCaptureStack()}log(t,e,...r){if(t<this.settings.minLevel)return;const n=this._resolveLogArguments(r),o=[...this.settings.prefix,...n],s=null!=this.settings.overwrite?.mask?this.settings.overwrite?.mask(o):null!=this.settings.maskValuesOfKeys&&this.settings.maskValuesOfKeys.length>0?this._mask(o):o,i=null!=this.logObj?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,a=null!=this.settings.overwrite?.toLogObj?this.settings.overwrite?.toLogObj(s,i):this._toLogObj(s,i),l=null!=this.settings.overwrite?.addMeta?this.settings.overwrite?.addMeta(a,t,e):this._addMetaToLogObj(a,t,e),u=l?.[this.settings.metaProperty];let c,f;if(null!=this.settings.overwrite?.formatMeta&&(c=this.settings.overwrite?.formatMeta(l?.[this.settings.metaProperty])),null!=this.settings.overwrite?.formatLogObj&&(f=this.settings.overwrite?.formatLogObj(s,this.settings)),"pretty"===this.settings.type&&(c=c??this._prettyFormatLogObjMeta(l?.[this.settings.metaProperty]),f=f??w.prettyFormatLogObj(s,this.settings)),null!=c&&null!=f)if(null!=this.settings.overwrite?.transportFormatted){const t=this.settings.overwrite.transportFormatted,e=t.length;e<4?t(c,f.args,f.errors):4===e?t(c,f.args,f.errors,u):t(c,f.args,f.errors,u,this.settings)}else w.transportFormatted(c,f.args,f.errors,u,this.settings);else null!=this.settings.overwrite?.transportJSON?this.settings.overwrite.transportJSON(l):"hidden"!==this.settings.type&&w.transportJSON(l);return null!=this.settings.attachedTransports&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(t=>{t(l)}),l}attachTransport(t){this.settings.attachedTransports.push(t)}getSubLogger(t,e){const r={...this.settings,...t,parentNames:null!=this.settings?.parentNames&&null!=this.settings?.name?[...this.settings.parentNames,this.settings.name]:null!=this.settings?.name?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...t?.prefix??[]]};return new this.constructor(r,e??this.logObj,this.stackDepthLevel)}_mask(t){const e=this._getMaskKeys();return t?.map(t=>this._recursiveCloneAndMaskValuesOfKeys(t,e))}_getMaskKeys(){const t=this.settings.maskValuesOfKeys??[],e=t.map(String).join("|");if(!0===this.settings.maskValuesOfKeysCaseInsensitive){if(this.maskKeysCache?.source===t&&!0===this.maskKeysCache.caseInsensitive&&this.maskKeysCache.signature===e)return this.maskKeysCache.normalized;const r=t.map(t=>"string"==typeof t?t.toLowerCase():String(t).toLowerCase());return this.maskKeysCache={source:t,caseInsensitive:!0,normalized:r,signature:e},r}return this.maskKeysCache={source:t,caseInsensitive:!1,normalized:t,signature:e},t}_resolveLogArguments(t){if(1===t.length&&"function"==typeof t[0]){const e=t[0];if(0===e.length){const t=e();return Array.isArray(t)?t:[t]}}return t}_recursiveCloneAndMaskValuesOfKeys(t,e,r=[]){if(r.includes(t))return{...t};if("object"==typeof t&&null!==t&&r.push(t),w.isError(t)||w.isBuffer(t))return t;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(Array.isArray(t))return t.map(t=>this._recursiveCloneAndMaskValuesOfKeys(t,e,r));if(t instanceof Date)return new Date(t.getTime());if(t instanceof URL)return(0,i.urlToObject)(t);if(null!==t&&"object"==typeof t){const n=w.isError(t)?this._cloneError(t):Object.create(Object.getPrototypeOf(t));return Object.getOwnPropertyNames(t).reduce((n,o)=>{const s=!0!==this.settings?.maskValuesOfKeysCaseInsensitive?o:"string"==typeof o?o.toLowerCase():String(o).toLowerCase();return n[o]=e.includes(s)?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(t[o],e,r)}catch{return null}})(),n},n)}if("string"==typeof t){let e=t;for(const t of this.settings?.maskValuesRegEx||[])e=e.replace(t,this.settings?.maskPlaceholder||"");return e}return t}_recursiveCloneAndExecuteFunctions(t,e=[]){return this.isObjectOrArray(t)&&e.includes(t)?this.shallowCopy(t):(this.isObjectOrArray(t)&&e.push(t),Array.isArray(t)?t.map(t=>this._recursiveCloneAndExecuteFunctions(t,e)):t instanceof Date?new Date(t.getTime()):this.isObject(t)?Object.getOwnPropertyNames(t).reduce((r,n)=>{const o=Object.getOwnPropertyDescriptor(t,n);if(o){Object.defineProperty(r,n,o);const s=t[n];r[n]="function"==typeof s?s():this._recursiveCloneAndExecuteFunctions(s,e)}return r},Object.create(Object.getPrototypeOf(t))):t)}isObjectOrArray(t){return"object"==typeof t&&null!==t}isObject(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}shallowCopy(t){return Array.isArray(t)?[...t]:{...t}}_toLogObj(t,e={}){return t=t?.map(t=>w.isError(t)?this._toErrorObject(t):t),e=null==this.settings.argumentsArrayName?1!==t.length||Array.isArray(t[0])||!0===w.isBuffer(t[0])||t[0]instanceof Date?{...e,...t}:"object"==typeof t[0]&&null!=t[0]?{...t[0],...e}:{0:t[0],...e}:{...e,[this.settings.argumentsArrayName]:t}}_cloneError(t){const e=new t.constructor;return Object.getOwnPropertyNames(t).forEach(r=>{e[r]=t[r]}),e}_toErrorObject(t,e=0,r=new Set){r.has(t)||r.add(t);const n={nativeError:t,name:t.name??"Error",message:t.message,stack:w.getErrorTrace(t)};if(e>=this.maxErrorCauseDepth)return n;const o=t.cause;if(null!=o){const t=(0,l.toError)(o);r.has(t)||(n.cause=this._toErrorObject(t,e+1,r))}return n}_addMetaToLogObj(t,e,r){return{...t,[this.settings.metaProperty]:w.getMeta(e,r,this.stackDepthLevel,!this.captureStackForMeta,this.settings.name,this.settings.parentNames)}}_shouldCaptureStack(){if(this.settings.hideLogPositionForProduction)return!1;if("json"===this.settings.type)return!0;const t=this.settings.prettyLogTemplate??"";return!!/{{\s*(file(Name|Path|Line|PathWithLine|NameWithLin