var u=Object.defineProperty;var f=(o,e,t)=>e in o?u(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var l=(o,e,t)=>f(o,typeof e!="symbol"?e+"":e,t);(function(){"use strict";const LogLevels={fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},LogTypes={silent:{level:-1},fatal:{level:LogLevels.fatal},error:{level:LogLevels.error},warn:{level:LogLevels.warn},log:{level:LogLevels.log},info:{level:LogLevels.info},success:{level:LogLevels.success},fail:{level:LogLevels.fail},ready:{level:LogLevels.info},start:{level:LogLevels.info},box:{level:LogLevels.info},debug:{level:LogLevels.debug},trace:{level:LogLevels.trace},verbose:{level:LogLevels.verbose}};function isPlainObject$1(o){if(o===null||typeof o!="object")return!1;const e=Object.getPrototypeOf(o);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in o?!1:Symbol.toStringTag in o?Object.prototype.toString.call(o)==="[object Module]":!0}function _defu(o,e,t=".",r){if(!isPlainObject$1(e))return _defu(o,{},t);const s=Object.assign({},e);for(const i in o){if(i==="__proto__"||i==="constructor")continue;const n=o[i];n!=null&&(Array.isArray(n)&&Array.isArray(s[i])?s[i]=[...n,...s[i]]:isPlainObject$1(n)&&isPlainObject$1(s[i])?s[i]=_defu(n,s[i],(t?`${t}.`:"")+i.toString()):s[i]=n)}return s}function createDefu(o){return(...e)=>e.reduce((t,r)=>_defu(t,r,""),{})}const defu=createDefu();function isPlainObject(o){return Object.prototype.toString.call(o)==="[object Object]"}function isLogObj(o){return!(!isPlainObject(o)||!o.message&&!o.args||o.stack)}let paused=!1;const queue=[];class Consola{constructor(e={}){l(this,"options");l(this,"_lastLog");l(this,"_mockFn");const t=e.types||LogTypes;this.options=defu({...e,defaults:{...e.defaults},level:_normalizeLogLevel(e.level,t),reporters:[...e.reporters||[]]},{types:LogTypes,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const r in t){const s={type:r,...this.options.defaults,...t[r]};this[r]=this._wrapLogFn(s),this[r].raw=this._wrapLogFn(s,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=_normalizeLogLevel(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(e,t)}create(e){const t=new Consola({...this.options,...e});return this._mockFn&&t.mockTypes(this._mockFn),t}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){const 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(const e in this.options.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(const 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.write=r=>{this[t].raw(String(r).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(){paused=!0}resumeLogs(){paused=!1;const e=queue.splice(0);for(const t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){const t=e||this.options.mockFn;if(this._mockFn=t,typeof t=="function")for(const r in this.options.types)this[r]=t(r,this.options.types[r])||this[r],this[r].raw=this[r]}_wrapLogFn(e,t){return(...r)=>{if(paused){queue.push([this,e,r,t]);return}return this._logFn(e,r,t)}}_logFn(e,t,r){if((e.level||0)>this.level)return!1;const s={date:new Date,args:[],...e,level:_normalizeLogLevel(e.level,this.options.types)};!r&&t.length===1&&isLogObj(t[0])?Object.assign(s,t[0]):s.args=[...t],s.message&&(s.args.unshift(s.message),delete s.message),s.additional&&(Array.isArray(s.additional)||(s.additional=s.additional.split(`
`)),s.args.push(`
`+s.additional.join(`
`)),delete s.additional),s.type=typeof s.type=="string"?s.type.toLowerCase():"log",s.tag=typeof s.tag=="string"?s.tag:"";const i=(a=!1)=>{const p=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&p>0){const c=[...this._lastLog.object.args];p>1&&c.push(`(repeated ${p} times)`),this._log({...this._lastLog.object,args:c}),this._lastLog.count=1}a&&(this._lastLog.object=s,this._log(s))};clearTimeout(this._lastLog.timeout);const n=this._lastLog.time&&s.date?s.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=s.date,n<this.options.throttle)try{const a=JSON.stringify([s.type,s.tag,s.args]),p=this._lastLog.serialized===a;if(this._lastLog.serialized=a,p&&(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(const t of this.options.reporters)t.log(e,{options:this.options})}}function _normalizeLogLevel(o,e={},t=3){return o===void 0?t:typeof o=="number"?o:e[o]&&e[o].level!==void 0?e[o].level:t}Consola.prototype.add=Consola.prototype.addReporter,Consola.prototype.remove=Consola.prototype.removeReporter,Consola.prototype.clear=Consola.prototype.removeReporter,Consola.prototype.withScope=Consola.prototype.withTag,Consola.prototype.mock=Consola.prototype.mockTypes,Consola.prototype.pause=Consola.prototype.pauseLogs,Consola.prototype.resume=Consola.prototype.resumeLogs;function createConsola$1(o={}){return new Consola(o)}class BrowserReporter{constructor(e){l(this,"options");l(this,"defaultColor");l(this,"levelColorMap");l(this,"typeColorMap");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){const t=this._getLogFn(e.level),r=e.type==="log"?"":e.type,s=e.tag||"",n=`
      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${[s,r].filter(Boolean).join(":")}`;typeof e.args[0]=="string"?t(`${a}%c ${e.args[0]}`,n,"",...e.args.slice(1)):t(a,n,...e.args)}}function createConsola(o={}){return createConsola$1({reporters:o.reporters||[new BrowserReporter({})],prompt(t,r={}){return r.type==="confirm"?Promise.resolve(confirm(t)):Promise.resolve(prompt(t))},...o})}const consola=createConsola(),disableProperty=(o,e)=>{try{Object.defineProperty(globalThis,o,{configurable:!1,writable:!1,value:e})}catch{}};disableProperty("fetch",()=>Promise.reject(new Error("fetch disabled in this worker")));const networkError=()=>{throw new Error("network disabled in this worker")},XHRStub=()=>{networkError()};XHRStub.prototype={},disableProperty("XMLHttpRequest",XHRStub),disableProperty("importScripts",networkError),disableProperty("WebSocket"),disableProperty("WebTransport"),disableProperty("RTCPeerConnection");const sendResult=(o,e)=>{const t={action:"result",result:o,id:e};self.postMessage(t)},sendError=(o,e)=>{const t={action:"error",error:o,id:e};self.postMessage(t)};self.onmessage=async event=>{const message=event.data;try{const result=eval(`(function (self) { ${message.code} })(null)`);sendResult(result,message.id)}catch(o){consola.error("[SandboxedEval] error in worker",o),sendError(o,message.id)}}})();
