(function(){let e={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},t={silent:{level:-1},fatal:{level:e.fatal},error:{level:e.error},warn:{level:e.warn},log:{level:e.log},info:{level:e.info},success:{level:e.success},fail:{level:e.fail},ready:{level:e.info},start:{level:e.info},box:{level:e.info},debug:{level:e.debug},trace:{level:e.trace},verbose:{level:e.verbose}};function n(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function r(e,t,i=`.`,a){if(!n(t))return r(e,{},i,a);let o=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let s=e[t];s!=null&&(a&&a(o,t,s,i)||(Array.isArray(s)&&Array.isArray(o[t])?o[t]=[...s,...o[t]]:n(s)&&n(o[t])?o[t]=r(s,o[t],(i?`${i}.`:``)+t.toString(),a):o[t]=s))}return o}function i(e){return(...t)=>t.reduce((t,n)=>r(t,n,``,e),{})}let a=i();function o(e){return Object.prototype.toString.call(e)===`[object Object]`}function s(e){return!(!o(e)||!e.message&&!e.args||e.stack)}let c=!1,l=[];var u=class e{options;_lastLog;_mockFn;constructor(e={}){let n=e.types||t;this.options=a({...e,defaults:{...e.defaults},level:d(e.level,n),reporters:[...e.reporters||[]]},{types:t,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let e in n){let t={type:e,...this.options.defaults,...n[e]};this[e]=this._wrapLogFn(t),this[e].raw=this._wrapLogFn(t,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=d(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(t){let n=new e({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||=e.write,e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){c=!0}resumeLogs(){c=!1;let e=l.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(c){l.push([this,e,n,t]);return}return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r={date:new Date,args:[],...e,level:d(e.level,this.options.types)};!n&&t.length===1&&s(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
`)),r.args.push(`
`+r.additional.join(`
`)),delete r.additional),r.type=typeof r.type==`string`?r.type.toLowerCase():`log`,r.tag=typeof r.tag==`string`?r.tag:``;let i=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=r,this._log(r))};clearTimeout(this._lastLog.timeout);let a=this._lastLog.time&&r.date?r.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=r.date,a<this.options.throttle)try{let e=JSON.stringify([r.type,r.tag,r.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch{}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}};function d(e,t={},n=3){return e===void 0?n:typeof e==`number`?e:t[e]&&t[e].level!==void 0?t[e].level:n}u.prototype.add=u.prototype.addReporter,u.prototype.remove=u.prototype.removeReporter,u.prototype.clear=u.prototype.removeReporter,u.prototype.withScope=u.prototype.withTag,u.prototype.mock=u.prototype.mockTypes,u.prototype.pause=u.prototype.pauseLogs,u.prototype.resume=u.prototype.resumeLogs;function f(e={}){return new u(e)}var p=class{options;defaultColor;levelColorMap;typeColorMap;constructor(e){this.options={...e},this.defaultColor=`#7f8c8d`,this.levelColorMap={0:`#c0392b`,1:`#f39c12`,3:`#00BCD4`},this.typeColorMap={success:`#2ecc71`}}_getLogFn(e){return e<1?console.__error||console.error:e===1?console.__warn||console.warn:console.__log||console.log}log(e){let t=this._getLogFn(e.level),n=e.type===`log`?``:e.type,r=e.tag||``,i=`
      background: ${this.typeColorMap[e.type]||this.levelColorMap[e.level]||this.defaultColor};
      border-radius: 0.5em;
      color: white;
      font-weight: bold;
      padding: 2px 0.5em;
    `,a=`%c${[r,n].filter(Boolean).join(`:`)}`;typeof e.args[0]==`string`?t(`${a}%c ${e.args[0]}`,i,``,...e.args.slice(1)):t(a,i,...e.args)}};function m(e={}){return f({reporters:e.reporters||[new p({})],prompt(e,t={}){return t.type===`confirm`?Promise.resolve(confirm(e)):Promise.resolve(prompt(e))},...e})}let h=m(),g=(e,t)=>{try{Object.defineProperty(globalThis,e,{configurable:!1,writable:!1,value:t})}catch{}};g(`fetch`,()=>Promise.reject(Error(`fetch disabled in this worker`)));let _=()=>{throw Error(`network disabled in this worker`)},v=()=>{_()};v.prototype={},g(`XMLHttpRequest`,v),g(`importScripts`,_),g(`WebSocket`),g(`WebTransport`),g(`RTCPeerConnection`);let y=(e,t)=>{let n={action:`result`,result:e,id:t};self.postMessage(n)},b=(e,t)=>{let n={action:`error`,error:e,id:t};self.postMessage(n)};self.onmessage=async e=>{let t=e.data;try{y((0,eval)(`(function (self, context) { ${t.code} })`)(null,t.context),t.id)}catch(e){h.error(`[SandboxedEval] error in worker`,e),b(e,t.id)}}})();