From a1d1f3c18c3334bd534378d0fcfccd9a65dddc8f Mon Sep 17 00:00:00 2001 From: oiov Date: Wed, 11 Feb 2026 16:08:37 +0800 Subject: [PATCH] upd --- .../middleware-insertion-facade.js | 11 + .../bundle-caThGl/middleware-loader.entry.ts | 134 + .../strip-cf-connecting-ip-header.js | 13 + .wrangler/tmp/dev-qzpL9Z/index.js | 41 + .wrangler/tmp/dev-qzpL9Z/index.js.map | 8 + README.md | 40 + docs/email-worker-source.js | 17909 ---------------- docs/receive-tutorial-en.md | 116 - docs/receive-tutorial.md | 150 - docs/send-tutorial-en.md | 119 - docs/send-tutorial.md | 120 - docs/send-worker.js | 93 - .../build/client/assets/main-B3RYd5Io.css | 1 - frontend/build/client/assets/main-Cj20Dz1y.js | 264 - frontend/build/client/assets/main-MaFOzO4x.js | 341 + .../build/client/assets/main-fe5He4OT.css | 1 + frontend/build/client/index.html | 6 +- frontend/build/client/locales/en/common.json | 56 +- frontend/build/client/locales/zh/common.json | 56 +- frontend/public/locales/en/common.json | 56 +- frontend/public/locales/zh/common.json | 56 +- frontend/src/App.tsx | 2 + frontend/src/components/Header.tsx | 52 +- frontend/src/components/icons/ApiIcon.tsx | 18 + frontend/src/components/icons/CodeBracket.tsx | 18 + .../src/components/icons/GlobeAltIcon.tsx | 18 + frontend/src/components/icons/ServerIcon.tsx | 18 + frontend/src/pages/ApiDocs.tsx | 560 + frontend/src/pages/Home.tsx | 52 +- worker/drizzle/0001_add_api_tables.sql | 29 + worker/src/api/v1/index.ts | 18 + worker/src/api/v1/middleware/apiKeyAuth.ts | 73 + worker/src/api/v1/routes/mailboxes.ts | 299 + worker/src/database/dao.ts | 219 +- worker/src/database/schema.ts | 35 +- worker/src/index.ts | 63 +- 36 files changed, 2238 insertions(+), 18827 deletions(-) create mode 100644 .wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js create mode 100644 .wrangler/tmp/bundle-caThGl/middleware-loader.entry.ts create mode 100644 .wrangler/tmp/bundle-caThGl/strip-cf-connecting-ip-header.js create mode 100644 .wrangler/tmp/dev-qzpL9Z/index.js create mode 100644 .wrangler/tmp/dev-qzpL9Z/index.js.map delete mode 100644 docs/email-worker-source.js delete mode 100644 docs/receive-tutorial-en.md delete mode 100644 docs/receive-tutorial.md delete mode 100644 docs/send-tutorial-en.md delete mode 100644 docs/send-tutorial.md delete mode 100644 docs/send-worker.js delete mode 100644 frontend/build/client/assets/main-B3RYd5Io.css delete mode 100644 frontend/build/client/assets/main-Cj20Dz1y.js create mode 100644 frontend/build/client/assets/main-MaFOzO4x.js create mode 100644 frontend/build/client/assets/main-fe5He4OT.css create mode 100644 frontend/src/components/icons/ApiIcon.tsx create mode 100644 frontend/src/components/icons/CodeBracket.tsx create mode 100644 frontend/src/components/icons/GlobeAltIcon.tsx create mode 100644 frontend/src/components/icons/ServerIcon.tsx create mode 100644 frontend/src/pages/ApiDocs.tsx create mode 100644 worker/drizzle/0001_add_api_tables.sql create mode 100644 worker/src/api/v1/index.ts create mode 100644 worker/src/api/v1/middleware/apiKeyAuth.ts create mode 100644 worker/src/api/v1/routes/mailboxes.ts diff --git a/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js b/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js new file mode 100644 index 0000000..f254059 --- /dev/null +++ b/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js @@ -0,0 +1,11 @@ + import worker, * as OTHER_EXPORTS from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts"; + import * as __MIDDLEWARE_0__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts"; +import * as __MIDDLEWARE_1__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts"; + + export * from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts"; + + export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [ + + __MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default + ] + export default worker; \ No newline at end of file diff --git a/.wrangler/tmp/bundle-caThGl/middleware-loader.entry.ts b/.wrangler/tmp/bundle-caThGl/middleware-loader.entry.ts new file mode 100644 index 0000000..be05b1b --- /dev/null +++ b/.wrangler/tmp/bundle-caThGl/middleware-loader.entry.ts @@ -0,0 +1,134 @@ +// This loads all middlewares exposed on the middleware object and then starts +// the invocation chain. The big idea is that we can add these to the middleware +// export dynamically through wrangler, or we can potentially let users directly +// add them as a sort of "plugin" system. + +import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js"; +import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts"; +import type { WorkerEntrypointConstructor } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js"; + +// Preserve all the exports from the worker +export * from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js"; + +class __Facade_ScheduledController__ implements ScheduledController { + readonly #noRetry: ScheduledController["noRetry"]; + + constructor( + readonly scheduledTime: number, + readonly cron: string, + noRetry: ScheduledController["noRetry"] + ) { + this.#noRetry = noRetry; + } + + noRetry() { + if (!(this instanceof __Facade_ScheduledController__)) { + throw new TypeError("Illegal invocation"); + } + // Need to call native method immediately in case uncaught error thrown + this.#noRetry(); + } +} + +function wrapExportedHandler(worker: ExportedHandler): ExportedHandler { + // If we don't have any middleware defined, just return the handler as is + if ( + __INTERNAL_WRANGLER_MIDDLEWARE__ === undefined || + __INTERNAL_WRANGLER_MIDDLEWARE__.length === 0 + ) { + return worker; + } + // Otherwise, register all middleware once + for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) { + __facade_register__(middleware); + } + + const fetchDispatcher: ExportedHandlerFetchHandler = function ( + request, + env, + ctx + ) { + if (worker.fetch === undefined) { + throw new Error("Handler does not export a fetch() function."); + } + return worker.fetch(request, env, ctx); + }; + + return { + ...worker, + fetch(request, env, ctx) { + const dispatcher: Dispatcher = function (type, init) { + if (type === "scheduled" && worker.scheduled !== undefined) { + const controller = new __Facade_ScheduledController__( + Date.now(), + init.cron ?? "", + () => {} + ); + return worker.scheduled(controller, env, ctx); + } + }; + return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher); + }, + }; +} + +function wrapWorkerEntrypoint( + klass: WorkerEntrypointConstructor +): WorkerEntrypointConstructor { + // If we don't have any middleware defined, just return the handler as is + if ( + __INTERNAL_WRANGLER_MIDDLEWARE__ === undefined || + __INTERNAL_WRANGLER_MIDDLEWARE__.length === 0 + ) { + return klass; + } + // Otherwise, register all middleware once + for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) { + __facade_register__(middleware); + } + + // `extend`ing `klass` here so other RPC methods remain callable + return class extends klass { + #fetchDispatcher: ExportedHandlerFetchHandler> = ( + request, + env, + ctx + ) => { + this.env = env; + this.ctx = ctx; + if (super.fetch === undefined) { + throw new Error("Entrypoint class does not define a fetch() function."); + } + return super.fetch(request); + }; + + #dispatcher: Dispatcher = (type, init) => { + if (type === "scheduled" && super.scheduled !== undefined) { + const controller = new __Facade_ScheduledController__( + Date.now(), + init.cron ?? "", + () => {} + ); + return super.scheduled(controller); + } + }; + + fetch(request: Request) { + return __facade_invoke__( + request, + this.env, + this.ctx, + this.#dispatcher, + this.#fetchDispatcher + ); + } + }; +} + +let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined; +if (typeof ENTRY === "object") { + WRAPPED_ENTRY = wrapExportedHandler(ENTRY); +} else if (typeof ENTRY === "function") { + WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY); +} +export default WRAPPED_ENTRY; diff --git a/.wrangler/tmp/bundle-caThGl/strip-cf-connecting-ip-header.js b/.wrangler/tmp/bundle-caThGl/strip-cf-connecting-ip-header.js new file mode 100644 index 0000000..a011710 --- /dev/null +++ b/.wrangler/tmp/bundle-caThGl/strip-cf-connecting-ip-header.js @@ -0,0 +1,13 @@ +function stripCfConnectingIPHeader(input, init) { + const request = new Request(input, init); + request.headers.delete("CF-Connecting-IP"); + return request; +} + +globalThis.fetch = new Proxy(globalThis.fetch, { + apply(target, thisArg, argArray) { + return Reflect.apply(target, thisArg, [ + stripCfConnectingIPHeader.apply(null, argArray), + ]); + }, +}); diff --git a/.wrangler/tmp/dev-qzpL9Z/index.js b/.wrangler/tmp/dev-qzpL9Z/index.js new file mode 100644 index 0000000..9ce45ab --- /dev/null +++ b/.wrangler/tmp/dev-qzpL9Z/index.js @@ -0,0 +1,41 @@ +var Rn=Object.defineProperty;var eu=(r,e,t)=>e in r?Rn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var o=(r,e)=>Rn(r,"name",{value:e,configurable:!0});var tu=(r,e)=>{for(var t in e)Rn(r,t,{get:e[t],enumerable:!0})};var h=(r,e,t)=>(eu(r,typeof e!="symbol"?e+"":e,t),t);function ru(r,e){let t=new Request(r,e);return t.headers.delete("CF-Connecting-IP"),t}o(ru,"stripCfConnectingIPHeader");globalThis.fetch=new Proxy(globalThis.fetch,{apply(r,e,t){return Reflect.apply(r,e,[ru.apply(null,t)])}});function L(r){return new Error(`[unenv] ${r} is not implemented yet!`)}o(L,"createNotImplementedError");function Ve(r){return Object.assign(o(()=>{throw L(r)},"fn"),{__unenv__:!0})}o(Ve,"notImplemented");function qi(r){return class{__unenv__=!0;constructor(){throw new Error(`[unenv] ${r} is not implemented yet!`)}}}o(qi,"notImplementedClass");var On=globalThis.performance?.timeOrigin??Date.now(),Bn=globalThis.performance?.now?globalThis.performance.now.bind(globalThis.performance):()=>Date.now()-On,su={name:"node",entryType:"node",startTime:0,duration:0,nodeStart:0,v8Start:0,bootstrapComplete:0,environment:0,loopStart:0,loopExit:0,idleTime:0,uvMetricsInfo:{loopCount:0,events:0,eventsWaiting:0},detail:void 0,toJSON(){return this}},rt=class{__unenv__=!0;detail;entryType="event";name;startTime;constructor(e,t){this.name=e,this.startTime=t?.startTime||Bn(),this.detail=t?.detail}get duration(){return Bn()-this.startTime}toJSON(){return{name:this.name,entryType:this.entryType,startTime:this.startTime,duration:this.duration,detail:this.detail}}};o(rt,"PerformanceEntry");var qn=o(class extends rt{entryType="mark";constructor(){super(...arguments)}get duration(){return 0}},"PerformanceMark"),ar=class extends rt{entryType="measure"};o(ar,"PerformanceMeasure");var or=class extends rt{entryType="resource";serverTiming=[];connectEnd=0;connectStart=0;decodedBodySize=0;domainLookupEnd=0;domainLookupStart=0;encodedBodySize=0;fetchStart=0;initiatorType="";name="";nextHopProtocol="";redirectEnd=0;redirectStart=0;requestStart=0;responseEnd=0;responseStart=0;secureConnectionStart=0;startTime=0;transferSize=0;workerStart=0;responseStatus=0};o(or,"PerformanceResourceTiming");var Kr=class{__unenv__=!0;getEntries(){return[]}getEntriesByName(e,t){return[]}getEntriesByType(e){return[]}};o(Kr,"PerformanceObserverEntryList");var ur=class{__unenv__=!0;timeOrigin=On;eventCounts=new Map;_entries=[];_resourceTimingBufferSize=0;navigation=void 0;timing=void 0;timerify(e,t){throw L("Performance.timerify")}get nodeTiming(){return su}eventLoopUtilization(){return{}}markResourceTiming(){return new or("")}onresourcetimingbufferfull=null;now(){return this.timeOrigin===On?Bn():Date.now()-this.timeOrigin}clearMarks(e){this._entries=e?this._entries.filter(t=>t.name!==e):this._entries.filter(t=>t.entryType!=="mark")}clearMeasures(e){this._entries=e?this._entries.filter(t=>t.name!==e):this._entries.filter(t=>t.entryType!=="measure")}clearResourceTimings(){this._entries=this._entries.filter(e=>e.entryType!=="resource"||e.entryType!=="navigation")}getEntries(){return this._entries}getEntriesByName(e,t){return this._entries.filter(s=>s.name===e&&(!t||s.entryType===t))}getEntriesByType(e){return this._entries.filter(t=>t.entryType===e)}mark(e,t){let s=new qn(e,t);return this._entries.push(s),s}measure(e,t,s){let n,i;typeof t=="string"?(n=this.getEntriesByName(t,"mark")[0]?.startTime,i=this.getEntriesByName(s,"mark")[0]?.startTime):(n=Number.parseFloat(t?.start)||this.now(),i=Number.parseFloat(t?.end)||this.now());let a=new ar(e,{startTime:n,detail:{start:n,end:i}});return this._entries.push(a),a}setResourceTimingBufferSize(e){this._resourceTimingBufferSize=e}addEventListener(e,t,s){throw L("Performance.addEventListener")}removeEventListener(e,t,s){throw L("Performance.removeEventListener")}dispatchEvent(e){throw L("Performance.dispatchEvent")}toJSON(){return this}};o(ur,"Performance");var ir=class{__unenv__=!0;_callback=null;constructor(e){this._callback=e}takeRecords(){return[]}disconnect(){throw L("PerformanceObserver.disconnect")}observe(e){throw L("PerformanceObserver.observe")}bind(e){return e}runInAsyncScope(e,t,...s){return e.call(t,...s)}asyncId(){return 0}triggerAsyncId(){return 0}emitDestroy(){return this}};o(ir,"PerformanceObserver"),h(ir,"supportedEntryTypes",[]);var Fi=globalThis.performance&&"addEventListener"in globalThis.performance?globalThis.performance:new ur;globalThis.performance=Fi;globalThis.Performance=ur;globalThis.PerformanceEntry=rt;globalThis.PerformanceMark=qn;globalThis.PerformanceMeasure=ar;globalThis.PerformanceObserver=ir;globalThis.PerformanceObserverEntryList=Kr;globalThis.PerformanceResourceTiming=or;import{Writable as ji}from"node:stream";var te=Object.assign(()=>{},{__unenv__:!0});var Q=globalThis.console,Ii=!0,Mi=new ji,$i=new ji,$s=Q?.log??te,nu=Q?.info??$s,Up=Q?.trace??nu,Kp=Q?.debug??$s,Hp=Q?.table??$s,iu=Q?.error??$s,Qp=Q?.warn??iu,Gp=Q?.createTask??Ve("console.createTask");var Wp=Q?.clear??te,Jp=Q?.count??te,Yp=Q?.countReset??te,Xp=Q?.dir??te,Zp=Q?.dirxml??te,em=Q?.group??te,tm=Q?.groupEnd??te,rm=Q?.groupCollapsed??te,sm=Q?.profile??te,nm=Q?.profileEnd??te,im=Q?.time??te,am=Q?.timeEnd??te,om=Q?.timeLog??te,um=Q?.timeStamp??te,Li=Q?.Console??qi("console.Console"),Pi=new Map;var zi=te,Vi=te;var Fn=globalThis.console,{assert:gm,clear:ym,context:bm,count:xm,countReset:vm,createTask:wm,debug:Am,dir:Dm,dirxml:_m,error:Em,group:Cm,groupCollapsed:Tm,groupEnd:Sm,info:Nm,log:km,profile:Rm,profileEnd:Om,table:Bm,time:qm,timeEnd:Fm,timeLog:jm,timeStamp:Im,trace:Mm,warn:$m}=Fn;Object.assign(Fn,{Console:Li,_ignoreErrors:Ii,_stderr:Mi,_stderrErrorHandler:Vi,_stdout:$i,_stdoutErrorHandler:zi,_times:Pi});var Ui=Fn;globalThis.console=Ui;var Ki=Object.assign(o(function(e){let t=Date.now(),s=Math.trunc(t/1e3),n=t%1e3*1e6;if(e){let i=s-e[0],a=n-e[0];return a<0&&(i=i-1,a=1e9+a),[i,a]}return[s,n]},"hrtime"),{bigint:o(function(){return BigInt(Date.now()*1e6)},"bigint")});import{EventEmitter as Hi}from"node:events";import{Socket as au}from"node:net";var lr=class extends au{fd;constructor(e){super(),this.fd=e}isRaw=!1;setRawMode(e){return this.isRaw=e,this}isTTY=!1};o(lr,"ReadStream");import{Socket as ou}from"node:net";var _t=class extends ou{fd;constructor(e){super(),this.fd=e}clearLine(e,t){return t&&t(),!1}clearScreenDown(e){return e&&e(),!1}cursorTo(e,t,s){return s&&typeof s=="function"&&s(),!1}moveCursor(e,t,s){return s&&s(),!1}getColorDepth(e){return 1}hasColors(e,t){return!1}getWindowSize(){return[this.columns,this.rows]}columns=80;rows=24;isTTY=!1};o(_t,"WriteStream");var Et=class extends Hi{env;hrtime;nextTick;constructor(e){super(),this.env=e.env,this.hrtime=e.hrtime,this.nextTick=e.nextTick;for(let t of[...Object.getOwnPropertyNames(Et.prototype),...Object.getOwnPropertyNames(Hi.prototype)]){let s=this[t];typeof s=="function"&&(this[t]=s.bind(this))}}emitWarning(e,t,s){console.warn(`${s?`[${s}] `:""}${t?`${t}: `:""}${e}`)}emit(...e){return super.emit(...e)}listeners(e){return super.listeners(e)}#e;#t;#r;get stdin(){return this.#e??=new lr(0)}get stdout(){return this.#t??=new _t(1)}get stderr(){return this.#r??=new _t(2)}#i="/";chdir(e){this.#i=e}cwd(){return this.#i}arch="";platform="";argv=[];argv0="";execArgv=[];execPath="";title="";pid=200;ppid=100;get version(){return""}get versions(){return{}}get allowedNodeEnvironmentFlags(){return new Set}get sourceMapsEnabled(){return!1}get debugPort(){return 0}get throwDeprecation(){return!1}get traceDeprecation(){return!1}get features(){return{}}get release(){return{}}get connected(){return!1}get config(){return{}}get moduleLoadList(){return[]}constrainedMemory(){return 0}availableMemory(){return 0}uptime(){return 0}resourceUsage(){return{}}ref(){}unref(){}umask(){throw L("process.umask")}getBuiltinModule(){}getActiveResourcesInfo(){throw L("process.getActiveResourcesInfo")}exit(){throw L("process.exit")}reallyExit(){throw L("process.reallyExit")}kill(){throw L("process.kill")}abort(){throw L("process.abort")}dlopen(){throw L("process.dlopen")}setSourceMapsEnabled(){throw L("process.setSourceMapsEnabled")}loadEnvFile(){throw L("process.loadEnvFile")}disconnect(){throw L("process.disconnect")}cpuUsage(){throw L("process.cpuUsage")}setUncaughtExceptionCaptureCallback(){throw L("process.setUncaughtExceptionCaptureCallback")}hasUncaughtExceptionCaptureCallback(){throw L("process.hasUncaughtExceptionCaptureCallback")}initgroups(){throw L("process.initgroups")}openStdin(){throw L("process.openStdin")}assert(){throw L("process.assert")}binding(){throw L("process.binding")}permission={has:Ve("process.permission.has")};report={directory:"",filename:"",signal:"SIGUSR2",compact:!1,reportOnFatalError:!1,reportOnSignal:!1,reportOnUncaughtException:!1,getReport:Ve("process.report.getReport"),writeReport:Ve("process.report.writeReport")};finalization={register:Ve("process.finalization.register"),unregister:Ve("process.finalization.unregister"),registerBeforeExit:Ve("process.finalization.registerBeforeExit")};memoryUsage=Object.assign(()=>({arrayBuffers:0,rss:0,external:0,heapTotal:0,heapUsed:0}),{rss:()=>0});mainModule=void 0;domain=void 0;send=void 0;exitCode=void 0;channel=void 0;getegid=void 0;geteuid=void 0;getgid=void 0;getgroups=void 0;getuid=void 0;setegid=void 0;seteuid=void 0;setgid=void 0;setgroups=void 0;setuid=void 0;_events=void 0;_eventsCount=void 0;_exiting=void 0;_maxListeners=void 0;_debugEnd=void 0;_debugProcess=void 0;_fatalException=void 0;_getActiveHandles=void 0;_getActiveRequests=void 0;_kill=void 0;_preload_modules=void 0;_rawDebug=void 0;_startProfilerIdleNotifier=void 0;_stopProfilerIdleNotifier=void 0;_tickCallback=void 0;_disconnect=void 0;_handleQueue=void 0;_pendingMessage=void 0;_channel=void 0;_send=void 0;_linkedBinding=void 0};o(Et,"Process");var Qi=globalThis.process,Gi=Qi.getBuiltinModule,{exit:uu,platform:lu,nextTick:Wi}=Gi("node:process"),cu=new Et({env:Qi.env,hrtime:Ki,nextTick:Wi}),{abort:du,addListener:fu,allowedNodeEnvironmentFlags:hu,hasUncaughtExceptionCaptureCallback:pu,setUncaughtExceptionCaptureCallback:mu,loadEnvFile:gu,sourceMapsEnabled:yu,arch:bu,argv:xu,argv0:vu,chdir:wu,config:Au,connected:Du,constrainedMemory:_u,availableMemory:Eu,cpuUsage:Cu,cwd:Tu,debugPort:Su,dlopen:Nu,disconnect:ku,emit:Ru,emitWarning:Ou,env:Bu,eventNames:qu,execArgv:Fu,execPath:ju,finalization:Iu,features:Mu,getActiveResourcesInfo:$u,getMaxListeners:Lu,hrtime:Pu,kill:zu,listeners:Vu,listenerCount:Uu,memoryUsage:Ku,on:Hu,off:Qu,once:Gu,pid:Wu,ppid:Ju,prependListener:Yu,prependOnceListener:Xu,rawListeners:Zu,release:el,removeAllListeners:tl,removeListener:rl,report:sl,resourceUsage:nl,setMaxListeners:il,setSourceMapsEnabled:al,stderr:ol,stdin:ul,stdout:ll,title:cl,throwDeprecation:dl,traceDeprecation:fl,umask:hl,uptime:pl,version:ml,versions:gl,domain:yl,initgroups:bl,moduleLoadList:xl,reallyExit:vl,openStdin:wl,assert:Al,binding:Dl,send:_l,exitCode:El,channel:Cl,getegid:Tl,geteuid:Sl,getgid:Nl,getgroups:kl,getuid:Rl,setegid:Ol,seteuid:Bl,setgid:ql,setgroups:Fl,setuid:jl,permission:Il,mainModule:Ml,_events:$l,_eventsCount:Ll,_exiting:Pl,_maxListeners:zl,_debugEnd:Vl,_debugProcess:Ul,_fatalException:Kl,_getActiveHandles:Hl,_getActiveRequests:Ql,_kill:Gl,_preload_modules:Wl,_rawDebug:Jl,_startProfilerIdleNotifier:Yl,_stopProfilerIdleNotifier:Xl,_tickCallback:Zl,_disconnect:ec,_handleQueue:tc,_pendingMessage:rc,_channel:sc,_send:nc,_linkedBinding:ic}=cu,ac={abort:du,addListener:fu,allowedNodeEnvironmentFlags:hu,hasUncaughtExceptionCaptureCallback:pu,setUncaughtExceptionCaptureCallback:mu,loadEnvFile:gu,sourceMapsEnabled:yu,arch:bu,argv:xu,argv0:vu,chdir:wu,config:Au,connected:Du,constrainedMemory:_u,availableMemory:Eu,cpuUsage:Cu,cwd:Tu,debugPort:Su,dlopen:Nu,disconnect:ku,emit:Ru,emitWarning:Ou,env:Bu,eventNames:qu,execArgv:Fu,execPath:ju,exit:uu,finalization:Iu,features:Mu,getBuiltinModule:Gi,getActiveResourcesInfo:$u,getMaxListeners:Lu,hrtime:Pu,kill:zu,listeners:Vu,listenerCount:Uu,memoryUsage:Ku,nextTick:Wi,on:Hu,off:Qu,once:Gu,pid:Wu,platform:lu,ppid:Ju,prependListener:Yu,prependOnceListener:Xu,rawListeners:Zu,release:el,removeAllListeners:tl,removeListener:rl,report:sl,resourceUsage:nl,setMaxListeners:il,setSourceMapsEnabled:al,stderr:ol,stdin:ul,stdout:ll,title:cl,throwDeprecation:dl,traceDeprecation:fl,umask:hl,uptime:pl,version:ml,versions:gl,domain:yl,initgroups:bl,moduleLoadList:xl,reallyExit:vl,openStdin:wl,assert:Al,binding:Dl,send:_l,exitCode:El,channel:Cl,getegid:Tl,geteuid:Sl,getgid:Nl,getgroups:kl,getuid:Rl,setegid:Ol,seteuid:Bl,setgid:ql,setgroups:Fl,setuid:jl,permission:Il,mainModule:Ml,_events:$l,_eventsCount:Ll,_exiting:Pl,_maxListeners:zl,_debugEnd:Vl,_debugProcess:Ul,_fatalException:Kl,_getActiveHandles:Hl,_getActiveRequests:Ql,_kill:Gl,_preload_modules:Wl,_rawDebug:Jl,_startProfilerIdleNotifier:Yl,_stopProfilerIdleNotifier:Xl,_tickCallback:Zl,_disconnect:ec,_handleQueue:tc,_pendingMessage:rc,_channel:sc,_send:nc,_linkedBinding:ic},Ji=ac;globalThis.process=Ji;var jn=o((r,e,t)=>(s,n)=>{let i=-1;return a(0);async function a(u){if(u<=i)throw new Error("next() called multiple times");i=u;let l,c=!1,d;if(r[u]?(d=r[u][0][0],s.req.routeIndex=u):d=u===r.length&&n||void 0,d)try{l=await d(s,()=>a(u+1))}catch(m){if(m instanceof Error&&e)s.error=m,l=await e(m,s),c=!0;else throw m}else s.finalized===!1&&t&&(l=await t(s));return l&&(s.finalized===!1||c)&&(s.res=l),s}},"compose");var Yi=Symbol();var Xi=o(async(r,e=Object.create(null))=>{let{all:t=!1,dot:s=!1}=e,i=(r instanceof Ls?r.raw.headers:r.headers).get("Content-Type");return i?.startsWith("multipart/form-data")||i?.startsWith("application/x-www-form-urlencoded")?oc(r,{all:t,dot:s}):{}},"parseBody");async function oc(r,e){let t=await r.formData();return t?uc(t,e):{}}o(oc,"parseFormData");function uc(r,e){let t=Object.create(null);return r.forEach((s,n)=>{e.all||n.endsWith("[]")?lc(t,n,s):t[n]=s}),e.dot&&Object.entries(t).forEach(([s,n])=>{s.includes(".")&&(cc(t,s,n),delete t[s])}),t}o(uc,"convertFormDataToBodyData");var lc=o((r,e,t)=>{r[e]!==void 0?Array.isArray(r[e])?r[e].push(t):r[e]=[r[e],t]:e.endsWith("[]")?r[e]=[t]:r[e]=t},"handleParsingAllValues"),cc=o((r,e,t)=>{let s=r,n=e.split(".");n.forEach((i,a)=>{a===n.length-1?s[i]=t:((!s[i]||typeof s[i]!="object"||Array.isArray(s[i])||s[i]instanceof File)&&(s[i]=Object.create(null)),s=s[i])})},"handleParsingNestedValues");var Mn=o(r=>{let e=r.split("/");return e[0]===""&&e.shift(),e},"splitPath"),Zi=o(r=>{let{groups:e,path:t}=dc(r),s=Mn(t);return fc(s,e)},"splitRoutingPath"),dc=o(r=>{let e=[];return r=r.replace(/\{[^}]+\}/g,(t,s)=>{let n=`@${s}`;return e.push([n,t]),n}),{groups:e,path:r}},"extractGroupsFromPath"),fc=o((r,e)=>{for(let t=e.length-1;t>=0;t--){let[s]=e[t];for(let n=r.length-1;n>=0;n--)if(r[n].includes(s)){r[n]=r[n].replace(s,e[t][1]);break}}return r},"replaceGroupMarks"),Ps={},ea=o((r,e)=>{if(r==="*")return"*";let t=r.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(t){let s=`${r}#${e}`;return Ps[s]||(t[2]?Ps[s]=e&&e[0]!==":"&&e[0]!=="*"?[s,t[1],new RegExp(`^${t[2]}(?=/${e})`)]:[r,t[1],new RegExp(`^${t[2]}$`)]:Ps[s]=[r,t[1],!0]),Ps[s]}return null},"getPattern"),zs=o((r,e)=>{try{return e(r)}catch{return r.replace(/(?:%[0-9A-Fa-f]{2})+/g,t=>{try{return e(t)}catch{return t}})}},"tryDecode"),hc=o(r=>zs(r,decodeURI),"tryDecodeURI"),$n=o(r=>{let e=r.url,t=e.indexOf("/",e.indexOf(":")+4),s=t;for(;s{let e=$n(r);return e.length>1&&e.at(-1)==="/"?e.slice(0,-1):e},"getPathNoStrict"),Ct=o((r,e,...t)=>(t.length&&(e=Ct(e,...t)),`${r?.[0]==="/"?"":"/"}${r}${e==="/"?"":`${r?.at(-1)==="/"?"":"/"}${e?.[0]==="/"?e.slice(1):e}`}`),"mergePath"),Vs=o(r=>{if(r.charCodeAt(r.length-1)!==63||!r.includes(":"))return null;let e=r.split("/"),t=[],s="";return e.forEach(n=>{if(n!==""&&!/\:/.test(n))s+="/"+n;else if(/\:/.test(n))if(/\?/.test(n)){t.length===0&&s===""?t.push("/"):t.push(s);let i=n.replace("?","");s+="/"+i,t.push(s)}else s+="/"+n}),t.filter((n,i,a)=>a.indexOf(n)===i)},"checkOptionalParameter"),In=o(r=>/[%+]/.test(r)?(r.indexOf("+")!==-1&&(r=r.replace(/\+/g," ")),r.indexOf("%")!==-1?zs(r,Ln):r):r,"_decodeURI"),ra=o((r,e,t)=>{let s;if(!t&&e&&!/[%+]/.test(e)){let a=r.indexOf(`?${e}`,8);for(a===-1&&(a=r.indexOf(`&${e}`,8));a!==-1;){let u=r.charCodeAt(a+e.length+1);if(u===61){let l=a+e.length+2,c=r.indexOf("&",l);return In(r.slice(l,c===-1?void 0:c))}else if(u==38||isNaN(u))return"";a=r.indexOf(`&${e}`,a+1)}if(s=/[%+]/.test(r),!s)return}let n={};s??=/[%+]/.test(r);let i=r.indexOf("?",8);for(;i!==-1;){let a=r.indexOf("&",i+1),u=r.indexOf("=",i);u>a&&a!==-1&&(u=-1);let l=r.slice(i+1,u===-1?a===-1?void 0:a:u);if(s&&(l=In(l)),i=a,l==="")continue;let c;u===-1?c="":(c=r.slice(u+1,a===-1?void 0:a),s&&(c=In(c))),t?(n[l]&&Array.isArray(n[l])||(n[l]=[]),n[l].push(c)):n[l]??=c}return e?n[e]:n},"_getQueryParam"),sa=ra,na=o((r,e)=>ra(r,e,!0),"getQueryParams"),Ln=decodeURIComponent;var ia=o(r=>zs(r,Ln),"tryDecodeURIComponent"),Ls=o(class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(r,e="/",t=[[]]){this.raw=r,this.path=e,this.#t=t,this.#e={}}param(r){return r?this.#r(r):this.#i()}#r(r){let e=this.#t[0][this.routeIndex][1][r],t=this.#n(e);return t&&/\%/.test(t)?ia(t):t}#i(){let r={},e=Object.keys(this.#t[0][this.routeIndex][1]);for(let t of e){let s=this.#n(this.#t[0][this.routeIndex][1][t]);s!==void 0&&(r[t]=/\%/.test(s)?ia(s):s)}return r}#n(r){return this.#t[1]?this.#t[1][r]:r}query(r){return sa(this.url,r)}queries(r){return na(this.url,r)}header(r){if(r)return this.raw.headers.get(r)??void 0;let e={};return this.raw.headers.forEach((t,s)=>{e[s]=t}),e}async parseBody(r){return this.bodyCache.parsedBody??=await Xi(this,r)}#s=r=>{let{bodyCache:e,raw:t}=this,s=e[r];if(s)return s;let n=Object.keys(e)[0];return n?e[n].then(i=>(n==="json"&&(i=JSON.stringify(i)),new Response(i)[r]())):e[r]=t[r]()};json(){return this.#s("text").then(r=>JSON.parse(r))}text(){return this.#s("text")}arrayBuffer(){return this.#s("arrayBuffer")}blob(){return this.#s("blob")}formData(){return this.#s("formData")}addValidatedData(r,e){this.#e[r]=e}valid(r){return this.#e[r]}get url(){return this.raw.url}get method(){return this.raw.method}get[Yi](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,r]])=>r)}get routePath(){return this.#t[0].map(([[,r]])=>r)[this.routeIndex].path}},"HonoRequest");var aa={Stringify:1,BeforeStream:2,Stream:3},pc=o((r,e)=>{let t=new String(r);return t.isEscaped=!0,t.callbacks=e,t},"raw");var Pn=o(async(r,e,t,s,n)=>{typeof r=="object"&&!(r instanceof String)&&(r instanceof Promise||(r=r.toString()),r instanceof Promise&&(r=await r));let i=r.callbacks;if(!i?.length)return Promise.resolve(r);n?n[0]+=r:n=[r];let a=Promise.all(i.map(u=>u({phase:e,buffer:n,context:s}))).then(u=>Promise.all(u.filter(Boolean).map(l=>Pn(l,e,!1,s,n))).then(()=>n[0]));return t?pc(await a,i):a},"resolveCallback");var mc="text/plain; charset=UTF-8",zn=o((r,e)=>({"Content-Type":r,...e}),"setDefaultContentType"),oa=o(class{#e;#t;env={};#r;finalized=!1;error;#i;#n;#s;#c;#u;#l;#o;#d;#f;constructor(r,e){this.#e=r,e&&(this.#n=e.executionCtx,this.env=e.env,this.#l=e.notFoundHandler,this.#f=e.path,this.#d=e.matchResult)}get req(){return this.#t??=new Ls(this.#e,this.#f,this.#d),this.#t}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;throw Error("This context has no ExecutionContext")}get res(){return this.#s||=new Response(null,{headers:this.#o??=new Headers})}set res(r){if(this.#s&&r){r=new Response(r.body,r);for(let[e,t]of this.#s.headers.entries())if(e!=="content-type")if(e==="set-cookie"){let s=this.#s.headers.getSetCookie();r.headers.delete("set-cookie");for(let n of s)r.headers.append("set-cookie",n)}else r.headers.set(e,t)}this.#s=r,this.finalized=!0}render=(...r)=>(this.#u??=e=>this.html(e),this.#u(...r));setLayout=r=>this.#c=r;getLayout=()=>this.#c;setRenderer=r=>{this.#u=r};header=(r,e,t)=>{this.finalized&&(this.#s=new Response(this.#s.body,this.#s));let s=this.#s?this.#s.headers:this.#o??=new Headers;e===void 0?s.delete(r):t?.append?s.append(r,e):s.set(r,e)};status=r=>{this.#i=r};set=(r,e)=>{this.#r??=new Map,this.#r.set(r,e)};get=r=>this.#r?this.#r.get(r):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#a(r,e,t){let s=this.#s?new Headers(this.#s.headers):this.#o??new Headers;if(typeof e=="object"&&"headers"in e){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[a,u]of i)a.toLowerCase()==="set-cookie"?s.append(a,u):s.set(a,u)}if(t)for(let[i,a]of Object.entries(t))if(typeof a=="string")s.set(i,a);else{s.delete(i);for(let u of a)s.append(i,u)}let n=typeof e=="number"?e:e?.status??this.#i;return new Response(r,{status:n,headers:s})}newResponse=(...r)=>this.#a(...r);body=(r,e,t)=>this.#a(r,e,t);text=(r,e,t)=>!this.#o&&!this.#i&&!e&&!t&&!this.finalized?new Response(r):this.#a(r,e,zn(mc,t));json=(r,e,t)=>this.#a(JSON.stringify(r),e,zn("application/json",t));html=(r,e,t)=>{let s=o(n=>this.#a(n,e,zn("text/html; charset=UTF-8",t)),"res");return typeof r=="object"?Pn(r,aa.Stringify,!1,{}).then(s):s(r)};redirect=(r,e)=>{let t=String(r);return this.header("Location",/[^\x00-\xFF]/.test(t)?encodeURI(t):t),this.newResponse(null,e??302)};notFound=()=>(this.#l??=()=>new Response,this.#l(this))},"Context");var U="ALL",ua="all",la=["get","post","put","delete","options","patch"],Us="Can not add a route since the matcher is already built.",Ks=o(class extends Error{},"UnsupportedPathError");var ca="__COMPOSED_HANDLER";var gc=o(r=>r.text("404 Not Found",404),"notFoundHandler"),da=o((r,e)=>{if("getResponse"in r){let t=r.getResponse();return e.newResponse(t.body,t)}return console.error(r),e.text("Internal Server Error",500)},"errorHandler"),Vn=o(class{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(r={}){[...la,ua].forEach(n=>{this[n]=(i,...a)=>(typeof i=="string"?this.#e=i:this.#i(n,this.#e,i),a.forEach(u=>{this.#i(n,this.#e,u)}),this)}),this.on=(n,i,...a)=>{for(let u of[i].flat()){this.#e=u;for(let l of[n].flat())a.map(c=>{this.#i(l.toUpperCase(),this.#e,c)})}return this},this.use=(n,...i)=>(typeof n=="string"?this.#e=n:(this.#e="*",i.unshift(n)),i.forEach(a=>{this.#i(U,this.#e,a)}),this);let{strict:t,...s}=r;Object.assign(this,s),this.getPath=t??!0?r.getPath??$n:ta}#t(){let r=new Vn({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#r=this.#r,r.routes=this.routes,r}#r=gc;errorHandler=da;route(r,e){let t=this.basePath(r);return e.routes.map(s=>{let n;e.errorHandler===da?n=s.handler:(n=o(async(i,a)=>(await jn([],e.errorHandler)(i,()=>s.handler(i,a))).res,"handler"),n[ca]=s.handler),t.#i(s.method,s.path,n)}),this}basePath(r){let e=this.#t();return e._basePath=Ct(this._basePath,r),e}onError=r=>(this.errorHandler=r,this);notFound=r=>(this.#r=r,this);mount(r,e,t){let s,n;t&&(typeof t=="function"?n=t:(n=t.optionHandler,t.replaceRequest===!1?s=o(u=>u,"replaceRequest"):s=t.replaceRequest));let i=n?u=>{let l=n(u);return Array.isArray(l)?l:[l]}:u=>{let l;try{l=u.executionCtx}catch{}return[u.env,l]};s||=(()=>{let u=Ct(this._basePath,r),l=u==="/"?0:u.length;return c=>{let d=new URL(c.url);return d.pathname=d.pathname.slice(l)||"/",new Request(d,c)}})();let a=o(async(u,l)=>{let c=await e(s(u.req.raw),...i(u));if(c)return c;await l()},"handler");return this.#i(U,Ct(r,"*"),a),this}#i(r,e,t){r=r.toUpperCase(),e=Ct(this._basePath,e);let s={basePath:this._basePath,path:e,method:r,handler:t};this.router.add(r,e,[t,s]),this.routes.push(s)}#n(r,e){if(r instanceof Error)return this.errorHandler(r,e);throw r}#s(r,e,t,s){if(s==="HEAD")return(async()=>new Response(null,await this.#s(r,e,t,"GET")))();let n=this.getPath(r,{env:t}),i=this.router.match(s,n),a=new oa(r,{path:n,matchResult:i,env:t,executionCtx:e,notFoundHandler:this.#r});if(i[0].length===1){let l;try{l=i[0][0][0][0](a,async()=>{a.res=await this.#r(a)})}catch(c){return this.#n(c,a)}return l instanceof Promise?l.then(c=>c||(a.finalized?a.res:this.#r(a))).catch(c=>this.#n(c,a)):l??this.#r(a)}let u=jn(i[0],this.errorHandler,this.#r);return(async()=>{try{let l=await u(a);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#n(l,a)}})()}fetch=(r,...e)=>this.#s(r,e[1],e[0],r.method);request=(r,e,t,s)=>r instanceof Request?this.fetch(e?new Request(r,e):r,t,s):(r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${Ct("/",r)}`,e),t,s));fire=()=>{addEventListener("fetch",r=>{r.respondWith(this.#s(r.request,r,void 0,r.request.method))})}},"Hono");var Hs=[];function Un(r,e){let t=this.buildAllMatchers(),s=o((n,i)=>{let a=t[n]||t[U],u=a[2][i];if(u)return u;let l=i.match(a[0]);if(!l)return[[],Hs];let c=l.indexOf("",1);return[a[1][c],l]},"match2");return this.match=s,s(r,e)}o(Un,"match");var Qs="[^/]+",Hr=".*",Qr="(?:|/.*)",Tt=Symbol(),yc=new Set(".\\+*[^]$()");function bc(r,e){return r.length===1?e.length===1?rm!==Hr&&m!==Qr))throw Tt;if(n)return;l=this.#r[d]=new Gs,c!==""&&(l.#t=s.varIndex++)}!n&&c!==""&&t.push([c,l.#t])}else if(l=this.#r[i],!l){if(Object.keys(this.#r).some(c=>c.length>1&&c!==Hr&&c!==Qr))throw Tt;if(n)return;l=this.#r[i]=new Gs}l.insert(a,e,t,s,n)}buildRegExpStr(){let e=Object.keys(this.#r).sort(bc).map(t=>{let s=this.#r[t];return(typeof s.#t=="number"?`(${t})@${s.#t}`:yc.has(t)?`\\${t}`:t)+s.buildRegExpStr()});return typeof this.#e=="number"&&e.unshift(`#${this.#e}`),e.length===0?"":e.length===1?e[0]:"(?:"+e.join("|")+")"}},"Node");var fa=o(class{#e={varIndex:0};#t=new Gs;insert(r,e,t){let s=[],n=[];for(let a=0;;){let u=!1;if(r=r.replace(/\{[^}]+\}/g,l=>{let c=`@\\${a}`;return n[a]=[c,l],a++,u=!0,c}),!u)break}let i=r.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=n.length-1;a>=0;a--){let[u]=n[a];for(let l=i.length-1;l>=0;l--)if(i[l].indexOf(u)!==-1){i[l]=i[l].replace(u,n[a][1]);break}}return this.#t.insert(i,e,s,this.#e,t),s}buildRegExp(){let r=this.#t.buildRegExpStr();if(r==="")return[/^$/,[],[]];let e=0,t=[],s=[];return r=r.replace(/#(\d+)|@(\d+)|\.\*\$/g,(n,i,a)=>i!==void 0?(t[++e]=Number(i),"$()"):(a!==void 0&&(s[Number(a)]=++e),"")),[new RegExp(`^${r}`),t,s]}},"Trie");var xc=[/^$/,[],Object.create(null)],ha=Object.create(null);function pa(r){return ha[r]??=new RegExp(r==="*"?"":`^${r.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,t)=>t?`\\${t}`:"(?:|/.*)")}$`)}o(pa,"buildWildcardRegExp");function vc(){ha=Object.create(null)}o(vc,"clearWildcardRegExpCache");function wc(r){let e=new fa,t=[];if(r.length===0)return xc;let s=r.map(c=>[!/\*|\/:/.test(c[0]),...c]).sort(([c,d],[m,x])=>c?1:m?-1:d.length-x.length),n=Object.create(null);for(let c=0,d=-1,m=s.length;c[q,Object.create(null)]),Hs]:d++;let O;try{O=e.insert(N,d,x)}catch(q){throw q===Tt?new Ks(N):q}x||(t[d]=C.map(([q,$])=>{let z=Object.create(null);for($-=1;$>=0;$--){let[j,M]=O[$];z[j]=M}return[q,z]}))}let[i,a,u]=e.buildRegExp();for(let c=0,d=t.length;cn.length-s.length))if(pa(t).test(e))return[...r[t]]}}o(cr,"findMiddleware");var Ws=o(class{name="RegExpRouter";#e;#t;constructor(){this.#e={[U]:Object.create(null)},this.#t={[U]:Object.create(null)}}add(r,e,t){let s=this.#e,n=this.#t;if(!s||!n)throw new Error(Us);s[r]||[s,n].forEach(u=>{u[r]=Object.create(null),Object.keys(u[U]).forEach(l=>{u[r][l]=[...u[U][l]]})}),e==="/*"&&(e="*");let i=(e.match(/\/:/g)||[]).length;if(/\*$/.test(e)){let u=pa(e);r===U?Object.keys(s).forEach(l=>{s[l][e]||=cr(s[l],e)||cr(s[U],e)||[]}):s[r][e]||=cr(s[r],e)||cr(s[U],e)||[],Object.keys(s).forEach(l=>{(r===U||r===l)&&Object.keys(s[l]).forEach(c=>{u.test(c)&&s[l][c].push([t,i])})}),Object.keys(n).forEach(l=>{(r===U||r===l)&&Object.keys(n[l]).forEach(c=>u.test(c)&&n[l][c].push([t,i]))});return}let a=Vs(e)||[e];for(let u=0,l=a.length;u{(r===U||r===d)&&(n[d][c]||=[...cr(s[d],c)||cr(s[U],c)||[]],n[d][c].push([t,i-l+u+1]))})}}match=Un;buildAllMatchers(){let r=Object.create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(e=>{r[e]||=this.#r(e)}),this.#e=this.#t=void 0,vc(),r}#r(r){let e=[],t=r===U;return[this.#e,this.#t].forEach(s=>{let n=s[r]?Object.keys(s[r]).map(i=>[i,s[r][i]]):[];n.length!==0?(t||=!0,e.push(...n)):r!==U&&e.push(...Object.keys(s[U]).map(i=>[i,s[U][i]]))}),t?wc(e):null}},"RegExpRouter");var Kn=o(class{name="SmartRouter";#e=[];#t=[];constructor(r){this.#e=r.routers}add(r,e,t){if(!this.#t)throw new Error(Us);this.#t.push([r,e,t])}match(r,e){if(!this.#t)throw new Error("Fatal error");let t=this.#e,s=this.#t,n=t.length,i=0,a;for(;il.indexOf(a)===u),score:this.#i}}),s}#s(r,e,t,s){let n=[];for(let i=0,a=r.#e.length;i1&&t.sort((u,l)=>u.score-l.score),[t.map(({handler:u,params:l})=>[u,l])]}},"Node");var Qn=o(class{name="TrieRouter";#e;constructor(){this.#e=new Hn}add(r,e,t){let s=Vs(e);if(s){for(let n=0,i=s.length;n{let t=/\.([a-zA-Z0-9]+?)$/,s=r.match(t);if(!s)return;let n=e[s[1]];return n&&n.startsWith("text")&&(n+="; charset=utf-8"),n},"getMimeType");var Ac={aac:"audio/aac",avi:"video/x-msvideo",avif:"image/avif",av1:"video/av1",bin:"application/octet-stream",bmp:"image/bmp",css:"text/css",csv:"text/csv",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/x-icon",ics:"text/calendar",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",map:"application/json",mid:"audio/x-midi",midi:"audio/x-midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",pdf:"application/pdf",png:"image/png",rtf:"application/rtf",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",wasm:"application/wasm",webm:"video/webm",weba:"audio/webm",webmanifest:"application/manifest+json",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xml:"application/xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2",gltf:"model/gltf+json",glb:"model/gltf-binary"},Dc=Ac;var ga=o((...r)=>{let e=r.filter(n=>n!=="").join("/");e=e.replace(/(?<=\/)\/+/g,"");let t=e.split("/"),s=[];for(let n of t)n===".."&&s.length>0&&s.at(-1)!==".."?s.pop():n!=="."&&s.push(n);return s.join("/")||"."},"defaultJoin");var ya={br:".br",zstd:".zst",gzip:".gz"},_c=Object.keys(ya),Ec="index.html",ba=o(r=>{let e=r.root??"./",t=r.path,s=r.join??ga;return async(n,i)=>{if(n.finalized)return i();let a;if(r.path)a=r.path;else try{if(a=decodeURIComponent(n.req.path),/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(a))throw new Error}catch{return await r.onNotFound?.(n.req.path,n),i()}let u=s(e,!t&&r.rewriteRequestPath?r.rewriteRequestPath(a):a);r.isDir&&await r.isDir(u)&&(u=s(u,Ec));let l=r.getContent,c=await l(u,n);if(c instanceof Response)return n.newResponse(c.body,c);if(c){let d=r.mimes&&Gn(u,r.mimes)||Gn(u);if(n.header("Content-Type",d||"application/octet-stream"),r.precompressed&&(!d||ma.test(d))){let m=new Set(n.req.header("Accept-Encoding")?.split(",").map(x=>x.trim()));for(let x of _c){if(!m.has(x))continue;let N=await l(u+ya[x],n);if(N){c=N,n.header("Content-Encoding",x),n.header("Vary","Accept-Encoding",{append:!0});break}}}return await r.onFound?.(u,n),n.body(c)}await r.onNotFound?.(u,n),await i()}},"serveStatic");var xa=o(async(r,e)=>{let t;e&&e.manifest?typeof e.manifest=="string"?t=JSON.parse(e.manifest):t=e.manifest:typeof __STATIC_CONTENT_MANIFEST=="string"?t=JSON.parse(__STATIC_CONTENT_MANIFEST):t=__STATIC_CONTENT_MANIFEST;let s;e&&e.namespace?s=e.namespace:s=__STATIC_CONTENT;let n=t[r]||r;if(!n)return null;let i=await s.get(n,{type:"stream"});return i||null},"getContentFromKVAsset");var va=o(r=>o(async function(t,s){return ba({...r,getContent:o(async i=>xa(i,{manifest:r.manifest,namespace:r.namespace?r.namespace:t.env?t.env.__STATIC_CONTENT:void 0}),"getContent")})(t,s)},"serveStatic2"),"serveStatic");var Js=o(r=>va(r),"module");var wa=o(class{#e;constructor(r){this.#e=r,this.raw=r.raw,this.url=r.url?new URL(r.url):null,this.protocol=r.protocol??null}send(r,e){this.#e.send(r,e??{})}raw;binaryType="arraybuffer";get readyState(){return this.#e.readyState}url;protocol;close(r,e){this.#e.close(r,e)}},"WSContext");var Aa=o(r=>(...e)=>{if(typeof e[0]=="function"){let[t,s]=e;return o(async function(i,a){let u=await t(i),l=await r(i,u,s);if(l)return l;await a()},"upgradeWebSocket")}else{let[t,s,n]=e;return(async()=>{let i=await r(t,s,n);if(!i)throw new Error("Failed to upgrade WebSocket");return i})()}},"defineWebSocketHelper");var Cc=Aa(async(r,e)=>{if(r.req.header("Upgrade")!=="websocket")return;let s=new WebSocketPair,n=s[0],i=s[1],a=new wa({close:(u,l)=>i.close(u,l),get protocol(){return i.protocol},raw:i,get readyState(){return i.readyState},url:i.url?new URL(i.url):null,send:u=>i.send(u)});return e.onClose&&i.addEventListener("close",u=>e.onClose?.(u,a)),e.onMessage&&i.addEventListener("message",u=>e.onMessage?.(u,a)),e.onError&&i.addEventListener("error",u=>e.onError?.(u,a)),i.accept?.(),new Response(null,{status:101,webSocket:n})});var Ys=o(r=>{let t={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...r},s=(i=>typeof i=="string"?i==="*"?()=>i:a=>i===a?a:null:typeof i=="function"?i:a=>i.includes(a)?a:null)(t.origin),n=(i=>typeof i=="function"?i:Array.isArray(i)?()=>i:()=>[])(t.allowMethods);return o(async function(a,u){function l(d,m){a.res.headers.set(d,m)}o(l,"set");let c=await s(a.req.header("origin")||"",a);if(c&&l("Access-Control-Allow-Origin",c),t.origin!=="*"){let d=a.req.header("Vary");d?l("Vary",d):l("Vary","Origin")}if(t.credentials&&l("Access-Control-Allow-Credentials","true"),t.exposeHeaders?.length&&l("Access-Control-Expose-Headers",t.exposeHeaders.join(",")),a.req.method==="OPTIONS"){t.maxAge!=null&&l("Access-Control-Max-Age",t.maxAge.toString());let d=await n(a.req.header("origin")||"",a);d.length&&l("Access-Control-Allow-Methods",d.join(","));let m=t.allowHeaders;if(!m?.length){let x=a.req.header("Access-Control-Request-Headers");x&&(m=x.split(/\s*,\s*/))}return m?.length&&(l("Access-Control-Allow-Headers",m.join(",")),a.res.headers.append("Vary","Access-Control-Request-Headers")),a.res.headers.delete("Content-Length"),a.res.headers.delete("Content-Type"),new Response(null,{headers:a.res.headers,status:204,statusText:"No Content"})}await u()},"cors2")},"cors");var p=Symbol.for("drizzle:entityKind"),Nx=Symbol.for("drizzle:hasOwnEntityKind");function g(r,e){if(!r||typeof r!="object")return!1;if(r instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,p))throw new Error(`Class "${e.name??""}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let t=r.constructor;if(t)for(;t;){if(p in t&&t[p]===e[p])return!0;t=Object.getPrototypeOf(t)}return!1}o(g,"is");var Tc,B=class{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType}name;primary;notNull;default;defaultFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}};o(B,"Column"),Tc=p,h(B,Tc,"Column");var J=Symbol.for("drizzle:SubqueryConfig"),Sc,ee=class{[(Sc=p,J)];constructor(e,t,s,n=!1){this[J]={sql:e,selection:t,alias:s,isWith:n}}};o(ee,"Subquery"),h(ee,Sc,"Subquery");var Nc,st=class extends ee{};o(st,"WithSubquery"),Nc=p,h(st,Nc,"WithSubquery");function Xs(r,...e){return r(...e)}o(Xs,"iife");var Da="0.29.5";var Wn,Jn,_a={startActiveSpan(r,e){return Wn?(Jn||(Jn=Wn.trace.getTracer("drizzle-orm",Da)),Xs((t,s)=>s.startActiveSpan(r,n=>{try{return e(n)}catch(i){throw n.setStatus({code:t.SpanStatusCode.ERROR,message:i instanceof Error?i.message:"Unknown error"}),i}finally{n.end()}}),Wn,Jn)):e()}};var Y=Symbol.for("drizzle:ViewBaseConfig");var Zs=Symbol.for("drizzle:Name"),Yn=Symbol.for("drizzle:Schema"),Ea=Symbol.for("drizzle:Columns"),Xn=Symbol.for("drizzle:OriginalName"),Zn=Symbol.for("drizzle:BaseName"),Ca=Symbol.for("drizzle:IsAlias"),Ta=Symbol.for("drizzle:ExtraConfigBuilder"),Sa=Symbol.for("drizzle:IsDrizzleTable"),kc,v=class{[(kc=p,Zs)];[Xn];[Yn];[Ea];[Zn];[Ca]=!1;[Ta]=void 0;[Sa]=!0;constructor(e,t,s){this[Zs]=this[Xn]=e,this[Yn]=t,this[Zn]=s}};o(v,"Table"),h(v,kc,"Table"),h(v,"Symbol",{Name:Zs,Schema:Yn,OriginalName:Xn,Columns:Ea,BaseName:Zn,IsAlias:Ca,ExtraConfigBuilder:Ta});function Na(r){return typeof r=="object"&&r!==null&&Sa in r}o(Na,"isTable");function nt(r){return r[Zs]}o(nt,"getTableName");var Oc,en=class{};o(en,"FakePrimitiveParam"),Oc=p,h(en,Oc,"FakePrimitiveParam");function ei(r){return typeof r=="object"&&r!==null&&"getSQL"in r&&typeof r.getSQL=="function"}o(ei,"isSQLWrapper");function Rc(r){let e={sql:"",params:[]};for(let t of r)e.sql+=t.sql,e.params.push(...t.params),t.typings?.length&&(e.typings||(e.typings=[]),e.typings.push(...t.typings));return e}o(Rc,"mergeQueries");var Bc,G=class{value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new D([this])}};o(G,"StringChunk"),Bc=p,h(G,Bc,"StringChunk");var qc,dr=class{constructor(e){this.queryChunks=e}decoder=Ra;shouldInlineParams=!1;append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return _a.startActiveSpan("drizzle.buildSQL",t=>{let s=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":s.sql,"drizzle.query.params":JSON.stringify(s.params)}),s})}buildQueryFromSourceParams(e,t){let s=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{escapeName:n,escapeParam:i,prepareTyping:a,inlineParams:u,paramStartIndex:l}=s;return Rc(e.map(c=>{if(g(c,G))return{sql:c.value.join(""),params:[]};if(g(c,Nt))return{sql:n(c.value),params:[]};if(c===void 0)return{sql:"",params:[]};if(Array.isArray(c)){let d=[new G("(")];for(let[m,x]of c.entries())d.push(x),mr},Oa={mapToDriverValue:r=>r},Ov={...Ra,...Oa},jc,ue=class{constructor(e,t=Oa){this.value=e,this.encoder=t}brand;getSQL(){return new D([this])}};o(ue,"Param"),jc=p,h(ue,jc,"Param");function f(r,...e){let t=[];(e.length>0||r.length>0&&r[0]!=="")&&t.push(new G(r[0]));for(let[s,n]of e.entries())t.push(n,new G(r[s+1]));return new D(t)}o(f,"sql");(r=>{function e(){return new D([])}o(e,"empty"),r.empty=e;function t(l){return new D(l)}o(t,"fromList"),r.fromList=t;function s(l){return new D([new G(l)])}o(s,"raw"),r.raw=s;function n(l,c){let d=[];for(let[m,x]of l.entries())m>0&&c!==void 0&&d.push(c),d.push(x);return new D(d)}o(n,"join"),r.join=n;function i(l){return new Nt(l)}o(i,"identifier"),r.identifier=i;function a(l){return new Ue(l)}o(a,"placeholder2"),r.placeholder=a;function u(l,c){return new ue(l,c)}o(u,"param2"),r.param=u})(f||(f={}));(r=>{class e{constructor(s,n){this.sql=s,this.fieldAlias=n}static[p]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}}o(e,"Aliased"),r.Aliased=e})(D||(D={}));var Ic,Ue=class{constructor(e){this.name=e}getSQL(){return new D([this])}};o(Ue,"Placeholder"),Ic=p,h(Ue,Ic,"Placeholder");function Wr(r,e){return r.map(t=>{if(g(t,Ue)){if(!(t.name in e))throw new Error(`No value for placeholder "${t.name}" was provided`);return e[t.name]}return t})}o(Wr,"fillPlaceholders");var Mc,le=class{[(Mc=p,Y)];constructor({name:e,schema:t,selectedFields:s,query:n}){this[Y]={name:e,originalName:e,schema:t,selectedFields:s,query:n,isExisting:!n,isAlias:!1}}getSQL(){return new D([this])}};o(le,"View"),h(le,Mc,"View");B.prototype.getSQL=function(){return new D([this])};v.prototype.getSQL=function(){return new D([this])};ee.prototype.getSQL=function(){return new D([this])};var $c,Ke=class{constructor(e){this.table=e}get(e,t){return t==="table"?this.table:e[t]}};o(Ke,"ColumnAliasProxyHandler"),$c=p,h(Ke,$c,"ColumnAliasProxyHandler");var Lc,it=class{constructor(e,t){this.alias=e,this.replaceOriginalName=t}get(e,t){if(t===v.Symbol.IsAlias)return!0;if(t===v.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===v.Symbol.OriginalName)return this.alias;if(t===Y)return{...e[Y],name:this.alias,isAlias:!0};if(t===v.Symbol.Columns){let n=e[v.Symbol.Columns];if(!n)return n;let i={};return Object.keys(n).map(a=>{i[a]=new Proxy(n[a],new Ke(new Proxy(e,this)))}),i}let s=e[t];return g(s,B)?new Proxy(s,new Ke(new Proxy(e,this))):s}};o(it,"TableAliasProxyHandler"),Lc=p,h(it,Lc,"TableAliasProxyHandler");var Pc,tn=class{constructor(e){this.alias=e}get(e,t){return t==="sourceTable"?Jr(e.sourceTable,this.alias):e[t]}};o(tn,"RelationTableAliasProxyHandler"),Pc=p,h(tn,Pc,"RelationTableAliasProxyHandler");function Jr(r,e){return new Proxy(r,new it(e,!1))}o(Jr,"aliasedTable");function qe(r,e){return new Proxy(r,new Ke(new Proxy(r.table,new it(e,!1))))}o(qe,"aliasedTableColumn");function ti(r,e){return new D.Aliased(Yr(r.sql,e),r.fieldAlias)}o(ti,"mapColumnsInAliasedSQLToAlias");function Yr(r,e){return f.join(r.queryChunks.map(t=>g(t,B)?qe(t,e):g(t,D)?Yr(t,e):g(t,D.Aliased)?ti(t,e):t))}o(Yr,"mapColumnsInSQLToAlias");var zc,Fe=class{config;constructor(e,t,s){this.config={name:e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:s}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}};o(Fe,"ColumnBuilder"),zc=p,h(Fe,zc,"ColumnBuilder");var Vc,He=class extends Error{constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}};o(He,"DrizzleError"),Vc=p,h(He,Vc,"DrizzleError");var Uc,fr=class extends He{constructor(){super({message:"Rollback"})}};o(fr,"TransactionRollbackError"),Uc=p,h(fr,Uc,"TransactionRollbackError");function de(r,e){return ka(e)&&!ei(r)&&!g(r,ue)&&!g(r,Ue)&&!g(r,B)&&!g(r,v)&&!g(r,le)?new ue(r,e):r}o(de,"bindIfParam");var se=o((r,e)=>f`${r} = ${de(e,r)}`,"eq"),Ba=o((r,e)=>f`${r} <> ${de(e,r)}`,"ne");function Qe(...r){let e=r.filter(t=>t!==void 0);if(e.length!==0)return e.length===1?new D(e):new D([new G("("),f.join(e,new G(" and ")),new G(")")])}o(Qe,"and");function qa(...r){let e=r.filter(t=>t!==void 0);if(e.length!==0)return e.length===1?new D(e):new D([new G("("),f.join(e,new G(" or ")),new G(")")])}o(qa,"or");function Fa(r){return f`not ${r}`}o(Fa,"not");var ja=o((r,e)=>f`${r} > ${de(e,r)}`,"gt"),Ia=o((r,e)=>f`${r} >= ${de(e,r)}`,"gte"),rn=o((r,e)=>f`${r} < ${de(e,r)}`,"lt"),Ma=o((r,e)=>f`${r} <= ${de(e,r)}`,"lte");function sn(r,e){if(Array.isArray(e)){if(e.length===0)throw new Error("inArray requires at least one value");return f`${r} in ${e.map(t=>de(t,r))}`}return f`${r} in ${de(e,r)}`}o(sn,"inArray");function $a(r,e){if(Array.isArray(e)){if(e.length===0)throw new Error("notInArray requires at least one value");return f`${r} not in ${e.map(t=>de(t,r))}`}return f`${r} not in ${de(e,r)}`}o($a,"notInArray");function La(r){return f`${r} is null`}o(La,"isNull");function Pa(r){return f`${r} is not null`}o(Pa,"isNotNull");function za(r){return f`exists ${r}`}o(za,"exists");function Va(r){return f`not exists ${r}`}o(Va,"notExists");function Ua(r,e,t){return f`${r} between ${de(e,r)} and ${de(t,r)}`}o(Ua,"between");function Ka(r,e,t){return f`${r} not between ${de(e,r)} and ${de(t,r)}`}o(Ka,"notBetween");function Ha(r,e){return f`${r} like ${e}`}o(Ha,"like");function Qa(r,e){return f`${r} not like ${e}`}o(Qa,"notLike");function Ga(r,e){return f`${r} ilike ${e}`}o(Ga,"ilike");function Wa(r,e){return f`${r} not ilike ${e}`}o(Wa,"notIlike");function nn(r){return f`${r} asc`}o(nn,"asc");function Xr(r){return f`${r} desc`}o(Xr,"desc");var Kc,Zr=class{write(e){console.log(e)}};o(Zr,"ConsoleLogWriter"),Kc=p,h(Zr,Kc,"ConsoleLogWriter");var Hc,hr=class{writer;constructor(e){this.writer=e?.writer??new Zr}logQuery(e,t){let s=t.map(i=>{try{return JSON.stringify(i)}catch{return String(i)}}),n=s.length?` -- params: [${s.join(", ")}]`:"";this.writer.write(`Query: ${e}${n}`)}};o(hr,"DefaultLogger"),Hc=p,h(hr,Hc,"DefaultLogger");var Qc,pr=class{logQuery(){}};o(pr,"NoopLogger"),Qc=p,h(pr,Qc,"NoopLogger");var Gc,re=class{[(Gc=p,Symbol.toStringTag)]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}};o(re,"QueryPromise"),h(re,Gc,"QueryPromise");var Ja=Symbol.for("drizzle:PgInlineForeignKeys"),Wc,we=class extends v{[(Wc=p,Ja)]=[];[v.Symbol.ExtraConfigBuilder]=void 0};o(we,"PgTable"),h(we,Wc,"PgTable"),h(we,"Symbol",Object.assign({},v.Symbol,{InlineForeignKeys:Ja}));var Jc,mr=class{columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new es(e,this.columns,this.name)}};o(mr,"PrimaryKeyBuilder"),Jc=p,h(mr,Jc,"PgPrimaryKeyBuilder");var Yc,es=class{constructor(e,t,s){this.table=e,this.columns=t,this.name=s}columns;name;getName(){return this.name??`${this.table[we.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}};o(es,"PrimaryKey"),Yc=p,h(es,Yc,"PgPrimaryKey");var ed,gr=class{constructor(e,t,s){this.sourceTable=e,this.referencedTable=t,this.relationName=s,this.referencedTableName=t[v.Symbol.Name]}referencedTableName;fieldName};o(gr,"Relation"),ed=p,h(gr,ed,"Relation");var td,ts=class{constructor(e,t){this.table=e,this.config=t}};o(ts,"Relations"),td=p,h(ts,td,"Relations");var rd,ri=class extends gr{constructor(e,t,s,n){super(e,t,s?.relationName),this.config=s,this.isNullable=n}withFieldName(e){let t=new ri(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}},je=ri;o(je,"One"),rd=p,h(je,rd,"One");var sd,si=class extends gr{constructor(e,t,s){super(e,t,s?.relationName),this.config=s}withFieldName(e){let t=new si(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}},kt=si;o(kt,"Many"),sd=p,h(kt,sd,"Many");function Ya(){return{and:Qe,between:Ua,eq:se,exists:za,gt:ja,gte:Ia,ilike:Ga,inArray:sn,isNull:La,isNotNull:Pa,like:Ha,lt:rn,lte:Ma,ne:Ba,not:Fa,notBetween:Ka,notExists:Va,notLike:Qa,notIlike:Wa,notInArray:$a,or:qa,sql:f}}o(Ya,"getOperators");function Xa(){return{sql:f,asc:nn,desc:Xr}}o(Xa,"getOrderByOperators");function Za(r,e){Object.keys(r).length===1&&"default"in r&&!g(r.default,v)&&(r=r.default);let t={},s={},n={};for(let[i,a]of Object.entries(r))if(Na(a)){let u=a[v.Symbol.Name],l=s[u];t[u]=i,n[i]={tsName:i,dbName:a[v.Symbol.Name],schema:a[v.Symbol.Schema],columns:a[v.Symbol.Columns],relations:l?.relations??{},primaryKey:l?.primaryKey??[]};for(let d of Object.values(a[v.Symbol.Columns]))d.primary&&n[i].primaryKey.push(d);let c=a[v.Symbol.ExtraConfigBuilder]?.(a);if(c)for(let d of Object.values(c))g(d,mr)&&n[i].primaryKey.push(...d.columns)}else if(g(a,ts)){let u=a.table[v.Symbol.Name],l=t[u],c=a.config(e(a.table)),d;for(let[m,x]of Object.entries(c))if(l){let N=n[l];N.relations[m]=x,d&&N.primaryKey.push(...d)}else u in s||(s[u]={relations:{},primaryKey:d}),s[u].relations[m]=x}return{tables:n,tableNamesMap:t}}o(Za,"extractTablesRelationalConfig");function Xc(r){return o(function(t,s){return new je(r,t,s,s?.fields.reduce((n,i)=>n&&i.notNull,!0)??!1)},"one")}o(Xc,"createOne");function Zc(r){return o(function(t,s){return new kt(r,t,s)},"many")}o(Zc,"createMany");function eo(r,e,t){if(g(t,je)&&t.config)return{fields:t.config.fields,references:t.config.references};let s=e[t.referencedTable[v.Symbol.Name]];if(!s)throw new Error(`Table "${t.referencedTable[v.Symbol.Name]}" not found in schema`);let n=r[s];if(!n)throw new Error(`Table "${s}" not found in schema`);let i=t.sourceTable,a=e[i[v.Symbol.Name]];if(!a)throw new Error(`Table "${i[v.Symbol.Name]}" not found in schema`);let u=[];for(let l of Object.values(n.relations))(t.relationName&&t!==l&&l.relationName===t.relationName||!t.relationName&&l.referencedTable===t.sourceTable)&&u.push(l);if(u.length>1)throw t.relationName?new Error(`There are multiple relations with name "${t.relationName}" in table "${s}"`):new Error(`There are multiple relations between "${s}" and "${t.sourceTable[v.Symbol.Name]}". Please specify relation name`);if(u[0]&&g(u[0],je)&&u[0].config)return{fields:u[0].config.references,references:u[0].config.fields};throw new Error(`There is not enough information to infer relation "${a}.${t.fieldName}"`)}o(eo,"normalizeRelation");function to(r){return{one:Xc(r),many:Zc(r)}}o(to,"createTableRelationsHelpers");function an(r,e,t,s,n=i=>i){let i={};for(let[a,u]of s.entries())if(u.isJson){let l=e.relations[u.tsKey],c=t[a],d=typeof c=="string"?JSON.parse(c):c;i[u.tsKey]=g(l,je)?d&&an(r,r[u.relationTableTsKey],d,u.selection,n):d.map(m=>an(r,r[u.relationTableTsKey],m,u.selection,n))}else{let l=n(t[a]),c=u.field,d;g(c,B)?d=c:g(c,D)?d=c.decoder:d=c.sql.decoder,i[u.tsKey]=l===null?null:d.mapFromDriverValue(l)}return i}o(an,"mapRelationalRow");function ni(r){return f`count(${r||f.raw("*")})`.mapWith(Number)}o(ni,"count");function on(r,e,t){let s={},n=r.reduce((i,{path:a,field:u},l)=>{let c;g(u,B)?c=u:g(u,D)?c=u.decoder:c=u.sql.decoder;let d=i;for(let[m,x]of a.entries())if(m0)for(let[i,a]of Object.entries(s))typeof a=="string"&&!t[a]&&(n[i]=null);return n}o(on,"mapResultRow");function Ae(r,e){return Object.entries(r).reduce((t,[s,n])=>{if(typeof s!="string")return t;let i=e?[...e,s]:[s];return g(n,B)||g(n,D)||g(n,D.Aliased)?t.push({path:i,field:n}):g(n,v)?t.push(...Ae(n[v.Symbol.Columns],i)):t.push(...Ae(n,i)),t},[])}o(Ae,"orderSelectedFields");function ii(r,e){let t=Object.keys(r),s=Object.keys(e);if(t.length!==s.length)return!1;for(let[n,i]of t.entries())if(i!==s[n])return!1;return!0}o(ii,"haveSameKeys");function un(r,e){let t=Object.entries(e).filter(([,s])=>s!==void 0).map(([s,n])=>g(n,D)?[s,n]:[s,new ue(n,r[v.Symbol.Columns][s])]);if(t.length===0)throw new Error("No values to set");return Object.fromEntries(t)}o(un,"mapUpdateSet");function ro(r,e){for(let t of e)for(let s of Object.getOwnPropertyNames(t.prototype))s!=="constructor"&&Object.defineProperty(r.prototype,s,Object.getOwnPropertyDescriptor(t.prototype,s)||Object.create(null))}o(ro,"applyMixins");function ln(r){return r[v.Symbol.Columns]}o(ln,"getTableColumns");function ai(r){return g(r,ee)?r[J].alias:g(r,le)?r[Y].name:g(r,D)?void 0:r[v.Symbol.IsAlias]?r[v.Symbol.Name]:r[v.Symbol.BaseName]}o(ai,"getTableLikeName");var oi=Symbol.for("drizzle:SQLiteInlineForeignKeys"),id,K=class extends v{[(id=p,v.Symbol.Columns)];[oi]=[];[v.Symbol.ExtraConfigBuilder]=void 0};o(K,"SQLiteTable"),h(K,id,"SQLiteTable"),h(K,"Symbol",Object.assign({},v.Symbol,{InlineForeignKeys:oi}));function nd(r,e,t,s,n=r){let i=new K(r,s,n),a=Object.fromEntries(Object.entries(e).map(([l,c])=>{let d=c,m=d.build(i);return i[oi].push(...d.buildForeignKeys(m,i)),[l,m]})),u=Object.assign(i,a);return u[v.Symbol.Columns]=a,t&&(u[K.Symbol.ExtraConfigBuilder]=t),u}o(nd,"sqliteTableBase");var cn=o((r,e,t)=>nd(r,e,t),"sqliteTable");var ad,yr=class{reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:s,columns:n,foreignColumns:i}=e();return{name:s,columns:n,foreignTable:i[0].table,foreignColumns:i}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new rs(e,this)}};o(yr,"ForeignKeyBuilder"),ad=p,h(yr,ad,"SQLiteForeignKeyBuilder");var od,rs=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:s}=this.reference(),n=t.map(u=>u.name),i=s.map(u=>u.name),a=[this.table[K.Symbol.Name],...n,s[0].table[K.Symbol.Name],...i];return e??`${a.join("_")}_fk`}};o(rs,"ForeignKey"),od=p,h(rs,od,"SQLiteForeignKey");function ui(r,e){return`${r[K.Symbol.Name]}_${e.join("_")}_unique`}o(ui,"uniqueKeyName");var ud,ss=class{constructor(e,t){this.name=t,this.columns=e}columns;build(e){return new ns(e,this.columns,this.name)}};o(ss,"UniqueConstraintBuilder"),ud=p,h(ss,ud,"SQLiteUniqueConstraintBuilder");var ld,dn=class{name;constructor(e){this.name=e}on(...e){return new ss(e,this.name)}};o(dn,"UniqueOnConstraintBuilder"),ld=p,h(dn,ld,"SQLiteUniqueOnConstraintBuilder");var cd,ns=class{constructor(e,t,s){this.table=e,this.columns=t,this.name=s??ui(this.table,this.columns.map(n=>n.name))}columns;name;getName(){return this.name}};o(ns,"UniqueConstraint"),cd=p,h(ns,cd,"SQLiteUniqueConstraint");var dd,Ge=class extends Fe{foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:s,actions:n})=>((i,a)=>{let u=new yr(()=>{let l=i();return{columns:[e],foreignColumns:[l]}});return a.onUpdate&&u.onUpdate(a.onUpdate),a.onDelete&&u.onDelete(a.onDelete),u.build(t)})(s,n))}};o(Ge,"SQLiteColumnBuilder"),dd=p,h(Ge,dd,"SQLiteColumnBuilder");var fd,me=class extends B{constructor(e,t){t.uniqueName||(t.uniqueName=ui(e,[t.name])),super(e,t),this.table=e}};o(me,"SQLiteColumn"),fd=p,h(me,fd,"SQLiteColumn");var hd,Rt=class extends Ge{constructor(e,t,s){super(e,t,s),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}};o(Rt,"SQLiteBaseIntegerBuilder"),hd=p,h(Rt,hd,"SQLiteBaseIntegerBuilder");var pd,Ot=class extends me{autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}};o(Ot,"SQLiteBaseInteger"),pd=p,h(Ot,pd,"SQLiteBaseInteger");var md,is=class extends Rt{constructor(e){super(e,"number","SQLiteInteger")}build(e){return new as(e,this.config)}};o(is,"SQLiteIntegerBuilder"),md=p,h(is,md,"SQLiteIntegerBuilder");var gd,as=class extends Ot{};o(as,"SQLiteInteger"),gd=p,h(as,gd,"SQLiteInteger");var yd,os=class extends Rt{constructor(e,t){super(e,"date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(f`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new us(e,this.config)}};o(os,"SQLiteTimestampBuilder"),yd=p,h(os,yd,"SQLiteTimestampBuilder");var bd,us=class extends Ot{mode=this.config.mode;mapFromDriverValue(e){return this.config.mode==="timestamp"?new Date(e*1e3):new Date(e)}mapToDriverValue(e){let t=e.getTime();return this.config.mode==="timestamp"?Math.floor(t/1e3):t}};o(us,"SQLiteTimestamp"),bd=p,h(us,bd,"SQLiteTimestamp");var xd,ls=class extends Rt{constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new cs(e,this.config)}};o(ls,"SQLiteBooleanBuilder"),xd=p,h(ls,xd,"SQLiteBooleanBuilder");var vd,cs=class extends Ot{mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return e?1:0}};o(cs,"SQLiteBoolean"),vd=p,h(cs,vd,"SQLiteBoolean");function De(r,e){return e?.mode==="timestamp"||e?.mode==="timestamp_ms"?new os(r,e.mode):e?.mode==="boolean"?new ls(r,e.mode):new is(r)}o(De,"integer");var wd,ds=class extends Ge{constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new Bt(e,this.config)}};o(ds,"SQLiteTextBuilder"),wd=p,h(ds,wd,"SQLiteTextBuilder");var Ad,Bt=class extends me{enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}};o(Bt,"SQLiteText"),Ad=p,h(Bt,Ad,"SQLiteText");var Dd,fs=class extends Ge{constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new hs(e,this.config)}};o(fs,"SQLiteTextJsonBuilder"),Dd=p,h(fs,Dd,"SQLiteTextJsonBuilder");var _d,hs=class extends me{getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}};o(hs,"SQLiteTextJson"),_d=p,h(hs,_d,"SQLiteTextJson");function I(r,e={}){return e.mode==="json"?new fs(r):new ds(r,e)}o(I,"text");var Ed,li=class{config;constructor(e){this.config={...e}}get(e,t){if(t===J)return{...e[J],selection:new Proxy(e[J].selection,this)};if(t===Y)return{...e[Y],selectedFields:new Proxy(e[Y].selectedFields,this)};if(typeof t=="symbol")return e[t];let n=(g(e,ee)?e[J].selection:g(e,le)?e[Y].selectedFields:e)[t];if(g(n,D.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!n.isSelectionField)return n.sql;let i=n.clone();return i.isSelectionField=!0,i}if(g(n,D)){if(this.config.sqlBehavior==="sql")return n;throw new Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return g(n,B)?this.config.alias?new Proxy(n,new Ke(new Proxy(n.table,new it(this.config.alias,this.config.replaceOriginalName??!1)))):n:typeof n!="object"||n===null?n:new Proxy(n,new li(this.config))}},ae=li;o(ae,"SelectionProxyHandler"),Ed=p,h(ae,Ed,"SelectionProxyHandler");var Cd,qt=class extends re{constructor(e,t,s,n){super(),this.table=e,this.session=t,this.dialect=s,this.config={table:e,withList:n}}config;where(e){return this.config.where=e,this}returning(e=this.table[K.Symbol.Columns]){return this.config.returning=Ae(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run")}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}};o(qt,"SQLiteDeleteBase"),Cd=p,h(qt,Cd,"SQLiteDelete");var Td,Ft=class{constructor(e,t,s,n){this.table=e,this.session=t,this.dialect=s,this.withList=n}values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw new Error("values() must be called with at least one value");let t=e.map(s=>{let n={},i=this.table[v.Symbol.Columns];for(let a of Object.keys(s)){let u=s[a];n[a]=g(u,D)?u:new ue(u,i[a])}return n});return new ps(this.table,t,this.session,this.dialect,this.withList)}};o(Ft,"SQLiteInsertBuilder"),Td=p,h(Ft,Td,"SQLiteInsertBuilder");var Sd,ps=class extends re{constructor(e,t,s,n,i){super(),this.session=s,this.dialect=n,this.config={table:e,values:t,withList:i}}config;returning(e=this.config.table[K.Symbol.Columns]){return this.config.returning=Ae(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=f`do nothing`;else{let t=Array.isArray(e.target)?f`${e.target}`:f`${[e.target]}`,s=e.where?f` where ${e.where}`:f``;this.config.onConflict=f`${t} do nothing${s}`}return this}onConflictDoUpdate(e){let t=Array.isArray(e.target)?f`${e.target}`:f`${[e.target]}`,s=e.where?f` where ${e.where}`:f``,n=this.dialect.buildUpdateSet(this.config.table,un(this.config.table,e.set));return this.config.onConflict=f`${t} do update set ${n}${s}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run")}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};o(ps,"SQLiteInsertBase"),Sd=p,h(ps,Sd,"SQLiteInsert");var Nd,at=class extends le{};o(at,"SQLiteViewBase"),Nd=p,h(at,Nd,"SQLiteViewBase");var kd,br=class{escapeName(e){return`"${e}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[f`with `];for(let[s,n]of e.entries())t.push(f`${f.identifier(n[J].alias)} as (${n[J].sql})`),s{let l=e[v.Symbol.Columns][i],c=f`${f.identifier(l.name)} = ${a}`;return u{let u=[];if(g(i,D.Aliased)&&i.isSelectionField)u.push(f.identifier(i.fieldAlias));else if(g(i,D.Aliased)||g(i,D)){let l=g(i,D.Aliased)?i.sql:i;t?u.push(new D(l.queryChunks.map(c=>g(c,B)?f.identifier(c.name):c))):u.push(l),g(i,D.Aliased)&&u.push(f` as ${f.identifier(i.fieldAlias)}`)}else if(g(i,B)){let l=i.table[v.Symbol.Name],c=i.name;t?u.push(f.identifier(c)):u.push(f`${f.identifier(l)}.${f.identifier(c)}`)}return au?.some(({alias:ze})=>ze===(Z[v.Symbol.IsAlias]?nt(Z):Z[v.Symbol.BaseName])))(ie.field.table)){let Z=nt(ie.field.table);throw new Error(`Your "${ie.path.join("->")}" field references a column "${Z}"."${ie.field.name}", but the table "${Z}" is not part of the query! Did you forget to join it?`)}let O=!u||u.length===0,q=this.buildWithCTE(e),$=x?f` distinct`:void 0,z=this.buildSelection(C,{isSingleTable:O}),j=(()=>g(a,v)&&a[v.Symbol.OriginalName]!==a[v.Symbol.Name]?f`${f.identifier(a[v.Symbol.OriginalName])} ${f.identifier(a[v.Symbol.Name])}`:a)(),M=[];if(u)for(let[ie,Z]of u.entries()){ie===0&&M.push(f` `);let ze=Z.table;if(g(ze,K)){let kn=ze[K.Symbol.Name],Ri=ze[K.Symbol.Schema],Oi=ze[K.Symbol.OriginalName],Bi=kn===Oi?void 0:Z.alias;M.push(f`${f.raw(Z.joinType)} join ${Ri?f`${f.identifier(Ri)}.`:void 0}${f.identifier(Oi)}${Bi&&f` ${f.identifier(Bi)}`} on ${Z.on}`)}else M.push(f`${f.raw(Z.joinType)} join ${ze} on ${Z.on}`);ie0?f` group by ${f.join(W)}`:void 0,js=F.length>0?f` order by ${f.join(F)}`:void 0,Ur=d?f` limit ${d}`:void 0,Is=m?f` offset ${m}`:void 0,Ms=f`${q}select${$} ${z} from ${j}${Ee}${ve}${nr}${T}${js}${Ur}${Is}`;return N.length>0?this.buildSetOperations(Ms,N):Ms}buildSetOperations(e,t){let[s,...n]=t;if(!s)throw new Error("Cannot pass undefined values to any set operator");return n.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:s}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:s}),n)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:s,rightSelect:n,limit:i,orderBy:a,offset:u}}){let l=f`${e.getSQL()} `,c=f`${n.getSQL()}`,d;if(a&&a.length>0){let C=[];for(let O of a)if(g(O,me))C.push(f.identifier(O.name));else if(g(O,D)){for(let q=0;qf.identifier(C.name));for(let[C,O]of t.entries()){let q=[];for(let[$,z]of l){let j=O[$];if(j===void 0||g(j,ue)&&j.value===void 0){let M;if(z.default!==null&&z.default!==void 0)M=g(z.default,D)?z.default:f.param(z.default,z);else if(z.defaultFn!==void 0){let Ee=z.defaultFn();M=g(Ee,D)?Ee:f.param(Ee,z)}else M=f`null`;q.push(M)}else q.push(j)}a.push(q),C({dbKey:j.name,tsKey:z,field:qe(j,u),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let $=Object.fromEntries(Object.entries(i.columns).map(([T,F])=>[T,qe(F,u)]));if(a.where){let T=typeof a.where=="function"?a.where($,Ya()):a.where;C=T&&Yr(T,u)}let z=[],j=[];if(a.columns){let T=!1;for(let[F,W]of Object.entries(a.columns))W!==void 0&&F in i.columns&&(!T&&W===!0&&(T=!0),j.push(F));j.length>0&&(j=T?j.filter(F=>a.columns?.[F]===!0):Object.keys(i.columns).filter(F=>!j.includes(F)))}else j=Object.keys(i.columns);for(let T of j){let F=i.columns[T];z.push({tsKey:T,value:F})}let M=[];a.with&&(M=Object.entries(a.with).filter(T=>!!T[1]).map(([T,F])=>({tsKey:T,queryConfig:F,relation:i.relations[T]})));let Ee;if(a.extras){Ee=typeof a.extras=="function"?a.extras($,{sql:f}):a.extras;for(let[T,F]of Object.entries(Ee))z.push({tsKey:T,value:ti(F,u)})}for(let{tsKey:T,value:F}of z)d.push({dbKey:g(F,D.Aliased)?F.fieldAlias:i.columns[T].name,tsKey:T,field:g(F,B)?qe(F,u):F,relationTableTsKey:void 0,isJson:!1,selection:[]});let ve=typeof a.orderBy=="function"?a.orderBy($,Xa()):a.orderBy??[];Array.isArray(ve)||(ve=[ve]),N=ve.map(T=>g(T,B)?qe(T,u):Yr(T,u)),m=a.limit,x=a.offset;for(let{tsKey:T,queryConfig:F,relation:W}of M){let nr=eo(t,s,W),js=W.referencedTable[v.Symbol.Name],Ur=s[js],Is=`${u}_${T}`,Ms=Qe(...nr.fields.map((ze,kn)=>se(qe(nr.references[kn],Is),qe(ze,u)))),ie=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:s,table:e[Ur],tableConfig:t[Ur],queryConfig:g(W,je)?F===!0?{limit:1}:{...F,limit:1}:F,tableAlias:Is,joinOn:Ms,nestedQueryRelation:W}),Z=f`(${ie.sql})`.as(T);d.push({dbKey:T,tsKey:T,field:Z,relationTableTsKey:Ur,isJson:!0,selection:ie.selection})}}if(d.length===0)throw new He({message:`No fields selected for table "${i.tsName}" ("${u}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let q;if(C=Qe(c,C),l){let $=f`json_array(${f.join(d.map(({field:M})=>g(M,me)?f.identifier(M.name):g(M,D.Aliased)?M.sql:M),f`, `)})`;g(l,kt)&&($=f`coalesce(json_group_array(${$}), json_array())`);let z=[{dbKey:"data",tsKey:"data",field:$.as("data"),isJson:!0,relationTableTsKey:i.tsName,selection:d}];m!==void 0||x!==void 0||N.length>0?(q=this.buildSelectQuery({table:Jr(n,u),fields:{},fieldsFlat:[{path:[],field:f.raw("*")}],where:C,limit:m,offset:x,orderBy:N,setOperators:[]}),C=void 0,m=void 0,x=void 0,N=void 0):q=Jr(n,u),q=this.buildSelectQuery({table:g(q,K)?q:new ee(q,{},u),fields:{},fieldsFlat:z.map(({field:M})=>({path:[],field:g(M,B)?qe(M,u):M})),joins:O,where:C,limit:m,offset:x,orderBy:N,setOperators:[]})}else q=this.buildSelectQuery({table:Jr(n,u),fields:{},fieldsFlat:d.map(({field:$})=>({path:[],field:g($,B)?qe($,u):$})),joins:O,where:C,limit:m,offset:x,orderBy:N,setOperators:[]});return{tableTsKey:i.tsName,sql:q,selection:d}}};o(br,"SQLiteDialect"),kd=p,h(br,kd,"SQLiteDialect");var Rd,xr=class extends br{migrate(e,t,s){let n=s===void 0||typeof s=="string"?"__drizzle_migrations":s.migrationsTable??"__drizzle_migrations",i=f` + CREATE TABLE IF NOT EXISTS ${f.identifier(n)} ( + id SERIAL PRIMARY KEY, + hash text NOT NULL, + created_at numeric + ) + `;t.run(i);let u=t.values(f`SELECT id, hash, created_at FROM ${f.identifier(n)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run(f`BEGIN`);try{for(let l of e)if(!u||Number(u[2]){for(let c of e)if(!u||Number(u[2])[n,e[n]])):g(e,at)?s=e[Y].selectedFields:g(e,D)?s={}:s=ln(e),new Ar({table:e,fields:s,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}};o(fe,"SQLiteSelectBuilder"),$d=p,h(fe,$d,"SQLiteSelectBuilder");var Ld,ms=class extends wr{_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:e,fields:t,isPartialSelect:s,session:n,dialect:i,withList:a,distinct:u}){super(),this.config={withList:a,table:e,fields:{...t},distinct:u,setOperators:[]},this.isPartialSelect=s,this.session=n,this.dialect=i,this._={selectedFields:t},this.tableName=ai(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}createJoin(e){return(t,s)=>{let n=this.tableName,i=ai(t);if(typeof i=="string"&&this.config.joins?.some(a=>a.alias===i))throw new Error(`Alias "${i}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof n=="string"&&(this.config.fields={[n]:this.config.fields}),typeof i=="string"&&!g(t,D))){let a=g(t,ee)?t[J].selection:g(t,le)?t[Y].selectedFields:t[v.Symbol.Columns];this.config.fields[i]=a}if(typeof s=="function"&&(s=s(new Proxy(this.config.fields,new ae({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:s,table:t,joinType:e,alias:i}),typeof i=="string")switch(e){case"left":{this.joinsNotNullableMap[i]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[i]=!0;break}case"inner":{this.joinsNotNullableMap[i]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[i]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(e,t){return s=>{let n=typeof s=="function"?s(qd()):s;if(!ii(this.getSelectedFields(),n.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:n}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new ae({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new ae({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new ae({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new ae({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),s=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=s:this.config.orderBy=s}else{let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){return new Proxy(new ee(this.getSQL(),this.config.fields,e),new ae({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new ae({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};o(ms,"SQLiteSelectQueryBuilderBase"),Ld=p,h(ms,Ld,"SQLiteSelectQueryBuilder");var Pd,Ar=class extends ms{_prepare(e=!0){if(!this.session)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=Ae(this.config.fields),s=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all");return s.joinsNotNullableMap=this.joinsNotNullableMap,s}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}};o(Ar,"SQLiteSelectBase"),Pd=p,h(Ar,Pd,"SQLiteSelect");ro(Ar,[re]);function fn(r,e){return(t,s,...n)=>{let i=[s,...n].map(a=>({type:r,isAll:e,rightSelect:a}));for(let a of i)if(!ii(t.getSelectedFields(),a.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return t.addSetOperators(i)}}o(fn,"createSetOperator");var qd=o(()=>({union:Fd,unionAll:jd,intersect:Id,except:Md}),"getSQLiteSetOperators"),Fd=fn("union",!1),jd=fn("union",!0),Id=fn("intersect",!1),Md=fn("except",!1);var zd,Dr=class{dialect;$with(e){let t=this;return{as(s){return typeof s=="function"&&(s=s(t)),new Proxy(new st(s.getSQL(),s.getSelectedFields(),e,!0),new ae({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}}with(...e){let t=this;function s(i){return new fe({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})}o(s,"select");function n(i){return new fe({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}return o(n,"selectDistinct"),{select:s,selectDistinct:n}}select(e){return new fe({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new fe({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new xr),this.dialect}};o(Dr,"QueryBuilder"),zd=p,h(Dr,zd,"SQLiteQueryBuilder");var Vd,jt=class{constructor(e,t,s,n){this.table=e,this.session=t,this.dialect=s,this.withList=n}set(e){return new gs(this.table,un(this.table,e),this.session,this.dialect,this.withList)}};o(jt,"SQLiteUpdateBuilder"),Vd=p,h(jt,Vd,"SQLiteUpdateBuilder");var Ud,gs=class extends re{constructor(e,t,s,n,i){super(),this.session=s,this.dialect=n,this.config={set:t,table:e,withList:i}}config;where(e){return this.config.where=e,this}returning(e=this.config.table[K.Symbol.Columns]){return this.config.returning=Ae(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run")}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};o(gs,"SQLiteUpdateBase"),Ud=p,h(gs,Ud,"SQLiteUpdate");var Kd,_r=class{constructor(e,t,s,n,i,a,u,l){this.mode=e,this.fullSchema=t,this.schema=s,this.tableNamesMap=n,this.table=i,this.tableConfig=a,this.dialect=u,this.session=l}findMany(e){return this.mode==="sync"?new Er(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new It(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return this.mode==="sync"?new Er(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new It(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}};o(_r,"RelationalQueryBuilder"),Kd=p,h(_r,Kd,"SQLiteAsyncRelationalQueryBuilder");var Hd,It=class extends re{constructor(e,t,s,n,i,a,u,l,c){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=s,this.table=n,this.tableConfig=i,this.dialect=a,this.session=u,this.config=l,this.mode=c}mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){let{query:t,builtQuery:s}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](s,void 0,this.mode==="first"?"get":"all",(n,i)=>{let a=n.map(u=>an(this.schema,this.tableConfig,u,t.selection,i));return this.mode==="first"?a[0]:a})}prepare(){return this._prepare(!1)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return this.mode==="first"?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}};o(It,"SQLiteRelationalQuery"),Hd=p,h(It,Hd,"SQLiteAsyncRelationalQuery");var Qd,Er=class extends It{sync(){return this.executeRaw()}};o(Er,"SQLiteSyncRelationalQuery"),Qd=p,h(Er,Qd,"SQLiteSyncRelationalQuery");var Gd,We=class extends re{constructor(e,t,s,n,i){super(),this.execute=e,this.getSQL=t,this.dialect=n,this.mapBatchResult=i,this.config={action:s}}config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}};o(We,"SQLiteRaw"),Gd=p,h(We,Gd,"SQLiteRaw");var Wd,ot=class{constructor(e,t,s,n){this.resultKind=e,this.dialect=t,this.session=s,this._=n?{schema:n.schema,tableNamesMap:n.tableNamesMap}:{schema:void 0,tableNamesMap:{}},this.query={};let i=this.query;if(this._.schema)for(let[a,u]of Object.entries(this._.schema))i[a]=new _r(e,n.fullSchema,this._.schema,this._.tableNamesMap,n.fullSchema[a],u,t,s)}query;$with(e){return{as(t){return typeof t=="function"&&(t=t(new Dr)),new Proxy(new st(t.getSQL(),t.getSelectedFields(),e,!0),new ae({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}}with(...e){let t=this;function s(l){return new fe({fields:l??void 0,session:t.session,dialect:t.dialect,withList:e})}o(s,"select");function n(l){return new fe({fields:l??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})}o(n,"selectDistinct");function i(l){return new jt(l,t.session,t.dialect,e)}o(i,"update");function a(l){return new Ft(l,t.session,t.dialect,e)}o(a,"insert");function u(l){return new qt(l,t.session,t.dialect,e)}return o(u,"delete_"),{select:s,selectDistinct:n,update:i,insert:a,delete:u}}select(e){return new fe({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new fe({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new jt(e,this.session,this.dialect)}insert(e){return new Ft(e,this.session,this.dialect)}delete(e){return new qt(e,this.session,this.dialect)}run(e){let t=e.getSQL();return this.resultKind==="async"?new We(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){let t=e.getSQL();return this.resultKind==="async"?new We(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){let t=e.getSQL();return this.resultKind==="async"?new We(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){let t=e.getSQL();return this.resultKind==="async"?new We(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}};o(ot,"BaseSQLiteDatabase"),Wd=p,h(ot,Wd,"BaseSQLiteDatabase");var Jd,ys=class extends re{constructor(e){super(),this.resultCb=e}async execute(){return this.resultCb()}sync(){return this.resultCb()}};o(ys,"ExecuteResultSync"),Jd=p,h(ys,Jd,"ExecuteResultSync");var Yd,Cr=class{constructor(e,t,s){this.mode=e,this.executeMethod=t,this.query=s}joinsNotNullableMap;getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw new Error("Not implemented")}mapGetResult(e,t){throw new Error("Not implemented")}execute(e){return this.mode==="async"?this[this.executeMethod](e):new ys(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}};o(Cr,"SQLitePreparedQuery"),Yd=p,h(Cr,Yd,"PreparedQuery");var Xd,Tr=class{constructor(e){this.dialect=e}prepareOneTimeQuery(e,t,s){return this.prepareQuery(e,t,s)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run").run()}catch(s){throw new He({cause:s,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run").all()}extractRawAllValueFromBatchResult(e){throw new Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run").get()}extractRawGetValueFromBatchResult(e){throw new Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run").values()}extractRawValuesValueFromBatchResult(e){throw new Error("Not implemented")}};o(Tr,"SQLiteSession"),Xd=p,h(Tr,Xd,"SQLiteSession");var Zd,Sr=class extends ot{constructor(e,t,s,n,i=0){super(e,t,s,n),this.schema=n,this.nestedIndex=i}rollback(){throw new fr}};o(Sr,"SQLiteTransaction"),Zd=p,h(Sr,Zd,"SQLiteTransaction");var so=Symbol.for("drizzle:MySqlInlineForeignKeys"),ef,Ie=class extends v{[(ef=p,v.Symbol.Columns)];[so]=[];[v.Symbol.ExtraConfigBuilder]=void 0};o(Ie,"MySqlTable"),h(Ie,ef,"MySqlTable"),h(Ie,"Symbol",Object.assign({},v.Symbol,{InlineForeignKeys:so}));var tf,Nr=class{reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:s,columns:n,foreignColumns:i}=e();return{name:s,columns:n,foreignTable:i[0].table,foreignColumns:i}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new bs(e,this)}};o(Nr,"ForeignKeyBuilder"),tf=p,h(Nr,tf,"MySqlForeignKeyBuilder");var rf,bs=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:s}=this.reference(),n=t.map(u=>u.name),i=s.map(u=>u.name),a=[this.table[Ie.Symbol.Name],...n,s[0].table[Ie.Symbol.Name],...i];return e??`${a.join("_")}_fk`}};o(bs,"ForeignKey"),rf=p,h(bs,rf,"MySqlForeignKey");function ci(r,e){return`${r[Ie.Symbol.Name]}_${e.join("_")}_unique`}o(ci,"uniqueKeyName");var sf,xs=class{constructor(e,t){this.name=t,this.columns=e}columns;build(e){return new vs(e,this.columns,this.name)}};o(xs,"UniqueConstraintBuilder"),sf=p,h(xs,sf,"MySqlUniqueConstraintBuilder");var nf,hn=class{name;constructor(e){this.name=e}on(...e){return new xs(e,this.name)}};o(hn,"UniqueOnConstraintBuilder"),nf=p,h(hn,nf,"MySqlUniqueOnConstraintBuilder");var af,vs=class{constructor(e,t,s){this.table=e,this.columns=t,this.name=s??ci(this.table,this.columns.map(n=>n.name))}columns;name;nullsNotDistinct=!1;getName(){return this.name}};o(vs,"UniqueConstraint"),af=p,h(vs,af,"MySqlUniqueConstraint");var of,Ce=class extends Fe{foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:s,actions:n})=>((i,a)=>{let u=new Nr(()=>{let l=i();return{columns:[e],foreignColumns:[l]}});return a.onUpdate&&u.onUpdate(a.onUpdate),a.onDelete&&u.onDelete(a.onDelete),u.build(t)})(s,n))}};o(Ce,"MySqlColumnBuilder"),of=p,h(Ce,of,"MySqlColumnBuilder");var uf,Te=class extends B{constructor(e,t){t.uniqueName||(t.uniqueName=ci(e,[t.name])),super(e,t),this.table=e}};o(Te,"MySqlColumn"),uf=p,h(Te,uf,"MySqlColumn");var lf,pn=class extends Ce{constructor(e,t,s){super(e,t,s),this.config.autoIncrement=!1}autoincrement(){return this.config.autoIncrement=!0,this.config.hasDefault=!0,this}};o(pn,"MySqlColumnBuilderWithAutoIncrement"),lf=p,h(pn,lf,"MySqlColumnBuilderWithAutoIncrement");var cf,mn=class extends Te{autoIncrement=this.config.autoIncrement};o(mn,"MySqlColumnWithAutoIncrement"),cf=p,h(mn,cf,"MySqlColumnWithAutoIncrement");var df,gn=class extends Ce{constructor(e,t){super(e,"string","MySqlChar"),this.config.length=t.length,this.config.enum=t.enum}build(e){return new Mt(e,this.config)}};o(gn,"MySqlCharBuilder"),df=p,h(gn,df,"MySqlCharBuilder");var ff,Mt=class extends Te{length=this.config.length;enumValues=this.config.enum;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}};o(Mt,"MySqlChar"),ff=p,h(Mt,ff,"MySqlChar");var hf,yn=class extends Ce{constructor(e,t){super(e,"string","MySqlVarBinary"),this.config.length=t?.length}build(e){return new $t(e,this.config)}};o(yn,"MySqlVarBinaryBuilder"),hf=p,h(yn,hf,"MySqlVarBinaryBuilder");var pf,$t=class extends Te{length=this.config.length;getSQLType(){return this.length===void 0?"varbinary":`varbinary(${this.length})`}};o($t,"MySqlVarBinary"),pf=p,h($t,pf,"MySqlVarBinary");var mf,bn=class extends Ce{constructor(e,t){super(e,"string","MySqlVarChar"),this.config.length=t.length,this.config.enum=t.enum}build(e){return new Lt(e,this.config)}};o(bn,"MySqlVarCharBuilder"),mf=p,h(bn,mf,"MySqlVarCharBuilder");var gf,Lt=class extends Te{length=this.config.length;enumValues=this.config.enum;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};o(Lt,"MySqlVarChar"),gf=p,h(Lt,gf,"MySqlVarChar");var yf,kr=class{reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{let{name:s,columns:n,foreignColumns:i}=e();return{name:s,columns:n,foreignTable:i[0].table,foreignColumns:i}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new ws(e,this)}};o(kr,"ForeignKeyBuilder"),yf=p,h(kr,yf,"PgForeignKeyBuilder");var bf,ws=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:s}=this.reference(),n=t.map(u=>u.name),i=s.map(u=>u.name),a=[this.table[we.Symbol.Name],...n,s[0].table[we.Symbol.Name],...i];return e??`${a.join("_")}_fk`}};o(ws,"ForeignKey"),bf=p,h(ws,bf,"PgForeignKey");function di(r,e){return`${r[we.Symbol.Name]}_${e.join("_")}_unique`}o(di,"uniqueKeyName");var xf,As=class{constructor(e,t){this.name=t,this.columns=e}columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new Ds(e,this.columns,this.nullsNotDistinctConfig,this.name)}};o(As,"UniqueConstraintBuilder"),xf=p,h(As,xf,"PgUniqueConstraintBuilder");var vf,xn=class{name;constructor(e){this.name=e}on(...e){return new As(e,this.name)}};o(xn,"UniqueOnConstraintBuilder"),vf=p,h(xn,vf,"PgUniqueOnConstraintBuilder");var wf,Ds=class{constructor(e,t,s,n){this.table=e,this.columns=t,this.name=n??di(this.table,this.columns.map(i=>i.name)),this.nullsNotDistinct=s}columns;name;nullsNotDistinct=!1;getName(){return this.name}};o(Ds,"UniqueConstraint"),wf=p,h(Ds,wf,"PgUniqueConstraint");function no(r,e,t){for(let s=e;sArray.isArray(e)?fi(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}o(fi,"makePgArray");var Af,Se=class extends Fe{foreignKeyConfigs=[];array(e){return new _s(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:s,actions:n})=>Xs((i,a)=>{let u=new kr(()=>{let l=i();return{columns:[e],foreignColumns:[l]}});return a.onUpdate&&u.onUpdate(a.onUpdate),a.onDelete&&u.onDelete(a.onDelete),u.build(t)},s,n))}};o(Se,"PgColumnBuilder"),Af=p,h(Se,Af,"PgColumnBuilder");var Df,Ne=class extends B{constructor(e,t){t.uniqueName||(t.uniqueName=di(e,[t.name])),super(e,t),this.table=e}};o(Ne,"PgColumn"),Df=p,h(Ne,Df,"PgColumn");var _f,_s=class extends Se{constructor(e,t,s){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=s}build(e){let t=this.config.baseBuilder.build(e);return new Es(e,this.config,t)}};o(_s,"PgArrayBuilder"),_f=p,h(_s,_f,"PgArrayBuilder");var Ef,hi=class extends Ne{constructor(e,t,s,n){super(e,t),this.baseColumn=s,this.range=n,this.size=t.size}size;getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(e){return typeof e=="string"&&(e=ao(e)),e.map(t=>this.baseColumn.mapFromDriverValue(t))}mapToDriverValue(e,t=!1){let s=e.map(n=>n===null?null:g(this.baseColumn,hi)?this.baseColumn.mapToDriverValue(n,!0):this.baseColumn.mapToDriverValue(n));return t?s:fi(s)}},Es=hi;o(Es,"PgArray"),Ef=p,h(Es,Ef,"PgArray");var Cf,vn=class extends Se{constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new Pt(e,this.config)}};o(vn,"PgCharBuilder"),Cf=p,h(vn,Cf,"PgCharBuilder");var Tf,Pt=class extends Ne{length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}};o(Pt,"PgChar"),Tf=p,h(Pt,Tf,"PgChar");var Sf,wn=class extends Se{constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(f`gen_random_uuid()`)}build(e){return new zt(e,this.config)}};o(wn,"PgUUIDBuilder"),Sf=p,h(wn,Sf,"PgUUIDBuilder");var Nf,zt=class extends Ne{getSQLType(){return"uuid"}};o(zt,"PgUUID"),Nf=p,h(zt,Nf,"PgUUID");var kf,An=class extends Se{constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new Vt(e,this.config)}};o(An,"PgVarcharBuilder"),kf=p,h(An,kf,"PgVarcharBuilder");var Rf,Vt=class extends Ne{length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};o(Vt,"PgVarchar"),Rf=p,h(Vt,Rf,"PgVarchar");var H={};tu(H,{BRAND:()=>sh,DIRTY:()=>Ut,EMPTY_PATH:()=>Ff,INVALID:()=>_,NEVER:()=>Mh,OK:()=>oe,ParseStatus:()=>X,Schema:()=>k,ZodAny:()=>Xe,ZodArray:()=>pe,ZodBigInt:()=>Re,ZodBoolean:()=>lt,ZodBranded:()=>qr,ZodCatch:()=>xt,ZodDate:()=>$e,ZodDefault:()=>bt,ZodDiscriminatedUnion:()=>Qt,ZodEffects:()=>be,ZodEnum:()=>Oe,ZodError:()=>ne,ZodFirstPartyTypeKind:()=>E,ZodFunction:()=>Ze,ZodIntersection:()=>ht,ZodIssueCode:()=>y,ZodLazy:()=>mt,ZodLiteral:()=>gt,ZodMap:()=>Gt,ZodNaN:()=>Wt,ZodNativeEnum:()=>yt,ZodNever:()=>_e,ZodNull:()=>dt,ZodNullable:()=>Be,ZodNumber:()=>ke,ZodObject:()=>P,ZodOptional:()=>xe,ZodParsedType:()=>w,ZodPipeline:()=>vt,ZodPromise:()=>et,ZodReadonly:()=>wt,ZodRecord:()=>pt,ZodSchema:()=>k,ZodSet:()=>Pe,ZodString:()=>he,ZodSymbol:()=>Kt,ZodTransformer:()=>be,ZodTuple:()=>ye,ZodType:()=>k,ZodUndefined:()=>ct,ZodUnion:()=>ft,ZodUnknown:()=>Le,ZodVoid:()=>Ht,addIssueToContext:()=>b,any:()=>fh,array:()=>Jt,bigint:()=>oh,boolean:()=>yo,coerce:()=>Ih,custom:()=>mo,date:()=>uh,datetimeRegex:()=>ho,defaultErrorMap:()=>Je,discriminatedUnion:()=>bh,effect:()=>Nh,enum:()=>Ch,function:()=>Dh,getErrorMap:()=>Rr,getParsedType:()=>Me,instanceof:()=>ih,intersection:()=>xh,isAborted:()=>Dn,isAsync:()=>Or,isDirty:()=>_n,isValid:()=>ut,late:()=>nh,lazy:()=>_h,literal:()=>Eh,makeIssue:()=>Cs,map:()=>wh,nan:()=>ah,nativeEnum:()=>Th,never:()=>ph,null:()=>dh,nullable:()=>Rh,number:()=>go,object:()=>yi,objectUtil:()=>pi,oboolean:()=>jh,onumber:()=>Fh,optional:()=>kh,ostring:()=>qh,pipeline:()=>Bh,preprocess:()=>Oh,promise:()=>Sh,quotelessJson:()=>Of,record:()=>bi,set:()=>Ah,setErrorMap:()=>qf,strictObject:()=>gh,string:()=>Fr,symbol:()=>lh,transformer:()=>Nh,tuple:()=>vh,undefined:()=>ch,union:()=>yh,unknown:()=>hh,util:()=>R,void:()=>mh});var R;(function(r){r.assertEqual=n=>{};function e(n){}o(e,"assertIs"),r.assertIs=e;function t(n){throw new Error}o(t,"assertNever"),r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(u=>typeof n[n[u]]!="number"),a={};for(let u of i)a[u]=n[u];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},r.find=(n,i)=>{for(let a of n)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}o(s,"joinValues"),r.joinValues=s,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(R||(R={}));var pi;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pi||(pi={}));var w=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=o(r=>{switch(typeof r){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(r)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(r)?w.array:r===null?w.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?w.promise:typeof Map<"u"&&r instanceof Map?w.map:typeof Set<"u"&&r instanceof Set?w.set:typeof Date<"u"&&r instanceof Date?w.date:w.object;default:return w.unknown}},"getParsedType");var y=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Of=o(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),ne=class extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},s={_errors:[]},n=o(i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let u=s,l=0;for(;lt.message){let t={},s=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};o(ne,"ZodError");ne.create=r=>new ne(r);var Bf=o((r,e)=>{let t;switch(r.code){case y.invalid_type:r.received===w.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case y.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,R.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:t=`Unrecognized key(s) in object: ${R.joinValues(r.keys,", ")}`;break;case y.invalid_union:t="Invalid input";break;case y.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${R.joinValues(r.options)}`;break;case y.invalid_enum_value:t=`Invalid enum value. Expected ${R.joinValues(r.options)}, received '${r.received}'`;break;case y.invalid_arguments:t="Invalid function arguments";break;case y.invalid_return_type:t="Invalid function return type";break;case y.invalid_date:t="Invalid date";break;case y.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:R.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case y.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case y.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case y.custom:t="Invalid input";break;case y.invalid_intersection_types:t="Intersection results could not be merged";break;case y.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case y.not_finite:t="Number must be finite";break;default:t=e.defaultError,R.assertNever(r)}return{message:t}},"errorMap"),Je=Bf;var oo=Je;function qf(r){oo=r}o(qf,"setErrorMap");function Rr(){return oo}o(Rr,"getErrorMap");var Cs=o(r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,i=[...t,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let u="",l=s.filter(c=>!!c).slice().reverse();for(let c of l)u=c(a,{data:e,defaultError:u}).message;return{...n,path:i,message:u}},"makeIssue"),Ff=[];function b(r,e){let t=Rr(),s=Cs({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Je?void 0:Je].filter(n=>!!n)});r.common.issues.push(s)}o(b,"addIssueToContext");var X=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return _;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let i=await n.key,a=await n.value;s.push({key:i,value:a})}return X.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return _;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(s[i.value]=a.value)}return{status:e.value,value:s}}};o(X,"ParseStatus");var _=Object.freeze({status:"aborted"}),Ut=o(r=>({status:"dirty",value:r}),"DIRTY"),oe=o(r=>({status:"valid",value:r}),"OK"),Dn=o(r=>r.status==="aborted","isAborted"),_n=o(r=>r.status==="dirty","isDirty"),ut=o(r=>r.status==="valid","isValid"),Or=o(r=>typeof Promise<"u"&&r instanceof Promise,"isAsync");var A;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));var ge=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};o(ge,"ParseInputLazyPath");var uo=o((r,e)=>{if(ut(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new ne(r.common.issues);return this._error=t,this._error}}},"handleResult");function S(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:o((a,u)=>{let{message:l}=r;return a.code==="invalid_enum_value"?{message:l??u.defaultError}:typeof u.data>"u"?{message:l??s??u.defaultError}:a.code!=="invalid_type"?{message:u.defaultError}:{message:l??t??u.defaultError}},"customMap"),description:n}}o(S,"processCreateParams");var k=class{get description(){return this._def.description}_getType(e){return Me(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Or(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},n=this._parseSync({data:e,path:s.path,parent:s});return uo(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return ut(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>ut(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(Or(n)?n:Promise.resolve(n));return uo(s,i)}refine(e,t){let s=o(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,i)=>{let a=e(n),u=o(()=>i.addIssue({code:y.custom,...s(n)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(u(),!1)):a?!0:(u(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new be({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return xe.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pe.create(this)}promise(){return et.create(this,this._def)}or(e){return ft.create([this,e],this._def)}and(e){return ht.create(this,e,this._def)}transform(e){return new be({...S(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new bt({...S(this._def),innerType:this,defaultValue:t,typeName:E.ZodDefault})}brand(){return new qr({typeName:E.ZodBranded,type:this,...S(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new xt({...S(this._def),innerType:this,catchValue:t,typeName:E.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return vt.create(this,e)}readonly(){return wt.create(this)}isOptional(){return this.safeParse(void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0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,co="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Yf=new RegExp(`^${co}$`);function fo(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}o(fo,"timeRegexSource");function Xf(r){return new RegExp(`^${fo(r)}$`)}o(Xf,"timeRegex");function ho(r){let e=`${co}T${fo(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}o(ho,"datetimeRegex");function Zf(r,e){return!!((e==="v4"||!e)&&Kf.test(r)||(e==="v6"||!e)&&Qf.test(r))}o(Zf,"isValidIP");function eh(r,e){if(!Pf.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}o(eh,"isValidJWT");function th(r,e){return!!((e==="v4"||!e)&&Hf.test(r)||(e==="v6"||!e)&&Gf.test(r))}o(th,"isValidCidr");var he=class extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:w.string,received:i.parsedType}),_}let s=new X,n;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,u=e.data.lengthe.test(n),{validation:t,code:y.invalid_string,...A.errToObj(s)})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...A.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...A.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new he({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new he({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new he({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew he({checks:[],typeName:E.ZodString,coerce:r?.coerce??!1,...S(r)});function rh(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,i=Number.parseInt(r.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return i%a/10**n}o(rh,"floatSafeRemainder");var ke=class extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:w.number,received:i.parsedType}),_}let s,n=new X;for(let i of this._def.checks)i.kind==="int"?R.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?rh(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:y.not_finite,message:i.message}),n.dirty()):R.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,s,n){return new ke({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:A.toString(n)}]})}_addCheck(e){return new ke({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&R.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew ke({checks:[],typeName:E.ZodNumber,coerce:r?.coerce||!1,...S(r)});var Re=class extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let s,n=new X;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),b(s,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):R.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return b(t,{code:y.invalid_type,expected:w.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,s,n){return new Re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:A.toString(n)}]})}_addCheck(e){return new Re({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Re({checks:[],typeName:E.ZodBigInt,coerce:r?.coerce??!1,...S(r)});var lt=class extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let s=this._getOrReturnCtx(e);return b(s,{code:y.invalid_type,expected:w.boolean,received:s.parsedType}),_}return oe(e.data)}};o(lt,"ZodBoolean");lt.create=r=>new lt({typeName:E.ZodBoolean,coerce:r?.coerce||!1,...S(r)});var $e=class extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:w.date,received:i.parsedType}),_}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_date}),_}let s=new X,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):R.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new $e({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew $e({checks:[],coerce:r?.coerce||!1,typeName:E.ZodDate,...S(r)});var Kt=class extends k{_parse(e){if(this._getType(e)!==w.symbol){let s=this._getOrReturnCtx(e);return b(s,{code:y.invalid_type,expected:w.symbol,received:s.parsedType}),_}return oe(e.data)}};o(Kt,"ZodSymbol");Kt.create=r=>new Kt({typeName:E.ZodSymbol,...S(r)});var ct=class extends k{_parse(e){if(this._getType(e)!==w.undefined){let s=this._getOrReturnCtx(e);return b(s,{code:y.invalid_type,expected:w.undefined,received:s.parsedType}),_}return oe(e.data)}};o(ct,"ZodUndefined");ct.create=r=>new ct({typeName:E.ZodUndefined,...S(r)});var dt=class extends k{_parse(e){if(this._getType(e)!==w.null){let s=this._getOrReturnCtx(e);return b(s,{code:y.invalid_type,expected:w.null,received:s.parsedType}),_}return oe(e.data)}};o(dt,"ZodNull");dt.create=r=>new dt({typeName:E.ZodNull,...S(r)});var Xe=class extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return oe(e.data)}};o(Xe,"ZodAny");Xe.create=r=>new Xe({typeName:E.ZodAny,...S(r)});var Le=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return oe(e.data)}};o(Le,"ZodUnknown");Le.create=r=>new Le({typeName:E.ZodUnknown,...S(r)});var _e=class extends k{_parse(e){let t=this._getOrReturnCtx(e);return b(t,{code:y.invalid_type,expected:w.never,received:t.parsedType}),_}};o(_e,"ZodNever");_e.create=r=>new _e({typeName:E.ZodNever,...S(r)});var Ht=class extends k{_parse(e){if(this._getType(e)!==w.undefined){let s=this._getOrReturnCtx(e);return b(s,{code:y.invalid_type,expected:w.void,received:s.parsedType}),_}return oe(e.data)}};o(Ht,"ZodVoid");Ht.create=r=>new Ht({typeName:E.ZodVoid,...S(r)});var pe=class extends k{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==w.array)return b(t,{code:y.invalid_type,expected:w.array,received:t.parsedType}),_;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,u=t.data.lengthn.maxLength.value&&(b(t,{code:y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,u)=>n.type._parseAsync(new ge(t,a,t.path,u)))).then(a=>X.mergeArray(s,a));let i=[...t.data].map((a,u)=>n.type._parseSync(new ge(t,a,t.path,u)));return X.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new pe({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new pe({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new pe({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}};o(pe,"ZodArray");pe.create=(r,e)=>new pe({type:r,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...S(e)});function Br(r){if(r instanceof P){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=xe.create(Br(s))}return new P({...r._def,shape:()=>e})}else return r instanceof pe?new pe({...r._def,type:Br(r.element)}):r instanceof xe?xe.create(Br(r.unwrap())):r instanceof Be?Be.create(Br(r.unwrap())):r instanceof ye?ye.create(r.items.map(e=>Br(e))):r}o(Br,"deepPartialify");var P=class extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=R.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==w.object){let c=this._getOrReturnCtx(e);return b(c,{code:y.invalid_type,expected:w.object,received:c.parsedType}),_}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof _e&&this._def.unknownKeys==="strip"))for(let c in n.data)a.includes(c)||u.push(c);let l=[];for(let c of a){let d=i[c],m=n.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new ge(n,m,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof _e){let c=this._def.unknownKeys;if(c==="passthrough")for(let d of u)l.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")u.length>0&&(b(n,{code:y.unrecognized_keys,keys:u}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let d of u){let m=n.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new ge(n,m,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let d of l){let m=await d.key,x=await d.value;c.push({key:m,value:x,alwaysSet:d.alwaysSet})}return c}).then(c=>X.mergeObjectSync(s,c)):X.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new P({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:A.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new P({...this._def,unknownKeys:"strip"})}passthrough(){return new P({...this._def,unknownKeys:"passthrough"})}extend(e){return new P({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new P({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:E.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new P({...this._def,catchall:e})}pick(e){let t={};for(let s of R.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new P({...this._def,shape:()=>t})}omit(e){let t={};for(let s of R.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new P({...this._def,shape:()=>t})}deepPartial(){return Br(this)}partial(e){let t={};for(let s of R.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new P({...this._def,shape:()=>t})}required(e){let t={};for(let s of R.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof xe;)i=i._def.innerType;t[s]=i}return new P({...this._def,shape:()=>t})}keyof(){return po(R.objectKeys(this.shape))}};o(P,"ZodObject");P.create=(r,e)=>new P({shape:()=>r,unknownKeys:"strip",catchall:_e.create(),typeName:E.ZodObject,...S(e)});P.strictCreate=(r,e)=>new P({shape:()=>r,unknownKeys:"strict",catchall:_e.create(),typeName:E.ZodObject,...S(e)});P.lazycreate=(r,e)=>new P({shape:r,unknownKeys:"strip",catchall:_e.create(),typeName:E.ZodObject,...S(e)});var ft=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(i){for(let u of i)if(u.result.status==="valid")return u.result;for(let u of i)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let a=i.map(u=>new ne(u.ctx.common.issues));return b(t,{code:y.invalid_union,unionErrors:a}),_}if(o(n,"handleResults"),t.common.async)return Promise.all(s.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let l of s){let c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let u=a.map(l=>new ne(l));return b(t,{code:y.invalid_union,unionErrors:u}),_}}get options(){return this._def.options}};o(ft,"ZodUnion");ft.create=(r,e)=>new ft({options:r,typeName:E.ZodUnion,...S(e)});var Ye=o(r=>r instanceof mt?Ye(r.schema):r instanceof be?Ye(r.innerType()):r instanceof gt?[r.value]:r instanceof Oe?r.options:r instanceof yt?R.objectValues(r.enum):r instanceof bt?Ye(r._def.innerType):r instanceof ct?[void 0]:r instanceof dt?[null]:r instanceof xe?[void 0,...Ye(r.unwrap())]:r instanceof Be?[null,...Ye(r.unwrap())]:r instanceof qr||r instanceof wt?Ye(r.unwrap()):r instanceof xt?Ye(r._def.innerType):[],"getDiscriminator"),Qt=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.object)return b(t,{code:y.invalid_type,expected:w.object,received:t.parsedType}),_;let s=this.discriminator,n=t.data[s],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let i of t){let a=Ye(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of a){if(n.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);n.set(u,i)}}return new Qt({typeName:E.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...S(s)})}};o(Qt,"ZodDiscriminatedUnion");function gi(r,e){let t=Me(r),s=Me(e);if(r===e)return{valid:!0,data:r};if(t===w.object&&s===w.object){let n=R.objectKeys(e),i=R.objectKeys(r).filter(u=>n.indexOf(u)!==-1),a={...r,...e};for(let u of i){let l=gi(r[u],e[u]);if(!l.valid)return{valid:!1};a[u]=l.data}return{valid:!0,data:a}}else if(t===w.array&&s===w.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i{if(Dn(i)||Dn(a))return _;let u=gi(i.value,a.value);return u.valid?((_n(i)||_n(a))&&t.dirty(),{status:t.value,value:u.data}):(b(s,{code:y.invalid_intersection_types}),_)},"handleParsed");return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};o(ht,"ZodIntersection");ht.create=(r,e,t)=>new ht({left:r,right:e,typeName:E.ZodIntersection,...S(t)});var ye=class extends k{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.array)return b(s,{code:y.invalid_type,expected:w.array,received:s.parsedType}),_;if(s.data.lengththis._def.items.length&&(b(s,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...s.data].map((a,u)=>{let l=this._def.items[u]||this._def.rest;return l?l._parse(new ge(s,a,s.path,u)):null}).filter(a=>!!a);return s.common.async?Promise.all(i).then(a=>X.mergeArray(t,a)):X.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ye({...this._def,rest:e})}};o(ye,"ZodTuple");ye.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ye({items:r,typeName:E.ZodTuple,rest:null,...S(e)})};var pt=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.object)return b(s,{code:y.invalid_type,expected:w.object,received:s.parsedType}),_;let n=[],i=this._def.keyType,a=this._def.valueType;for(let u in s.data)n.push({key:i._parse(new ge(s,u,s.path,u)),value:a._parse(new ge(s,s.data[u],s.path,u)),alwaysSet:u in s.data});return s.common.async?X.mergeObjectAsync(t,n):X.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof k?new pt({keyType:e,valueType:t,typeName:E.ZodRecord,...S(s)}):new pt({keyType:he.create(),valueType:e,typeName:E.ZodRecord,...S(t)})}};o(pt,"ZodRecord");var Gt=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.map)return b(s,{code:y.invalid_type,expected:w.map,received:s.parsedType}),_;let n=this._def.keyType,i=this._def.valueType,a=[...s.data.entries()].map(([u,l],c)=>({key:n._parse(new ge(s,u,s.path,[c,"key"])),value:i._parse(new ge(s,l,s.path,[c,"value"]))}));if(s.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let l of a){let c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),u.set(c.value,d.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let l of a){let c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),u.set(c.value,d.value)}return{status:t.value,value:u}}}};o(Gt,"ZodMap");Gt.create=(r,e,t)=>new Gt({valueType:e,keyType:r,typeName:E.ZodMap,...S(t)});var Pe=class extends k{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.set)return b(s,{code:y.invalid_type,expected:w.set,received:s.parsedType}),_;let n=this._def;n.minSize!==null&&s.data.sizen.maxSize.value&&(b(s,{code:y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(l){let c=new Set;for(let d of l){if(d.status==="aborted")return _;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}o(a,"finalizeSet");let u=[...s.data.values()].map((l,c)=>i._parse(new ge(s,l,s.path,c)));return s.common.async?Promise.all(u).then(l=>a(l)):a(u)}min(e,t){return new Pe({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new Pe({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o(Pe,"ZodSet");Pe.create=(r,e)=>new Pe({valueType:r,minSize:null,maxSize:null,typeName:E.ZodSet,...S(e)});var Ze=class extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.function)return b(t,{code:y.invalid_type,expected:w.function,received:t.parsedType}),_;function s(u,l){return Cs({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rr(),Je].filter(c=>!!c),issueData:{code:y.invalid_arguments,argumentsError:l}})}o(s,"makeArgsIssue");function n(u,l){return Cs({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rr(),Je].filter(c=>!!c),issueData:{code:y.invalid_return_type,returnTypeError:l}})}o(n,"makeReturnsIssue");let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof et){let u=this;return oe(async function(...l){let c=new ne([]),d=await u._def.args.parseAsync(l,i).catch(N=>{throw c.addIssue(s(l,N)),c}),m=await Reflect.apply(a,this,d);return await u._def.returns._def.type.parseAsync(m,i).catch(N=>{throw c.addIssue(n(m,N)),c})})}else{let u=this;return oe(function(...l){let c=u._def.args.safeParse(l,i);if(!c.success)throw new ne([s(l,c.error)]);let d=Reflect.apply(a,this,c.data),m=u._def.returns.safeParse(d,i);if(!m.success)throw new ne([n(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ze({...this._def,args:ye.create(e).rest(Le.create())})}returns(e){return new Ze({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Ze({args:e||ye.create([]).rest(Le.create()),returns:t||Le.create(),typeName:E.ZodFunction,...S(s)})}};o(Ze,"ZodFunction");var mt=class extends k{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};o(mt,"ZodLazy");mt.create=(r,e)=>new mt({getter:r,typeName:E.ZodLazy,...S(e)});var gt=class extends k{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}};o(gt,"ZodLiteral");gt.create=(r,e)=>new gt({value:r,typeName:E.ZodLiteral,...S(e)});function po(r,e){return new Oe({values:r,typeName:E.ZodEnum,...S(e)})}o(po,"createZodEnum");var Oe=class extends k{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return b(t,{expected:R.joinValues(s),received:t.parsedType,code:y.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return b(t,{received:t.data,code:y.invalid_enum_value,options:s}),_}return oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Oe.create(e,{...this._def,...t})}exclude(e,t=this._def){return Oe.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};o(Oe,"ZodEnum");Oe.create=po;var yt=class extends k{_parse(e){let t=R.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==w.string&&s.parsedType!==w.number){let n=R.objectValues(t);return b(s,{expected:R.joinValues(n),received:s.parsedType,code:y.invalid_type}),_}if(this._cache||(this._cache=new Set(R.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=R.objectValues(t);return b(s,{received:s.data,code:y.invalid_enum_value,options:n}),_}return oe(e.data)}get enum(){return this._def.values}};o(yt,"ZodNativeEnum");yt.create=(r,e)=>new yt({values:r,typeName:E.ZodNativeEnum,...S(e)});var et=class extends k{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.promise&&t.common.async===!1)return b(t,{code:y.invalid_type,expected:w.promise,received:t.parsedType}),_;let s=t.parsedType===w.promise?t.data:Promise.resolve(t.data);return oe(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};o(et,"ZodPromise");et.create=(r,e)=>new et({type:r,typeName:E.ZodPromise,...S(e)});var be=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:a=>{b(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let a=n.transform(s.data,i);if(s.common.async)return Promise.resolve(a).then(async u=>{if(t.value==="aborted")return _;let l=await this._def.schema._parseAsync({data:u,path:s.path,parent:s});return l.status==="aborted"?_:l.status==="dirty"?Ut(l.value):t.value==="dirty"?Ut(l.value):l});{if(t.value==="aborted")return _;let u=this._def.schema._parseSync({data:a,path:s.path,parent:s});return u.status==="aborted"?_:u.status==="dirty"?Ut(u.value):t.value==="dirty"?Ut(u.value):u}}if(n.type==="refinement"){let a=o(u=>{let l=n.refinement(u,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u},"executeRefinement");if(s.common.async===!1){let u=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return u.status==="aborted"?_:(u.status==="dirty"&&t.dirty(),a(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(u=>u.status==="aborted"?_:(u.status==="dirty"&&t.dirty(),a(u.value).then(()=>({status:t.value,value:u.value}))))}if(n.type==="transform")if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ut(a))return _;let u=n.transform(a.value,i);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>ut(a)?Promise.resolve(n.transform(a.value,i)).then(u=>({status:t.value,value:u})):_);R.assertNever(n)}};o(be,"ZodEffects");be.create=(r,e,t)=>new be({schema:r,typeName:E.ZodEffects,effect:e,...S(t)});be.createWithPreprocess=(r,e,t)=>new be({schema:e,effect:{type:"preprocess",transform:r},typeName:E.ZodEffects,...S(t)});var xe=class extends k{_parse(e){return this._getType(e)===w.undefined?oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o(xe,"ZodOptional");xe.create=(r,e)=>new xe({innerType:r,typeName:E.ZodOptional,...S(e)});var Be=class extends k{_parse(e){return this._getType(e)===w.null?oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o(Be,"ZodNullable");Be.create=(r,e)=>new Be({innerType:r,typeName:E.ZodNullable,...S(e)});var bt=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===w.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};o(bt,"ZodDefault");bt.create=(r,e)=>new bt({innerType:r,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var xt=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Or(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ne(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ne(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};o(xt,"ZodCatch");xt.create=(r,e)=>new xt({innerType:r,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var Wt=class extends k{_parse(e){if(this._getType(e)!==w.nan){let s=this._getOrReturnCtx(e);return b(s,{code:y.invalid_type,expected:w.nan,received:s.parsedType}),_}return{status:"valid",value:e.data}}};o(Wt,"ZodNaN");Wt.create=r=>new Wt({typeName:E.ZodNaN,...S(r)});var sh=Symbol("zod_brand"),qr=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}};o(qr,"ZodBranded");var vt=class extends k{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return o(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),Ut(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})},"handleAsync")();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?_:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new vt({in:e,out:t,typeName:E.ZodPipeline})}};o(vt,"ZodPipeline");var wt=class extends k{_parse(e){let t=this._def.innerType._parse(e),s=o(n=>(ut(n)&&(n.value=Object.freeze(n.value)),n),"freeze");return Or(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};o(wt,"ZodReadonly");wt.create=(r,e)=>new wt({innerType:r,typeName:E.ZodReadonly,...S(e)});function lo(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}o(lo,"cleanParams");function mo(r,e={},t){return r?Xe.create().superRefine((s,n)=>{let i=r(s);if(i instanceof Promise)return i.then(a=>{if(!a){let u=lo(e,s),l=u.fatal??t??!0;n.addIssue({code:"custom",...u,fatal:l})}});if(!i){let a=lo(e,s),u=a.fatal??t??!0;n.addIssue({code:"custom",...a,fatal:u})}}):Xe.create()}o(mo,"custom");var nh={object:P.lazycreate},E;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(E||(E={}));var ih=o((r,e={message:`Input not instance of ${r.name}`})=>mo(t=>t instanceof r,e),"instanceOfType"),Fr=he.create,go=ke.create,ah=Wt.create,oh=Re.create,yo=lt.create,uh=$e.create,lh=Kt.create,ch=ct.create,dh=dt.create,fh=Xe.create,hh=Le.create,ph=_e.create,mh=Ht.create,Jt=pe.create,yi=P.create,gh=P.strictCreate,yh=ft.create,bh=Qt.create,xh=ht.create,vh=ye.create,bi=pt.create,wh=Gt.create,Ah=Pe.create,Dh=Ze.create,_h=mt.create,Eh=gt.create,Ch=Oe.create,Th=yt.create,Sh=et.create,Nh=be.create,kh=xe.create,Rh=Be.create,Oh=be.createWithPreprocess,Bh=vt.create,qh=o(()=>Fr().optional(),"ostring"),Fh=o(()=>go().optional(),"onumber"),jh=o(()=>yo().optional(),"oboolean"),Ih={string:r=>he.create({...r,coerce:!0}),number:r=>ke.create({...r,coerce:!0}),boolean:r=>lt.create({...r,coerce:!0}),bigint:r=>Re.create({...r,coerce:!0}),date:r=>$e.create({...r,coerce:!0})};var Mh=_;var Lh=H.union([H.string(),H.number(),H.boolean(),H.null()]),xi=H.lazy(()=>H.union([Lh,H.array(xi),H.record(xi)]));function En(r,e){let t=ln(r),s=Object.entries(t),n=Object.fromEntries(s.map(([i,a])=>[i,bo(a)]));e&&(n=Object.assign(n,Object.fromEntries(Object.entries(e).map(([i,a])=>[i,typeof a=="function"?a(n):a]))));for(let[i,a]of s)a.notNull?a.hasDefault&&(n[i]=n[i].optional()):n[i]=n[i].nullable().optional();return H.object(n)}o(En,"c");function bo(r){let e;if(function(t){return"enumValues"in t&&Array.isArray(t.enumValues)&&t.enumValues.length>0}(r)&&(e=r.enumValues.length?H.enum(r.enumValues):H.string()),!e){if(g(r,zt))e=H.string().uuid();else if(r.dataType==="custom")e=H.any();else if(r.dataType==="json")e=xi;else if(r.dataType==="array")e=H.array(bo(r.baseColumn));else if(r.dataType==="number")e=H.number();else if(r.dataType==="bigint")e=H.bigint();else if(r.dataType==="boolean")e=H.boolean();else if(r.dataType==="date")e=H.date();else if(r.dataType==="string"){let t=H.string();(g(r,Pt)||g(r,Vt)||g(r,Lt)||g(r,$t)||g(r,Mt)||g(r,Bt))&&typeof r.length=="number"&&(t=t.max(r.length)),e=t}}return e||(e=H.any()),e}o(bo,"p");var Yt=cn("api_keys",{id:I("id").primaryKey(),key:I("key").notNull().unique(),keyPrefix:I("key_prefix").notNull(),name:I("name"),rateLimit:De("rate_limit").default(100),isActive:De("is_active",{mode:"boolean"}).default(!0).notNull(),lastUsedAt:De("last_used_at",{mode:"timestamp"}),expiresAt:De("expires_at",{mode:"timestamp"}),createdAt:De("created_at",{mode:"timestamp"}).notNull(),updatedAt:De("updated_at",{mode:"timestamp"}).notNull()}),ZS=En(Yt),Ts=cn("mailboxes",{id:I("id").primaryKey(),address:I("address").notNull().unique(),domain:I("domain").notNull(),expiresAt:De("expires_at",{mode:"timestamp"}),apiKeyId:I("api_key_id").notNull(),createdAt:De("created_at",{mode:"timestamp"}).notNull(),updatedAt:De("updated_at",{mode:"timestamp"}).notNull()}),e3=En(Ts),V=cn("emails",{id:I("id").primaryKey(),messageFrom:I("message_from").notNull(),messageTo:I("message_to").notNull(),headers:I("headers",{mode:"json"}).$type().notNull(),from:I("from",{mode:"json"}).$type().notNull(),sender:I("sender",{mode:"json"}).$type(),replyTo:I("reply_to",{mode:"json"}).$type(),deliveredTo:I("delivered_to"),returnPath:I("return_path"),to:I("to",{mode:"json"}).$type(),cc:I("cc",{mode:"json"}).$type(),bcc:I("bcc",{mode:"json"}).$type(),subject:I("subject"),messageId:I("message_id").notNull(),inReplyTo:I("in_reply_to"),references:I("references"),date:I("date"),html:I("html"),text:I("text"),createdAt:De("created_at",{mode:"timestamp"}).notNull(),updatedAt:De("updated_at",{mode:"timestamp"}).notNull()}),jr=yi({address:Fr(),name:Fr()}),xo=En(V,{headers:Jt(bi(Fr())),from:jr,sender:jr.optional(),replyTo:Jt(jr).optional(),to:Jt(jr).optional(),cc:Jt(jr).optional(),bcc:Jt(jr).optional()});async function vo(r,e){try{await r.insert(V).values(e).execute()}catch(t){console.error(t)}}o(vo,"insertEmail");async function wo(r,e){try{let t=await r.select().from(V).where(Qe(se(V.id,e))).execute();return t.length!=1?null:t[0]}catch{return null}}o(wo,"findEmailById");async function Ao(r,e){try{return await r.select().from(V).where(se(V.messageTo,e)).orderBy(Xr(V.createdAt)).execute()}catch{return[]}}o(Ao,"getEmailsByMessageTo");async function Do(r,e){if(!e||e.length===0)return{count:0};try{return{count:(await r.delete(V).where(sn(V.id,e))).rowsAffected}}catch(t){return console.error(t),{count:0}}}o(Do,"deleteEmails");async function _o(r,e){try{return{count:(await r.delete(V).where(rn(V.createdAt,e)).execute()).rowsAffected}}catch(t){return console.error("\u6E05\u7406\u8FC7\u671F\u90AE\u4EF6\u5931\u8D25:",t),{count:0}}}o(_o,"deleteExpiredEmails");async function Eo(r,e){try{let t=await r.select().from(Yt).where(se(Yt.key,e)).execute();return t.length===1?t[0]:null}catch(t){return console.error("findApiKeyByKey error:",t),null}}o(Eo,"findApiKeyByKey");async function Co(r,e){try{await r.update(Yt).set({lastUsedAt:new Date,updatedAt:new Date}).where(se(Yt.id,e)).execute()}catch(t){console.error("updateApiKeyLastUsed error:",t)}}o(Co,"updateApiKeyLastUsed");async function To(r,e){try{return await r.insert(Yt).values(e).execute(),e}catch(t){return console.error("insertApiKey error:",t),null}}o(To,"insertApiKey");async function So(r,e){try{return await r.insert(Ts).values(e).execute(),e}catch(t){throw console.error("insertMailbox error:",t),t}}o(So,"insertMailbox");async function Ss(r,e){try{let t=await r.select().from(Ts).where(se(Ts.id,e)).execute();return t.length===1?t[0]:null}catch(t){return console.error("findMailboxById error:",t),null}}o(Ss,"findMailboxById");async function No(r,e,t){try{let s=(t.page-1)*t.limit,n=t.sort==="asc"?nn:Xr,[i,a]=await Promise.all([r.select().from(V).where(se(V.messageTo,e)).orderBy(n(V.createdAt)).limit(t.limit).offset(s).execute(),r.select({count:ni()}).from(V).where(se(V.messageTo,e)).execute()]),u=a[0]?.count||0;return{messages:i,total:u,totalPages:Math.ceil(u/t.limit)}}catch(s){return console.error("getMailboxMessages error:",s),{messages:[],total:0,totalPages:0}}}o(No,"getMailboxMessages");async function ko(r,e,t){try{let s=await r.select().from(V).where(Qe(se(V.id,t),se(V.messageTo,e))).execute();return s.length===1?s[0]:null}catch(s){return console.error("findMailboxMessage error:",s),null}}o(ko,"findMailboxMessage");async function Ro(r,e,t){try{return(await r.delete(V).where(Qe(se(V.id,t),se(V.messageTo,e))).execute()).rowsAffected>0}catch(s){return console.error("deleteMailboxMessage error:",s),!1}}o(Ro,"deleteMailboxMessage");async function Oo(r,e){try{return(await r.select({count:ni()}).from(V).where(se(V.messageTo,e)).execute())[0]?.count||0}catch(t){return console.error("getMailboxMessageCount error:",t),0}}o(Oo,"getMailboxMessageCount");var Ph,Ir=class extends Tr{constructor(e,t,s,n={}){super(t),this.client=e,this.schema=s,this.options=n,this.logger=n.logger??new pr}logger;prepareQuery(e,t,s,n){let i=this.client.prepare(e.sql);return new ks(i,e,this.logger,t,s,n)}async batch(e){let t=[],s=[];for(let i of e){let a=i._prepare(),u=a.getQuery();if(t.push(a),u.params.length>0)s.push(a.stmt.bind(...u.params));else{let l=a.getQuery();s.push(this.client.prepare(l.sql).bind(...l.params))}}return(await this.client.batch(s)).map((i,a)=>t[a].mapResult(i,!0))}extractRawAllValueFromBatchResult(e){return e.results}extractRawGetValueFromBatchResult(e){return e.results[0]}extractRawValuesValueFromBatchResult(e){return vi(e.results)}async transaction(e,t){let s=new Ns("async",this.dialect,this,this.schema);await this.run(f.raw(`begin${t?.behavior?" "+t.behavior:""}`));try{let n=await e(s);return await this.run(f`commit`),n}catch(n){throw await this.run(f`rollback`),n}}};o(Ir,"SQLiteD1Session"),Ph=p,h(Ir,Ph,"SQLiteD1Session");var zh,wi=class extends Sr{async transaction(e){let t=`sp${this.nestedIndex}`,s=new wi("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(f.raw(`savepoint ${t}`));try{let n=await e(s);return await this.session.run(f.raw(`release savepoint ${t}`)),n}catch(n){throw await this.session.run(f.raw(`rollback to savepoint ${t}`)),n}}},Ns=wi;o(Ns,"D1Transaction"),zh=p,h(Ns,zh,"D1Transaction");function vi(r){let e=[];for(let t of r){let s=Object.keys(t).map(n=>t[n]);e.push(s)}return e}o(vi,"d1ToRawMapping");var Vh,ks=class extends Cr{constructor(e,t,s,n,i,a){super("async",i,t),this.logger=s,this.customResultMapper=a,this.fields=n,this.stmt=e}customResultMapper;fields;stmt;run(e){let t=Wr(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),this.stmt.bind(...t).run()}async all(e){let{fields:t,query:s,logger:n,stmt:i,customResultMapper:a}=this;if(!t&&!a){let l=Wr(s.params,e??{});return n.logQuery(s.sql,l),i.bind(...l).all().then(({results:c})=>this.mapAllResult(c))}let u=await this.values(e);return this.mapAllResult(u)}mapAllResult(e,t){return t&&(e=vi(e.results)),!this.fields&&!this.customResultMapper?e:this.customResultMapper?this.customResultMapper(e):e.map(s=>on(this.fields,s,this.joinsNotNullableMap))}async get(e){let{fields:t,joinsNotNullableMap:s,query:n,logger:i,stmt:a,customResultMapper:u}=this;if(!t&&!u){let c=Wr(n.params,e??{});return i.logQuery(n.sql,c),a.bind(...c).all().then(({results:d})=>d[0])}let l=await this.values(e);if(l[0])return u?u(l):on(t,l[0],s)}mapGetResult(e,t){return t&&(e=vi(e.results)[0]),!this.fields&&!this.customResultMapper?e:this.customResultMapper?this.customResultMapper([e]):on(this.fields,e,this.joinsNotNullableMap)}values(e){let t=Wr(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),this.stmt.bind(...t).raw()}};o(ks,"D1PreparedQuery"),Vh=p,h(ks,Vh,"D1PreparedQuery");var Uh,Rs=class extends ot{async batch(e){return this.session.batch(e)}};o(Rs,"DrizzleD1Database"),Uh=p,h(Rs,Uh,"LibSQLDatabase");function Bo(r,e={}){let t=new vr,s;e.logger===!0?s=new hr:e.logger!==!1&&(s=e.logger);let n;if(e.schema){let a=Za(e.schema,to);n={fullSchema:e.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}let i=new Ir(r,t,n,{logger:s});return new Rs("async",t,i,n)}o(Bo,"drizzle");function ce(r){return Bo(r)}o(ce,"getD1DB");var Kh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Os=o((r=21)=>{let e="",t=r|0;for(;t--;)e+=Kh[Math.random()*64|0];return e},"nanoid");var At=new TextEncoder,qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qs=new Uint8Array(256);for(Bs=0;Bs>4,i[s++]=(l&15)<<4|c>>2,i[s++]=(c&3)<<6|d&63}return n}o(Cn,"decodeBase64");function Mr(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}o(Mr,"getDecoder");async function Dt(r){if("arrayBuffer"in r)return await r.arrayBuffer();let e=new FileReader;return new Promise((t,s)=>{e.onload=function(n){t(n.target.result)},e.onerror=function(n){s(e.error)},e.readAsArrayBuffer(r)})}o(Dt,"blobToArrayBuffer");function Fo(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}o(Fo,"getHex");function Hh(r,e,t){let s=r.indexOf("*");s>=0&&(r=r.substr(0,s)),e=e.toUpperCase();let n;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=At.encode(t),a=[];for(let l=0,c=i.length;le&&a===l&&u.length%4===0&&!/=$/.test(u)?i+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,i,a,u)=>e&&a===u?i+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,i,a,u)=>Hh(i,a,u));if(e&&s.indexOf("\uFFFD")>=0)e=!1;else return s}}o(Xt,"decodeWords");function Qh(r,e){e=e||"utf-8";let t=[];for(let i=0;i126){a=At.encode(a);for(let u=0;u{let s=t.match(/\*((\d+)\*?)?$/);if(!s)return;let n=t.substr(0,s.index).toLowerCase(),i=Number(s[2])||0,a;e.has(n)?a=e.get(n):(a={charset:!1,values:[]},e.set(n,a));let u=r.params[t];i===0&&s[0].charAt(s[0].length-1)==="*"&&(s=u.match(/^([^']*)'[^']*'(.*)$/))&&(a.charset=s[1]||"utf-8",u=s[2]),a.values.push({nr:i,value:u}),delete r.params[t]}),e.forEach((t,s)=>{r.params[s]=Qh(t.values.sort((n,i)=>n.nr-i.nr).map(n=>n.value).join(""),t.charset)})}o(jo,"decodeParameterValueContinuations");var $r=class{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(` +`)}finalize(){return Dt(new Blob(this.chunks,{type:"application/octet-stream"}))}};o($r,"PassThroughDecoder");var Lr=class{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let s=Math.floor(this.remainder.length/4)*4,n;s===this.remainder.length?(n=this.remainder,this.remainder=""):(n=this.remainder.substr(0,s),this.remainder=this.remainder.substr(s)),n.length&&this.chunks.push(Cn(n))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Cn(this.remainder)),Dt(new Blob(this.chunks,{type:"application/octet-stream"}))}};o(Lr,"Base64Decoder");var Io=/^=[a-f0-9]{2}$/i,Gh=/(?==[a-f0-9]{2})/i,Wh=/=\r?\n/g,Jh=/=[a-fA-F0-9]?$/,Pr=class{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),s=new DataView(t);for(let n=0,i=e.length;n3){let i=n.substr(0,3);Io.test(i)?(s.push(n.substr(1,2)),this.chunks.push(this.decodeQPBytes(s)),s=[],n=n.substr(3),this.chunks.push(n)):(s.length&&(this.chunks.push(this.decodeQPBytes(s)),s=[]),this.chunks.push(n))}}s.length&&(this.chunks.push(this.decodeQPBytes(s)),s=[])}update(e){let t=this.decoder.decode(e)+` +`;if(t=this.remainder+t,t.lengththis.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new Lr:/quoted-printable/i.test(e)?this.contentDecoder=new Pr({decoder:Mr(this.contentType.parsed.params.charset)}):this.contentDecoder=new $r}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},s=!1,n="",i="value",a=!1,u=!1,l;for(let c=0,d=e.length;c/ $/.test(s)&&!/(^|\n)-- $/.test(s)?t?s.slice(0,-1)+n:s+n:s+` +`+n).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=Mr(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let t=this.headerLines[e];if(e&&/^\s/.test(t))this.headerLines[e-1]+=` +`+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let s=t.indexOf(":"),n=s<0?t.trim():t.substr(0,s).trim(),i=s<0?"":t.substr(s+1).trim();switch(this.headers.push({key:n.toLowerCase(),originalKey:n,value:i}),n.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:At.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(Mr().decode(e));break;case"body":this.contentDecoder.update(e)}}};o(Zt,"MimeNode");var Yh={"Æ":"\xC6","Æ":"\xC6","&":"&","&":"&","Á":"\xC1","Á":"\xC1","Ă":"\u0102","Â":"\xC2","Â":"\xC2","А":"\u0410","𝔄":"\u{1D504}","À":"\xC0","À":"\xC0","Α":"\u0391","Ā":"\u0100","⩓":"\u2A53","Ą":"\u0104","𝔸":"\u{1D538}","⁡":"\u2061","Å":"\xC5","Å":"\xC5","𝒜":"\u{1D49C}","≔":"\u2254","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","∖":"\u2216","⫧":"\u2AE7","⌆":"\u2306","Б":"\u0411","∵":"\u2235","ℬ":"\u212C","Β":"\u0392","𝔅":"\u{1D505}","𝔹":"\u{1D539}","˘":"\u02D8","ℬ":"\u212C","≎":"\u224E","Ч":"\u0427","©":"\xA9","©":"\xA9","Ć":"\u0106","⋒":"\u22D2","ⅅ":"\u2145","ℭ":"\u212D","Č":"\u010C","Ç":"\xC7","Ç":"\xC7","Ĉ":"\u0108","∰":"\u2230","Ċ":"\u010A","¸":"\xB8","·":"\xB7","ℭ":"\u212D","Χ":"\u03A7","⊙":"\u2299","⊖":"\u2296","⊕":"\u2295","⊗":"\u2297","∲":"\u2232","”":"\u201D","’":"\u2019","∷":"\u2237","⩴":"\u2A74","≡":"\u2261","∯":"\u222F","∮":"\u222E","ℂ":"\u2102","∐":"\u2210","∳":"\u2233","⨯":"\u2A2F","𝒞":"\u{1D49E}","⋓":"\u22D3","≍":"\u224D","ⅅ":"\u2145","⤑":"\u2911","Ђ":"\u0402","Ѕ":"\u0405","Џ":"\u040F","‡":"\u2021","↡":"\u21A1","⫤":"\u2AE4","Ď":"\u010E","Д":"\u0414","∇":"\u2207","Δ":"\u0394","𝔇":"\u{1D507}","´":"\xB4","˙":"\u02D9","˝":"\u02DD","`":"`","˜":"\u02DC","⋄":"\u22C4","ⅆ":"\u2146","𝔻":"\u{1D53B}","¨":"\xA8","⃜":"\u20DC","≐":"\u2250","∯":"\u222F","¨":"\xA8","⇓":"\u21D3","⇐":"\u21D0","⇔":"\u21D4","⫤":"\u2AE4","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","⇒":"\u21D2","⊨":"\u22A8","⇑":"\u21D1","⇕":"\u21D5","∥":"\u2225","↓":"\u2193","⤓":"\u2913","⇵":"\u21F5","̑":"\u0311","⥐":"\u2950","⥞":"\u295E","↽":"\u21BD","⥖":"\u2956","⥟":"\u295F","⇁":"\u21C1","⥗":"\u2957","⊤":"\u22A4","↧":"\u21A7","⇓":"\u21D3","𝒟":"\u{1D49F}","Đ":"\u0110","Ŋ":"\u014A","Ð":"\xD0","Ð":"\xD0","É":"\xC9","É":"\xC9","Ě":"\u011A","Ê":"\xCA","Ê":"\xCA","Э":"\u042D","Ė":"\u0116","𝔈":"\u{1D508}","È":"\xC8","È":"\xC8","∈":"\u2208","Ē":"\u0112","◻":"\u25FB","▫":"\u25AB","Ę":"\u0118","𝔼":"\u{1D53C}","Ε":"\u0395","⩵":"\u2A75","≂":"\u2242","⇌":"\u21CC","ℰ":"\u2130","⩳":"\u2A73","Η":"\u0397","Ë":"\xCB","Ë":"\xCB","∃":"\u2203","ⅇ":"\u2147","Ф":"\u0424","𝔉":"\u{1D509}","◼":"\u25FC","▪":"\u25AA","𝔽":"\u{1D53D}","∀":"\u2200","ℱ":"\u2131","ℱ":"\u2131","Ѓ":"\u0403",">":">",">":">","Γ":"\u0393","Ϝ":"\u03DC","Ğ":"\u011E","Ģ":"\u0122","Ĝ":"\u011C","Г":"\u0413","Ġ":"\u0120","𝔊":"\u{1D50A}","⋙":"\u22D9","𝔾":"\u{1D53E}","≥":"\u2265","⋛":"\u22DB","≧":"\u2267","⪢":"\u2AA2","≷":"\u2277","⩾":"\u2A7E","≳":"\u2273","𝒢":"\u{1D4A2}","≫":"\u226B","Ъ":"\u042A","ˇ":"\u02C7","^":"^","Ĥ":"\u0124","ℌ":"\u210C","ℋ":"\u210B","ℍ":"\u210D","─":"\u2500","ℋ":"\u210B","Ħ":"\u0126","≎":"\u224E","≏":"\u224F","Е":"\u0415","IJ":"\u0132","Ё":"\u0401","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","И":"\u0418","İ":"\u0130","ℑ":"\u2111","Ì":"\xCC","Ì":"\xCC","ℑ":"\u2111","Ī":"\u012A","ⅈ":"\u2148","⇒":"\u21D2","∬":"\u222C","∫":"\u222B","⋂":"\u22C2","⁣":"\u2063","⁢":"\u2062","Į":"\u012E","𝕀":"\u{1D540}","Ι":"\u0399","ℐ":"\u2110","Ĩ":"\u0128","І":"\u0406","Ï":"\xCF","Ï":"\xCF","Ĵ":"\u0134","Й":"\u0419","𝔍":"\u{1D50D}","𝕁":"\u{1D541}","𝒥":"\u{1D4A5}","Ј":"\u0408","Є":"\u0404","Х":"\u0425","Ќ":"\u040C","Κ":"\u039A","Ķ":"\u0136","К":"\u041A","𝔎":"\u{1D50E}","𝕂":"\u{1D542}","𝒦":"\u{1D4A6}","Љ":"\u0409","<":"<","<":"<","Ĺ":"\u0139","Λ":"\u039B","⟪":"\u27EA","ℒ":"\u2112","↞":"\u219E","Ľ":"\u013D","Ļ":"\u013B","Л":"\u041B","⟨":"\u27E8","←":"\u2190","⇤":"\u21E4","⇆":"\u21C6","⌈":"\u2308","⟦":"\u27E6","⥡":"\u2961","⇃":"\u21C3","⥙":"\u2959","⌊":"\u230A","↔":"\u2194","⥎":"\u294E","⊣":"\u22A3","↤":"\u21A4","⥚":"\u295A","⊲":"\u22B2","⧏":"\u29CF","⊴":"\u22B4","⥑":"\u2951","⥠":"\u2960","↿":"\u21BF","⥘":"\u2958","↼":"\u21BC","⥒":"\u2952","⇐":"\u21D0","⇔":"\u21D4","⋚":"\u22DA","≦":"\u2266","≶":"\u2276","⪡":"\u2AA1","⩽":"\u2A7D","≲":"\u2272","𝔏":"\u{1D50F}","⋘":"\u22D8","⇚":"\u21DA","Ŀ":"\u013F","⟵":"\u27F5","⟷":"\u27F7","⟶":"\u27F6","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","𝕃":"\u{1D543}","↙":"\u2199","↘":"\u2198","ℒ":"\u2112","↰":"\u21B0","Ł":"\u0141","≪":"\u226A","⤅":"\u2905","М":"\u041C"," ":"\u205F","ℳ":"\u2133","𝔐":"\u{1D510}","∓":"\u2213","𝕄":"\u{1D544}","ℳ":"\u2133","Μ":"\u039C","Њ":"\u040A","Ń":"\u0143","Ň":"\u0147","Ņ":"\u0145","Н":"\u041D","​":"\u200B","​":"\u200B","​":"\u200B","​":"\u200B","≫":"\u226B","≪":"\u226A"," ":` +`,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426"," ":" ","Τ":"\u03A4","Ť":"\u0164","Ţ":"\u0162","Т":"\u0422","𝔗":"\u{1D517}","∴":"\u2234","Θ":"\u0398","  ":"\u205F\u200A"," ":"\u2009","∼":"\u223C","≃":"\u2243","≅":"\u2245","≈":"\u2248","𝕋":"\u{1D54B}","⃛":"\u20DB","𝒯":"\u{1D4AF}","Ŧ":"\u0166","Ú":"\xDA","Ú":"\xDA","↟":"\u219F","⥉":"\u2949","Ў":"\u040E","Ŭ":"\u016C","Û":"\xDB","Û":"\xDB","У":"\u0423","Ű":"\u0170","𝔘":"\u{1D518}","Ù":"\xD9","Ù":"\xD9","Ū":"\u016A","_":"_","⏟":"\u23DF","⎵":"\u23B5","⏝":"\u23DD","⋃":"\u22C3","⊎":"\u228E","Ų":"\u0172","𝕌":"\u{1D54C}","↑":"\u2191","⤒":"\u2912","⇅":"\u21C5","↕":"\u2195","⥮":"\u296E","⊥":"\u22A5","↥":"\u21A5","⇑":"\u21D1","⇕":"\u21D5","↖":"\u2196","↗":"\u2197","ϒ":"\u03D2","Υ":"\u03A5","Ů":"\u016E","𝒰":"\u{1D4B0}","Ũ":"\u0168","Ü":"\xDC","Ü":"\xDC","⊫":"\u22AB","⫫":"\u2AEB","В":"\u0412","⊩":"\u22A9","⫦":"\u2AE6","⋁":"\u22C1","‖":"\u2016","‖":"\u2016","∣":"\u2223","|":"|","❘":"\u2758","≀":"\u2240"," ":"\u200A","𝔙":"\u{1D519}","𝕍":"\u{1D54D}","𝒱":"\u{1D4B1}","⊪":"\u22AA","Ŵ":"\u0174","⋀":"\u22C0","𝔚":"\u{1D51A}","𝕎":"\u{1D54E}","𝒲":"\u{1D4B2}","𝔛":"\u{1D51B}","Ξ":"\u039E","𝕏":"\u{1D54F}","𝒳":"\u{1D4B3}","Я":"\u042F","Ї":"\u0407","Ю":"\u042E","Ý":"\xDD","Ý":"\xDD","Ŷ":"\u0176","Ы":"\u042B","𝔜":"\u{1D51C}","𝕐":"\u{1D550}","𝒴":"\u{1D4B4}","Ÿ":"\u0178","Ж":"\u0416","Ź":"\u0179","Ž":"\u017D","З":"\u0417","Ż":"\u017B","​":"\u200B","Ζ":"\u0396","ℨ":"\u2128","ℤ":"\u2124","𝒵":"\u{1D4B5}","á":"\xE1","á":"\xE1","ă":"\u0103","∾":"\u223E","∾̳":"\u223E\u0333","∿":"\u223F","â":"\xE2","â":"\xE2","´":"\xB4","´":"\xB4","а":"\u0430","æ":"\xE6","æ":"\xE6","⁡":"\u2061","𝔞":"\u{1D51E}","à":"\xE0","à":"\xE0","ℵ":"\u2135","ℵ":"\u2135","α":"\u03B1","ā":"\u0101","⨿":"\u2A3F","&":"&","&":"&","∧":"\u2227","⩕":"\u2A55","⩜":"\u2A5C","⩘":"\u2A58","⩚":"\u2A5A","∠":"\u2220","⦤":"\u29A4","∠":"\u2220","∡":"\u2221","⦨":"\u29A8","⦩":"\u29A9","⦪":"\u29AA","⦫":"\u29AB","⦬":"\u29AC","⦭":"\u29AD","⦮":"\u29AE","⦯":"\u29AF","∟":"\u221F","⊾":"\u22BE","⦝":"\u299D","∢":"\u2222","Å":"\xC5","⍼":"\u237C","ą":"\u0105","𝕒":"\u{1D552}","≈":"\u2248","⩰":"\u2A70","⩯":"\u2A6F","≊":"\u224A","≋":"\u224B","'":"'","≈":"\u2248","≊":"\u224A","å":"\xE5","å":"\xE5","𝒶":"\u{1D4B6}","*":"*","≈":"\u2248","≍":"\u224D","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","∳":"\u2233","⨑":"\u2A11","⫭":"\u2AED","≌":"\u224C","϶":"\u03F6","‵":"\u2035","∽":"\u223D","⋍":"\u22CD","⊽":"\u22BD","⌅":"\u2305","⌅":"\u2305","⎵":"\u23B5","⎶":"\u23B6","≌":"\u224C","б":"\u0431","„":"\u201E","∵":"\u2235","∵":"\u2235","⦰":"\u29B0","϶":"\u03F6","ℬ":"\u212C","β":"\u03B2","ℶ":"\u2136","≬":"\u226C","𝔟":"\u{1D51F}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","⨀":"\u2A00","⨁":"\u2A01","⨂":"\u2A02","⨆":"\u2A06","★":"\u2605","▽":"\u25BD","△":"\u25B3","⨄":"\u2A04","⋁":"\u22C1","⋀":"\u22C0","⤍":"\u290D","⧫":"\u29EB","▪":"\u25AA","▴":"\u25B4","▾":"\u25BE","◂":"\u25C2","▸":"\u25B8","␣":"\u2423","▒":"\u2592","░":"\u2591","▓":"\u2593","█":"\u2588","=⃥":"=\u20E5","≡⃥":"\u2261\u20E5","⌐":"\u2310","𝕓":"\u{1D553}","⊥":"\u22A5","⊥":"\u22A5","⋈":"\u22C8","╗":"\u2557","╔":"\u2554","╖":"\u2556","╓":"\u2553","═":"\u2550","╦":"\u2566","╩":"\u2569","╤":"\u2564","╧":"\u2567","╝":"\u255D","╚":"\u255A","╜":"\u255C","╙":"\u2559","║":"\u2551","╬":"\u256C","╣":"\u2563","╠":"\u2560","╫":"\u256B","╢":"\u2562","╟":"\u255F","⧉":"\u29C9","╕":"\u2555","╒":"\u2552","┐":"\u2510","┌":"\u250C","─":"\u2500","╥":"\u2565","╨":"\u2568","┬":"\u252C","┴":"\u2534","⊟":"\u229F","⊞":"\u229E","⊠":"\u22A0","╛":"\u255B","╘":"\u2558","┘":"\u2518","└":"\u2514","│":"\u2502","╪":"\u256A","╡":"\u2561","╞":"\u255E","┼":"\u253C","┤":"\u2524","├":"\u251C","‵":"\u2035","˘":"\u02D8","¦":"\xA6","¦":"\xA6","𝒷":"\u{1D4B7}","⁏":"\u204F","∽":"\u223D","⋍":"\u22CD","\":"\\","⧅":"\u29C5","⟈":"\u27C8","•":"\u2022","•":"\u2022","≎":"\u224E","⪮":"\u2AAE","≏":"\u224F","≏":"\u224F","ć":"\u0107","∩":"\u2229","⩄":"\u2A44","⩉":"\u2A49","⩋":"\u2A4B","⩇":"\u2A47","⩀":"\u2A40","∩︀":"\u2229\uFE00","⁁":"\u2041","ˇ":"\u02C7","⩍":"\u2A4D","č":"\u010D","ç":"\xE7","ç":"\xE7","ĉ":"\u0109","⩌":"\u2A4C","⩐":"\u2A50","ċ":"\u010B","¸":"\xB8","¸":"\xB8","⦲":"\u29B2","¢":"\xA2","¢":"\xA2","·":"\xB7","𝔠":"\u{1D520}","ч":"\u0447","✓":"\u2713","✓":"\u2713","χ":"\u03C7","○":"\u25CB","⧃":"\u29C3","ˆ":"\u02C6","≗":"\u2257","↺":"\u21BA","↻":"\u21BB","®":"\xAE","Ⓢ":"\u24C8","⊛":"\u229B","⊚":"\u229A","⊝":"\u229D","≗":"\u2257","⨐":"\u2A10","⫯":"\u2AEF","⧂":"\u29C2","♣":"\u2663","♣":"\u2663",":":":","≔":"\u2254","≔":"\u2254",",":",","@":"@","∁":"\u2201","∘":"\u2218","∁":"\u2201","ℂ":"\u2102","≅":"\u2245","⩭":"\u2A6D","∮":"\u222E","𝕔":"\u{1D554}","∐":"\u2210","©":"\xA9","©":"\xA9","℗":"\u2117","↵":"\u21B5","✗":"\u2717","𝒸":"\u{1D4B8}","⫏":"\u2ACF","⫑":"\u2AD1","⫐":"\u2AD0","⫒":"\u2AD2","⋯":"\u22EF","⤸":"\u2938","⤵":"\u2935","⋞":"\u22DE","⋟":"\u22DF","↶":"\u21B6","⤽":"\u293D","∪":"\u222A","⩈":"\u2A48","⩆":"\u2A46","⩊":"\u2A4A","⊍":"\u228D","⩅":"\u2A45","∪︀":"\u222A\uFE00","↷":"\u21B7","⤼":"\u293C","⋞":"\u22DE","⋟":"\u22DF","⋎":"\u22CE","⋏":"\u22CF","¤":"\xA4","¤":"\xA4","↶":"\u21B6","↷":"\u21B7","⋎":"\u22CE","⋏":"\u22CF","∲":"\u2232","∱":"\u2231","⌭":"\u232D","⇓":"\u21D3","⥥":"\u2965","†":"\u2020","ℸ":"\u2138","↓":"\u2193","‐":"\u2010","⊣":"\u22A3","⤏":"\u290F","˝":"\u02DD","ď":"\u010F","д":"\u0434","ⅆ":"\u2146","‡":"\u2021","⇊":"\u21CA","⩷":"\u2A77","°":"\xB0","°":"\xB0","δ":"\u03B4","⦱":"\u29B1","⥿":"\u297F","𝔡":"\u{1D521}","⇃":"\u21C3","⇂":"\u21C2","⋄":"\u22C4","⋄":"\u22C4","♦":"\u2666","♦":"\u2666","¨":"\xA8","ϝ":"\u03DD","⋲":"\u22F2","÷":"\xF7","÷":"\xF7","÷":"\xF7","⋇":"\u22C7","⋇":"\u22C7","ђ":"\u0452","⌞":"\u231E","⌍":"\u230D","$":"$","𝕕":"\u{1D555}","˙":"\u02D9","≐":"\u2250","≑":"\u2251","∸":"\u2238","∔":"\u2214","⊡":"\u22A1","⌆":"\u2306","↓":"\u2193","⇊":"\u21CA","⇃":"\u21C3","⇂":"\u21C2","⤐":"\u2910","⌟":"\u231F","⌌":"\u230C","𝒹":"\u{1D4B9}","ѕ":"\u0455","⧶":"\u29F6","đ":"\u0111","⋱":"\u22F1","▿":"\u25BF","▾":"\u25BE","⇵":"\u21F5","⥯":"\u296F","⦦":"\u29A6","џ":"\u045F","⟿":"\u27FF","⩷":"\u2A77","≑":"\u2251","é":"\xE9","é":"\xE9","⩮":"\u2A6E","ě":"\u011B","≖":"\u2256","ê":"\xEA","ê":"\xEA","≕":"\u2255","э":"\u044D","ė":"\u0117","ⅇ":"\u2147","≒":"\u2252","𝔢":"\u{1D522}","⪚":"\u2A9A","è":"\xE8","è":"\xE8","⪖":"\u2A96","⪘":"\u2A98","⪙":"\u2A99","⏧":"\u23E7","ℓ":"\u2113","⪕":"\u2A95","⪗":"\u2A97","ē":"\u0113","∅":"\u2205","∅":"\u2205","∅":"\u2205"," ":"\u2004"," ":"\u2005"," ":"\u2003","ŋ":"\u014B"," ":"\u2002","ę":"\u0119","𝕖":"\u{1D556}","⋕":"\u22D5","⧣":"\u29E3","⩱":"\u2A71","ε":"\u03B5","ε":"\u03B5","ϵ":"\u03F5","≖":"\u2256","≕":"\u2255","≂":"\u2242","⪖":"\u2A96","⪕":"\u2A95","=":"=","≟":"\u225F","≡":"\u2261","⩸":"\u2A78","⧥":"\u29E5","≓":"\u2253","⥱":"\u2971","ℯ":"\u212F","≐":"\u2250","≂":"\u2242","η":"\u03B7","ð":"\xF0","ð":"\xF0","ë":"\xEB","ë":"\xEB","€":"\u20AC","!":"!","∃":"\u2203","ℰ":"\u2130","ⅇ":"\u2147","≒":"\u2252","ф":"\u0444","♀":"\u2640","ffi":"\uFB03","ff":"\uFB00","ffl":"\uFB04","𝔣":"\u{1D523}","fi":"\uFB01","fj":"fj","♭":"\u266D","fl":"\uFB02","▱":"\u25B1","ƒ":"\u0192","𝕗":"\u{1D557}","∀":"\u2200","⋔":"\u22D4","⫙":"\u2AD9","⨍":"\u2A0D","½":"\xBD","½":"\xBD","⅓":"\u2153","¼":"\xBC","¼":"\xBC","⅕":"\u2155","⅙":"\u2159","⅛":"\u215B","⅔":"\u2154","⅖":"\u2156","¾":"\xBE","¾":"\xBE","⅗":"\u2157","⅜":"\u215C","⅘":"\u2158","⅚":"\u215A","⅝":"\u215D","⅞":"\u215E","⁄":"\u2044","⌢":"\u2322","𝒻":"\u{1D4BB}","≧":"\u2267","⪌":"\u2A8C","ǵ":"\u01F5","γ":"\u03B3","ϝ":"\u03DD","⪆":"\u2A86","ğ":"\u011F","ĝ":"\u011D","г":"\u0433","ġ":"\u0121","≥":"\u2265","⋛":"\u22DB","≥":"\u2265","≧":"\u2267","⩾":"\u2A7E","⩾":"\u2A7E","⪩":"\u2AA9","⪀":"\u2A80","⪂":"\u2A82","⪄":"\u2A84","⋛︀":"\u22DB\uFE00","⪔":"\u2A94","𝔤":"\u{1D524}","≫":"\u226B","⋙":"\u22D9","ℷ":"\u2137","ѓ":"\u0453","≷":"\u2277","⪒":"\u2A92","⪥":"\u2AA5","⪤":"\u2AA4","≩":"\u2269","⪊":"\u2A8A","⪊":"\u2A8A","⪈":"\u2A88","⪈":"\u2A88","≩":"\u2269","⋧":"\u22E7","𝕘":"\u{1D558}","`":"`","ℊ":"\u210A","≳":"\u2273","⪎":"\u2A8E","⪐":"\u2A90",">":">",">":">","⪧":"\u2AA7","⩺":"\u2A7A","⋗":"\u22D7","⦕":"\u2995","⩼":"\u2A7C","⪆":"\u2A86","⥸":"\u2978","⋗":"\u22D7","⋛":"\u22DB","⪌":"\u2A8C","≷":"\u2277","≳":"\u2273","≩︀":"\u2269\uFE00","≩︀":"\u2269\uFE00","⇔":"\u21D4"," ":"\u200A","½":"\xBD","ℋ":"\u210B","ъ":"\u044A","↔":"\u2194","⥈":"\u2948","↭":"\u21AD","ℏ":"\u210F","ĥ":"\u0125","♥":"\u2665","♥":"\u2665","…":"\u2026","⊹":"\u22B9","𝔥":"\u{1D525}","⤥":"\u2925","⤦":"\u2926","⇿":"\u21FF","∻":"\u223B","↩":"\u21A9","↪":"\u21AA","𝕙":"\u{1D559}","―":"\u2015","𝒽":"\u{1D4BD}","ℏ":"\u210F","ħ":"\u0127","⁃":"\u2043","‐":"\u2010","í":"\xED","í":"\xED","⁣":"\u2063","î":"\xEE","î":"\xEE","и":"\u0438","е":"\u0435","¡":"\xA1","¡":"\xA1","⇔":"\u21D4","𝔦":"\u{1D526}","ì":"\xEC","ì":"\xEC","ⅈ":"\u2148","⨌":"\u2A0C","∭":"\u222D","⧜":"\u29DC","℩":"\u2129","ij":"\u0133","ī":"\u012B","ℑ":"\u2111","ℐ":"\u2110","ℑ":"\u2111","ı":"\u0131","⊷":"\u22B7","Ƶ":"\u01B5","∈":"\u2208","℅":"\u2105","∞":"\u221E","⧝":"\u29DD","ı":"\u0131","∫":"\u222B","⊺":"\u22BA","ℤ":"\u2124","⊺":"\u22BA","⨗":"\u2A17","⨼":"\u2A3C","ё":"\u0451","į":"\u012F","𝕚":"\u{1D55A}","ι":"\u03B9","⨼":"\u2A3C","¿":"\xBF","¿":"\xBF","𝒾":"\u{1D4BE}","∈":"\u2208","⋹":"\u22F9","⋵":"\u22F5","⋴":"\u22F4","⋳":"\u22F3","∈":"\u2208","⁢":"\u2062","ĩ":"\u0129","і":"\u0456","ï":"\xEF","ï":"\xEF","ĵ":"\u0135","й":"\u0439","𝔧":"\u{1D527}","ȷ":"\u0237","𝕛":"\u{1D55B}","𝒿":"\u{1D4BF}","ј":"\u0458","є":"\u0454","κ":"\u03BA","ϰ":"\u03F0","ķ":"\u0137","к":"\u043A","𝔨":"\u{1D528}","ĸ":"\u0138","х":"\u0445","ќ":"\u045C","𝕜":"\u{1D55C}","𝓀":"\u{1D4C0}","⇚":"\u21DA","⇐":"\u21D0","⤛":"\u291B","⤎":"\u290E","≦":"\u2266","⪋":"\u2A8B","⥢":"\u2962","ĺ":"\u013A","⦴":"\u29B4","ℒ":"\u2112","λ":"\u03BB","⟨":"\u27E8","⦑":"\u2991","⟨":"\u27E8","⪅":"\u2A85","«":"\xAB","«":"\xAB","←":"\u2190","⇤":"\u21E4","⤟":"\u291F","⤝":"\u291D","↩":"\u21A9","↫":"\u21AB","⤹":"\u2939","⥳":"\u2973","↢":"\u21A2","⪫":"\u2AAB","⤙":"\u2919","⪭":"\u2AAD","⪭︀":"\u2AAD\uFE00","⤌":"\u290C","❲":"\u2772","{":"{","[":"[","⦋":"\u298B","⦏":"\u298F","⦍":"\u298D","ľ":"\u013E","ļ":"\u013C","⌈":"\u2308","{":"{","л":"\u043B","⤶":"\u2936","“":"\u201C","„":"\u201E","⥧":"\u2967","⥋":"\u294B","↲":"\u21B2","≤":"\u2264","←":"\u2190","↢":"\u21A2","↽":"\u21BD","↼":"\u21BC","⇇":"\u21C7","↔":"\u2194","⇆":"\u21C6","⇋":"\u21CB","↭":"\u21AD","⋋":"\u22CB","⋚":"\u22DA","≤":"\u2264","≦":"\u2266","⩽":"\u2A7D","⩽":"\u2A7D","⪨":"\u2AA8","⩿":"\u2A7F","⪁":"\u2A81","⪃":"\u2A83","⋚︀":"\u22DA\uFE00","⪓":"\u2A93","⪅":"\u2A85","⋖":"\u22D6","⋚":"\u22DA","⪋":"\u2A8B","≶":"\u2276","≲":"\u2272","⥼":"\u297C","⌊":"\u230A","𝔩":"\u{1D529}","≶":"\u2276","⪑":"\u2A91","↽":"\u21BD","↼":"\u21BC","⥪":"\u296A","▄":"\u2584","љ":"\u0459","≪":"\u226A","⇇":"\u21C7","⌞":"\u231E","⥫":"\u296B","◺":"\u25FA","ŀ":"\u0140","⎰":"\u23B0","⎰":"\u23B0","≨":"\u2268","⪉":"\u2A89","⪉":"\u2A89","⪇":"\u2A87","⪇":"\u2A87","≨":"\u2268","⋦":"\u22E6","⟬":"\u27EC","⇽":"\u21FD","⟦":"\u27E6","⟵":"\u27F5","⟷":"\u27F7","⟼":"\u27FC","⟶":"\u27F6","↫":"\u21AB","↬":"\u21AC","⦅":"\u2985","𝕝":"\u{1D55D}","⨭":"\u2A2D","⨴":"\u2A34","∗":"\u2217","_":"_","◊":"\u25CA","◊":"\u25CA","⧫":"\u29EB","(":"(","⦓":"\u2993","⇆":"\u21C6","⌟":"\u231F","⇋":"\u21CB","⥭":"\u296D","‎":"\u200E","⊿":"\u22BF","‹":"\u2039","𝓁":"\u{1D4C1}","↰":"\u21B0","≲":"\u2272","⪍":"\u2A8D","⪏":"\u2A8F","[":"[","‘":"\u2018","‚":"\u201A","ł":"\u0142","<":"<","<":"<","⪦":"\u2AA6","⩹":"\u2A79","⋖":"\u22D6","⋋":"\u22CB","⋉":"\u22C9","⥶":"\u2976","⩻":"\u2A7B","⦖":"\u2996","◃":"\u25C3","⊴":"\u22B4","◂":"\u25C2","⥊":"\u294A","⥦":"\u2966","≨︀":"\u2268\uFE00","≨︀":"\u2268\uFE00","∺":"\u223A","¯":"\xAF","¯":"\xAF","♂":"\u2642","✠":"\u2720","✠":"\u2720","↦":"\u21A6","↦":"\u21A6","↧":"\u21A7","↤":"\u21A4","↥":"\u21A5","▮":"\u25AE","⨩":"\u2A29","м":"\u043C","—":"\u2014","∡":"\u2221","𝔪":"\u{1D52A}","℧":"\u2127","µ":"\xB5","µ":"\xB5","∣":"\u2223","*":"*","⫰":"\u2AF0","·":"\xB7","·":"\xB7","−":"\u2212","⊟":"\u229F","∸":"\u2238","⨪":"\u2A2A","⫛":"\u2ADB","…":"\u2026","∓":"\u2213","⊧":"\u22A7","𝕞":"\u{1D55E}","∓":"\u2213","𝓂":"\u{1D4C2}","∾":"\u223E","μ":"\u03BC","⊸":"\u22B8","⊸":"\u22B8","⋙̸":"\u22D9\u0338","≫⃒":"\u226B\u20D2","≫̸":"\u226B\u0338","⇍":"\u21CD","⇎":"\u21CE","⋘̸":"\u22D8\u0338","≪⃒":"\u226A\u20D2","≪̸":"\u226A\u0338","⇏":"\u21CF","⊯":"\u22AF","⊮":"\u22AE","∇":"\u2207","ń":"\u0144","∠⃒":"\u2220\u20D2","≉":"\u2249","⩰̸":"\u2A70\u0338","≋̸":"\u224B\u0338","ʼn":"\u0149","≉":"\u2249","♮":"\u266E","♮":"\u266E","ℕ":"\u2115"," ":"\xA0"," ":"\xA0","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⩃":"\u2A43","ň":"\u0148","ņ":"\u0146","≇":"\u2247","⩭̸":"\u2A6D\u0338","⩂":"\u2A42","н":"\u043D","–":"\u2013","≠":"\u2260","⇗":"\u21D7","⤤":"\u2924","↗":"\u2197","↗":"\u2197","≐̸":"\u2250\u0338","≢":"\u2262","⤨":"\u2928","≂̸":"\u2242\u0338","∄":"\u2204","∄":"\u2204","𝔫":"\u{1D52B}","≧̸":"\u2267\u0338","≱":"\u2271","≱":"\u2271","≧̸":"\u2267\u0338","⩾̸":"\u2A7E\u0338","⩾̸":"\u2A7E\u0338","≵":"\u2275","≯":"\u226F","≯":"\u226F","⇎":"\u21CE","↮":"\u21AE","⫲":"\u2AF2","∋":"\u220B","⋼":"\u22FC","⋺":"\u22FA","∋":"\u220B","њ":"\u045A","⇍":"\u21CD","≦̸":"\u2266\u0338","↚":"\u219A","‥":"\u2025","≰":"\u2270","↚":"\u219A","↮":"\u21AE","≰":"\u2270","≦̸":"\u2266\u0338","⩽̸":"\u2A7D\u0338","⩽̸":"\u2A7D\u0338","≮":"\u226E","≴":"\u2274","≮":"\u226E","⋪":"\u22EA","⋬":"\u22EC","∤":"\u2224","𝕟":"\u{1D55F}","¬":"\xAC","¬":"\xAC","∉":"\u2209","⋹̸":"\u22F9\u0338","⋵̸":"\u22F5\u0338","∉":"\u2209","⋷":"\u22F7","⋶":"\u22F6","∌":"\u220C","∌":"\u220C","⋾":"\u22FE","⋽":"\u22FD","∦":"\u2226","∦":"\u2226","⫽⃥":"\u2AFD\u20E5","∂̸":"\u2202\u0338","⨔":"\u2A14","⊀":"\u2280","⋠":"\u22E0","⪯̸":"\u2AAF\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⇏":"\u21CF","↛":"\u219B","⤳̸":"\u2933\u0338","↝̸":"\u219D\u0338","↛":"\u219B","⋫":"\u22EB","⋭":"\u22ED","⊁":"\u2281","⋡":"\u22E1","⪰̸":"\u2AB0\u0338","𝓃":"\u{1D4C3}","∤":"\u2224","∦":"\u2226","≁":"\u2241","≄":"\u2244","≄":"\u2244","∤":"\u2224","∦":"\u2226","⋢":"\u22E2","⋣":"\u22E3","⊄":"\u2284","⫅̸":"\u2AC5\u0338","⊈":"\u2288","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⫅̸":"\u2AC5\u0338","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⊅":"\u2285","⫆̸":"\u2AC6\u0338","⊉":"\u2289","⊃⃒":"\u2283\u20D2","⊉":"\u2289","⫆̸":"\u2AC6\u0338","≹":"\u2279","ñ":"\xF1","ñ":"\xF1","≸":"\u2278","⋪":"\u22EA","⋬":"\u22EC","⋫":"\u22EB","⋭":"\u22ED","ν":"\u03BD","#":"#","№":"\u2116"," ":"\u2007","⊭":"\u22AD","⤄":"\u2904","≍⃒":"\u224D\u20D2","⊬":"\u22AC","≥⃒":"\u2265\u20D2",">⃒":">\u20D2","⧞":"\u29DE","⤂":"\u2902","≤⃒":"\u2264\u20D2","<⃒":"<\u20D2","⊴⃒":"\u22B4\u20D2","⤃":"\u2903","⊵⃒":"\u22B5\u20D2","∼⃒":"\u223C\u20D2","⇖":"\u21D6","⤣":"\u2923","↖":"\u2196","↖":"\u2196","⤧":"\u2927","Ⓢ":"\u24C8","ó":"\xF3","ó":"\xF3","⊛":"\u229B","⊚":"\u229A","ô":"\xF4","ô":"\xF4","о":"\u043E","⊝":"\u229D","ő":"\u0151","⨸":"\u2A38","⊙":"\u2299","⦼":"\u29BC","œ":"\u0153","⦿":"\u29BF","𝔬":"\u{1D52C}","˛":"\u02DB","ò":"\xF2","ò":"\xF2","⧁":"\u29C1","⦵":"\u29B5","Ω":"\u03A9","∮":"\u222E","↺":"\u21BA","⦾":"\u29BE","⦻":"\u29BB","‾":"\u203E","⧀":"\u29C0","ō":"\u014D","ω":"\u03C9","ο":"\u03BF","⦶":"\u29B6","⊖":"\u2296","𝕠":"\u{1D560}","⦷":"\u29B7","⦹":"\u29B9","⊕":"\u2295","∨":"\u2228","↻":"\u21BB","⩝":"\u2A5D","ℴ":"\u2134","ℴ":"\u2134","ª":"\xAA","ª":"\xAA","º":"\xBA","º":"\xBA","⊶":"\u22B6","⩖":"\u2A56","⩗":"\u2A57","⩛":"\u2A5B","ℴ":"\u2134","ø":"\xF8","ø":"\xF8","⊘":"\u2298","õ":"\xF5","õ":"\xF5","⊗":"\u2297","⨶":"\u2A36","ö":"\xF6","ö":"\xF6","⌽":"\u233D","∥":"\u2225","¶":"\xB6","¶":"\xB6","∥":"\u2225","⫳":"\u2AF3","⫽":"\u2AFD","∂":"\u2202","п":"\u043F","%":"%",".":".","‰":"\u2030","⊥":"\u22A5","‱":"\u2031","𝔭":"\u{1D52D}","φ":"\u03C6","ϕ":"\u03D5","ℳ":"\u2133","☎":"\u260E","π":"\u03C0","⋔":"\u22D4","ϖ":"\u03D6","ℏ":"\u210F","ℎ":"\u210E","ℏ":"\u210F","+":"+","⨣":"\u2A23","⊞":"\u229E","⨢":"\u2A22","∔":"\u2214","⨥":"\u2A25","⩲":"\u2A72","±":"\xB1","±":"\xB1","⨦":"\u2A26","⨧":"\u2A27","±":"\xB1","⨕":"\u2A15","𝕡":"\u{1D561}","£":"\xA3","£":"\xA3","≺":"\u227A","⪳":"\u2AB3","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","≺":"\u227A","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","⪹":"\u2AB9","⪵":"\u2AB5","⋨":"\u22E8","≾":"\u227E","′":"\u2032","ℙ":"\u2119","⪵":"\u2AB5","⪹":"\u2AB9","⋨":"\u22E8","∏":"\u220F","⌮":"\u232E","⌒":"\u2312","⌓":"\u2313","∝":"\u221D","∝":"\u221D","≾":"\u227E","⊰":"\u22B0","𝓅":"\u{1D4C5}","ψ":"\u03C8"," ":"\u2008","𝔮":"\u{1D52E}","⨌":"\u2A0C","𝕢":"\u{1D562}","⁗":"\u2057","𝓆":"\u{1D4C6}","ℍ":"\u210D","⨖":"\u2A16","?":"?","≟":"\u225F",""":'"',""":'"',"⇛":"\u21DB","⇒":"\u21D2","⤜":"\u291C","⤏":"\u290F","⥤":"\u2964","∽̱":"\u223D\u0331","ŕ":"\u0155","√":"\u221A","⦳":"\u29B3","⟩":"\u27E9","⦒":"\u2992","⦥":"\u29A5","⟩":"\u27E9","»":"\xBB","»":"\xBB","→":"\u2192","⥵":"\u2975","⇥":"\u21E5","⤠":"\u2920","⤳":"\u2933","⤞":"\u291E","↪":"\u21AA","↬":"\u21AC","⥅":"\u2945","⥴":"\u2974","↣":"\u21A3","↝":"\u219D","⤚":"\u291A","∶":"\u2236","ℚ":"\u211A","⤍":"\u290D","❳":"\u2773","}":"}","]":"]","⦌":"\u298C","⦎":"\u298E","⦐":"\u2990","ř":"\u0159","ŗ":"\u0157","⌉":"\u2309","}":"}","р":"\u0440","⤷":"\u2937","⥩":"\u2969","”":"\u201D","”":"\u201D","↳":"\u21B3","ℜ":"\u211C","ℛ":"\u211B","ℜ":"\u211C","ℝ":"\u211D","▭":"\u25AD","®":"\xAE","®":"\xAE","⥽":"\u297D","⌋":"\u230B","𝔯":"\u{1D52F}","⇁":"\u21C1","⇀":"\u21C0","⥬":"\u296C","ρ":"\u03C1","ϱ":"\u03F1","→":"\u2192","↣":"\u21A3","⇁":"\u21C1","⇀":"\u21C0","⇄":"\u21C4","⇌":"\u21CC","⇉":"\u21C9","↝":"\u219D","⋌":"\u22CC","˚":"\u02DA","≓":"\u2253","⇄":"\u21C4","⇌":"\u21CC","‏":"\u200F","⎱":"\u23B1","⎱":"\u23B1","⫮":"\u2AEE","⟭":"\u27ED","⇾":"\u21FE","⟧":"\u27E7","⦆":"\u2986","𝕣":"\u{1D563}","⨮":"\u2A2E","⨵":"\u2A35",")":")","⦔":"\u2994","⨒":"\u2A12","⇉":"\u21C9","›":"\u203A","𝓇":"\u{1D4C7}","↱":"\u21B1","]":"]","’":"\u2019","’":"\u2019","⋌":"\u22CC","⋊":"\u22CA","▹":"\u25B9","⊵":"\u22B5","▸":"\u25B8","⧎":"\u29CE","⥨":"\u2968","℞":"\u211E","ś":"\u015B","‚":"\u201A","≻":"\u227B","⪴":"\u2AB4","⪸":"\u2AB8","š":"\u0161","≽":"\u227D","⪰":"\u2AB0","ş":"\u015F","ŝ":"\u015D","⪶":"\u2AB6","⪺":"\u2ABA","⋩":"\u22E9","⨓":"\u2A13","≿":"\u227F","с":"\u0441","⋅":"\u22C5","⊡":"\u22A1","⩦":"\u2A66","⇘":"\u21D8","⤥":"\u2925","↘":"\u2198","↘":"\u2198","§":"\xA7","§":"\xA7",";":";","⤩":"\u2929","∖":"\u2216","∖":"\u2216","✶":"\u2736","𝔰":"\u{1D530}","⌢":"\u2322","♯":"\u266F","щ":"\u0449","ш":"\u0448","∣":"\u2223","∥":"\u2225","­":"\xAD","­":"\xAD","σ":"\u03C3","ς":"\u03C2","ς":"\u03C2","∼":"\u223C","⩪":"\u2A6A","≃":"\u2243","≃":"\u2243","⪞":"\u2A9E","⪠":"\u2AA0","⪝":"\u2A9D","⪟":"\u2A9F","≆":"\u2246","⨤":"\u2A24","⥲":"\u2972","←":"\u2190","∖":"\u2216","⨳":"\u2A33","⧤":"\u29E4","∣":"\u2223","⌣":"\u2323","⪪":"\u2AAA","⪬":"\u2AAC","⪬︀":"\u2AAC\uFE00","ь":"\u044C","/":"/","⧄":"\u29C4","⌿":"\u233F","𝕤":"\u{1D564}","♠":"\u2660","♠":"\u2660","∥":"\u2225","⊓":"\u2293","⊓︀":"\u2293\uFE00","⊔":"\u2294","⊔︀":"\u2294\uFE00","⊏":"\u228F","⊑":"\u2291","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊐":"\u2290","⊒":"\u2292","□":"\u25A1","□":"\u25A1","▪":"\u25AA","▪":"\u25AA","→":"\u2192","𝓈":"\u{1D4C8}","∖":"\u2216","⌣":"\u2323","⋆":"\u22C6","☆":"\u2606","★":"\u2605","ϵ":"\u03F5","ϕ":"\u03D5","¯":"\xAF","⊂":"\u2282","⫅":"\u2AC5","⪽":"\u2ABD","⊆":"\u2286","⫃":"\u2AC3","⫁":"\u2AC1","⫋":"\u2ACB","⊊":"\u228A","⪿":"\u2ABF","⥹":"\u2979","⊂":"\u2282","⊆":"\u2286","⫅":"\u2AC5","⊊":"\u228A","⫋":"\u2ACB","⫇":"\u2AC7","⫕":"\u2AD5","⫓":"\u2AD3","≻":"\u227B","⪸":"\u2AB8","≽":"\u227D","⪰":"\u2AB0","⪺":"\u2ABA","⪶":"\u2AB6","⋩":"\u22E9","≿":"\u227F","∑":"\u2211","♪":"\u266A","¹":"\xB9","¹":"\xB9","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","⊃":"\u2283","⫆":"\u2AC6","⪾":"\u2ABE","⫘":"\u2AD8","⊇":"\u2287","⫄":"\u2AC4","⟉":"\u27C9","⫗":"\u2AD7","⥻":"\u297B","⫂":"\u2AC2","⫌":"\u2ACC","⊋":"\u228B","⫀":"\u2AC0","⊃":"\u2283","⊇":"\u2287","⫆":"\u2AC6","⊋":"\u228B","⫌":"\u2ACC","⫈":"\u2AC8","⫔":"\u2AD4","⫖":"\u2AD6","⇙":"\u21D9","⤦":"\u2926","↙":"\u2199","↙":"\u2199","⤪":"\u292A","ß":"\xDF","ß":"\xDF","⌖":"\u2316","τ":"\u03C4","⎴":"\u23B4","ť":"\u0165","ţ":"\u0163","т":"\u0442","⃛":"\u20DB","⌕":"\u2315","𝔱":"\u{1D531}","∴":"\u2234","∴":"\u2234","θ":"\u03B8","ϑ":"\u03D1","ϑ":"\u03D1","≈":"\u2248","∼":"\u223C"," ":"\u2009","≈":"\u2248","∼":"\u223C","þ":"\xFE","þ":"\xFE","˜":"\u02DC","×":"\xD7","×":"\xD7","⊠":"\u22A0","⨱":"\u2A31","⨰":"\u2A30","∭":"\u222D","⤨":"\u2928","⊤":"\u22A4","⌶":"\u2336","⫱":"\u2AF1","𝕥":"\u{1D565}","⫚":"\u2ADA","⤩":"\u2929","‴":"\u2034","™":"\u2122","▵":"\u25B5","▿":"\u25BF","◃":"\u25C3","⊴":"\u22B4","≜":"\u225C","▹":"\u25B9","⊵":"\u22B5","◬":"\u25EC","≜":"\u225C","⨺":"\u2A3A","⨹":"\u2A39","⧍":"\u29CD","⨻":"\u2A3B","⏢":"\u23E2","𝓉":"\u{1D4C9}","ц":"\u0446","ћ":"\u045B","ŧ":"\u0167","≬":"\u226C","↞":"\u219E","↠":"\u21A0","⇑":"\u21D1","⥣":"\u2963","ú":"\xFA","ú":"\xFA","↑":"\u2191","ў":"\u045E","ŭ":"\u016D","û":"\xFB","û":"\xFB","у":"\u0443","⇅":"\u21C5","ű":"\u0171","⥮":"\u296E","⥾":"\u297E","𝔲":"\u{1D532}","ù":"\xF9","ù":"\xF9","↿":"\u21BF","↾":"\u21BE","▀":"\u2580","⌜":"\u231C","⌜":"\u231C","⌏":"\u230F","◸":"\u25F8","ū":"\u016B","¨":"\xA8","¨":"\xA8","ų":"\u0173","𝕦":"\u{1D566}","↑":"\u2191","↕":"\u2195","↿":"\u21BF","↾":"\u21BE","⊎":"\u228E","υ":"\u03C5","ϒ":"\u03D2","υ":"\u03C5","⇈":"\u21C8","⌝":"\u231D","⌝":"\u231D","⌎":"\u230E","ů":"\u016F","◹":"\u25F9","𝓊":"\u{1D4CA}","⋰":"\u22F0","ũ":"\u0169","▵":"\u25B5","▴":"\u25B4","⇈":"\u21C8","ü":"\xFC","ü":"\xFC","⦧":"\u29A7","⇕":"\u21D5","⫨":"\u2AE8","⫩":"\u2AE9","⊨":"\u22A8","⦜":"\u299C","ϵ":"\u03F5","ϰ":"\u03F0","∅":"\u2205","ϕ":"\u03D5","ϖ":"\u03D6","∝":"\u221D","↕":"\u2195","ϱ":"\u03F1","ς":"\u03C2","⊊︀":"\u228A\uFE00","⫋︀":"\u2ACB\uFE00","⊋︀":"\u228B\uFE00","⫌︀":"\u2ACC\uFE00","ϑ":"\u03D1","⊲":"\u22B2","⊳":"\u22B3","в":"\u0432","⊢":"\u22A2","∨":"\u2228","⊻":"\u22BB","≚":"\u225A","⋮":"\u22EE","|":"|","|":"|","𝔳":"\u{1D533}","⊲":"\u22B2","⊂⃒":"\u2282\u20D2","⊃⃒":"\u2283\u20D2","𝕧":"\u{1D567}","∝":"\u221D","⊳":"\u22B3","𝓋":"\u{1D4CB}","⫋︀":"\u2ACB\uFE00","⊊︀":"\u228A\uFE00","⫌︀":"\u2ACC\uFE00","⊋︀":"\u228B\uFE00","⦚":"\u299A","ŵ":"\u0175","⩟":"\u2A5F","∧":"\u2227","≙":"\u2259","℘":"\u2118","𝔴":"\u{1D534}","𝕨":"\u{1D568}","℘":"\u2118","≀":"\u2240","≀":"\u2240","𝓌":"\u{1D4CC}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","▽":"\u25BD","𝔵":"\u{1D535}","⟺":"\u27FA","⟷":"\u27F7","ξ":"\u03BE","⟸":"\u27F8","⟵":"\u27F5","⟼":"\u27FC","⋻":"\u22FB","⨀":"\u2A00","𝕩":"\u{1D569}","⨁":"\u2A01","⨂":"\u2A02","⟹":"\u27F9","⟶":"\u27F6","𝓍":"\u{1D4CD}","⨆":"\u2A06","⨄":"\u2A04","△":"\u25B3","⋁":"\u22C1","⋀":"\u22C0","ý":"\xFD","ý":"\xFD","я":"\u044F","ŷ":"\u0177","ы":"\u044B","¥":"\xA5","¥":"\xA5","𝔶":"\u{1D536}","ї":"\u0457","𝕪":"\u{1D56A}","𝓎":"\u{1D4CE}","ю":"\u044E","ÿ":"\xFF","ÿ":"\xFF","ź":"\u017A","ž":"\u017E","з":"\u0437","ż":"\u017C","ℨ":"\u2128","ζ":"\u03B6","𝔷":"\u{1D537}","ж":"\u0436","⇝":"\u21DD","𝕫":"\u{1D56B}","𝓏":"\u{1D4CF}","‍":"\u200D","‌":"\u200C"},Ai=Yh;function Xh(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof Ai[e]=="string")return Ai[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let s;t.charAt(1)==="x"?s=parseInt(t.substr(2),16):s=parseInt(t.substr(1),10);var n="";return s>=55296&&s<=57343||s>1114111?"\uFFFD":(s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),n)})}o(Xh,"decodeHTMLEntities");function er(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}o(er,"escapeHtml");function Mo(r){return"
"+er(r).replace(/\n/g,"
")+"
"}o(Mo,"textToHtml");function $o(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/]*>/gi,` +`).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,` + +`).replace(/]*>.*?<\/script\b[^>]*>/gi," ").replace(/^.*]*>/i,"").replace(/^.*<\/head\b[^>]*>/i,"").replace(/^.*<\!doctype\b[^>]*>/i,"").replace(/<\/body\b[^>]*>.*$/i,"").replace(/<\/html\b[^>]*>.*$/i,"").replace(/]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi," ($1) ").replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,"").replace(/]*>[\n\u0001\s]*/gi,"* ").replace(/]*>/g,` +------------- +`).replace(/<[^>]*>/g," ").replace(/\u0001/g,` +`).replace(/[ \t]+/g," ").replace(/^\s+$/gm,"").replace(/\n\n+/g,` + +`).replace(/^\n+/,` +`).replace(/\n+$/,` +`),r=Xh(r),r}o($o,"htmlToText");function Lo(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}o(Lo,"formatTextAddress");function Di(r){let e=[],t=o((s,n)=>{if(n&&e.push(", "),s.group){let i=`${s.name}:`,a=";";e.push(i),s.group.forEach(t),e.push(a)}else e.push(Lo(s))},"processAddress");return r.forEach(t),e.join("")}o(Di,"formatTextAddresses");function Po(r){return``}o(Po,"formatHtmlAddress");function _i(r){let e=[],t=o((s,n)=>{if(n&&e.push(''),s.group){let i=``,a='';e.push(i),s.group.forEach(t),e.push(a)}else e.push(Po(s))},"processAddress");return r.forEach(t),e.join(" ")}o(_i,"formatHtmlAddresses");function Zh(r,e,t){r=(r||"").toString(),e=e||76;let s=0,n=r.length,i="",a,u;for(;s"u"?r.date:new Intl.DateTimeFormat("default",a).format(new Date(r.date));e.push({key:"Date",val:u})}r.to&&r.to.length&&e.push({key:"To",val:Di(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:Di(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:Di(r.bcc)});let t=e.map(a=>a.key.length).reduce((a,u)=>u>a?u:a,0);e=e.flatMap(a=>{let u=t-a.key.length,l=`${a.key}: ${" ".repeat(u)}`,c=`${" ".repeat(a.key.length+1)} ${" ".repeat(u)}`;return Zh(a.val,80,!0).split(/\r?\n/).map(m=>m.trim()).map((m,x)=>`${x?c:l}${m}`)});let s=e.map(a=>a.length).reduce((a,u)=>u>a?u:a,0),n="-".repeat(s);return` +${n} +${e.join(` +`)} +${n} +`}o(Ei,"formatTextHeader");function Ci(r){let e=[];if(r.from&&e.push(``),r.subject&&e.push(``),r.date){let s={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},n=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",s).format(new Date(r.date));e.push(``)}return r.to&&r.to.length&&e.push(``),r.cc&&r.cc.length&&e.push(``),r.bcc&&r.bcc.length&&e.push(``),``}o(Ci,"formatHtmlHeader");function ep(r){let e=!1,t="text",s,n=[],i={address:[],comment:[],group:[],text:[],textWasQuoted:[]},a,u,l=!1;for(a=0,u=r.length;a{m.group?c=c.concat(m.group):c.push(m)}),n.push({name:Xt(i.text||s&&s.name),group:c})}else{if(!i.address.length&&i.text.length){for(a=i.text.length-1;a>=0;a--)if(!i.textWasQuoted[a]&&i.text[a].match(/^[^@\s]+@[^@\s]+$/)){i.address=i.text.splice(a,1),i.textWasQuoted.splice(a,1);break}let c=o(function(d){return i.address.length?d:(i.address=[d.trim()]," ")},"_regexHandler");if(!i.address.length)for(a=i.text.length-1;a>=0&&!(!i.textWasQuoted[a]&&(i.text[a]=i.text[a].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),i.address.length));a--);}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),i.address.length>1&&(i.text=i.text.concat(i.address.splice(1))),i.text=i.text.join(" "),i.address=i.address.join(" "),!i.address&&/^=\?[^=]+?=$/.test(i.text.trim())){let c=Ti(Xt(i.text));if(c&&c.length)return c}if(!i.address&&e)return[];s={address:i.address||i.text||"",name:Xt(i.text||i.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),n.push(s)}return n}o(ep,"_handleAddress");var Tn=class{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let t=0,s=this.str.length;t{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},t&&![" "," ","\r",` +`,",",";"].includes(t)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&e in this.operators){this.node={type:"operator",value:e},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[e],this.escaped=!1;return}else if(['"',"'"].includes(this.operatorExpecting)&&e==="\\"){this.escaped=!0;return}}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),e===` +`&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}};o(Tn,"Tokenizer");function Ti(r,e){e=e||{};let s=new Tn(r).tokenize(),n=[],i=[],a=[];if(s.forEach(u=>{u.type==="operator"&&(u.value===","||u.value===";")?(i.length&&n.push(i),i=[]):i.push(u)}),i.length&&n.push(i),n.forEach(u=>{u=ep(u),u.length&&(a=a.concat(u))}),e.flatten){let u=[],l=o(c=>{c.forEach(d=>{if(d.group)return l(d.group);u.push(d)})},"walkAddressList");return l(a),u}return a}o(Ti,"addressParser");var Sn=Ti;function zo(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(r),n=s.byteLength,i=n%3,a=n-i,u,l,c,d,m,x=0;x>18,l=(m&258048)>>12,c=(m&4032)>>6,d=m&63,e+=t[u]+t[l]+t[c]+t[d];return i==1?(m=s[a],u=(m&252)>>2,l=(m&3)<<4,e+=t[u]+t[l]+"=="):i==2&&(m=s[a]<<8|s[a+1],u=(m&64512)>>10,l=(m&1008)>>4,c=(m&15)<<2,e+=t[u]+t[l]+t[c]+"="),e}o(zo,"base64ArrayBuffer");var tp=256,rp=2*1024*1024,tt=class{static parse(e,t){return new tt(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||tp,maxHeadersSize:this.options.maxHeadersSize||rp},this.root=this.currentNode=new Zt({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let s=this.boundaries;if(s.length&&e.length>2&&e[0]===45&&e[1]===45)for(let n=s.length-1;n>=0;n--){let i=s[n];if(e.length!==i.value.length+2&&e.length!==i.value.length+4)continue;let a=e.length===i.value.length+4;if(a&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let u=!0;for(let l=0;l({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length}),"res");for(;this.readPos{if(u=u||!1,l=l||!1,a.contentType.multipart)a.contentType.multipart==="alternative"?u=a:a.contentType.multipart==="related"&&(l=a);else if(this.isInlineMessageRfc822(a)&&!n){let c=new tt;a.subMessage=await c.parse(a.content),s.has(a)||s.set(a,{});let d=s.get(a);(a.subMessage.text||!a.subMessage.html)&&(d.plain=d.plain||[],d.plain.push({type:"subMessage",value:a.subMessage}),t.add("plain")),a.subMessage.html&&(d.html=d.html||[],d.html.push({type:"subMessage",value:a.subMessage}),t.add("html")),c.textMap&&c.textMap.forEach((m,x)=>{s.set(x,m)});for(let m of a.subMessage.attachments||[])this.attachments.push(m)}else if(this.isInlineTextNode(a)){let c=a.contentType.parsed.value.substr(a.contentType.parsed.value.indexOf("/")+1),d=u||a;s.has(d)||s.set(d,{});let m=s.get(d);m[c]=m[c]||[],m[c].push({type:"text",value:a.getTextContent()}),t.add(c)}else if(a.content){let c=a.contentDisposition.parsed.params.filename||a.contentType.parsed.params.name||null,d={filename:c?Xt(c):null,mimeType:a.contentType.parsed.value,disposition:a.contentDisposition.parsed.value||null};switch(l&&a.contentId&&(d.related=!0),a.contentDescription&&(d.description=a.contentDescription),a.contentId&&(d.contentId=a.contentId),a.contentType.parsed.value){case"text/calendar":case"application/ics":{a.contentType.parsed.params.method&&(d.method=a.contentType.parsed.params.method.toString().toUpperCase().trim());let m=a.getTextContent().replace(/\r?\n/g,` +`).replace(/\n*$/,` +`);d.content=At.encode(m);break}default:d.content=a.content}this.attachments.push(d)}for(let c of a.childNodes)await i(c,u,l)},"walk");await i(this.root,!1,[]),s.forEach(a=>{t.forEach(u=>{if(e[u]||(e[u]=[]),a[u])a[u].forEach(l=>{switch(l.type){case"text":e[u].push(l.value);break;case"subMessage":switch(u){case"html":e[u].push(Ci(l.value));break;case"plain":e[u].push(Ei(l.value));break}break}});else{let l;switch(u){case"html":l="plain";break;case"plain":l="html";break}(a[l]||[]).forEach(c=>{switch(c.type){case"text":switch(u){case"html":e[u].push(Mo(c.value));break;case"plain":e[u].push($o(c.value));break}break;case"subMessage":switch(u){case"html":e[u].push(Ci(c.value));break;case"plain":e[u].push(Ei(c.value));break}break}})}})}),Object.keys(e).forEach(a=>{e[a]=e[a].join(` +`)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=o(s=>{s.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(s.contentType.parsed.value)&&(e=!0);for(let n of s.childNodes)t(n)},"walk");return t(this.root),e}async resolveStream(e){let t=0,s=[],n=e.getReader();for(;;){let{done:u,value:l}=await n.read();if(u)break;s.push(l),t+=l.length}let i=new Uint8Array(t),a=0;for(let u of s)i.set(u,a),a+=u.length;return i}async parse(e){if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=At.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await Dt(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos({key:n.key,value:n.value})).reverse()};for(let n of["from","sender"]){let i=this.root.headers.find(a=>a.key===n);if(i&&i.value){let a=Sn(i.value);a&&a.length&&(t[n]=a[0])}}for(let n of["delivered-to","return-path"]){let i=this.root.headers.find(a=>a.key===n);if(i&&i.value){let a=Sn(i.value);if(a&&a.length&&a[0].address){let u=n.replace(/\-(.)/g,(l,c)=>c.toUpperCase());t[u]=a[0].address}}}for(let n of["to","cc","bcc","reply-to"]){let i=this.root.headers.filter(u=>u.key===n),a=[];if(i.filter(u=>u&&u.value).map(u=>Sn(u.value)).forEach(u=>a=a.concat(u||[])),a&&a.length){let u=n.replace(/\-(.)/g,(l,c)=>c.toUpperCase());t[u]=a}}for(let n of["subject","message-id","in-reply-to","references"]){let i=this.root.headers.find(a=>a.key===n);if(i&&i.value){let a=n.replace(/\-(.)/g,(u,l)=>l.toUpperCase());t[a]=Xt(i.value)}}let s=this.root.headers.find(n=>n.key==="date");if(s){let n=new Date(s.value);!n||n.toString()==="Invalid Date"?n=s.value:n=n.toISOString(),t.date=n}switch(this.textContent?.html&&(t.html=this.textContent.html),this.textContent?.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let i of t.attachments||[])i?.content&&(i.content=zo(i.content),i.encoding="base64");break;case"utf8":let n=new TextDecoder("utf8");for(let i of t.attachments||[])i?.content&&(i.content=n.decode(i.content),i.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}};o(tt,"PostalMime");function Vo(r,e){let t=atob(r),s="";for(let n=0;n{let t=r.req.header("X-API-Key");if(!t){let i=r.req.header("Authorization");i?.startsWith("Bearer ")&&(t=i.substring(7))}if(!t)return r.json({error:{code:"UNAUTHORIZED",message:"Missing API Key. Provide it via X-API-Key header or Authorization: Bearer "}},401);let s=ce(r.env.DB),n=await Eo(s,t);if(!n)return r.json({error:{code:"UNAUTHORIZED",message:"Invalid API Key"}},401);if(!n.isActive)return r.json({error:{code:"FORBIDDEN",message:"API Key is disabled"}},403);if(n.expiresAt&&n.expiresAt{let e=ce(r.env.DB),t=r.get("apiKey"),s={};try{s=await r.req.json()}catch{}let n=r.env.EMAIL_DOMAIN?r.env.EMAIL_DOMAIN.split(",").map(x=>x.trim()):[];if(n.length===0)return r.json({error:{code:"CONFIGURATION_ERROR",message:"No email domains configured"}},500);let i=s.domain||n[0];if(!n.includes(i))return r.json({error:{code:"VALIDATION_ERROR",message:`Invalid domain. Available domains: ${n.join(", ")}`,details:{field:"domain",allowed:n}}},400);let u=`${s.localPart||sp()}@${i}`,l=s.expiresIn||24*60*60,c=new Date(Date.now()+l*1e3),d=new Date,m={id:Os(),address:u,domain:i,expiresAt:c,apiKeyId:t.id,createdAt:d,updatedAt:d};try{return await So(e,m),r.json({data:{id:m.id,address:m.address,domain:m.domain,expiresAt:m.expiresAt.toISOString(),createdAt:m.createdAt.toISOString()}},201)}catch(x){return x.message?.includes("UNIQUE constraint failed")?r.json({error:{code:"CONFLICT",message:"Email address already exists"}},409):(console.error("Create mailbox error:",x),r.json({error:{code:"INTERNAL_ERROR",message:"Failed to create mailbox"}},500))}});zr.get("/:id",async r=>{let e=ce(r.env.DB),t=r.get("apiKey"),{id:s}=r.req.param(),n=await Ss(e,s);if(!n)return r.json({error:{code:"NOT_FOUND",message:"Mailbox not found"}},404);if(n.apiKeyId!==t.id)return r.json({error:{code:"FORBIDDEN",message:"You do not have access to this mailbox"}},403);let i=await Oo(e,n.address);return r.json({data:{id:n.id,address:n.address,domain:n.domain,expiresAt:n.expiresAt?.toISOString()||null,createdAt:n.createdAt.toISOString(),messageCount:i}})});zr.get("/:id/messages",async r=>{let e=ce(r.env.DB),t=r.get("apiKey"),{id:s}=r.req.param(),n=await Ss(e,s);if(!n)return r.json({error:{code:"NOT_FOUND",message:"Mailbox not found"}},404);if(n.apiKeyId!==t.id)return r.json({error:{code:"FORBIDDEN",message:"You do not have access to this mailbox"}},403);let i=Math.max(1,parseInt(r.req.query("page")||"1",10)),a=Math.min(100,Math.max(1,parseInt(r.req.query("limit")||"20",10))),u=r.req.query("sort")==="asc"?"asc":"desc",{messages:l,total:c,totalPages:d}=await No(e,n.address,{page:i,limit:a,sort:u});return r.json({data:l.map(m=>({id:m.id,from:m.from,subject:m.subject,preview:m.text?.substring(0,100)||null,receivedAt:m.createdAt.toISOString()})),pagination:{page:i,limit:a,total:c,totalPages:d,hasMore:i{let e=ce(r.env.DB),t=r.get("apiKey"),{id:s,messageId:n}=r.req.param(),i=await Ss(e,s);if(!i)return r.json({error:{code:"NOT_FOUND",message:"Mailbox not found"}},404);if(i.apiKeyId!==t.id)return r.json({error:{code:"FORBIDDEN",message:"You do not have access to this mailbox"}},403);let a=await ko(e,i.address,n);return a?r.json({data:{id:a.id,messageId:a.messageId,from:a.from,to:a.to,cc:a.cc,bcc:a.bcc,replyTo:a.replyTo,subject:a.subject,text:a.text,html:a.html,headers:a.headers,receivedAt:a.createdAt.toISOString()}}):r.json({error:{code:"NOT_FOUND",message:"Message not found"}},404)});zr.delete("/:id/messages/:messageId",async r=>{let e=ce(r.env.DB),t=r.get("apiKey"),{id:s,messageId:n}=r.req.param(),i=await Ss(e,s);return i?i.apiKeyId!==t.id?r.json({error:{code:"FORBIDDEN",message:"You do not have access to this mailbox"}},403):await Ro(e,i.address,n)?r.json({data:{deleted:!0,id:n}}):r.json({error:{code:"NOT_FOUND",message:"Message not found"}},404):r.json({error:{code:"NOT_FOUND",message:"Mailbox not found"}},404)});var Ko=zr;var Nn=new St;Nn.use("/*",Ys());Nn.use("/*",Uo);Nn.route("/mailboxes",Ko);var Ho=Nn;var tr=new St;tr.use("/api/*",Ys());var Qo=o(async(r,e)=>{let t;try{t=await r.req.json()}catch(l){return console.error("\u8BF7\u6C42\u4F53\u89E3\u6790\u4E3AJSON\u65F6\u51FA\u9519:",l),r.json({message:"\u9519\u8BEF\u7684\u8BF7\u6C42\uFF1A\u8BF7\u6C42\u4F53\u65E0\u6548\u6216\u4E3A\u7A7A\u3002"},400)}r.set("parsedBody",t);let s=t.token||r.req.header("cf-turnstile-token"),n=r.req.header("CF-Connecting-IP");if(!s)return r.json({message:"\u7F3A\u5C11 turnstile token"},400);let i=new URLSearchParams;i.append("secret",r.env.TURNSTILE_SECRET),i.append("response",s),n&&i.append("remoteip",n);let u=await(await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString()})).json();if(!u.success)return console.error("Turnstile \u9A8C\u8BC1\u5931\u8D25:",u["error-codes"]),r.json({message:"token \u65E0\u6548"},400);await e()},"turnstile"),Vr=tr.basePath("/api");Vr.post("/verify",Qo,async r=>r.json({success:!0}));function np(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="vmail_";for(let t=0;t<32;t++)e+=r.charAt(Math.floor(Math.random()*r.length));return e}o(np,"generateApiKey");Vr.post("/api-keys",Qo,async r=>{let e=ce(r.env.DB),t=r.get("parsedBody"),s=new Date,n=np(),i=n.substring(0,12)+"...",a={id:Os(),key:n,keyPrefix:i,name:t?.name||null,rateLimit:100,isActive:!0,lastUsedAt:null,expiresAt:null,createdAt:s,updatedAt:s};try{return await To(e,a),r.json({data:{id:a.id,key:n,keyPrefix:i,name:a.name,createdAt:s.toISOString()},message:"API Key created successfully. Please save it now, it will not be shown again!"},201)}catch(u){return console.error("Create API Key error:",u),r.json({error:{code:"INTERNAL_ERROR",message:"Failed to create API Key"}},500)}});Vr.post("/emails",async r=>{let e=ce(r.env.DB),t;try{t=await r.req.json()}catch{return r.json({message:"\u9519\u8BEF\u7684\u8BF7\u6C42\uFF1A\u8BF7\u6C42\u4F53\u65E0\u6548\u6216\u4E3A\u7A7A\u3002"},400)}let s=t?.address;if(!s)return r.json({message:"address is required"},400);let n=await Ao(e,s);return r.json(n)});Vr.get("/emails/:id",async r=>{let e=ce(r.env.DB),{id:t}=r.req.param(),s=await wo(e,t);return s?r.json(s):r.json({message:"Email not found"},404)});Vr.post("/delete-emails",async r=>{let e=ce(r.env.DB),s=(await r.req.json())?.ids;if(!s||!Array.isArray(s)||s.length===0)return r.json({message:"ids are required"},400);let n=await Do(e,s);return r.json(n)});Vr.post("/login",async r=>{let t=(await r.req.json())?.password;if(!t)return r.json({message:"Password is required"},400);try{let s=Vo(t,r.env.COOKIES_SECRET);return!s||typeof s!="string"||!s.includes("@")?(console.error("\u89E3\u5BC6\u540E\u7684\u5730\u5740\u683C\u5F0F\u65E0\u6548:",s),r.json({message:"Invalid password"},400)):r.json({address:s})}catch(s){return console.error("Login error:",s),r.json({message:"Invalid password"},400)}});tr.get("/config",r=>{let e=r.env.EMAIL_DOMAIN?r.env.EMAIL_DOMAIN.split(",").map(t=>t.trim()):[];return r.json({emailDomain:e,turnstileKey:r.env.TURNSTILE_KEY,cookiesSecret:r.env.COOKIES_SECRET})});tr.route("/api/v1",Ho);tr.get("/*",Js({root:"./"}));tr.get("/assets/*",Js({root:"./"}));var Go={async email(r,e,t){try{let s=ce(e.DB),n=await new Response(r.raw).text(),i=await new tt().parse(n),a=new Date,u={id:Os(),messageFrom:r.from,messageTo:r.to,headers:i.headers||[],from:i.from,sender:i.sender,replyTo:i.replyTo,deliveredTo:i.deliveredTo,returnPath:i.returnPath,to:i.to,cc:i.cc,bcc:i.bcc,subject:i.subject,messageId:i.messageId,inReplyTo:i.inReplyTo,references:i.references,date:i.date,html:i.html,text:i.text,createdAt:a,updatedAt:a},l=xo.parse(u);await vo(s,l)}catch(s){console.error("\u5904\u7406\u90AE\u4EF6\u5931\u8D25:",s),r.setReject(`\u90AE\u4EF6\u5904\u7406\u5931\u8D25: ${s.message}`)}},async fetch(r,e,t){let s=new URL(r.url);return s.pathname.startsWith("/api/")||s.pathname==="/config"?tr.fetch(r,e,t):e.ASSETS.fetch(r)},async scheduled(r,e,t){let s=ce(e.DB),n=new Date(Date.now()-1e3*60*60*24);await _o(s,n),console.log(`\u5DF2\u6E05\u7406 ${n.toISOString()} \u4E4B\u524D\u7684\u8FC7\u671F\u90AE\u4EF6`)}};var ip=o(async(r,e,t,s)=>{try{return await s.next(r,e)}finally{try{if(r.body!==null&&!r.bodyUsed){let n=r.body.getReader();for(;!(await n.read()).done;);}}catch(n){console.error("Failed to drain the unused request body.",n)}}},"drainBody"),Wo=ip;function Jo(r){return{name:r?.name,message:r?.message??String(r),stack:r?.stack,cause:r?.cause===void 0?void 0:Jo(r.cause)}}o(Jo,"reduceError");var op=o(async(r,e,t,s)=>{try{return await s.next(r,e)}catch(n){let i=Jo(n);return Response.json(i,{status:500,headers:{"MF-Experimental-Error-Stack":"true"}})}},"jsonError"),Yo=op;var rr=[Wo,Yo],Fs=Go;var Xo=[];function Si(...r){Xo.push(...r.flat())}o(Si,"__facade_register__");function Zo(r,e,t,s,n){let[i,...a]=n;return i(r,e,t,{dispatch:s,next(l,c){return Zo(l,c,t,s,a)}})}o(Zo,"__facade_invokeChain__");function Ni(r,e,t,s,n){return Zo(r,e,t,s,[...Xo,n])}o(Ni,"__facade_invoke__");var sr=class{constructor(e,t,s){this.scheduledTime=e;this.cron=t;this.#e=s}#e;noRetry(){if(!(this instanceof sr))throw new TypeError("Illegal invocation");this.#e()}};o(sr,"__Facade_ScheduledController__");function lp(r){if(rr===void 0||rr.length===0)return r;for(let t of rr)Si(t);let e=o(function(t,s,n){if(r.fetch===void 0)throw new Error("Handler does not export a fetch() function.");return r.fetch(t,s,n)},"fetchDispatcher");return{...r,fetch(t,s,n){return Ni(t,s,n,o(function(a,u){if(a==="scheduled"&&r.scheduled!==void 0){let l=new sr(Date.now(),u.cron??"",()=>{});return r.scheduled(l,s,n)}},"dispatcher"),e)}}}o(lp,"wrapExportedHandler");function cp(r){if(rr===void 0||rr.length===0)return r;for(let e of rr)Si(e);return class extends r{#e=(e,t,s)=>{if(this.env=t,this.ctx=s,super.fetch===void 0)throw new Error("Entrypoint class does not define a fetch() function.");return super.fetch(e)};#t=(e,t)=>{if(e==="scheduled"&&super.scheduled!==void 0){let s=new sr(Date.now(),t.cron??"",()=>{});return super.scheduled(s)}};fetch(e){return Ni(e,this.env,this.ctx,this.#t,this.#e)}}}o(cp,"wrapWorkerEntrypoint");var ki;typeof Fs=="object"?ki=lp(Fs):typeof Fs=="function"&&(ki=cp(Fs));var zR=ki;export{rr as __INTERNAL_WRANGLER_MIDDLEWARE__,zR as default}; +//# sourceMappingURL=index.js.map diff --git a/.wrangler/tmp/dev-qzpL9Z/index.js.map b/.wrangler/tmp/dev-qzpL9Z/index.js.map new file mode 100644 index 0000000..e15670f --- /dev/null +++ b/.wrangler/tmp/dev-qzpL9Z/index.js.map @@ -0,0 +1,8 @@ +{ + "version": 3, + "sources": ["../bundle-caThGl/strip-cf-connecting-ip-header.js", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/_internal/utils.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/perf_hooks/performance.mjs", "../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.0.2_unenv@2.0.0-rc.14_workerd@1.20250718.0/node_modules/@cloudflare/unenv-preset/dist/runtime/polyfill/performance.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/console.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/mock/noop.mjs", "../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.0.2_unenv@2.0.0-rc.14_workerd@1.20250718.0/node_modules/@cloudflare/unenv-preset/dist/runtime/node/console.mjs", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-console", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/process/hrtime.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/process/process.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/tty/read-stream.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/tty/write-stream.mjs", "../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.0.2_unenv@2.0.0-rc.14_workerd@1.20250718.0/node_modules/@cloudflare/unenv-preset/dist/runtime/node/process.mjs", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-process", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/compose.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/request/constants.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/body.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/url.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/request.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/html.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/context.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/constants.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/hono-base.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/matcher.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/node.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/trie.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/smart-router/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/trie-router/node.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/trie-router/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/hono.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/compress.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/mime.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/middleware/serve-static/path.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/middleware/serve-static/index.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/utils.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/helper/websocket/index.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/middleware/cors/index.js", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/entity.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/column.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/subquery.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/tracing-utils.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/drizzle-orm/version.js", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/tracing.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/view-common.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/table.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sql/sql.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/alias.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/column-builder.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/errors.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sql/expressions/conditions.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sql/expressions/select.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/logger.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/query-promise.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/table.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/primary-keys.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/relations.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sql/functions/aggregate.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/utils.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/table.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/foreign-keys.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/unique-constraint.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/columns/common.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/columns/integer.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/columns/text.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/selection-proxy.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/delete.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/insert.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/view-base.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/dialect.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/query-builders/query-builder.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/select.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/query-builder.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/update.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/query.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/query-builders/raw.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/db.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/sqlite-core/session.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/table.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/foreign-keys.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/unique-constraint.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/columns/common.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/columns/char.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/columns/varbinary.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/mysql-core/columns/varchar.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/foreign-keys.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/unique-constraint.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/utils/array.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/columns/common.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/columns/char.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/columns/uuid.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/pg-core/columns/varchar.ts", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js", "../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js", "../../../node_modules/.pnpm/drizzle-zod@0.5.1_drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0__zod@3.25.76/node_modules/src/index.ts", "../../../worker/src/database/schema.ts", "../../../worker/src/database/dao.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/d1/session.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/d1/driver.ts", "../../../worker/src/database/db.ts", "../../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/non-secure/index.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/decode-strings.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/pass-through-decoder.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/base64-decoder.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/qp-decoder.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/mime-node.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/html-entities.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/text-format.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/address-parser.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/base64-encoder.js", "../../../node_modules/.pnpm/postal-mime@2.4.7/node_modules/postal-mime/src/postal-mime.js", "../../../worker/src/utils.ts", "../../../worker/src/api/v1/middleware/apiKeyAuth.ts", "../../../worker/src/api/v1/routes/mailboxes.ts", "../../../worker/src/api/v1/index.ts", "../../../worker/src/index.ts", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts", "../bundle-caThGl/middleware-insertion-facade.js", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts", "../bundle-caThGl/middleware-loader.entry.ts"], + "sourceRoot": "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/dev-qzpL9Z", + "sourcesContent": ["function stripCfConnectingIPHeader(input, init) {\n\tconst request = new Request(input, init);\n\trequest.headers.delete(\"CF-Connecting-IP\");\n\treturn request;\n}\n\nglobalThis.fetch = new Proxy(globalThis.fetch, {\n\tapply(target, thisArg, argArray) {\n\t\treturn Reflect.apply(target, thisArg, [\n\t\t\tstripCfConnectingIPHeader.apply(null, argArray),\n\t\t]);\n\t},\n});\n", "/*@__NO_SIDE_EFFECTS__*/ export function rawHeaders(headers) {\n\tconst rawHeaders = [];\n\tfor (const key in headers) {\n\t\tif (Array.isArray(headers[key])) {\n\t\t\tfor (const h of headers[key]) {\n\t\t\t\trawHeaders.push(key, h);\n\t\t\t}\n\t\t} else {\n\t\t\trawHeaders.push(key, headers[key]);\n\t\t}\n\t}\n\treturn rawHeaders;\n}\n/*@__NO_SIDE_EFFECTS__*/ export function mergeFns(...functions) {\n\treturn function(...args) {\n\t\tfor (const fn of functions) {\n\t\t\tfn(...args);\n\t\t}\n\t};\n}\n/*@__NO_SIDE_EFFECTS__*/ export function createNotImplementedError(name) {\n\treturn new Error(`[unenv] ${name} is not implemented yet!`);\n}\n/*@__NO_SIDE_EFFECTS__*/ export function notImplemented(name) {\n\tconst fn = () => {\n\t\tthrow createNotImplementedError(name);\n\t};\n\treturn Object.assign(fn, { __unenv__: true });\n}\n/*@__NO_SIDE_EFFECTS__*/ export function notImplementedAsync(name) {\n\tconst fn = notImplemented(name);\n\tfn.__promisify__ = () => notImplemented(name + \".__promisify__\");\n\tfn.native = fn;\n\treturn fn;\n}\n/*@__NO_SIDE_EFFECTS__*/ export function notImplementedClass(name) {\n\treturn class {\n\t\t__unenv__ = true;\n\t\tconstructor() {\n\t\t\tthrow new Error(`[unenv] ${name} is not implemented yet!`);\n\t\t}\n\t};\n}\n", "import { createNotImplementedError } from \"../../../_internal/utils.mjs\";\nconst _timeOrigin = globalThis.performance?.timeOrigin ?? Date.now();\nconst _performanceNow = globalThis.performance?.now ? globalThis.performance.now.bind(globalThis.performance) : () => Date.now() - _timeOrigin;\nconst nodeTiming = {\n\tname: \"node\",\n\tentryType: \"node\",\n\tstartTime: 0,\n\tduration: 0,\n\tnodeStart: 0,\n\tv8Start: 0,\n\tbootstrapComplete: 0,\n\tenvironment: 0,\n\tloopStart: 0,\n\tloopExit: 0,\n\tidleTime: 0,\n\tuvMetricsInfo: {\n\t\tloopCount: 0,\n\t\tevents: 0,\n\t\teventsWaiting: 0\n\t},\n\tdetail: undefined,\n\ttoJSON() {\n\t\treturn this;\n\t}\n};\nexport class PerformanceEntry {\n\t__unenv__ = true;\n\tdetail;\n\tentryType = \"event\";\n\tname;\n\tstartTime;\n\tconstructor(name, options) {\n\t\tthis.name = name;\n\t\tthis.startTime = options?.startTime || _performanceNow();\n\t\tthis.detail = options?.detail;\n\t}\n\tget duration() {\n\t\treturn _performanceNow() - this.startTime;\n\t}\n\ttoJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tentryType: this.entryType,\n\t\t\tstartTime: this.startTime,\n\t\t\tduration: this.duration,\n\t\t\tdetail: this.detail\n\t\t};\n\t}\n}\nexport const PerformanceMark = class PerformanceMark extends PerformanceEntry {\n\tentryType = \"mark\";\n\tconstructor() {\n\t\tsuper(...arguments);\n\t}\n\tget duration() {\n\t\treturn 0;\n\t}\n};\nexport class PerformanceMeasure extends PerformanceEntry {\n\tentryType = \"measure\";\n}\nexport class PerformanceResourceTiming extends PerformanceEntry {\n\tentryType = \"resource\";\n\tserverTiming = [];\n\tconnectEnd = 0;\n\tconnectStart = 0;\n\tdecodedBodySize = 0;\n\tdomainLookupEnd = 0;\n\tdomainLookupStart = 0;\n\tencodedBodySize = 0;\n\tfetchStart = 0;\n\tinitiatorType = \"\";\n\tname = \"\";\n\tnextHopProtocol = \"\";\n\tredirectEnd = 0;\n\tredirectStart = 0;\n\trequestStart = 0;\n\tresponseEnd = 0;\n\tresponseStart = 0;\n\tsecureConnectionStart = 0;\n\tstartTime = 0;\n\ttransferSize = 0;\n\tworkerStart = 0;\n\tresponseStatus = 0;\n}\nexport class PerformanceObserverEntryList {\n\t__unenv__ = true;\n\tgetEntries() {\n\t\treturn [];\n\t}\n\tgetEntriesByName(_name, _type) {\n\t\treturn [];\n\t}\n\tgetEntriesByType(type) {\n\t\treturn [];\n\t}\n}\nexport class Performance {\n\t__unenv__ = true;\n\ttimeOrigin = _timeOrigin;\n\teventCounts = new Map();\n\t_entries = [];\n\t_resourceTimingBufferSize = 0;\n\tnavigation = undefined;\n\ttiming = undefined;\n\ttimerify(_fn, _options) {\n\t\tthrow createNotImplementedError(\"Performance.timerify\");\n\t}\n\tget nodeTiming() {\n\t\treturn nodeTiming;\n\t}\n\teventLoopUtilization() {\n\t\treturn {};\n\t}\n\tmarkResourceTiming() {\n\t\treturn new PerformanceResourceTiming(\"\");\n\t}\n\tonresourcetimingbufferfull = null;\n\tnow() {\n\t\tif (this.timeOrigin === _timeOrigin) {\n\t\t\treturn _performanceNow();\n\t\t}\n\t\treturn Date.now() - this.timeOrigin;\n\t}\n\tclearMarks(markName) {\n\t\tthis._entries = markName ? this._entries.filter((e) => e.name !== markName) : this._entries.filter((e) => e.entryType !== \"mark\");\n\t}\n\tclearMeasures(measureName) {\n\t\tthis._entries = measureName ? this._entries.filter((e) => e.name !== measureName) : this._entries.filter((e) => e.entryType !== \"measure\");\n\t}\n\tclearResourceTimings() {\n\t\tthis._entries = this._entries.filter((e) => e.entryType !== \"resource\" || e.entryType !== \"navigation\");\n\t}\n\tgetEntries() {\n\t\treturn this._entries;\n\t}\n\tgetEntriesByName(name, type) {\n\t\treturn this._entries.filter((e) => e.name === name && (!type || e.entryType === type));\n\t}\n\tgetEntriesByType(type) {\n\t\treturn this._entries.filter((e) => e.entryType === type);\n\t}\n\tmark(name, options) {\n\t\tconst entry = new PerformanceMark(name, options);\n\t\tthis._entries.push(entry);\n\t\treturn entry;\n\t}\n\tmeasure(measureName, startOrMeasureOptions, endMark) {\n\t\tlet start;\n\t\tlet end;\n\t\tif (typeof startOrMeasureOptions === \"string\") {\n\t\t\tstart = this.getEntriesByName(startOrMeasureOptions, \"mark\")[0]?.startTime;\n\t\t\tend = this.getEntriesByName(endMark, \"mark\")[0]?.startTime;\n\t\t} else {\n\t\t\tstart = Number.parseFloat(startOrMeasureOptions?.start) || this.now();\n\t\t\tend = Number.parseFloat(startOrMeasureOptions?.end) || this.now();\n\t\t}\n\t\tconst entry = new PerformanceMeasure(measureName, {\n\t\t\tstartTime: start,\n\t\t\tdetail: {\n\t\t\t\tstart,\n\t\t\t\tend\n\t\t\t}\n\t\t});\n\t\tthis._entries.push(entry);\n\t\treturn entry;\n\t}\n\tsetResourceTimingBufferSize(maxSize) {\n\t\tthis._resourceTimingBufferSize = maxSize;\n\t}\n\taddEventListener(type, listener, options) {\n\t\tthrow createNotImplementedError(\"Performance.addEventListener\");\n\t}\n\tremoveEventListener(type, listener, options) {\n\t\tthrow createNotImplementedError(\"Performance.removeEventListener\");\n\t}\n\tdispatchEvent(event) {\n\t\tthrow createNotImplementedError(\"Performance.dispatchEvent\");\n\t}\n\ttoJSON() {\n\t\treturn this;\n\t}\n}\nexport class PerformanceObserver {\n\t__unenv__ = true;\n\tstatic supportedEntryTypes = [];\n\t_callback = null;\n\tconstructor(callback) {\n\t\tthis._callback = callback;\n\t}\n\ttakeRecords() {\n\t\treturn [];\n\t}\n\tdisconnect() {\n\t\tthrow createNotImplementedError(\"PerformanceObserver.disconnect\");\n\t}\n\tobserve(options) {\n\t\tthrow createNotImplementedError(\"PerformanceObserver.observe\");\n\t}\n\tbind(fn) {\n\t\treturn fn;\n\t}\n\trunInAsyncScope(fn, thisArg, ...args) {\n\t\treturn fn.call(thisArg, ...args);\n\t}\n\tasyncId() {\n\t\treturn 0;\n\t}\n\ttriggerAsyncId() {\n\t\treturn 0;\n\t}\n\temitDestroy() {\n\t\treturn this;\n\t}\n}\nexport const performance = globalThis.performance && \"addEventListener\" in globalThis.performance ? globalThis.performance : new Performance();\n", "import {\n performance,\n Performance,\n PerformanceEntry,\n PerformanceMark,\n PerformanceMeasure,\n PerformanceObserver,\n PerformanceObserverEntryList,\n PerformanceResourceTiming\n} from \"node:perf_hooks\";\nglobalThis.performance = performance;\nglobalThis.Performance = Performance;\nglobalThis.PerformanceEntry = PerformanceEntry;\nglobalThis.PerformanceMark = PerformanceMark;\nglobalThis.PerformanceMeasure = PerformanceMeasure;\nglobalThis.PerformanceObserver = PerformanceObserver;\nglobalThis.PerformanceObserverEntryList = PerformanceObserverEntryList;\nglobalThis.PerformanceResourceTiming = PerformanceResourceTiming;\n", "import { Writable } from \"node:stream\";\nimport noop from \"../mock/noop.mjs\";\nimport { notImplemented, notImplementedClass } from \"../_internal/utils.mjs\";\nconst _console = globalThis.console;\nexport const _ignoreErrors = true;\nexport const _stderr = new Writable();\nexport const _stdout = new Writable();\nexport const log = _console?.log ?? noop;\nexport const info = _console?.info ?? log;\nexport const trace = _console?.trace ?? info;\nexport const debug = _console?.debug ?? log;\nexport const table = _console?.table ?? log;\nexport const error = _console?.error ?? log;\nexport const warn = _console?.warn ?? error;\nexport const createTask = _console?.createTask ?? /*@__PURE__*/ notImplemented(\"console.createTask\");\nexport const assert = /*@__PURE__*/ notImplemented(\"console.assert\");\nexport const clear = _console?.clear ?? noop;\nexport const count = _console?.count ?? noop;\nexport const countReset = _console?.countReset ?? noop;\nexport const dir = _console?.dir ?? noop;\nexport const dirxml = _console?.dirxml ?? noop;\nexport const group = _console?.group ?? noop;\nexport const groupEnd = _console?.groupEnd ?? noop;\nexport const groupCollapsed = _console?.groupCollapsed ?? noop;\nexport const profile = _console?.profile ?? noop;\nexport const profileEnd = _console?.profileEnd ?? noop;\nexport const time = _console?.time ?? noop;\nexport const timeEnd = _console?.timeEnd ?? noop;\nexport const timeLog = _console?.timeLog ?? noop;\nexport const timeStamp = _console?.timeStamp ?? noop;\nexport const Console = _console?.Console ?? /*@__PURE__*/ notImplementedClass(\"console.Console\");\nexport const _times = /*@__PURE__*/ new Map();\nexport function context() {\n\treturn _console;\n}\nexport const _stdoutErrorHandler = noop;\nexport const _stderrErrorHandler = noop;\nexport default {\n\t_times,\n\t_ignoreErrors,\n\t_stdoutErrorHandler,\n\t_stderrErrorHandler,\n\t_stdout,\n\t_stderr,\n\tassert,\n\tclear,\n\tConsole,\n\tcount,\n\tcountReset,\n\tdebug,\n\tdir,\n\tdirxml,\n\terror,\n\tcontext,\n\tcreateTask,\n\tgroup,\n\tgroupEnd,\n\tgroupCollapsed,\n\tinfo,\n\tlog,\n\tprofile,\n\tprofileEnd,\n\ttable,\n\ttime,\n\ttimeEnd,\n\ttimeLog,\n\ttimeStamp,\n\ttrace,\n\twarn\n};\n", "export default Object.assign(() => {}, { __unenv__: true });\n", "import {\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times,\n Console\n} from \"unenv/node/console\";\nexport {\n Console,\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times\n} from \"unenv/node/console\";\nconst workerdConsole = globalThis[\"console\"];\nexport const {\n assert,\n clear,\n // @ts-expect-error undocumented public API\n context,\n count,\n countReset,\n // @ts-expect-error undocumented public API\n createTask,\n debug,\n dir,\n dirxml,\n error,\n group,\n groupCollapsed,\n groupEnd,\n info,\n log,\n profile,\n profileEnd,\n table,\n time,\n timeEnd,\n timeLog,\n timeStamp,\n trace,\n warn\n} = workerdConsole;\nObject.assign(workerdConsole, {\n Console,\n _ignoreErrors,\n _stderr,\n _stderrErrorHandler,\n _stdout,\n _stdoutErrorHandler,\n _times\n});\nexport default workerdConsole;\n", "import { default as defaultExport } from \"@cloudflare/unenv-preset/node/console\";\nglobalThis.console = defaultExport;", "export const hrtime = /*@__PURE__*/ Object.assign(function hrtime(startTime) {\n\tconst now = Date.now();\n\tconst seconds = Math.trunc(now / 1e3);\n\tconst nanos = now % 1e3 * 1e6;\n\tif (startTime) {\n\t\tlet diffSeconds = seconds - startTime[0];\n\t\tlet diffNanos = nanos - startTime[0];\n\t\tif (diffNanos < 0) {\n\t\t\tdiffSeconds = diffSeconds - 1;\n\t\t\tdiffNanos = 1e9 + diffNanos;\n\t\t}\n\t\treturn [diffSeconds, diffNanos];\n\t}\n\treturn [seconds, nanos];\n}, { bigint: function bigint() {\n\treturn BigInt(Date.now() * 1e6);\n} });\n", "import { EventEmitter } from \"node:events\";\nimport { ReadStream, WriteStream } from \"node:tty\";\nimport { notImplemented, createNotImplementedError } from \"../../../_internal/utils.mjs\";\nexport class Process extends EventEmitter {\n\tenv;\n\thrtime;\n\tnextTick;\n\tconstructor(impl) {\n\t\tsuper();\n\t\tthis.env = impl.env;\n\t\tthis.hrtime = impl.hrtime;\n\t\tthis.nextTick = impl.nextTick;\n\t\tfor (const prop of [...Object.getOwnPropertyNames(Process.prototype), ...Object.getOwnPropertyNames(EventEmitter.prototype)]) {\n\t\t\tconst value = this[prop];\n\t\t\tif (typeof value === \"function\") {\n\t\t\t\tthis[prop] = value.bind(this);\n\t\t\t}\n\t\t}\n\t}\n\temitWarning(warning, type, code) {\n\t\tconsole.warn(`${code ? `[${code}] ` : \"\"}${type ? `${type}: ` : \"\"}${warning}`);\n\t}\n\temit(...args) {\n\t\treturn super.emit(...args);\n\t}\n\tlisteners(eventName) {\n\t\treturn super.listeners(eventName);\n\t}\n\t#stdin;\n\t#stdout;\n\t#stderr;\n\tget stdin() {\n\t\treturn this.#stdin ??= new ReadStream(0);\n\t}\n\tget stdout() {\n\t\treturn this.#stdout ??= new WriteStream(1);\n\t}\n\tget stderr() {\n\t\treturn this.#stderr ??= new WriteStream(2);\n\t}\n\t#cwd = \"/\";\n\tchdir(cwd) {\n\t\tthis.#cwd = cwd;\n\t}\n\tcwd() {\n\t\treturn this.#cwd;\n\t}\n\tarch = \"\";\n\tplatform = \"\";\n\targv = [];\n\targv0 = \"\";\n\texecArgv = [];\n\texecPath = \"\";\n\ttitle = \"\";\n\tpid = 200;\n\tppid = 100;\n\tget version() {\n\t\treturn \"\";\n\t}\n\tget versions() {\n\t\treturn {};\n\t}\n\tget allowedNodeEnvironmentFlags() {\n\t\treturn new Set();\n\t}\n\tget sourceMapsEnabled() {\n\t\treturn false;\n\t}\n\tget debugPort() {\n\t\treturn 0;\n\t}\n\tget throwDeprecation() {\n\t\treturn false;\n\t}\n\tget traceDeprecation() {\n\t\treturn false;\n\t}\n\tget features() {\n\t\treturn {};\n\t}\n\tget release() {\n\t\treturn {};\n\t}\n\tget connected() {\n\t\treturn false;\n\t}\n\tget config() {\n\t\treturn {};\n\t}\n\tget moduleLoadList() {\n\t\treturn [];\n\t}\n\tconstrainedMemory() {\n\t\treturn 0;\n\t}\n\tavailableMemory() {\n\t\treturn 0;\n\t}\n\tuptime() {\n\t\treturn 0;\n\t}\n\tresourceUsage() {\n\t\treturn {};\n\t}\n\tref() {}\n\tunref() {}\n\tumask() {\n\t\tthrow createNotImplementedError(\"process.umask\");\n\t}\n\tgetBuiltinModule() {\n\t\treturn undefined;\n\t}\n\tgetActiveResourcesInfo() {\n\t\tthrow createNotImplementedError(\"process.getActiveResourcesInfo\");\n\t}\n\texit() {\n\t\tthrow createNotImplementedError(\"process.exit\");\n\t}\n\treallyExit() {\n\t\tthrow createNotImplementedError(\"process.reallyExit\");\n\t}\n\tkill() {\n\t\tthrow createNotImplementedError(\"process.kill\");\n\t}\n\tabort() {\n\t\tthrow createNotImplementedError(\"process.abort\");\n\t}\n\tdlopen() {\n\t\tthrow createNotImplementedError(\"process.dlopen\");\n\t}\n\tsetSourceMapsEnabled() {\n\t\tthrow createNotImplementedError(\"process.setSourceMapsEnabled\");\n\t}\n\tloadEnvFile() {\n\t\tthrow createNotImplementedError(\"process.loadEnvFile\");\n\t}\n\tdisconnect() {\n\t\tthrow createNotImplementedError(\"process.disconnect\");\n\t}\n\tcpuUsage() {\n\t\tthrow createNotImplementedError(\"process.cpuUsage\");\n\t}\n\tsetUncaughtExceptionCaptureCallback() {\n\t\tthrow createNotImplementedError(\"process.setUncaughtExceptionCaptureCallback\");\n\t}\n\thasUncaughtExceptionCaptureCallback() {\n\t\tthrow createNotImplementedError(\"process.hasUncaughtExceptionCaptureCallback\");\n\t}\n\tinitgroups() {\n\t\tthrow createNotImplementedError(\"process.initgroups\");\n\t}\n\topenStdin() {\n\t\tthrow createNotImplementedError(\"process.openStdin\");\n\t}\n\tassert() {\n\t\tthrow createNotImplementedError(\"process.assert\");\n\t}\n\tbinding() {\n\t\tthrow createNotImplementedError(\"process.binding\");\n\t}\n\tpermission = { has: /*@__PURE__*/ notImplemented(\"process.permission.has\") };\n\treport = {\n\t\tdirectory: \"\",\n\t\tfilename: \"\",\n\t\tsignal: \"SIGUSR2\",\n\t\tcompact: false,\n\t\treportOnFatalError: false,\n\t\treportOnSignal: false,\n\t\treportOnUncaughtException: false,\n\t\tgetReport: /*@__PURE__*/ notImplemented(\"process.report.getReport\"),\n\t\twriteReport: /*@__PURE__*/ notImplemented(\"process.report.writeReport\")\n\t};\n\tfinalization = {\n\t\tregister: /*@__PURE__*/ notImplemented(\"process.finalization.register\"),\n\t\tunregister: /*@__PURE__*/ notImplemented(\"process.finalization.unregister\"),\n\t\tregisterBeforeExit: /*@__PURE__*/ notImplemented(\"process.finalization.registerBeforeExit\")\n\t};\n\tmemoryUsage = Object.assign(() => ({\n\t\tarrayBuffers: 0,\n\t\trss: 0,\n\t\texternal: 0,\n\t\theapTotal: 0,\n\t\theapUsed: 0\n\t}), { rss: () => 0 });\n\tmainModule = undefined;\n\tdomain = undefined;\n\tsend = undefined;\n\texitCode = undefined;\n\tchannel = undefined;\n\tgetegid = undefined;\n\tgeteuid = undefined;\n\tgetgid = undefined;\n\tgetgroups = undefined;\n\tgetuid = undefined;\n\tsetegid = undefined;\n\tseteuid = undefined;\n\tsetgid = undefined;\n\tsetgroups = undefined;\n\tsetuid = undefined;\n\t_events = undefined;\n\t_eventsCount = undefined;\n\t_exiting = undefined;\n\t_maxListeners = undefined;\n\t_debugEnd = undefined;\n\t_debugProcess = undefined;\n\t_fatalException = undefined;\n\t_getActiveHandles = undefined;\n\t_getActiveRequests = undefined;\n\t_kill = undefined;\n\t_preload_modules = undefined;\n\t_rawDebug = undefined;\n\t_startProfilerIdleNotifier = undefined;\n\t_stopProfilerIdleNotifier = undefined;\n\t_tickCallback = undefined;\n\t_disconnect = undefined;\n\t_handleQueue = undefined;\n\t_pendingMessage = undefined;\n\t_channel = undefined;\n\t_send = undefined;\n\t_linkedBinding = undefined;\n}\n", "import { Socket } from \"node:net\";\nexport class ReadStream extends Socket {\n\tfd;\n\tconstructor(fd) {\n\t\tsuper();\n\t\tthis.fd = fd;\n\t}\n\tisRaw = false;\n\tsetRawMode(mode) {\n\t\tthis.isRaw = mode;\n\t\treturn this;\n\t}\n\tisTTY = false;\n}\n", "import { Socket } from \"node:net\";\nexport class WriteStream extends Socket {\n\tfd;\n\tconstructor(fd) {\n\t\tsuper();\n\t\tthis.fd = fd;\n\t}\n\tclearLine(dir, callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tclearScreenDown(callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tcursorTo(x, y, callback) {\n\t\tcallback && typeof callback === \"function\" && callback();\n\t\treturn false;\n\t}\n\tmoveCursor(dx, dy, callback) {\n\t\tcallback && callback();\n\t\treturn false;\n\t}\n\tgetColorDepth(env) {\n\t\treturn 1;\n\t}\n\thasColors(count, env) {\n\t\treturn false;\n\t}\n\tgetWindowSize() {\n\t\treturn [this.columns, this.rows];\n\t}\n\tcolumns = 80;\n\trows = 24;\n\tisTTY = false;\n}\n", "import { hrtime as UnenvHrTime } from \"unenv/node/internal/process/hrtime\";\nimport { Process as UnenvProcess } from \"unenv/node/internal/process/process\";\nconst globalProcess = globalThis[\"process\"];\nexport const getBuiltinModule = globalProcess.getBuiltinModule;\nexport const { exit, platform, nextTick } = getBuiltinModule(\n \"node:process\"\n);\nconst unenvProcess = new UnenvProcess({\n env: globalProcess.env,\n hrtime: UnenvHrTime,\n nextTick\n});\nexport const {\n abort,\n addListener,\n allowedNodeEnvironmentFlags,\n hasUncaughtExceptionCaptureCallback,\n setUncaughtExceptionCaptureCallback,\n loadEnvFile,\n sourceMapsEnabled,\n arch,\n argv,\n argv0,\n chdir,\n config,\n connected,\n constrainedMemory,\n availableMemory,\n cpuUsage,\n cwd,\n debugPort,\n dlopen,\n disconnect,\n emit,\n emitWarning,\n env,\n eventNames,\n execArgv,\n execPath,\n finalization,\n features,\n getActiveResourcesInfo,\n getMaxListeners,\n hrtime,\n kill,\n listeners,\n listenerCount,\n memoryUsage,\n on,\n off,\n once,\n pid,\n ppid,\n prependListener,\n prependOnceListener,\n rawListeners,\n release,\n removeAllListeners,\n removeListener,\n report,\n resourceUsage,\n setMaxListeners,\n setSourceMapsEnabled,\n stderr,\n stdin,\n stdout,\n title,\n throwDeprecation,\n traceDeprecation,\n umask,\n uptime,\n version,\n versions,\n domain,\n initgroups,\n moduleLoadList,\n reallyExit,\n openStdin,\n assert,\n binding,\n send,\n exitCode,\n channel,\n getegid,\n geteuid,\n getgid,\n getgroups,\n getuid,\n setegid,\n seteuid,\n setgid,\n setgroups,\n setuid,\n permission,\n mainModule,\n _events,\n _eventsCount,\n _exiting,\n _maxListeners,\n _debugEnd,\n _debugProcess,\n _fatalException,\n _getActiveHandles,\n _getActiveRequests,\n _kill,\n _preload_modules,\n _rawDebug,\n _startProfilerIdleNotifier,\n _stopProfilerIdleNotifier,\n _tickCallback,\n _disconnect,\n _handleQueue,\n _pendingMessage,\n _channel,\n _send,\n _linkedBinding\n} = unenvProcess;\nconst _process = {\n abort,\n addListener,\n allowedNodeEnvironmentFlags,\n hasUncaughtExceptionCaptureCallback,\n setUncaughtExceptionCaptureCallback,\n loadEnvFile,\n sourceMapsEnabled,\n arch,\n argv,\n argv0,\n chdir,\n config,\n connected,\n constrainedMemory,\n availableMemory,\n cpuUsage,\n cwd,\n debugPort,\n dlopen,\n disconnect,\n emit,\n emitWarning,\n env,\n eventNames,\n execArgv,\n execPath,\n exit,\n finalization,\n features,\n getBuiltinModule,\n getActiveResourcesInfo,\n getMaxListeners,\n hrtime,\n kill,\n listeners,\n listenerCount,\n memoryUsage,\n nextTick,\n on,\n off,\n once,\n pid,\n platform,\n ppid,\n prependListener,\n prependOnceListener,\n rawListeners,\n release,\n removeAllListeners,\n removeListener,\n report,\n resourceUsage,\n setMaxListeners,\n setSourceMapsEnabled,\n stderr,\n stdin,\n stdout,\n title,\n throwDeprecation,\n traceDeprecation,\n umask,\n uptime,\n version,\n versions,\n // @ts-expect-error old API\n domain,\n initgroups,\n moduleLoadList,\n reallyExit,\n openStdin,\n assert,\n binding,\n send,\n exitCode,\n channel,\n getegid,\n geteuid,\n getgid,\n getgroups,\n getuid,\n setegid,\n seteuid,\n setgid,\n setgroups,\n setuid,\n permission,\n mainModule,\n _events,\n _eventsCount,\n _exiting,\n _maxListeners,\n _debugEnd,\n _debugProcess,\n _fatalException,\n _getActiveHandles,\n _getActiveRequests,\n _kill,\n _preload_modules,\n _rawDebug,\n _startProfilerIdleNotifier,\n _stopProfilerIdleNotifier,\n _tickCallback,\n _disconnect,\n _handleQueue,\n _pendingMessage,\n _channel,\n _send,\n _linkedBinding\n};\nexport default _process;\n", "import { default as defaultExport } from \"@cloudflare/unenv-preset/node/process\";\nglobalThis.process = defaultExport;", "// src/compose.ts\nvar compose = (middleware, onError, onNotFound) => {\n return (context, next) => {\n let index = -1;\n return dispatch(0);\n async function dispatch(i) {\n if (i <= index) {\n throw new Error(\"next() called multiple times\");\n }\n index = i;\n let res;\n let isError = false;\n let handler;\n if (middleware[i]) {\n handler = middleware[i][0][0];\n context.req.routeIndex = i;\n } else {\n handler = i === middleware.length && next || void 0;\n }\n if (handler) {\n try {\n res = await handler(context, () => dispatch(i + 1));\n } catch (err) {\n if (err instanceof Error && onError) {\n context.error = err;\n res = await onError(err, context);\n isError = true;\n } else {\n throw err;\n }\n }\n } else {\n if (context.finalized === false && onNotFound) {\n res = await onNotFound(context);\n }\n }\n if (res && (context.finalized === false || isError)) {\n context.res = res;\n }\n return context;\n }\n };\n};\nexport {\n compose\n};\n", "// src/request/constants.ts\nvar GET_MATCH_RESULT = Symbol();\nexport {\n GET_MATCH_RESULT\n};\n", "// src/utils/body.ts\nimport { HonoRequest } from \"../request.js\";\nvar parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {\n const { all = false, dot = false } = options;\n const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;\n const contentType = headers.get(\"Content-Type\");\n if (contentType?.startsWith(\"multipart/form-data\") || contentType?.startsWith(\"application/x-www-form-urlencoded\")) {\n return parseFormData(request, { all, dot });\n }\n return {};\n};\nasync function parseFormData(request, options) {\n const formData = await request.formData();\n if (formData) {\n return convertFormDataToBodyData(formData, options);\n }\n return {};\n}\nfunction convertFormDataToBodyData(formData, options) {\n const form = /* @__PURE__ */ Object.create(null);\n formData.forEach((value, key) => {\n const shouldParseAllValues = options.all || key.endsWith(\"[]\");\n if (!shouldParseAllValues) {\n form[key] = value;\n } else {\n handleParsingAllValues(form, key, value);\n }\n });\n if (options.dot) {\n Object.entries(form).forEach(([key, value]) => {\n const shouldParseDotValues = key.includes(\".\");\n if (shouldParseDotValues) {\n handleParsingNestedValues(form, key, value);\n delete form[key];\n }\n });\n }\n return form;\n}\nvar handleParsingAllValues = (form, key, value) => {\n if (form[key] !== void 0) {\n if (Array.isArray(form[key])) {\n ;\n form[key].push(value);\n } else {\n form[key] = [form[key], value];\n }\n } else {\n if (!key.endsWith(\"[]\")) {\n form[key] = value;\n } else {\n form[key] = [value];\n }\n }\n};\nvar handleParsingNestedValues = (form, key, value) => {\n let nestedForm = form;\n const keys = key.split(\".\");\n keys.forEach((key2, index) => {\n if (index === keys.length - 1) {\n nestedForm[key2] = value;\n } else {\n if (!nestedForm[key2] || typeof nestedForm[key2] !== \"object\" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {\n nestedForm[key2] = /* @__PURE__ */ Object.create(null);\n }\n nestedForm = nestedForm[key2];\n }\n });\n};\nexport {\n parseBody\n};\n", "// src/utils/url.ts\nvar splitPath = (path) => {\n const paths = path.split(\"/\");\n if (paths[0] === \"\") {\n paths.shift();\n }\n return paths;\n};\nvar splitRoutingPath = (routePath) => {\n const { groups, path } = extractGroupsFromPath(routePath);\n const paths = splitPath(path);\n return replaceGroupMarks(paths, groups);\n};\nvar extractGroupsFromPath = (path) => {\n const groups = [];\n path = path.replace(/\\{[^}]+\\}/g, (match, index) => {\n const mark = `@${index}`;\n groups.push([mark, match]);\n return mark;\n });\n return { groups, path };\n};\nvar replaceGroupMarks = (paths, groups) => {\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = paths.length - 1; j >= 0; j--) {\n if (paths[j].includes(mark)) {\n paths[j] = paths[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n return paths;\n};\nvar patternCache = {};\nvar getPattern = (label, next) => {\n if (label === \"*\") {\n return \"*\";\n }\n const match = label.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n if (match) {\n const cacheKey = `${label}#${next}`;\n if (!patternCache[cacheKey]) {\n if (match[2]) {\n patternCache[cacheKey] = next && next[0] !== \":\" && next[0] !== \"*\" ? [cacheKey, match[1], new RegExp(`^${match[2]}(?=/${next})`)] : [label, match[1], new RegExp(`^${match[2]}$`)];\n } else {\n patternCache[cacheKey] = [label, match[1], true];\n }\n }\n return patternCache[cacheKey];\n }\n return null;\n};\nvar tryDecode = (str, decoder) => {\n try {\n return decoder(str);\n } catch {\n return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {\n try {\n return decoder(match);\n } catch {\n return match;\n }\n });\n }\n};\nvar tryDecodeURI = (str) => tryDecode(str, decodeURI);\nvar getPath = (request) => {\n const url = request.url;\n const start = url.indexOf(\"/\", url.indexOf(\":\") + 4);\n let i = start;\n for (; i < url.length; i++) {\n const charCode = url.charCodeAt(i);\n if (charCode === 37) {\n const queryIndex = url.indexOf(\"?\", i);\n const path = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);\n return tryDecodeURI(path.includes(\"%25\") ? path.replace(/%25/g, \"%2525\") : path);\n } else if (charCode === 63) {\n break;\n }\n }\n return url.slice(start, i);\n};\nvar getQueryStrings = (url) => {\n const queryIndex = url.indexOf(\"?\", 8);\n return queryIndex === -1 ? \"\" : \"?\" + url.slice(queryIndex + 1);\n};\nvar getPathNoStrict = (request) => {\n const result = getPath(request);\n return result.length > 1 && result.at(-1) === \"/\" ? result.slice(0, -1) : result;\n};\nvar mergePath = (base, sub, ...rest) => {\n if (rest.length) {\n sub = mergePath(sub, ...rest);\n }\n return `${base?.[0] === \"/\" ? \"\" : \"/\"}${base}${sub === \"/\" ? \"\" : `${base?.at(-1) === \"/\" ? \"\" : \"/\"}${sub?.[0] === \"/\" ? sub.slice(1) : sub}`}`;\n};\nvar checkOptionalParameter = (path) => {\n if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(\":\")) {\n return null;\n }\n const segments = path.split(\"/\");\n const results = [];\n let basePath = \"\";\n segments.forEach((segment) => {\n if (segment !== \"\" && !/\\:/.test(segment)) {\n basePath += \"/\" + segment;\n } else if (/\\:/.test(segment)) {\n if (/\\?/.test(segment)) {\n if (results.length === 0 && basePath === \"\") {\n results.push(\"/\");\n } else {\n results.push(basePath);\n }\n const optionalSegment = segment.replace(\"?\", \"\");\n basePath += \"/\" + optionalSegment;\n results.push(basePath);\n } else {\n basePath += \"/\" + segment;\n }\n }\n });\n return results.filter((v, i, a) => a.indexOf(v) === i);\n};\nvar _decodeURI = (value) => {\n if (!/[%+]/.test(value)) {\n return value;\n }\n if (value.indexOf(\"+\") !== -1) {\n value = value.replace(/\\+/g, \" \");\n }\n return value.indexOf(\"%\") !== -1 ? tryDecode(value, decodeURIComponent_) : value;\n};\nvar _getQueryParam = (url, key, multiple) => {\n let encoded;\n if (!multiple && key && !/[%+]/.test(key)) {\n let keyIndex2 = url.indexOf(`?${key}`, 8);\n if (keyIndex2 === -1) {\n keyIndex2 = url.indexOf(`&${key}`, 8);\n }\n while (keyIndex2 !== -1) {\n const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);\n if (trailingKeyCode === 61) {\n const valueIndex = keyIndex2 + key.length + 2;\n const endIndex = url.indexOf(\"&\", valueIndex);\n return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));\n } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {\n return \"\";\n }\n keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);\n }\n encoded = /[%+]/.test(url);\n if (!encoded) {\n return void 0;\n }\n }\n const results = {};\n encoded ??= /[%+]/.test(url);\n let keyIndex = url.indexOf(\"?\", 8);\n while (keyIndex !== -1) {\n const nextKeyIndex = url.indexOf(\"&\", keyIndex + 1);\n let valueIndex = url.indexOf(\"=\", keyIndex);\n if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {\n valueIndex = -1;\n }\n let name = url.slice(\n keyIndex + 1,\n valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex\n );\n if (encoded) {\n name = _decodeURI(name);\n }\n keyIndex = nextKeyIndex;\n if (name === \"\") {\n continue;\n }\n let value;\n if (valueIndex === -1) {\n value = \"\";\n } else {\n value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);\n if (encoded) {\n value = _decodeURI(value);\n }\n }\n if (multiple) {\n if (!(results[name] && Array.isArray(results[name]))) {\n results[name] = [];\n }\n ;\n results[name].push(value);\n } else {\n results[name] ??= value;\n }\n }\n return key ? results[key] : results;\n};\nvar getQueryParam = _getQueryParam;\nvar getQueryParams = (url, key) => {\n return _getQueryParam(url, key, true);\n};\nvar decodeURIComponent_ = decodeURIComponent;\nexport {\n checkOptionalParameter,\n decodeURIComponent_,\n getPath,\n getPathNoStrict,\n getPattern,\n getQueryParam,\n getQueryParams,\n getQueryStrings,\n mergePath,\n splitPath,\n splitRoutingPath,\n tryDecode\n};\n", "// src/request.ts\nimport { GET_MATCH_RESULT } from \"./request/constants.js\";\nimport { parseBody } from \"./utils/body.js\";\nimport { decodeURIComponent_, getQueryParam, getQueryParams, tryDecode } from \"./utils/url.js\";\nvar tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);\nvar HonoRequest = class {\n raw;\n #validatedData;\n #matchResult;\n routeIndex = 0;\n path;\n bodyCache = {};\n constructor(request, path = \"/\", matchResult = [[]]) {\n this.raw = request;\n this.path = path;\n this.#matchResult = matchResult;\n this.#validatedData = {};\n }\n param(key) {\n return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();\n }\n #getDecodedParam(key) {\n const paramKey = this.#matchResult[0][this.routeIndex][1][key];\n const param = this.#getParamValue(paramKey);\n return param && /\\%/.test(param) ? tryDecodeURIComponent(param) : param;\n }\n #getAllDecodedParams() {\n const decoded = {};\n const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);\n for (const key of keys) {\n const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);\n if (value !== void 0) {\n decoded[key] = /\\%/.test(value) ? tryDecodeURIComponent(value) : value;\n }\n }\n return decoded;\n }\n #getParamValue(paramKey) {\n return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey;\n }\n query(key) {\n return getQueryParam(this.url, key);\n }\n queries(key) {\n return getQueryParams(this.url, key);\n }\n header(name) {\n if (name) {\n return this.raw.headers.get(name) ?? void 0;\n }\n const headerData = {};\n this.raw.headers.forEach((value, key) => {\n headerData[key] = value;\n });\n return headerData;\n }\n async parseBody(options) {\n return this.bodyCache.parsedBody ??= await parseBody(this, options);\n }\n #cachedBody = (key) => {\n const { bodyCache, raw } = this;\n const cachedBody = bodyCache[key];\n if (cachedBody) {\n return cachedBody;\n }\n const anyCachedKey = Object.keys(bodyCache)[0];\n if (anyCachedKey) {\n return bodyCache[anyCachedKey].then((body) => {\n if (anyCachedKey === \"json\") {\n body = JSON.stringify(body);\n }\n return new Response(body)[key]();\n });\n }\n return bodyCache[key] = raw[key]();\n };\n json() {\n return this.#cachedBody(\"text\").then((text) => JSON.parse(text));\n }\n text() {\n return this.#cachedBody(\"text\");\n }\n arrayBuffer() {\n return this.#cachedBody(\"arrayBuffer\");\n }\n blob() {\n return this.#cachedBody(\"blob\");\n }\n formData() {\n return this.#cachedBody(\"formData\");\n }\n addValidatedData(target, data) {\n this.#validatedData[target] = data;\n }\n valid(target) {\n return this.#validatedData[target];\n }\n get url() {\n return this.raw.url;\n }\n get method() {\n return this.raw.method;\n }\n get [GET_MATCH_RESULT]() {\n return this.#matchResult;\n }\n get matchedRoutes() {\n return this.#matchResult[0].map(([[, route]]) => route);\n }\n get routePath() {\n return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;\n }\n};\nexport {\n HonoRequest\n};\n", "// src/utils/html.ts\nvar HtmlEscapedCallbackPhase = {\n Stringify: 1,\n BeforeStream: 2,\n Stream: 3\n};\nvar raw = (value, callbacks) => {\n const escapedString = new String(value);\n escapedString.isEscaped = true;\n escapedString.callbacks = callbacks;\n return escapedString;\n};\nvar escapeRe = /[&<>'\"]/;\nvar stringBufferToString = async (buffer, callbacks) => {\n let str = \"\";\n callbacks ||= [];\n const resolvedBuffer = await Promise.all(buffer);\n for (let i = resolvedBuffer.length - 1; ; i--) {\n str += resolvedBuffer[i];\n i--;\n if (i < 0) {\n break;\n }\n let r = resolvedBuffer[i];\n if (typeof r === \"object\") {\n callbacks.push(...r.callbacks || []);\n }\n const isEscaped = r.isEscaped;\n r = await (typeof r === \"object\" ? r.toString() : r);\n if (typeof r === \"object\") {\n callbacks.push(...r.callbacks || []);\n }\n if (r.isEscaped ?? isEscaped) {\n str += r;\n } else {\n const buf = [str];\n escapeToBuffer(r, buf);\n str = buf[0];\n }\n }\n return raw(str, callbacks);\n};\nvar escapeToBuffer = (str, buffer) => {\n const match = str.search(escapeRe);\n if (match === -1) {\n buffer[0] += str;\n return;\n }\n let escape;\n let index;\n let lastIndex = 0;\n for (index = match; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escape = \""\";\n break;\n case 39:\n escape = \"'\";\n break;\n case 38:\n escape = \"&\";\n break;\n case 60:\n escape = \"<\";\n break;\n case 62:\n escape = \">\";\n break;\n default:\n continue;\n }\n buffer[0] += str.substring(lastIndex, index) + escape;\n lastIndex = index + 1;\n }\n buffer[0] += str.substring(lastIndex, index);\n};\nvar resolveCallbackSync = (str) => {\n const callbacks = str.callbacks;\n if (!callbacks?.length) {\n return str;\n }\n const buffer = [str];\n const context = {};\n callbacks.forEach((c) => c({ phase: HtmlEscapedCallbackPhase.Stringify, buffer, context }));\n return buffer[0];\n};\nvar resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {\n if (typeof str === \"object\" && !(str instanceof String)) {\n if (!(str instanceof Promise)) {\n str = str.toString();\n }\n if (str instanceof Promise) {\n str = await str;\n }\n }\n const callbacks = str.callbacks;\n if (!callbacks?.length) {\n return Promise.resolve(str);\n }\n if (buffer) {\n buffer[0] += str;\n } else {\n buffer = [str];\n }\n const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(\n (res) => Promise.all(\n res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))\n ).then(() => buffer[0])\n );\n if (preserveCallbacks) {\n return raw(await resStr, callbacks);\n } else {\n return resStr;\n }\n};\nexport {\n HtmlEscapedCallbackPhase,\n escapeToBuffer,\n raw,\n resolveCallback,\n resolveCallbackSync,\n stringBufferToString\n};\n", "// src/context.ts\nimport { HonoRequest } from \"./request.js\";\nimport { HtmlEscapedCallbackPhase, resolveCallback } from \"./utils/html.js\";\nvar TEXT_PLAIN = \"text/plain; charset=UTF-8\";\nvar setDefaultContentType = (contentType, headers) => {\n return {\n \"Content-Type\": contentType,\n ...headers\n };\n};\nvar Context = class {\n #rawRequest;\n #req;\n env = {};\n #var;\n finalized = false;\n error;\n #status;\n #executionCtx;\n #res;\n #layout;\n #renderer;\n #notFoundHandler;\n #preparedHeaders;\n #matchResult;\n #path;\n constructor(req, options) {\n this.#rawRequest = req;\n if (options) {\n this.#executionCtx = options.executionCtx;\n this.env = options.env;\n this.#notFoundHandler = options.notFoundHandler;\n this.#path = options.path;\n this.#matchResult = options.matchResult;\n }\n }\n get req() {\n this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);\n return this.#req;\n }\n get event() {\n if (this.#executionCtx && \"respondWith\" in this.#executionCtx) {\n return this.#executionCtx;\n } else {\n throw Error(\"This context has no FetchEvent\");\n }\n }\n get executionCtx() {\n if (this.#executionCtx) {\n return this.#executionCtx;\n } else {\n throw Error(\"This context has no ExecutionContext\");\n }\n }\n get res() {\n return this.#res ||= new Response(null, {\n headers: this.#preparedHeaders ??= new Headers()\n });\n }\n set res(_res) {\n if (this.#res && _res) {\n _res = new Response(_res.body, _res);\n for (const [k, v] of this.#res.headers.entries()) {\n if (k === \"content-type\") {\n continue;\n }\n if (k === \"set-cookie\") {\n const cookies = this.#res.headers.getSetCookie();\n _res.headers.delete(\"set-cookie\");\n for (const cookie of cookies) {\n _res.headers.append(\"set-cookie\", cookie);\n }\n } else {\n _res.headers.set(k, v);\n }\n }\n }\n this.#res = _res;\n this.finalized = true;\n }\n render = (...args) => {\n this.#renderer ??= (content) => this.html(content);\n return this.#renderer(...args);\n };\n setLayout = (layout) => this.#layout = layout;\n getLayout = () => this.#layout;\n setRenderer = (renderer) => {\n this.#renderer = renderer;\n };\n header = (name, value, options) => {\n if (this.finalized) {\n this.#res = new Response(this.#res.body, this.#res);\n }\n const headers = this.#res ? this.#res.headers : this.#preparedHeaders ??= new Headers();\n if (value === void 0) {\n headers.delete(name);\n } else if (options?.append) {\n headers.append(name, value);\n } else {\n headers.set(name, value);\n }\n };\n status = (status) => {\n this.#status = status;\n };\n set = (key, value) => {\n this.#var ??= /* @__PURE__ */ new Map();\n this.#var.set(key, value);\n };\n get = (key) => {\n return this.#var ? this.#var.get(key) : void 0;\n };\n get var() {\n if (!this.#var) {\n return {};\n }\n return Object.fromEntries(this.#var);\n }\n #newResponse(data, arg, headers) {\n const responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders ?? new Headers();\n if (typeof arg === \"object\" && \"headers\" in arg) {\n const argHeaders = arg.headers instanceof Headers ? arg.headers : new Headers(arg.headers);\n for (const [key, value] of argHeaders) {\n if (key.toLowerCase() === \"set-cookie\") {\n responseHeaders.append(key, value);\n } else {\n responseHeaders.set(key, value);\n }\n }\n }\n if (headers) {\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v === \"string\") {\n responseHeaders.set(k, v);\n } else {\n responseHeaders.delete(k);\n for (const v2 of v) {\n responseHeaders.append(k, v2);\n }\n }\n }\n }\n const status = typeof arg === \"number\" ? arg : arg?.status ?? this.#status;\n return new Response(data, { status, headers: responseHeaders });\n }\n newResponse = (...args) => this.#newResponse(...args);\n body = (data, arg, headers) => this.#newResponse(data, arg, headers);\n text = (text, arg, headers) => {\n return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text) : this.#newResponse(\n text,\n arg,\n setDefaultContentType(TEXT_PLAIN, headers)\n );\n };\n json = (object, arg, headers) => {\n return this.#newResponse(\n JSON.stringify(object),\n arg,\n setDefaultContentType(\"application/json\", headers)\n );\n };\n html = (html, arg, headers) => {\n const res = (html2) => this.#newResponse(html2, arg, setDefaultContentType(\"text/html; charset=UTF-8\", headers));\n return typeof html === \"object\" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);\n };\n redirect = (location, status) => {\n const locationString = String(location);\n this.header(\n \"Location\",\n !/[^\\x00-\\xFF]/.test(locationString) ? locationString : encodeURI(locationString)\n );\n return this.newResponse(null, status ?? 302);\n };\n notFound = () => {\n this.#notFoundHandler ??= () => new Response();\n return this.#notFoundHandler(this);\n };\n};\nexport {\n Context,\n TEXT_PLAIN\n};\n", "// src/router.ts\nvar METHOD_NAME_ALL = \"ALL\";\nvar METHOD_NAME_ALL_LOWERCASE = \"all\";\nvar METHODS = [\"get\", \"post\", \"put\", \"delete\", \"options\", \"patch\"];\nvar MESSAGE_MATCHER_IS_ALREADY_BUILT = \"Can not add a route since the matcher is already built.\";\nvar UnsupportedPathError = class extends Error {\n};\nexport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHODS,\n METHOD_NAME_ALL,\n METHOD_NAME_ALL_LOWERCASE,\n UnsupportedPathError\n};\n", "// src/utils/constants.ts\nvar COMPOSED_HANDLER = \"__COMPOSED_HANDLER\";\nexport {\n COMPOSED_HANDLER\n};\n", "// src/hono-base.ts\nimport { compose } from \"./compose.js\";\nimport { Context } from \"./context.js\";\nimport { METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE } from \"./router.js\";\nimport { COMPOSED_HANDLER } from \"./utils/constants.js\";\nimport { getPath, getPathNoStrict, mergePath } from \"./utils/url.js\";\nvar notFoundHandler = (c) => {\n return c.text(\"404 Not Found\", 404);\n};\nvar errorHandler = (err, c) => {\n if (\"getResponse\" in err) {\n const res = err.getResponse();\n return c.newResponse(res.body, res);\n }\n console.error(err);\n return c.text(\"Internal Server Error\", 500);\n};\nvar Hono = class {\n get;\n post;\n put;\n delete;\n options;\n patch;\n all;\n on;\n use;\n router;\n getPath;\n _basePath = \"/\";\n #path = \"/\";\n routes = [];\n constructor(options = {}) {\n const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];\n allMethods.forEach((method) => {\n this[method] = (args1, ...args) => {\n if (typeof args1 === \"string\") {\n this.#path = args1;\n } else {\n this.#addRoute(method, this.#path, args1);\n }\n args.forEach((handler) => {\n this.#addRoute(method, this.#path, handler);\n });\n return this;\n };\n });\n this.on = (method, path, ...handlers) => {\n for (const p of [path].flat()) {\n this.#path = p;\n for (const m of [method].flat()) {\n handlers.map((handler) => {\n this.#addRoute(m.toUpperCase(), this.#path, handler);\n });\n }\n }\n return this;\n };\n this.use = (arg1, ...handlers) => {\n if (typeof arg1 === \"string\") {\n this.#path = arg1;\n } else {\n this.#path = \"*\";\n handlers.unshift(arg1);\n }\n handlers.forEach((handler) => {\n this.#addRoute(METHOD_NAME_ALL, this.#path, handler);\n });\n return this;\n };\n const { strict, ...optionsWithoutStrict } = options;\n Object.assign(this, optionsWithoutStrict);\n this.getPath = strict ?? true ? options.getPath ?? getPath : getPathNoStrict;\n }\n #clone() {\n const clone = new Hono({\n router: this.router,\n getPath: this.getPath\n });\n clone.errorHandler = this.errorHandler;\n clone.#notFoundHandler = this.#notFoundHandler;\n clone.routes = this.routes;\n return clone;\n }\n #notFoundHandler = notFoundHandler;\n errorHandler = errorHandler;\n route(path, app) {\n const subApp = this.basePath(path);\n app.routes.map((r) => {\n let handler;\n if (app.errorHandler === errorHandler) {\n handler = r.handler;\n } else {\n handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;\n handler[COMPOSED_HANDLER] = r.handler;\n }\n subApp.#addRoute(r.method, r.path, handler);\n });\n return this;\n }\n basePath(path) {\n const subApp = this.#clone();\n subApp._basePath = mergePath(this._basePath, path);\n return subApp;\n }\n onError = (handler) => {\n this.errorHandler = handler;\n return this;\n };\n notFound = (handler) => {\n this.#notFoundHandler = handler;\n return this;\n };\n mount(path, applicationHandler, options) {\n let replaceRequest;\n let optionHandler;\n if (options) {\n if (typeof options === \"function\") {\n optionHandler = options;\n } else {\n optionHandler = options.optionHandler;\n if (options.replaceRequest === false) {\n replaceRequest = (request) => request;\n } else {\n replaceRequest = options.replaceRequest;\n }\n }\n }\n const getOptions = optionHandler ? (c) => {\n const options2 = optionHandler(c);\n return Array.isArray(options2) ? options2 : [options2];\n } : (c) => {\n let executionContext = void 0;\n try {\n executionContext = c.executionCtx;\n } catch {\n }\n return [c.env, executionContext];\n };\n replaceRequest ||= (() => {\n const mergedPath = mergePath(this._basePath, path);\n const pathPrefixLength = mergedPath === \"/\" ? 0 : mergedPath.length;\n return (request) => {\n const url = new URL(request.url);\n url.pathname = url.pathname.slice(pathPrefixLength) || \"/\";\n return new Request(url, request);\n };\n })();\n const handler = async (c, next) => {\n const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));\n if (res) {\n return res;\n }\n await next();\n };\n this.#addRoute(METHOD_NAME_ALL, mergePath(path, \"*\"), handler);\n return this;\n }\n #addRoute(method, path, handler) {\n method = method.toUpperCase();\n path = mergePath(this._basePath, path);\n const r = { basePath: this._basePath, path, method, handler };\n this.router.add(method, path, [handler, r]);\n this.routes.push(r);\n }\n #handleError(err, c) {\n if (err instanceof Error) {\n return this.errorHandler(err, c);\n }\n throw err;\n }\n #dispatch(request, executionCtx, env, method) {\n if (method === \"HEAD\") {\n return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, \"GET\")))();\n }\n const path = this.getPath(request, { env });\n const matchResult = this.router.match(method, path);\n const c = new Context(request, {\n path,\n matchResult,\n env,\n executionCtx,\n notFoundHandler: this.#notFoundHandler\n });\n if (matchResult[0].length === 1) {\n let res;\n try {\n res = matchResult[0][0][0][0](c, async () => {\n c.res = await this.#notFoundHandler(c);\n });\n } catch (err) {\n return this.#handleError(err, c);\n }\n return res instanceof Promise ? res.then(\n (resolved) => resolved || (c.finalized ? c.res : this.#notFoundHandler(c))\n ).catch((err) => this.#handleError(err, c)) : res ?? this.#notFoundHandler(c);\n }\n const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler);\n return (async () => {\n try {\n const context = await composed(c);\n if (!context.finalized) {\n throw new Error(\n \"Context is not finalized. Did you forget to return a Response object or `await next()`?\"\n );\n }\n return context.res;\n } catch (err) {\n return this.#handleError(err, c);\n }\n })();\n }\n fetch = (request, ...rest) => {\n return this.#dispatch(request, rest[1], rest[0], request.method);\n };\n request = (input, requestInit, Env, executionCtx) => {\n if (input instanceof Request) {\n return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx);\n }\n input = input.toString();\n return this.fetch(\n new Request(\n /^https?:\\/\\//.test(input) ? input : `http://localhost${mergePath(\"/\", input)}`,\n requestInit\n ),\n Env,\n executionCtx\n );\n };\n fire = () => {\n addEventListener(\"fetch\", (event) => {\n event.respondWith(this.#dispatch(event.request, event, void 0, event.request.method));\n });\n };\n};\nexport {\n Hono as HonoBase\n};\n", "// src/router/reg-exp-router/matcher.ts\nimport { METHOD_NAME_ALL } from \"../../router.js\";\nvar emptyParam = [];\nfunction match(method, path) {\n const matchers = this.buildAllMatchers();\n const match2 = (method2, path2) => {\n const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];\n const staticMatch = matcher[2][path2];\n if (staticMatch) {\n return staticMatch;\n }\n const match3 = path2.match(matcher[0]);\n if (!match3) {\n return [[], emptyParam];\n }\n const index = match3.indexOf(\"\", 1);\n return [matcher[1][index], match3];\n };\n this.match = match2;\n return match2(method, path);\n}\nexport {\n emptyParam,\n match\n};\n", "// src/router/reg-exp-router/node.ts\nvar LABEL_REG_EXP_STR = \"[^/]+\";\nvar ONLY_WILDCARD_REG_EXP_STR = \".*\";\nvar TAIL_WILDCARD_REG_EXP_STR = \"(?:|/.*)\";\nvar PATH_ERROR = Symbol();\nvar regExpMetaChars = new Set(\".\\\\+*[^]$()\");\nfunction compareKey(a, b) {\n if (a.length === 1) {\n return b.length === 1 ? a < b ? -1 : 1 : -1;\n }\n if (b.length === 1) {\n return 1;\n }\n if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {\n return 1;\n } else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {\n return -1;\n }\n if (a === LABEL_REG_EXP_STR) {\n return 1;\n } else if (b === LABEL_REG_EXP_STR) {\n return -1;\n }\n return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;\n}\nvar Node = class {\n #index;\n #varIndex;\n #children = /* @__PURE__ */ Object.create(null);\n insert(tokens, index, paramMap, context, pathErrorCheckOnly) {\n if (tokens.length === 0) {\n if (this.#index !== void 0) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n this.#index = index;\n return;\n }\n const [token, ...restTokens] = tokens;\n const pattern = token === \"*\" ? restTokens.length === 0 ? [\"\", \"\", ONLY_WILDCARD_REG_EXP_STR] : [\"\", \"\", LABEL_REG_EXP_STR] : token === \"/*\" ? [\"\", \"\", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\\:([^\\{\\}]+)(?:\\{(.+)\\})?$/);\n let node;\n if (pattern) {\n const name = pattern[1];\n let regexpStr = pattern[2] || LABEL_REG_EXP_STR;\n if (name && pattern[2]) {\n if (regexpStr === \".*\") {\n throw PATH_ERROR;\n }\n regexpStr = regexpStr.replace(/^\\((?!\\?:)(?=[^)]+\\)$)/, \"(?:\");\n if (/\\((?!\\?:)/.test(regexpStr)) {\n throw PATH_ERROR;\n }\n }\n node = this.#children[regexpStr];\n if (!node) {\n if (Object.keys(this.#children).some(\n (k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.#children[regexpStr] = new Node();\n if (name !== \"\") {\n node.#varIndex = context.varIndex++;\n }\n }\n if (!pathErrorCheckOnly && name !== \"\") {\n paramMap.push([name, node.#varIndex]);\n }\n } else {\n node = this.#children[token];\n if (!node) {\n if (Object.keys(this.#children).some(\n (k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR\n )) {\n throw PATH_ERROR;\n }\n if (pathErrorCheckOnly) {\n return;\n }\n node = this.#children[token] = new Node();\n }\n }\n node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);\n }\n buildRegExpStr() {\n const childKeys = Object.keys(this.#children).sort(compareKey);\n const strList = childKeys.map((k) => {\n const c = this.#children[k];\n return (typeof c.#varIndex === \"number\" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\\\${k}` : k) + c.buildRegExpStr();\n });\n if (typeof this.#index === \"number\") {\n strList.unshift(`#${this.#index}`);\n }\n if (strList.length === 0) {\n return \"\";\n }\n if (strList.length === 1) {\n return strList[0];\n }\n return \"(?:\" + strList.join(\"|\") + \")\";\n }\n};\nexport {\n Node,\n PATH_ERROR\n};\n", "// src/router/reg-exp-router/trie.ts\nimport { Node } from \"./node.js\";\nvar Trie = class {\n #context = { varIndex: 0 };\n #root = new Node();\n insert(path, index, pathErrorCheckOnly) {\n const paramAssoc = [];\n const groups = [];\n for (let i = 0; ; ) {\n let replaced = false;\n path = path.replace(/\\{[^}]+\\}/g, (m) => {\n const mark = `@\\\\${i}`;\n groups[i] = [mark, m];\n i++;\n replaced = true;\n return mark;\n });\n if (!replaced) {\n break;\n }\n }\n const tokens = path.match(/(?::[^\\/]+)|(?:\\/\\*$)|./g) || [];\n for (let i = groups.length - 1; i >= 0; i--) {\n const [mark] = groups[i];\n for (let j = tokens.length - 1; j >= 0; j--) {\n if (tokens[j].indexOf(mark) !== -1) {\n tokens[j] = tokens[j].replace(mark, groups[i][1]);\n break;\n }\n }\n }\n this.#root.insert(tokens, index, paramAssoc, this.#context, pathErrorCheckOnly);\n return paramAssoc;\n }\n buildRegExp() {\n let regexp = this.#root.buildRegExpStr();\n if (regexp === \"\") {\n return [/^$/, [], []];\n }\n let captureIndex = 0;\n const indexReplacementMap = [];\n const paramReplacementMap = [];\n regexp = regexp.replace(/#(\\d+)|@(\\d+)|\\.\\*\\$/g, (_, handlerIndex, paramIndex) => {\n if (handlerIndex !== void 0) {\n indexReplacementMap[++captureIndex] = Number(handlerIndex);\n return \"$()\";\n }\n if (paramIndex !== void 0) {\n paramReplacementMap[Number(paramIndex)] = ++captureIndex;\n return \"\";\n }\n return \"\";\n });\n return [new RegExp(`^${regexp}`), indexReplacementMap, paramReplacementMap];\n }\n};\nexport {\n Trie\n};\n", "// src/router/reg-exp-router/router.ts\nimport {\n MESSAGE_MATCHER_IS_ALREADY_BUILT,\n METHOD_NAME_ALL,\n UnsupportedPathError\n} from \"../../router.js\";\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { match, emptyParam } from \"./matcher.js\";\nimport { PATH_ERROR } from \"./node.js\";\nimport { Trie } from \"./trie.js\";\nvar nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];\nvar wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\nfunction buildWildcardRegExp(path) {\n return wildcardRegExpCache[path] ??= new RegExp(\n path === \"*\" ? \"\" : `^${path.replace(\n /\\/\\*$|([.\\\\+*[^\\]$()])/g,\n (_, metaChar) => metaChar ? `\\\\${metaChar}` : \"(?:|/.*)\"\n )}$`\n );\n}\nfunction clearWildcardRegExpCache() {\n wildcardRegExpCache = /* @__PURE__ */ Object.create(null);\n}\nfunction buildMatcherFromPreprocessedRoutes(routes) {\n const trie = new Trie();\n const handlerData = [];\n if (routes.length === 0) {\n return nullMatcher;\n }\n const routesWithStaticPathFlag = routes.map(\n (route) => [!/\\*|\\/:/.test(route[0]), ...route]\n ).sort(\n ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length\n );\n const staticMap = /* @__PURE__ */ Object.create(null);\n for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {\n const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];\n if (pathErrorCheckOnly) {\n staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];\n } else {\n j++;\n }\n let paramAssoc;\n try {\n paramAssoc = trie.insert(path, j, pathErrorCheckOnly);\n } catch (e) {\n throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;\n }\n if (pathErrorCheckOnly) {\n continue;\n }\n handlerData[j] = handlers.map(([h, paramCount]) => {\n const paramIndexMap = /* @__PURE__ */ Object.create(null);\n paramCount -= 1;\n for (; paramCount >= 0; paramCount--) {\n const [key, value] = paramAssoc[paramCount];\n paramIndexMap[key] = value;\n }\n return [h, paramIndexMap];\n });\n }\n const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();\n for (let i = 0, len = handlerData.length; i < len; i++) {\n for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {\n const map = handlerData[i][j]?.[1];\n if (!map) {\n continue;\n }\n const keys = Object.keys(map);\n for (let k = 0, len3 = keys.length; k < len3; k++) {\n map[keys[k]] = paramReplacementMap[map[keys[k]]];\n }\n }\n }\n const handlerMap = [];\n for (const i in indexReplacementMap) {\n handlerMap[i] = handlerData[indexReplacementMap[i]];\n }\n return [regexp, handlerMap, staticMap];\n}\nfunction findMiddleware(middleware, path) {\n if (!middleware) {\n return void 0;\n }\n for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {\n if (buildWildcardRegExp(k).test(path)) {\n return [...middleware[k]];\n }\n }\n return void 0;\n}\nvar RegExpRouter = class {\n name = \"RegExpRouter\";\n #middleware;\n #routes;\n constructor() {\n this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };\n }\n add(method, path, handler) {\n const middleware = this.#middleware;\n const routes = this.#routes;\n if (!middleware || !routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n if (!middleware[method]) {\n ;\n [middleware, routes].forEach((handlerMap) => {\n handlerMap[method] = /* @__PURE__ */ Object.create(null);\n Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {\n handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];\n });\n });\n }\n if (path === \"/*\") {\n path = \"*\";\n }\n const paramCount = (path.match(/\\/:/g) || []).length;\n if (/\\*$/.test(path)) {\n const re = buildWildcardRegExp(path);\n if (method === METHOD_NAME_ALL) {\n Object.keys(middleware).forEach((m) => {\n middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n });\n } else {\n middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];\n }\n Object.keys(middleware).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(middleware[m]).forEach((p) => {\n re.test(p) && middleware[m][p].push([handler, paramCount]);\n });\n }\n });\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n Object.keys(routes[m]).forEach(\n (p) => re.test(p) && routes[m][p].push([handler, paramCount])\n );\n }\n });\n return;\n }\n const paths = checkOptionalParameter(path) || [path];\n for (let i = 0, len = paths.length; i < len; i++) {\n const path2 = paths[i];\n Object.keys(routes).forEach((m) => {\n if (method === METHOD_NAME_ALL || method === m) {\n routes[m][path2] ||= [\n ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []\n ];\n routes[m][path2].push([handler, paramCount - len + i + 1]);\n }\n });\n }\n }\n match = match;\n buildAllMatchers() {\n const matchers = /* @__PURE__ */ Object.create(null);\n Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => {\n matchers[method] ||= this.#buildMatcher(method);\n });\n this.#middleware = this.#routes = void 0;\n clearWildcardRegExpCache();\n return matchers;\n }\n #buildMatcher(method) {\n const routes = [];\n let hasOwnRoute = method === METHOD_NAME_ALL;\n [this.#middleware, this.#routes].forEach((r) => {\n const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];\n if (ownRoute.length !== 0) {\n hasOwnRoute ||= true;\n routes.push(...ownRoute);\n } else if (method !== METHOD_NAME_ALL) {\n routes.push(\n ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])\n );\n }\n });\n if (!hasOwnRoute) {\n return null;\n } else {\n return buildMatcherFromPreprocessedRoutes(routes);\n }\n }\n};\nexport {\n RegExpRouter\n};\n", "// src/router/smart-router/router.ts\nimport { MESSAGE_MATCHER_IS_ALREADY_BUILT, UnsupportedPathError } from \"../../router.js\";\nvar SmartRouter = class {\n name = \"SmartRouter\";\n #routers = [];\n #routes = [];\n constructor(init) {\n this.#routers = init.routers;\n }\n add(method, path, handler) {\n if (!this.#routes) {\n throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);\n }\n this.#routes.push([method, path, handler]);\n }\n match(method, path) {\n if (!this.#routes) {\n throw new Error(\"Fatal error\");\n }\n const routers = this.#routers;\n const routes = this.#routes;\n const len = routers.length;\n let i = 0;\n let res;\n for (; i < len; i++) {\n const router = routers[i];\n try {\n for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {\n router.add(...routes[i2]);\n }\n res = router.match(method, path);\n } catch (e) {\n if (e instanceof UnsupportedPathError) {\n continue;\n }\n throw e;\n }\n this.match = router.match.bind(router);\n this.#routers = [router];\n this.#routes = void 0;\n break;\n }\n if (i === len) {\n throw new Error(\"Fatal error\");\n }\n this.name = `SmartRouter + ${this.activeRouter.name}`;\n return res;\n }\n get activeRouter() {\n if (this.#routes || this.#routers.length !== 1) {\n throw new Error(\"No active router has been determined yet.\");\n }\n return this.#routers[0];\n }\n};\nexport {\n SmartRouter\n};\n", "// src/router/trie-router/node.ts\nimport { METHOD_NAME_ALL } from \"../../router.js\";\nimport { getPattern, splitPath, splitRoutingPath } from \"../../utils/url.js\";\nvar emptyParams = /* @__PURE__ */ Object.create(null);\nvar Node = class {\n #methods;\n #children;\n #patterns;\n #order = 0;\n #params = emptyParams;\n constructor(method, handler, children) {\n this.#children = children || /* @__PURE__ */ Object.create(null);\n this.#methods = [];\n if (method && handler) {\n const m = /* @__PURE__ */ Object.create(null);\n m[method] = { handler, possibleKeys: [], score: 0 };\n this.#methods = [m];\n }\n this.#patterns = [];\n }\n insert(method, path, handler) {\n this.#order = ++this.#order;\n let curNode = this;\n const parts = splitRoutingPath(path);\n const possibleKeys = [];\n for (let i = 0, len = parts.length; i < len; i++) {\n const p = parts[i];\n const nextP = parts[i + 1];\n const pattern = getPattern(p, nextP);\n const key = Array.isArray(pattern) ? pattern[0] : p;\n if (key in curNode.#children) {\n curNode = curNode.#children[key];\n if (pattern) {\n possibleKeys.push(pattern[1]);\n }\n continue;\n }\n curNode.#children[key] = new Node();\n if (pattern) {\n curNode.#patterns.push(pattern);\n possibleKeys.push(pattern[1]);\n }\n curNode = curNode.#children[key];\n }\n curNode.#methods.push({\n [method]: {\n handler,\n possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),\n score: this.#order\n }\n });\n return curNode;\n }\n #getHandlerSets(node, method, nodeParams, params) {\n const handlerSets = [];\n for (let i = 0, len = node.#methods.length; i < len; i++) {\n const m = node.#methods[i];\n const handlerSet = m[method] || m[METHOD_NAME_ALL];\n const processedSet = {};\n if (handlerSet !== void 0) {\n handlerSet.params = /* @__PURE__ */ Object.create(null);\n handlerSets.push(handlerSet);\n if (nodeParams !== emptyParams || params && params !== emptyParams) {\n for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {\n const key = handlerSet.possibleKeys[i2];\n const processed = processedSet[handlerSet.score];\n handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];\n processedSet[handlerSet.score] = true;\n }\n }\n }\n }\n return handlerSets;\n }\n search(method, path) {\n const handlerSets = [];\n this.#params = emptyParams;\n const curNode = this;\n let curNodes = [curNode];\n const parts = splitPath(path);\n const curNodesQueue = [];\n for (let i = 0, len = parts.length; i < len; i++) {\n const part = parts[i];\n const isLast = i === len - 1;\n const tempNodes = [];\n for (let j = 0, len2 = curNodes.length; j < len2; j++) {\n const node = curNodes[j];\n const nextNode = node.#children[part];\n if (nextNode) {\n nextNode.#params = node.#params;\n if (isLast) {\n if (nextNode.#children[\"*\"]) {\n handlerSets.push(\n ...this.#getHandlerSets(nextNode.#children[\"*\"], method, node.#params)\n );\n }\n handlerSets.push(...this.#getHandlerSets(nextNode, method, node.#params));\n } else {\n tempNodes.push(nextNode);\n }\n }\n for (let k = 0, len3 = node.#patterns.length; k < len3; k++) {\n const pattern = node.#patterns[k];\n const params = node.#params === emptyParams ? {} : { ...node.#params };\n if (pattern === \"*\") {\n const astNode = node.#children[\"*\"];\n if (astNode) {\n handlerSets.push(...this.#getHandlerSets(astNode, method, node.#params));\n astNode.#params = params;\n tempNodes.push(astNode);\n }\n continue;\n }\n const [key, name, matcher] = pattern;\n if (!part && !(matcher instanceof RegExp)) {\n continue;\n }\n const child = node.#children[key];\n const restPathString = parts.slice(i).join(\"/\");\n if (matcher instanceof RegExp) {\n const m = matcher.exec(restPathString);\n if (m) {\n params[name] = m[0];\n handlerSets.push(...this.#getHandlerSets(child, method, node.#params, params));\n if (Object.keys(child.#children).length) {\n child.#params = params;\n const componentCount = m[0].match(/\\//)?.length ?? 0;\n const targetCurNodes = curNodesQueue[componentCount] ||= [];\n targetCurNodes.push(child);\n }\n continue;\n }\n }\n if (matcher === true || matcher.test(part)) {\n params[name] = part;\n if (isLast) {\n handlerSets.push(...this.#getHandlerSets(child, method, params, node.#params));\n if (child.#children[\"*\"]) {\n handlerSets.push(\n ...this.#getHandlerSets(child.#children[\"*\"], method, params, node.#params)\n );\n }\n } else {\n child.#params = params;\n tempNodes.push(child);\n }\n }\n }\n }\n curNodes = tempNodes.concat(curNodesQueue.shift() ?? []);\n }\n if (handlerSets.length > 1) {\n handlerSets.sort((a, b) => {\n return a.score - b.score;\n });\n }\n return [handlerSets.map(({ handler, params }) => [handler, params])];\n }\n};\nexport {\n Node\n};\n", "// src/router/trie-router/router.ts\nimport { checkOptionalParameter } from \"../../utils/url.js\";\nimport { Node } from \"./node.js\";\nvar TrieRouter = class {\n name = \"TrieRouter\";\n #node;\n constructor() {\n this.#node = new Node();\n }\n add(method, path, handler) {\n const results = checkOptionalParameter(path);\n if (results) {\n for (let i = 0, len = results.length; i < len; i++) {\n this.#node.insert(method, results[i], handler);\n }\n return;\n }\n this.#node.insert(method, path, handler);\n }\n match(method, path) {\n return this.#node.search(method, path);\n }\n};\nexport {\n TrieRouter\n};\n", "// src/hono.ts\nimport { HonoBase } from \"./hono-base.js\";\nimport { RegExpRouter } from \"./router/reg-exp-router/index.js\";\nimport { SmartRouter } from \"./router/smart-router/index.js\";\nimport { TrieRouter } from \"./router/trie-router/index.js\";\nvar Hono = class extends HonoBase {\n constructor(options = {}) {\n super(options);\n this.router = options.router ?? new SmartRouter({\n routers: [new RegExpRouter(), new TrieRouter()]\n });\n }\n};\nexport {\n Hono\n};\n", "// src/utils/compress.ts\nvar COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\\s*(?:text\\/(?!event-stream(?:[;\\s]|$))[^;\\s]+|application\\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\\.dart|vnd\\.ms-fontobject|vnd\\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\\/(?:otf|ttf)|image\\/(?:bmp|vnd\\.adobe\\.photoshop|vnd\\.microsoft\\.icon|vnd\\.ms-dds|x-icon|x-ms-bmp)|message\\/rfc822|model\\/gltf-binary|x-shader\\/x-fragment|x-shader\\/x-vertex|[^;\\s]+?\\+(?:json|text|xml|yaml))(?:[;\\s]|$)/i;\nexport {\n COMPRESSIBLE_CONTENT_TYPE_REGEX\n};\n", "// src/utils/mime.ts\nvar getMimeType = (filename, mimes = baseMimes) => {\n const regexp = /\\.([a-zA-Z0-9]+?)$/;\n const match = filename.match(regexp);\n if (!match) {\n return;\n }\n let mimeType = mimes[match[1]];\n if (mimeType && mimeType.startsWith(\"text\")) {\n mimeType += \"; charset=utf-8\";\n }\n return mimeType;\n};\nvar getExtension = (mimeType) => {\n for (const ext in baseMimes) {\n if (baseMimes[ext] === mimeType) {\n return ext;\n }\n }\n};\nvar _baseMimes = {\n aac: \"audio/aac\",\n avi: \"video/x-msvideo\",\n avif: \"image/avif\",\n av1: \"video/av1\",\n bin: \"application/octet-stream\",\n bmp: \"image/bmp\",\n css: \"text/css\",\n csv: \"text/csv\",\n eot: \"application/vnd.ms-fontobject\",\n epub: \"application/epub+zip\",\n gif: \"image/gif\",\n gz: \"application/gzip\",\n htm: \"text/html\",\n html: \"text/html\",\n ico: \"image/x-icon\",\n ics: \"text/calendar\",\n jpeg: \"image/jpeg\",\n jpg: \"image/jpeg\",\n js: \"text/javascript\",\n json: \"application/json\",\n jsonld: \"application/ld+json\",\n map: \"application/json\",\n mid: \"audio/x-midi\",\n midi: \"audio/x-midi\",\n mjs: \"text/javascript\",\n mp3: \"audio/mpeg\",\n mp4: \"video/mp4\",\n mpeg: \"video/mpeg\",\n oga: \"audio/ogg\",\n ogv: \"video/ogg\",\n ogx: \"application/ogg\",\n opus: \"audio/opus\",\n otf: \"font/otf\",\n pdf: \"application/pdf\",\n png: \"image/png\",\n rtf: \"application/rtf\",\n svg: \"image/svg+xml\",\n tif: \"image/tiff\",\n tiff: \"image/tiff\",\n ts: \"video/mp2t\",\n ttf: \"font/ttf\",\n txt: \"text/plain\",\n wasm: \"application/wasm\",\n webm: \"video/webm\",\n weba: \"audio/webm\",\n webmanifest: \"application/manifest+json\",\n webp: \"image/webp\",\n woff: \"font/woff\",\n woff2: \"font/woff2\",\n xhtml: \"application/xhtml+xml\",\n xml: \"application/xml\",\n zip: \"application/zip\",\n \"3gp\": \"video/3gpp\",\n \"3g2\": \"video/3gpp2\",\n gltf: \"model/gltf+json\",\n glb: \"model/gltf-binary\"\n};\nvar baseMimes = _baseMimes;\nexport {\n getExtension,\n getMimeType,\n baseMimes as mimes\n};\n", "// src/middleware/serve-static/path.ts\nvar defaultJoin = (...paths) => {\n let result = paths.filter((p) => p !== \"\").join(\"/\");\n result = result.replace(/(?<=\\/)\\/+/g, \"\");\n const segments = result.split(\"/\");\n const resolved = [];\n for (const segment of segments) {\n if (segment === \"..\" && resolved.length > 0 && resolved.at(-1) !== \"..\") {\n resolved.pop();\n } else if (segment !== \".\") {\n resolved.push(segment);\n }\n }\n return resolved.join(\"/\") || \".\";\n};\nexport {\n defaultJoin\n};\n", "// src/middleware/serve-static/index.ts\nimport { COMPRESSIBLE_CONTENT_TYPE_REGEX } from \"../../utils/compress.js\";\nimport { getMimeType } from \"../../utils/mime.js\";\nimport { defaultJoin } from \"./path.js\";\nvar ENCODINGS = {\n br: \".br\",\n zstd: \".zst\",\n gzip: \".gz\"\n};\nvar ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);\nvar DEFAULT_DOCUMENT = \"index.html\";\nvar serveStatic = (options) => {\n const root = options.root ?? \"./\";\n const optionPath = options.path;\n const join = options.join ?? defaultJoin;\n return async (c, next) => {\n if (c.finalized) {\n return next();\n }\n let filename;\n if (options.path) {\n filename = options.path;\n } else {\n try {\n filename = decodeURIComponent(c.req.path);\n if (/(?:^|[\\/\\\\])\\.\\.(?:$|[\\/\\\\])/.test(filename)) {\n throw new Error();\n }\n } catch {\n await options.onNotFound?.(c.req.path, c);\n return next();\n }\n }\n let path = join(\n root,\n !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename\n );\n if (options.isDir && await options.isDir(path)) {\n path = join(path, DEFAULT_DOCUMENT);\n }\n const getContent = options.getContent;\n let content = await getContent(path, c);\n if (content instanceof Response) {\n return c.newResponse(content.body, content);\n }\n if (content) {\n const mimeType = options.mimes && getMimeType(path, options.mimes) || getMimeType(path);\n c.header(\"Content-Type\", mimeType || \"application/octet-stream\");\n if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {\n const acceptEncodingSet = new Set(\n c.req.header(\"Accept-Encoding\")?.split(\",\").map((encoding) => encoding.trim())\n );\n for (const encoding of ENCODINGS_ORDERED_KEYS) {\n if (!acceptEncodingSet.has(encoding)) {\n continue;\n }\n const compressedContent = await getContent(path + ENCODINGS[encoding], c);\n if (compressedContent) {\n content = compressedContent;\n c.header(\"Content-Encoding\", encoding);\n c.header(\"Vary\", \"Accept-Encoding\", { append: true });\n break;\n }\n }\n }\n await options.onFound?.(path, c);\n return c.body(content);\n }\n await options.onNotFound?.(path, c);\n await next();\n return;\n };\n};\nexport {\n serveStatic\n};\n", "// src/adapter/cloudflare-workers/utils.ts\nvar getContentFromKVAsset = async (path, options) => {\n let ASSET_MANIFEST;\n if (options && options.manifest) {\n if (typeof options.manifest === \"string\") {\n ASSET_MANIFEST = JSON.parse(options.manifest);\n } else {\n ASSET_MANIFEST = options.manifest;\n }\n } else {\n if (typeof __STATIC_CONTENT_MANIFEST === \"string\") {\n ASSET_MANIFEST = JSON.parse(__STATIC_CONTENT_MANIFEST);\n } else {\n ASSET_MANIFEST = __STATIC_CONTENT_MANIFEST;\n }\n }\n let ASSET_NAMESPACE;\n if (options && options.namespace) {\n ASSET_NAMESPACE = options.namespace;\n } else {\n ASSET_NAMESPACE = __STATIC_CONTENT;\n }\n const key = ASSET_MANIFEST[path] || path;\n if (!key) {\n return null;\n }\n const content = await ASSET_NAMESPACE.get(key, { type: \"stream\" });\n if (!content) {\n return null;\n }\n return content;\n};\nexport {\n getContentFromKVAsset\n};\n", "// src/adapter/cloudflare-workers/serve-static.ts\nimport { serveStatic as baseServeStatic } from \"../../middleware/serve-static/index.js\";\nimport { getContentFromKVAsset } from \"./utils.js\";\nvar serveStatic = (options) => {\n return async function serveStatic2(c, next) {\n const getContent = async (path) => {\n return getContentFromKVAsset(path, {\n manifest: options.manifest,\n namespace: options.namespace ? options.namespace : c.env ? c.env.__STATIC_CONTENT : void 0\n });\n };\n return baseServeStatic({\n ...options,\n getContent\n })(c, next);\n };\n};\nexport {\n serveStatic\n};\n", "// src/adapter/cloudflare-workers/serve-static-module.ts\nimport { serveStatic } from \"./serve-static.js\";\nvar module = (options) => {\n return serveStatic(options);\n};\nexport {\n module as serveStatic\n};\n", "// src/helper/websocket/index.ts\nvar WSContext = class {\n #init;\n constructor(init) {\n this.#init = init;\n this.raw = init.raw;\n this.url = init.url ? new URL(init.url) : null;\n this.protocol = init.protocol ?? null;\n }\n send(source, options) {\n this.#init.send(source, options ?? {});\n }\n raw;\n binaryType = \"arraybuffer\";\n get readyState() {\n return this.#init.readyState;\n }\n url;\n protocol;\n close(code, reason) {\n this.#init.close(code, reason);\n }\n};\nvar createWSMessageEvent = (source) => {\n return new MessageEvent(\"message\", {\n data: source\n });\n};\nvar defineWebSocketHelper = (handler) => {\n return (...args) => {\n if (typeof args[0] === \"function\") {\n const [createEvents, options] = args;\n return async function upgradeWebSocket(c, next) {\n const events = await createEvents(c);\n const result = await handler(c, events, options);\n if (result) {\n return result;\n }\n await next();\n };\n } else {\n const [c, events, options] = args;\n return (async () => {\n const upgraded = await handler(c, events, options);\n if (!upgraded) {\n throw new Error(\"Failed to upgrade WebSocket\");\n }\n return upgraded;\n })();\n }\n };\n};\nexport {\n WSContext,\n createWSMessageEvent,\n defineWebSocketHelper\n};\n", "// src/adapter/cloudflare-workers/websocket.ts\nimport { WSContext, defineWebSocketHelper } from \"../../helper/websocket/index.js\";\nvar upgradeWebSocket = defineWebSocketHelper(async (c, events) => {\n const upgradeHeader = c.req.header(\"Upgrade\");\n if (upgradeHeader !== \"websocket\") {\n return;\n }\n const webSocketPair = new WebSocketPair();\n const client = webSocketPair[0];\n const server = webSocketPair[1];\n const wsContext = new WSContext({\n close: (code, reason) => server.close(code, reason),\n get protocol() {\n return server.protocol;\n },\n raw: server,\n get readyState() {\n return server.readyState;\n },\n url: server.url ? new URL(server.url) : null,\n send: (source) => server.send(source)\n });\n if (events.onClose) {\n server.addEventListener(\"close\", (evt) => events.onClose?.(evt, wsContext));\n }\n if (events.onMessage) {\n server.addEventListener(\"message\", (evt) => events.onMessage?.(evt, wsContext));\n }\n if (events.onError) {\n server.addEventListener(\"error\", (evt) => events.onError?.(evt, wsContext));\n }\n server.accept?.();\n return new Response(null, {\n status: 101,\n webSocket: client\n });\n});\nexport {\n upgradeWebSocket\n};\n", "// src/middleware/cors/index.ts\nvar cors = (options) => {\n const defaults = {\n origin: \"*\",\n allowMethods: [\"GET\", \"HEAD\", \"PUT\", \"POST\", \"DELETE\", \"PATCH\"],\n allowHeaders: [],\n exposeHeaders: []\n };\n const opts = {\n ...defaults,\n ...options\n };\n const findAllowOrigin = ((optsOrigin) => {\n if (typeof optsOrigin === \"string\") {\n if (optsOrigin === \"*\") {\n return () => optsOrigin;\n } else {\n return (origin) => optsOrigin === origin ? origin : null;\n }\n } else if (typeof optsOrigin === \"function\") {\n return optsOrigin;\n } else {\n return (origin) => optsOrigin.includes(origin) ? origin : null;\n }\n })(opts.origin);\n const findAllowMethods = ((optsAllowMethods) => {\n if (typeof optsAllowMethods === \"function\") {\n return optsAllowMethods;\n } else if (Array.isArray(optsAllowMethods)) {\n return () => optsAllowMethods;\n } else {\n return () => [];\n }\n })(opts.allowMethods);\n return async function cors2(c, next) {\n function set(key, value) {\n c.res.headers.set(key, value);\n }\n const allowOrigin = await findAllowOrigin(c.req.header(\"origin\") || \"\", c);\n if (allowOrigin) {\n set(\"Access-Control-Allow-Origin\", allowOrigin);\n }\n if (opts.origin !== \"*\") {\n const existingVary = c.req.header(\"Vary\");\n if (existingVary) {\n set(\"Vary\", existingVary);\n } else {\n set(\"Vary\", \"Origin\");\n }\n }\n if (opts.credentials) {\n set(\"Access-Control-Allow-Credentials\", \"true\");\n }\n if (opts.exposeHeaders?.length) {\n set(\"Access-Control-Expose-Headers\", opts.exposeHeaders.join(\",\"));\n }\n if (c.req.method === \"OPTIONS\") {\n if (opts.maxAge != null) {\n set(\"Access-Control-Max-Age\", opts.maxAge.toString());\n }\n const allowMethods = await findAllowMethods(c.req.header(\"origin\") || \"\", c);\n if (allowMethods.length) {\n set(\"Access-Control-Allow-Methods\", allowMethods.join(\",\"));\n }\n let headers = opts.allowHeaders;\n if (!headers?.length) {\n const requestHeaders = c.req.header(\"Access-Control-Request-Headers\");\n if (requestHeaders) {\n headers = requestHeaders.split(/\\s*,\\s*/);\n }\n }\n if (headers?.length) {\n set(\"Access-Control-Allow-Headers\", headers.join(\",\"));\n c.res.headers.append(\"Vary\", \"Access-Control-Request-Headers\");\n }\n c.res.headers.delete(\"Content-Length\");\n c.res.headers.delete(\"Content-Type\");\n return new Response(null, {\n headers: c.res.headers,\n status: 204,\n statusText: \"No Content\"\n });\n }\n await next();\n };\n};\nexport {\n cors\n};\n", "export const entityKind = Symbol.for('drizzle:entityKind');\nexport const hasOwnEntityKind = Symbol.for('drizzle:hasOwnEntityKind');\n\nexport interface DrizzleEntity {\n\t[entityKind]: string;\n}\n\nexport type DrizzleEntityClass =\n\t& ((abstract new(...args: any[]) => T) | (new(...args: any[]) => T))\n\t& DrizzleEntity;\n\nexport function is>(value: any, type: T): value is InstanceType {\n\tif (!value || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\n\tif (value instanceof type) { // eslint-disable-line no-instanceof/no-instanceof\n\t\treturn true;\n\t}\n\n\tif (!Object.prototype.hasOwnProperty.call(type, entityKind)) {\n\t\tthrow new Error(\n\t\t\t`Class \"${\n\t\t\t\ttype.name ?? ''\n\t\t\t}\" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`,\n\t\t);\n\t}\n\n\tlet cls = value.constructor;\n\tif (cls) {\n\t\t// Traverse the prototype chain to find the entityKind\n\t\twhile (cls) {\n\t\t\tif (entityKind in cls && cls[entityKind] === type[entityKind]) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcls = Object.getPrototypeOf(cls);\n\t\t}\n\t}\n\n\treturn false;\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, ColumnDataType } from './column-builder.ts';\nimport { entityKind } from './entity.ts';\nimport type { DriverValueMapper, SQL, SQLWrapper } from './sql/sql.ts';\nimport type { Table } from './table.ts';\nimport type { Update } from './utils.ts';\n\nexport interface ColumnBaseConfig<\n\tTDataType extends ColumnDataType,\n\tTColumnType extends string,\n> extends ColumnBuilderBaseConfig {\n\ttableName: string;\n\tnotNull: boolean;\n\thasDefault: boolean;\n}\n\nexport type ColumnTypeConfig, TTypeConfig extends object> = T & {\n\tbrand: 'Column';\n\ttableName: T['tableName'];\n\tname: T['name'];\n\tdataType: T['dataType'];\n\tcolumnType: T['columnType'];\n\tdata: T['data'];\n\tdriverParam: T['driverParam'];\n\tnotNull: T['notNull'];\n\thasDefault: T['hasDefault'];\n\tenumValues: T['enumValues'];\n\tbaseColumn: T extends { baseColumn: infer U } ? U : unknown;\n} & TTypeConfig;\n\nexport type ColumnRuntimeConfig = ColumnBuilderRuntimeConfig<\n\tTData,\n\tTRuntimeConfig\n>;\n\nexport interface Column<\n\tT extends ColumnBaseConfig = ColumnBaseConfig,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTRuntimeConfig extends object = object,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTTypeConfig extends object = object,\n> extends DriverValueMapper, SQLWrapper {\n\t// SQLWrapper runtime implementation is defined in 'sql/sql.ts'\n}\n/*\n\t`Column` only accepts a full `ColumnConfig` as its generic.\n\tTo infer parts of the config, use `AnyColumn` that accepts a partial config.\n\tSee `GetColumnData` for example usage of inferring.\n*/\nexport abstract class Column<\n\tT extends ColumnBaseConfig = ColumnBaseConfig,\n\tTRuntimeConfig extends object = object,\n\tTTypeConfig extends object = object,\n> implements DriverValueMapper, SQLWrapper {\n\tstatic readonly [entityKind]: string = 'Column';\n\n\tdeclare readonly _: ColumnTypeConfig;\n\n\treadonly name: string;\n\treadonly primary: boolean;\n\treadonly notNull: boolean;\n\treadonly default: T['data'] | SQL | undefined;\n\treadonly defaultFn: (() => T['data'] | SQL) | undefined;\n\treadonly hasDefault: boolean;\n\treadonly isUnique: boolean;\n\treadonly uniqueName: string | undefined;\n\treadonly uniqueType: string | undefined;\n\treadonly dataType: T['dataType'];\n\treadonly columnType: T['columnType'];\n\treadonly enumValues: T['enumValues'] = undefined;\n\n\tprotected config: ColumnRuntimeConfig;\n\n\tconstructor(\n\t\treadonly table: Table,\n\t\tconfig: ColumnRuntimeConfig,\n\t) {\n\t\tthis.config = config;\n\t\tthis.name = config.name;\n\t\tthis.notNull = config.notNull;\n\t\tthis.default = config.default;\n\t\tthis.defaultFn = config.defaultFn;\n\t\tthis.hasDefault = config.hasDefault;\n\t\tthis.primary = config.primaryKey;\n\t\tthis.isUnique = config.isUnique;\n\t\tthis.uniqueName = config.uniqueName;\n\t\tthis.uniqueType = config.uniqueType;\n\t\tthis.dataType = config.dataType as T['dataType'];\n\t\tthis.columnType = config.columnType;\n\t}\n\n\tabstract getSQLType(): string;\n\n\tmapFromDriverValue(value: unknown): unknown {\n\t\treturn value;\n\t}\n\n\tmapToDriverValue(value: unknown): unknown {\n\t\treturn value;\n\t}\n}\n\nexport type UpdateColConfig<\n\tT extends ColumnBaseConfig,\n\tTUpdate extends Partial>,\n> = Update;\n\nexport type AnyColumn> = {}> = Column<\n\tRequired, TPartial>>\n>;\n\nexport type GetColumnData =\n\t// dprint-ignore\n\tTInferMode extends 'raw' // Raw mode\n\t\t? TColumn['_']['data'] // Just return the underlying type\n\t\t: TColumn['_']['notNull'] extends true // Query mode\n\t\t? TColumn['_']['data'] // Query mode, not null\n\t\t: TColumn['_']['data'] | null; // Query mode, nullable\n\nexport type InferColumnsDataTypes> = {\n\t[Key in keyof TColumns]: GetColumnData;\n};\n", "import { entityKind } from './entity.ts';\nimport type { SQL, SQLWrapper, ColumnsSelection } from './sql/sql.ts';\n\nexport const SubqueryConfig = Symbol.for('drizzle:SubqueryConfig');\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface Subquery extends SQLWrapper {\n\t// SQLWrapper runtime implementation is defined in 'sql/sql.ts'\n}\nexport class Subquery implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'Subquery';\n\n\tdeclare _: {\n\t\tbrand: 'Subquery';\n\t\tselectedFields: TSelectedFields;\n\t\talias: TAlias;\n\t};\n\n\t/** @internal */\n\t[SubqueryConfig]: {\n\t\tsql: SQL;\n\t\tselection: ColumnsSelection;\n\t\talias: string;\n\t\tisWith: boolean;\n\t};\n\n\tconstructor(sql: SQL, selection: Record, alias: string, isWith = false) {\n\t\tthis[SubqueryConfig] = {\n\t\t\tsql,\n\t\t\tselection,\n\t\t\talias,\n\t\t\tisWith,\n\t\t};\n\t}\n\n\t// getSQL(): SQL {\n\t// \treturn new SQL([this]);\n\t// }\n}\n\nexport class WithSubquery extends Subquery {\n\tstatic readonly [entityKind]: string = 'WithSubquery';\n}", "export function iife(fn: (...args: T) => U, ...args: T): U {\n\treturn fn(...args);\n}", "// package.json\nvar version = \"0.29.5\";\n\n// src/version.ts\nvar compatibilityVersion = 6;\nexport {\n compatibilityVersion,\n version as npmVersion\n};\n", "import type { Span, Tracer } from '@opentelemetry/api';\nimport { iife } from '~/tracing-utils.ts';\nimport { npmVersion } from '~/version.ts';\n\nlet otel: typeof import('@opentelemetry/api') | undefined;\nlet rawTracer: Tracer | undefined;\n// try {\n// \totel = await import('@opentelemetry/api');\n// } catch (err: any) {\n// \tif (err.code !== 'MODULE_NOT_FOUND' && err.code !== 'ERR_MODULE_NOT_FOUND') {\n// \t\tthrow err;\n// \t}\n// }\n\ntype SpanName =\n\t| 'drizzle.operation'\n\t| 'drizzle.prepareQuery'\n\t| 'drizzle.buildSQL'\n\t| 'drizzle.execute'\n\t| 'drizzle.driver.execute'\n\t| 'drizzle.mapResponse';\n\n/** @internal */\nexport const tracer = {\n\tstartActiveSpan unknown>(name: SpanName, fn: F): ReturnType {\n\t\tif (!otel) {\n\t\t\treturn fn() as ReturnType;\n\t\t}\n\n\t\tif (!rawTracer) {\n\t\t\trawTracer = otel.trace.getTracer('drizzle-orm', npmVersion);\n\t\t}\n\n\t\treturn iife(\n\t\t\t(otel, rawTracer) =>\n\t\t\t\trawTracer.startActiveSpan(\n\t\t\t\t\tname,\n\t\t\t\t\t((span: Span) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn fn(span);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tspan.setStatus({\n\t\t\t\t\t\t\t\tcode: otel.SpanStatusCode.ERROR,\n\t\t\t\t\t\t\t\tmessage: e instanceof Error ? e.message : 'Unknown error', // eslint-disable-line no-instanceof/no-instanceof\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tspan.end();\n\t\t\t\t\t\t}\n\t\t\t\t\t}) as F,\n\t\t\t\t),\n\t\t\totel,\n\t\t\trawTracer,\n\t\t);\n\t},\n};\n", "export const ViewBaseConfig = Symbol.for('drizzle:ViewBaseConfig');\n", "import type { Column, GetColumnData } from './column.ts';\nimport { entityKind } from './entity.ts';\nimport type { OptionalKeyOnly, RequiredKeyOnly } from './operations.ts';\nimport type { SQLWrapper } from './sql/sql.ts';\nimport type { Simplify, Update } from './utils.ts';\n\nexport interface TableConfig> {\n\tname: string;\n\tschema: string | undefined;\n\tcolumns: Record;\n\tdialect: string;\n}\n\nexport type UpdateTableConfig> = Required<\n\tUpdate\n>;\n\n/** @internal */\nexport const TableName = Symbol.for('drizzle:Name');\n\n/** @internal */\nexport const Schema = Symbol.for('drizzle:Schema');\n\n/** @internal */\nexport const Columns = Symbol.for('drizzle:Columns');\n\n/** @internal */\nexport const OriginalName = Symbol.for('drizzle:OriginalName');\n\n/** @internal */\nexport const BaseName = Symbol.for('drizzle:BaseName');\n\n/** @internal */\nexport const IsAlias = Symbol.for('drizzle:IsAlias');\n\n/** @internal */\nexport const ExtraConfigBuilder = Symbol.for('drizzle:ExtraConfigBuilder');\n\nconst IsDrizzleTable = Symbol.for('drizzle:IsDrizzleTable');\n\nexport interface Table<\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tT extends TableConfig = TableConfig,\n> extends SQLWrapper {\n\t// SQLWrapper runtime implementation is defined in 'sql/sql.ts'\n}\n\nexport class Table implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'Table';\n\n\tdeclare readonly _: {\n\t\treadonly brand: 'Table';\n\t\treadonly config: T;\n\t\treadonly name: T['name'];\n\t\treadonly schema: T['schema'];\n\t\treadonly columns: T['columns'];\n\t\treadonly inferSelect: InferSelectModel>;\n\t\treadonly inferInsert: InferInsertModel>;\n\t};\n\n\tdeclare readonly $inferSelect: InferSelectModel>;\n\tdeclare readonly $inferInsert: InferInsertModel>;\n\n\t/** @internal */\n\tstatic readonly Symbol = {\n\t\tName: TableName as typeof TableName,\n\t\tSchema: Schema as typeof Schema,\n\t\tOriginalName: OriginalName as typeof OriginalName,\n\t\tColumns: Columns as typeof Columns,\n\t\tBaseName: BaseName as typeof BaseName,\n\t\tIsAlias: IsAlias as typeof IsAlias,\n\t\tExtraConfigBuilder: ExtraConfigBuilder as typeof ExtraConfigBuilder,\n\t};\n\n\t/**\n\t * @internal\n\t * Can be changed if the table is aliased.\n\t */\n\t[TableName]: string;\n\n\t/**\n\t * @internal\n\t * Used to store the original name of the table, before any aliasing.\n\t */\n\t[OriginalName]: string;\n\n\t/** @internal */\n\t[Schema]: string | undefined;\n\n\t/** @internal */\n\t[Columns]!: T['columns'];\n\n\t/**\n\t * @internal\n\t * Used to store the table name before the transformation via the `tableCreator` functions.\n\t */\n\t[BaseName]: string;\n\n\t/** @internal */\n\t[IsAlias] = false;\n\n\t/** @internal */\n\t[ExtraConfigBuilder]: ((self: any) => Record) | undefined = undefined;\n\n\t[IsDrizzleTable] = true;\n\n\tconstructor(name: string, schema: string | undefined, baseName: string) {\n\t\tthis[TableName] = this[OriginalName] = name;\n\t\tthis[Schema] = schema;\n\t\tthis[BaseName] = baseName;\n\t}\n}\n\nexport function isTable(table: unknown): table is Table {\n\treturn typeof table === 'object' && table !== null && IsDrizzleTable in table;\n}\n\n/**\n * Any table with a specified boundary.\n *\n * @example\n\t```ts\n\t// Any table with a specific name\n\ttype AnyUsersTable = AnyTable<{ name: 'users' }>;\n\t```\n *\n * To describe any table with any config, simply use `Table` without any type arguments, like this:\n *\n\t```ts\n\tfunction needsTable(table: Table) {\n\t\t...\n\t}\n\t```\n */\nexport type AnyTable> = Table>;\n\nexport function getTableName(table: T): T['_']['name'] {\n\treturn table[TableName];\n}\n\nexport type MapColumnName =\n\tTDBColumNames extends true ? TColumn['_']['name']\n\t\t: TName;\n\nexport type InferModelFromColumns<\n\tTColumns extends Record,\n\tTInferMode extends 'select' | 'insert' = 'select',\n\tTConfig extends { dbColumnNames: boolean } = { dbColumnNames: false },\n> = Simplify<\n\tTInferMode extends 'insert' ? \n\t\t\t& {\n\t\t\t\t[\n\t\t\t\t\tKey in keyof TColumns & string as RequiredKeyOnly<\n\t\t\t\t\t\tMapColumnName,\n\t\t\t\t\t\tTColumns[Key]\n\t\t\t\t\t>\n\t\t\t\t]: GetColumnData;\n\t\t\t}\n\t\t\t& {\n\t\t\t\t[\n\t\t\t\t\tKey in keyof TColumns & string as OptionalKeyOnly<\n\t\t\t\t\t\tMapColumnName,\n\t\t\t\t\t\tTColumns[Key]\n\t\t\t\t\t>\n\t\t\t\t]?: GetColumnData;\n\t\t\t}\n\t\t: {\n\t\t\t[\n\t\t\t\tKey in keyof TColumns & string as MapColumnName<\n\t\t\t\t\tKey,\n\t\t\t\t\tTColumns[Key],\n\t\t\t\t\tTConfig['dbColumnNames']\n\t\t\t\t>\n\t\t\t]: GetColumnData;\n\t\t}\n>;\n\n/** @deprecated Use one of the alternatives: {@link InferSelectModel} / {@link InferInsertModel}, or `table.$inferSelect` / `table.$inferInsert`\n */\nexport type InferModel<\n\tTTable extends Table,\n\tTInferMode extends 'select' | 'insert' = 'select',\n\tTConfig extends { dbColumnNames: boolean } = { dbColumnNames: false },\n> = InferModelFromColumns;\n\nexport type InferSelectModel<\n\tTTable extends Table,\n\tTConfig extends { dbColumnNames: boolean } = { dbColumnNames: false },\n> = InferModelFromColumns;\n\nexport type InferInsertModel<\n\tTTable extends Table,\n\tTConfig extends { dbColumnNames: boolean } = { dbColumnNames: false },\n> = InferModelFromColumns;\n", "import { entityKind, is } from '~/entity.ts';\nimport type { SelectedFields } from '~/operations.ts';\nimport { Subquery, SubqueryConfig } from '~/subquery.ts';\nimport { tracer } from '~/tracing.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport type { AnyColumn } from '../column.ts';\nimport { Column } from '../column.ts';\nimport { Table } from '../table.ts';\n\n/**\n * This class is used to indicate a primitive param value that is used in `sql` tag.\n * It is only used on type level and is never instantiated at runtime.\n * If you see a value of this type in the code, its runtime value is actually the primitive param value.\n */\nexport class FakePrimitiveParam {\n\tstatic readonly [entityKind]: string = 'FakePrimitiveParam';\n}\n\nexport type Chunk =\n\t| string\n\t| Table\n\t| View\n\t| AnyColumn\n\t| Name\n\t| Param\n\t| Placeholder\n\t| SQL;\n\nexport interface BuildQueryConfig {\n\tescapeName(name: string): string;\n\tescapeParam(num: number, value: unknown): string;\n\tescapeString(str: string): string;\n\tprepareTyping?: (encoder: DriverValueEncoder) => QueryTypingsValue;\n\tparamStartIndex?: { value: number };\n\tinlineParams?: boolean;\n}\n\nexport type QueryTypingsValue = 'json' | 'decimal' | 'time' | 'timestamp' | 'uuid' | 'date' | 'none';\n\nexport interface Query {\n\tsql: string;\n\tparams: unknown[];\n}\n\nexport interface QueryWithTypings extends Query {\n\ttypings?: QueryTypingsValue[];\n}\n\n/**\n * Any value that implements the `getSQL` method. The implementations include:\n * - `Table`\n * - `Column`\n * - `View`\n * - `Subquery`\n * - `SQL`\n * - `SQL.Aliased`\n * - `Placeholder`\n * - `Param`\n */\nexport interface SQLWrapper {\n\tgetSQL(): SQL;\n}\n\nexport function isSQLWrapper(value: unknown): value is SQLWrapper {\n\treturn typeof value === 'object' && value !== null && 'getSQL' in value\n\t\t&& typeof (value as any).getSQL === 'function';\n}\n\nfunction mergeQueries(queries: QueryWithTypings[]): QueryWithTypings {\n\tconst result: QueryWithTypings = { sql: '', params: [] };\n\tfor (const query of queries) {\n\t\tresult.sql += query.sql;\n\t\tresult.params.push(...query.params);\n\t\tif (query.typings?.length) {\n\t\t\tif (!result.typings) {\n\t\t\t\tresult.typings = [];\n\t\t\t}\n\t\t\tresult.typings.push(...query.typings);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class StringChunk implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'StringChunk';\n\n\treadonly value: string[];\n\n\tconstructor(value: string | string[]) {\n\t\tthis.value = Array.isArray(value) ? value : [value];\n\t}\n\n\tgetSQL(): SQL {\n\t\treturn new SQL([this]);\n\t}\n}\n\nexport class SQL implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'SQL';\n\n\tdeclare _: {\n\t\tbrand: 'SQL';\n\t\ttype: T;\n\t};\n\n\t/** @internal */\n\tdecoder: DriverValueDecoder = noopDecoder;\n\tprivate shouldInlineParams = false;\n\n\tconstructor(readonly queryChunks: SQLChunk[]) {}\n\n\tappend(query: SQL): this {\n\t\tthis.queryChunks.push(...query.queryChunks);\n\t\treturn this;\n\t}\n\n\ttoQuery(config: BuildQueryConfig): QueryWithTypings {\n\t\treturn tracer.startActiveSpan('drizzle.buildSQL', (span) => {\n\t\t\tconst query = this.buildQueryFromSourceParams(this.queryChunks, config);\n\t\t\tspan?.setAttributes({\n\t\t\t\t'drizzle.query.text': query.sql,\n\t\t\t\t'drizzle.query.params': JSON.stringify(query.params),\n\t\t\t});\n\t\t\treturn query;\n\t\t});\n\t}\n\n\tbuildQueryFromSourceParams(chunks: SQLChunk[], _config: BuildQueryConfig): Query {\n\t\tconst config = Object.assign({}, _config, {\n\t\t\tinlineParams: _config.inlineParams || this.shouldInlineParams,\n\t\t\tparamStartIndex: _config.paramStartIndex || { value: 0 },\n\t\t});\n\n\t\tconst {\n\t\t\tescapeName,\n\t\t\tescapeParam,\n\t\t\tprepareTyping,\n\t\t\tinlineParams,\n\t\t\tparamStartIndex,\n\t\t} = config;\n\n\t\treturn mergeQueries(chunks.map((chunk): QueryWithTypings => {\n\t\t\tif (is(chunk, StringChunk)) {\n\t\t\t\treturn { sql: chunk.value.join(''), params: [] };\n\t\t\t}\n\n\t\t\tif (is(chunk, Name)) {\n\t\t\t\treturn { sql: escapeName(chunk.value), params: [] };\n\t\t\t}\n\n\t\t\tif (chunk === undefined) {\n\t\t\t\treturn { sql: '', params: [] };\n\t\t\t}\n\n\t\t\tif (Array.isArray(chunk)) {\n\t\t\t\tconst result: SQLChunk[] = [new StringChunk('(')];\n\t\t\t\tfor (const [i, p] of chunk.entries()) {\n\t\t\t\t\tresult.push(p);\n\t\t\t\t\tif (i < chunk.length - 1) {\n\t\t\t\t\t\tresult.push(new StringChunk(', '));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult.push(new StringChunk(')'));\n\t\t\t\treturn this.buildQueryFromSourceParams(result, config);\n\t\t\t}\n\n\t\t\tif (is(chunk, SQL)) {\n\t\t\t\treturn this.buildQueryFromSourceParams(chunk.queryChunks, {\n\t\t\t\t\t...config,\n\t\t\t\t\tinlineParams: inlineParams || chunk.shouldInlineParams,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (is(chunk, Table)) {\n\t\t\t\tconst schemaName = chunk[Table.Symbol.Schema];\n\t\t\t\tconst tableName = chunk[Table.Symbol.Name];\n\t\t\t\treturn {\n\t\t\t\t\tsql: schemaName === undefined\n\t\t\t\t\t\t? escapeName(tableName)\n\t\t\t\t\t\t: escapeName(schemaName) + '.' + escapeName(tableName),\n\t\t\t\t\tparams: [],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (is(chunk, Column)) {\n\t\t\t\treturn { sql: escapeName(chunk.table[Table.Symbol.Name]) + '.' + escapeName(chunk.name), params: [] };\n\t\t\t}\n\n\t\t\tif (is(chunk, View)) {\n\t\t\t\tconst schemaName = chunk[ViewBaseConfig].schema;\n\t\t\t\tconst viewName = chunk[ViewBaseConfig].name;\n\t\t\t\treturn {\n\t\t\t\t\tsql: schemaName === undefined\n\t\t\t\t\t\t? escapeName(viewName)\n\t\t\t\t\t\t: escapeName(schemaName) + '.' + escapeName(viewName),\n\t\t\t\t\tparams: [],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (is(chunk, Param)) {\n\t\t\t\tconst mappedValue = (chunk.value === null) ? null : chunk.encoder.mapToDriverValue(chunk.value);\n\n\t\t\t\tif (is(mappedValue, SQL)) {\n\t\t\t\t\treturn this.buildQueryFromSourceParams([mappedValue], config);\n\t\t\t\t}\n\n\t\t\t\tif (inlineParams) {\n\t\t\t\t\treturn { sql: this.mapInlineParam(mappedValue, config), params: [] };\n\t\t\t\t}\n\n\t\t\t\tlet typings: QueryTypingsValue[] | undefined;\n\t\t\t\tif (prepareTyping !== undefined) {\n\t\t\t\t\ttypings = [prepareTyping(chunk.encoder)];\n\t\t\t\t}\n\n\t\t\t\treturn { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };\n\t\t\t}\n\n\t\t\tif (is(chunk, Placeholder)) {\n\t\t\t\treturn { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk] };\n\t\t\t}\n\n\t\t\tif (is(chunk, SQL.Aliased) && chunk.fieldAlias !== undefined) {\n\t\t\t\treturn { sql: escapeName(chunk.fieldAlias), params: [] };\n\t\t\t}\n\n\t\t\tif (is(chunk, Subquery)) {\n\t\t\t\tif (chunk[SubqueryConfig].isWith) {\n\t\t\t\t\treturn { sql: escapeName(chunk[SubqueryConfig].alias), params: [] };\n\t\t\t\t}\n\t\t\t\treturn this.buildQueryFromSourceParams([\n\t\t\t\t\tnew StringChunk('('),\n\t\t\t\t\tchunk[SubqueryConfig].sql,\n\t\t\t\t\tnew StringChunk(') '),\n\t\t\t\t\tnew Name(chunk[SubqueryConfig].alias),\n\t\t\t\t], config);\n\t\t\t}\n\n\t\t\tif (isSQLWrapper(chunk)) {\n\t\t\t\treturn this.buildQueryFromSourceParams([\n\t\t\t\t\tnew StringChunk('('),\n\t\t\t\t\tchunk.getSQL(),\n\t\t\t\t\tnew StringChunk(')'),\n\t\t\t\t], config);\n\t\t\t}\n\n\t\t\tif (inlineParams) {\n\t\t\t\treturn { sql: this.mapInlineParam(chunk, config), params: [] };\n\t\t\t}\n\n\t\t\treturn { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk] };\n\t\t}));\n\t}\n\n\tprivate mapInlineParam(\n\t\tchunk: unknown,\n\t\t{ escapeString }: BuildQueryConfig,\n\t): string {\n\t\tif (chunk === null) {\n\t\t\treturn 'null';\n\t\t}\n\t\tif (typeof chunk === 'number' || typeof chunk === 'boolean') {\n\t\t\treturn chunk.toString();\n\t\t}\n\t\tif (typeof chunk === 'string') {\n\t\t\treturn escapeString(chunk);\n\t\t}\n\t\tif (typeof chunk === 'object') {\n\t\t\tconst mappedValueAsString = chunk.toString();\n\t\t\tif (mappedValueAsString === '[object Object]') {\n\t\t\t\treturn escapeString(JSON.stringify(chunk));\n\t\t\t}\n\t\t\treturn escapeString(mappedValueAsString);\n\t\t}\n\t\tthrow new Error('Unexpected param value: ' + chunk);\n\t}\n\n\tgetSQL(): SQL {\n\t\treturn this;\n\t}\n\n\tas(alias: string): SQL.Aliased;\n\t/**\n\t * @deprecated\n\t * Use ``sql`query`.as(alias)`` instead.\n\t */\n\tas(): SQL;\n\t/**\n\t * @deprecated\n\t * Use ``sql`query`.as(alias)`` instead.\n\t */\n\tas(alias: string): SQL.Aliased;\n\tas(alias?: string): SQL | SQL.Aliased {\n\t\t// TODO: remove with deprecated overloads\n\t\tif (alias === undefined) {\n\t\t\treturn this;\n\t\t}\n\n\t\treturn new SQL.Aliased(this, alias);\n\t}\n\n\tmapWith<\n\t\tTDecoder extends\n\t\t\t| DriverValueDecoder\n\t\t\t| DriverValueDecoder['mapFromDriverValue'],\n\t>(decoder: TDecoder): SQL> {\n\t\tthis.decoder = typeof decoder === 'function' ? { mapFromDriverValue: decoder } : decoder;\n\t\treturn this as SQL>;\n\t}\n\n\tinlineParams(): this {\n\t\tthis.shouldInlineParams = true;\n\t\treturn this;\n\t}\n}\n\nexport type GetDecoderResult = T extends Column ? T['_']['data'] : T extends\n\t| DriverValueDecoder\n\t| DriverValueDecoder['mapFromDriverValue'] ? TData\n: never;\n\n/**\n * Any DB name (table, column, index etc.)\n */\nexport class Name implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'Name';\n\n\tprotected brand!: 'Name';\n\n\tconstructor(readonly value: string) {}\n\n\tgetSQL(): SQL {\n\t\treturn new SQL([this]);\n\t}\n}\n\n/**\n * Any DB name (table, column, index etc.)\n * @deprecated Use `sql.identifier` instead.\n */\nexport function name(value: string): Name {\n\treturn new Name(value);\n}\n\nexport interface DriverValueDecoder {\n\tmapFromDriverValue(value: TDriverParam): TData;\n}\n\nexport interface DriverValueEncoder {\n\tmapToDriverValue(value: TData): TDriverParam | SQL;\n}\n\nexport function isDriverValueEncoder(value: unknown): value is DriverValueEncoder {\n\treturn typeof value === 'object' && value !== null && 'mapToDriverValue' in value\n\t\t&& typeof (value as any).mapToDriverValue === 'function';\n}\n\nexport const noopDecoder: DriverValueDecoder = {\n\tmapFromDriverValue: (value) => value,\n};\n\nexport const noopEncoder: DriverValueEncoder = {\n\tmapToDriverValue: (value) => value,\n};\n\nexport interface DriverValueMapper\n\textends DriverValueDecoder, DriverValueEncoder\n{}\n\nexport const noopMapper: DriverValueMapper = {\n\t...noopDecoder,\n\t...noopEncoder,\n};\n\n/** Parameter value that is optionally bound to an encoder (for example, a column). */\nexport class Param implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'Param';\n\n\tprotected brand!: 'BoundParamValue';\n\n\t/**\n\t * @param value - Parameter value\n\t * @param encoder - Encoder to convert the value to a driver parameter\n\t */\n\tconstructor(\n\t\treadonly value: TDataType,\n\t\treadonly encoder: DriverValueEncoder = noopEncoder,\n\t) {}\n\n\tgetSQL(): SQL {\n\t\treturn new SQL([this]);\n\t}\n}\n\n/** @deprecated Use `sql.param` instead. */\nexport function param(\n\tvalue: TData,\n\tencoder?: DriverValueEncoder,\n): Param {\n\treturn new Param(value, encoder);\n}\n\n/**\n * Anything that can be passed to the `` sql`...` `` tagged function.\n */\nexport type SQLChunk =\n\t| StringChunk\n\t| SQLChunk[]\n\t| SQLWrapper\n\t| SQL\n\t| Table\n\t| View\n\t| Subquery\n\t| AnyColumn\n\t| Param\n\t| Name\n\t| undefined\n\t| FakePrimitiveParam\n\t| Placeholder;\n\nexport function sql(strings: TemplateStringsArray, ...params: any[]): SQL;\n/*\n\tThe type of `params` is specified as `SQLSourceParam[]`, but that's slightly incorrect -\n\tin runtime, users won't pass `FakePrimitiveParam` instances as `params` - they will pass primitive values\n\twhich will be wrapped in `Param` using `buildChunksFromParam(...)`. That's why the overload\n\tspecify `params` as `any[]` and not as `SQLSourceParam[]`. This type is used to make our lives easier and\n\tthe type checker happy.\n*/\nexport function sql(strings: TemplateStringsArray, ...params: SQLChunk[]): SQL {\n\tconst queryChunks: SQLChunk[] = [];\n\tif (params.length > 0 || (strings.length > 0 && strings[0] !== '')) {\n\t\tqueryChunks.push(new StringChunk(strings[0]!));\n\t}\n\tfor (const [paramIndex, param] of params.entries()) {\n\t\tqueryChunks.push(param, new StringChunk(strings[paramIndex + 1]!));\n\t}\n\n\treturn new SQL(queryChunks);\n}\n\nexport namespace sql {\n\texport function empty(): SQL {\n\t\treturn new SQL([]);\n\t}\n\n\t/** @deprecated - use `sql.join()` */\n\texport function fromList(list: SQLChunk[]): SQL {\n\t\treturn new SQL(list);\n\t}\n\n\t/**\n\t * Convenience function to create an SQL query from a raw string.\n\t * @param str The raw SQL query string.\n\t */\n\texport function raw(str: string): SQL {\n\t\treturn new SQL([new StringChunk(str)]);\n\t}\n\n\t/**\n\t * Join a list of SQL chunks with a separator.\n\t * @example\n\t * ```ts\n\t * const query = sql.join([sql`a`, sql`b`, sql`c`]);\n\t * // sql`abc`\n\t * ```\n\t * @example\n\t * ```ts\n\t * const query = sql.join([sql`a`, sql`b`, sql`c`], sql`, `);\n\t * // sql`a, b, c`\n\t * ```\n\t */\n\texport function join(chunks: SQLChunk[], separator?: SQLChunk): SQL {\n\t\tconst result: SQLChunk[] = [];\n\t\tfor (const [i, chunk] of chunks.entries()) {\n\t\t\tif (i > 0 && separator !== undefined) {\n\t\t\t\tresult.push(separator);\n\t\t\t}\n\t\t\tresult.push(chunk);\n\t\t}\n\t\treturn new SQL(result);\n\t}\n\n\t/**\n\t * Create a SQL chunk that represents a DB identifier (table, column, index etc.).\n\t * When used in a query, the identifier will be escaped based on the DB engine.\n\t * For example, in PostgreSQL, identifiers are escaped with double quotes.\n\t *\n\t * **WARNING: This function does not offer any protection against SQL injections, so you must validate any user input beforehand.**\n\t *\n\t * @example ```ts\n\t * const query = sql`SELECT * FROM ${sql.identifier('my-table')}`;\n\t * // 'SELECT * FROM \"my-table\"'\n\t * ```\n\t */\n\texport function identifier(value: string): Name {\n\t\treturn new Name(value);\n\t}\n\n\texport function placeholder(name: TName): Placeholder {\n\t\treturn new Placeholder(name);\n\t}\n\n\texport function param(\n\t\tvalue: TData,\n\t\tencoder?: DriverValueEncoder,\n\t): Param {\n\t\treturn new Param(value, encoder);\n\t}\n}\n\nexport namespace SQL {\n\texport class Aliased implements SQLWrapper {\n\t\tstatic readonly [entityKind]: string = 'SQL.Aliased';\n\n\t\tdeclare _: {\n\t\t\tbrand: 'SQL.Aliased';\n\t\t\ttype: T;\n\t\t};\n\n\t\t/** @internal */\n\t\tisSelectionField = false;\n\n\t\tconstructor(\n\t\t\treadonly sql: SQL,\n\t\t\treadonly fieldAlias: string,\n\t\t) {}\n\n\t\tgetSQL(): SQL {\n\t\t\treturn this.sql;\n\t\t}\n\n\t\t/** @internal */\n\t\tclone() {\n\t\t\treturn new Aliased(this.sql, this.fieldAlias);\n\t\t}\n\t}\n}\n\nexport class Placeholder implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'Placeholder';\n\n\tdeclare protected: TValue;\n\n\tconstructor(readonly name: TName) {}\n\n\tgetSQL(): SQL {\n\t\treturn new SQL([this]);\n\t}\n}\n\n/** @deprecated Use `sql.placeholder` instead. */\nexport function placeholder(name: TName): Placeholder {\n\treturn new Placeholder(name);\n}\n\nexport function fillPlaceholders(params: unknown[], values: Record): unknown[] {\n\treturn params.map((p) => {\n\t\tif (is(p, Placeholder)) {\n\t\t\tif (!(p.name in values)) {\n\t\t\t\tthrow new Error(`No value for placeholder \"${p.name}\" was provided`);\n\t\t\t}\n\t\t\treturn values[p.name];\n\t\t}\n\n\t\treturn p;\n\t});\n}\n\nexport type ColumnsSelection = Record;\n\nexport abstract class View<\n\tTName extends string = string,\n\tTExisting extends boolean = boolean,\n\tTSelection extends ColumnsSelection = ColumnsSelection,\n> implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'View';\n\n\tdeclare _: {\n\t\tbrand: 'View';\n\t\tviewBrand: string;\n\t\tname: TName;\n\t\texisting: TExisting;\n\t\tselectedFields: TSelection;\n\t};\n\n\t/** @internal */\n\t[ViewBaseConfig]: {\n\t\tname: TName;\n\t\toriginalName: TName;\n\t\tschema: string | undefined;\n\t\tselectedFields: SelectedFields;\n\t\tisExisting: TExisting;\n\t\tquery: TExisting extends true ? undefined : SQL;\n\t\tisAlias: boolean;\n\t};\n\n\tconstructor(\n\t\t{ name, schema, selectedFields, query }: {\n\t\t\tname: TName;\n\t\t\tschema: string | undefined;\n\t\t\tselectedFields: SelectedFields;\n\t\t\tquery: SQL | undefined;\n\t\t},\n\t) {\n\t\tthis[ViewBaseConfig] = {\n\t\t\tname,\n\t\t\toriginalName: name,\n\t\t\tschema,\n\t\t\tselectedFields,\n\t\t\tquery: query as (TExisting extends true ? undefined : SQL),\n\t\t\tisExisting: !query as TExisting,\n\t\t\tisAlias: false,\n\t\t};\n\t}\n\n\tgetSQL(): SQL {\n\t\treturn new SQL([this]);\n\t}\n}\n\n// Defined separately from the Column class to resolve circular dependency\nColumn.prototype.getSQL = function() {\n\treturn new SQL([this]);\n};\n\n// Defined separately from the Table class to resolve circular dependency\nTable.prototype.getSQL = function() {\n\treturn new SQL([this]);\n};\n\n// Defined separately from the Column class to resolve circular dependency\nSubquery.prototype.getSQL = function() {\n\treturn new SQL([this]);\n};\n", "import type { AnyColumn } from './column.ts';\nimport { Column } from './column.ts';\nimport { entityKind, is } from './entity.ts';\nimport type { Relation } from './relations.ts';\nimport type { View } from './sql/sql.ts';\nimport { SQL, sql } from './sql/sql.ts';\nimport { Table } from './table.ts';\nimport { ViewBaseConfig } from './view-common.ts';\n\nexport class ColumnAliasProxyHandler implements ProxyHandler {\n\tstatic readonly [entityKind]: string = 'ColumnAliasProxyHandler';\n\n\tconstructor(private table: Table | View) {}\n\n\tget(columnObj: TColumn, prop: string | symbol): any {\n\t\tif (prop === 'table') {\n\t\t\treturn this.table;\n\t\t}\n\n\t\treturn columnObj[prop as keyof TColumn];\n\t}\n}\n\nexport class TableAliasProxyHandler implements ProxyHandler {\n\tstatic readonly [entityKind]: string = 'TableAliasProxyHandler';\n\n\tconstructor(private alias: string, private replaceOriginalName: boolean) {}\n\n\tget(target: T, prop: string | symbol): any {\n\t\tif (prop === Table.Symbol.IsAlias) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (prop === Table.Symbol.Name) {\n\t\t\treturn this.alias;\n\t\t}\n\n\t\tif (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {\n\t\t\treturn this.alias;\n\t\t}\n\n\t\tif (prop === ViewBaseConfig) {\n\t\t\treturn {\n\t\t\t\t...target[ViewBaseConfig as keyof typeof target],\n\t\t\t\tname: this.alias,\n\t\t\t\tisAlias: true,\n\t\t\t};\n\t\t}\n\n\t\tif (prop === Table.Symbol.Columns) {\n\t\t\tconst columns = (target as Table)[Table.Symbol.Columns];\n\t\t\tif (!columns) {\n\t\t\t\treturn columns;\n\t\t\t}\n\n\t\t\tconst proxiedColumns: { [key: string]: any } = {};\n\n\t\t\tObject.keys(columns).map((key) => {\n\t\t\t\tproxiedColumns[key] = new Proxy(\n\t\t\t\t\tcolumns[key]!,\n\t\t\t\t\tnew ColumnAliasProxyHandler(new Proxy(target, this)),\n\t\t\t\t);\n\t\t\t});\n\n\t\t\treturn proxiedColumns;\n\t\t}\n\n\t\tconst value = target[prop as keyof typeof target];\n\t\tif (is(value, Column)) {\n\t\t\treturn new Proxy(value as AnyColumn, new ColumnAliasProxyHandler(new Proxy(target, this)));\n\t\t}\n\n\t\treturn value;\n\t}\n}\n\nexport class RelationTableAliasProxyHandler implements ProxyHandler {\n\tstatic readonly [entityKind]: string = 'RelationTableAliasProxyHandler';\n\n\tconstructor(private alias: string) {}\n\n\tget(target: T, prop: string | symbol): any {\n\t\tif (prop === 'sourceTable') {\n\t\t\treturn aliasedTable(target.sourceTable, this.alias);\n\t\t}\n\n\t\treturn target[prop as keyof typeof target];\n\t}\n}\n\nexport function aliasedTable(table: T, tableAlias: string): T {\n\treturn new Proxy(table, new TableAliasProxyHandler(tableAlias, false));\n}\n\nexport function aliasedRelation(relation: T, tableAlias: string): T {\n\treturn new Proxy(relation, new RelationTableAliasProxyHandler(tableAlias));\n}\n\nexport function aliasedTableColumn(column: T, tableAlias: string): T {\n\treturn new Proxy(\n\t\tcolumn,\n\t\tnew ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false))),\n\t);\n}\n\nexport function mapColumnsInAliasedSQLToAlias(query: SQL.Aliased, alias: string): SQL.Aliased {\n\treturn new SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);\n}\n\nexport function mapColumnsInSQLToAlias(query: SQL, alias: string): SQL {\n\treturn sql.join(query.queryChunks.map((c) => {\n\t\tif (is(c, Column)) {\n\t\t\treturn aliasedTableColumn(c, alias);\n\t\t}\n\t\tif (is(c, SQL)) {\n\t\t\treturn mapColumnsInSQLToAlias(c, alias);\n\t\t}\n\t\tif (is(c, SQL.Aliased)) {\n\t\t\treturn mapColumnsInAliasedSQLToAlias(c, alias);\n\t\t}\n\t\treturn c;\n\t}));\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { Column } from './column.ts';\nimport type { MySqlColumn } from './mysql-core/index.ts';\nimport type { PgColumn } from './pg-core/index.ts';\nimport type { SQL } from './sql/sql.ts';\nimport type { SQLiteColumn } from './sqlite-core/index.ts';\nimport type { Simplify } from './utils.ts';\n\nexport type ColumnDataType =\n\t| 'string'\n\t| 'number'\n\t| 'boolean'\n\t| 'array'\n\t| 'json'\n\t| 'date'\n\t| 'bigint'\n\t| 'custom'\n\t| 'buffer';\n\nexport type Dialect = 'pg' | 'mysql' | 'sqlite' | 'common';\n\nexport interface ColumnBuilderBaseConfig {\n\tname: string;\n\tdataType: TDataType;\n\tcolumnType: TColumnType;\n\tdata: unknown;\n\tdriverParam: unknown;\n\tenumValues: string[] | undefined;\n}\n\nexport type MakeColumnConfig<\n\tT extends ColumnBuilderBaseConfig,\n\tTTableName extends string,\n> = {\n\tname: T['name'];\n\ttableName: TTableName;\n\tdataType: T['dataType'];\n\tcolumnType: T['columnType'];\n\tdata: T extends { $type: infer U } ? U : T['data'];\n\tdriverParam: T['driverParam'];\n\tnotNull: T extends { notNull: true } ? true : false;\n\thasDefault: T extends { hasDefault: true } ? true : false;\n\tenumValues: T['enumValues'];\n\tbaseColumn: T extends { baseBuilder: infer U extends ColumnBuilderBase } ? BuildColumn\n\t\t: never;\n} & {};\n\nexport type ColumnBuilderTypeConfig<\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tT extends ColumnBuilderBaseConfig,\n\tTTypeConfig extends object = object,\n> = Simplify<\n\t& {\n\t\tbrand: 'ColumnBuilder';\n\t\tname: T['name'];\n\t\tdataType: T['dataType'];\n\t\tcolumnType: T['columnType'];\n\t\tdata: T['data'];\n\t\tdriverParam: T['driverParam'];\n\t\tnotNull: T extends { notNull: infer U } ? U : boolean;\n\t\thasDefault: T extends { hasDefault: infer U } ? U : boolean;\n\t\tenumValues: T['enumValues'];\n\t}\n\t& TTypeConfig\n>;\n\nexport type ColumnBuilderRuntimeConfig = {\n\tname: string;\n\tnotNull: boolean;\n\tdefault: TData | SQL | undefined;\n\tdefaultFn: (() => TData | SQL) | undefined;\n\thasDefault: boolean;\n\tprimaryKey: boolean;\n\tisUnique: boolean;\n\tuniqueName: string | undefined;\n\tuniqueType: string | undefined;\n\tdataType: string;\n\tcolumnType: string;\n} & TRuntimeConfig;\n\nexport interface ColumnBuilderExtraConfig {\n\tprimaryKeyHasDefault?: boolean;\n}\n\nexport type NotNull = T & {\n\t_: {\n\t\tnotNull: true;\n\t};\n};\n\nexport type HasDefault = T & {\n\t_: {\n\t\thasDefault: true;\n\t};\n};\n\nexport type $Type = T & {\n\t_: {\n\t\t$type: TType;\n\t};\n};\n\nexport interface ColumnBuilderBase<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTTypeConfig extends object = object,\n> {\n\t_: ColumnBuilderTypeConfig;\n}\n\n// To understand how to use `ColumnBuilder` and `AnyColumnBuilder`, see `Column` and `AnyColumn` documentation.\nexport abstract class ColumnBuilder<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTRuntimeConfig extends object = object,\n\tTTypeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig,\n> implements ColumnBuilderBase {\n\tstatic readonly [entityKind]: string = 'ColumnBuilder';\n\n\tdeclare _: ColumnBuilderTypeConfig;\n\n\tprotected config: ColumnBuilderRuntimeConfig;\n\n\tconstructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']) {\n\t\tthis.config = {\n\t\t\tname,\n\t\t\tnotNull: false,\n\t\t\tdefault: undefined,\n\t\t\thasDefault: false,\n\t\t\tprimaryKey: false,\n\t\t\tisUnique: false,\n\t\t\tuniqueName: undefined,\n\t\t\tuniqueType: undefined,\n\t\t\tdataType,\n\t\t\tcolumnType,\n\t\t} as ColumnBuilderRuntimeConfig;\n\t}\n\n\t/**\n\t * Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.\n\t *\n\t * @example\n\t * ```ts\n\t * const users = pgTable('users', {\n\t * \tid: integer('id').$type().primaryKey(),\n\t * \tdetails: json('details').$type().notNull(),\n\t * });\n\t * ```\n\t */\n\t$type(): $Type {\n\t\treturn this as $Type;\n\t}\n\n\t/**\n\t * Adds a `not null` clause to the column definition.\n\t *\n\t * Affects the `select` model of the table - columns *without* `not null` will be nullable on select.\n\t */\n\tnotNull(): NotNull {\n\t\tthis.config.notNull = true;\n\t\treturn this as NotNull;\n\t}\n\n\t/**\n\t * Adds a `default ` clause to the column definition.\n\t *\n\t * Affects the `insert` model of the table - columns *with* `default` are optional on insert.\n\t *\n\t * If you need to set a dynamic default value, use {@link $defaultFn} instead.\n\t */\n\tdefault(value: (this['_'] extends { $type: infer U } ? U : this['_']['data']) | SQL): HasDefault {\n\t\tthis.config.default = value;\n\t\tthis.config.hasDefault = true;\n\t\treturn this as HasDefault;\n\t}\n\n\t/**\n\t * Adds a dynamic default value to the column.\n\t * The function will be called when the row is inserted, and the returned value will be used as the column value.\n\t *\n\t * **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.\n\t */\n\t$defaultFn(\n\t\tfn: () => (this['_'] extends { $type: infer U } ? U : this['_']['data']) | SQL,\n\t): HasDefault {\n\t\tthis.config.defaultFn = fn;\n\t\tthis.config.hasDefault = true;\n\t\treturn this as HasDefault;\n\t}\n\n\t/**\n\t * Alias for {@link $defaultFn}.\n\t */\n\t$default = this.$defaultFn;\n\n\t/**\n\t * Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.\n\t *\n\t * In SQLite, `integer primary key` implicitly makes the column auto-incrementing.\n\t */\n\tprimaryKey(): TExtraConfig['primaryKeyHasDefault'] extends true ? HasDefault> : NotNull {\n\t\tthis.config.primaryKey = true;\n\t\tthis.config.notNull = true;\n\t\treturn this as TExtraConfig['primaryKeyHasDefault'] extends true ? HasDefault> : NotNull;\n\t}\n}\n\nexport type BuildColumn<\n\tTTableName extends string,\n\tTBuilder extends ColumnBuilderBase,\n\tTDialect extends Dialect,\n> = TDialect extends 'pg' ? PgColumn>\n\t: TDialect extends 'mysql' ? MySqlColumn>\n\t: TDialect extends 'sqlite' ? SQLiteColumn>\n\t: TDialect extends 'common' ? Column>\n\t: never;\n\nexport type BuildColumns<\n\tTTableName extends string,\n\tTConfigMap extends Record,\n\tTDialect extends Dialect,\n> =\n\t& {\n\t\t[Key in keyof TConfigMap]: BuildColumn;\n\t}\n\t& {};\n\nexport type ChangeColumnTableName =\n\tTDialect extends 'pg' ? PgColumn>\n\t\t: TDialect extends 'mysql' ? MySqlColumn>\n\t\t: TDialect extends 'sqlite' ? SQLiteColumn>\n\t\t: never;\n", "import { entityKind } from '~/entity.ts';\n\nexport class DrizzleError extends Error {\n\tstatic readonly [entityKind]: string = 'DrizzleError';\n\n\tconstructor({ message, cause }: { message?: string; cause?: unknown }) {\n\t\tsuper(message);\n\t\tthis.name = 'DrizzleError';\n\t\tthis.cause = cause;\n\t}\n}\n\nexport class TransactionRollbackError extends DrizzleError {\n\tstatic readonly [entityKind]: string = 'TransactionRollbackError';\n\n\tconstructor() {\n\t\tsuper({ message: 'Rollback' });\n\t}\n}\n", "import { type AnyColumn, Column, type GetColumnData } from '~/column.ts';\nimport { is } from '~/entity.ts';\nimport { Table } from '~/table.ts';\nimport {\n\tisDriverValueEncoder,\n\tisSQLWrapper,\n\tParam,\n\tPlaceholder,\n\tSQL,\n\tsql,\n\ttype SQLChunk,\n\ttype SQLWrapper,\n\tStringChunk,\n\tView,\n} from '../sql.ts';\n\nexport function bindIfParam(value: unknown, column: SQLWrapper): SQLChunk {\n\tif (\n\t\tisDriverValueEncoder(column)\n\t\t&& !isSQLWrapper(value)\n\t\t&& !is(value, Param)\n\t\t&& !is(value, Placeholder)\n\t\t&& !is(value, Column)\n\t\t&& !is(value, Table)\n\t\t&& !is(value, View)\n\t) {\n\t\treturn new Param(value, column);\n\t}\n\treturn value as SQLChunk;\n}\n\nexport interface BinaryOperator {\n\t(\n\t\tleft: TColumn,\n\t\tright: GetColumnData | SQLWrapper,\n\t): SQL;\n\t(left: SQL.Aliased, right: T | SQLWrapper): SQL;\n\t(\n\t\tleft: Exclude,\n\t\tright: unknown,\n\t): SQL;\n}\n\n/**\n * Test that two values are equal.\n *\n * Remember that the SQL standard dictates that\n * two NULL values are not equal, so if you want to test\n * whether a value is null, you may want to use\n * `isNull` instead.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made by Ford\n * db.select().from(cars)\n * .where(eq(cars.make, 'Ford'))\n * ```\n *\n * @see isNull for a way to test equality to NULL.\n */\nexport const eq: BinaryOperator = (left: SQLWrapper, right: unknown): SQL => {\n\treturn sql`${left} = ${bindIfParam(right, left)}`;\n};\n\n/**\n * Test that two values are not equal.\n *\n * Remember that the SQL standard dictates that\n * two NULL values are not equal, so if you want to test\n * whether a value is not null, you may want to use\n * `isNotNull` instead.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars not made by Ford\n * db.select().from(cars)\n * .where(ne(cars.make, 'Ford'))\n * ```\n *\n * @see isNotNull for a way to test whether a value is not null.\n */\nexport const ne: BinaryOperator = (left: SQLWrapper, right: unknown): SQL => {\n\treturn sql`${left} <> ${bindIfParam(right, left)}`;\n};\n\n/**\n * Combine a list of conditions with the `and` operator. Conditions\n * that are equal `undefined` are automatically ignored.\n *\n * ## Examples\n *\n * ```ts\n * db.select().from(cars)\n * .where(\n * and(\n * eq(cars.make, 'Volvo'),\n * eq(cars.year, 1950),\n * )\n * )\n * ```\n */\nexport function and(...conditions: (SQLWrapper | undefined)[]): SQL | undefined;\nexport function and(\n\t...unfilteredConditions: (SQLWrapper | undefined)[]\n): SQL | undefined {\n\tconst conditions = unfilteredConditions.filter(\n\t\t(c): c is Exclude => c !== undefined,\n\t);\n\n\tif (conditions.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tif (conditions.length === 1) {\n\t\treturn new SQL(conditions);\n\t}\n\n\treturn new SQL([\n\t\tnew StringChunk('('),\n\t\tsql.join(conditions, new StringChunk(' and ')),\n\t\tnew StringChunk(')'),\n\t]);\n}\n\n/**\n * Combine a list of conditions with the `or` operator. Conditions\n * that are equal `undefined` are automatically ignored.\n *\n * ## Examples\n *\n * ```ts\n * db.select().from(cars)\n * .where(\n * or(\n * eq(cars.make, 'GM'),\n * eq(cars.make, 'Ford'),\n * )\n * )\n * ```\n */\nexport function or(...conditions: (SQLWrapper | undefined)[]): SQL | undefined;\nexport function or(\n\t...unfilteredConditions: (SQLWrapper | undefined)[]\n): SQL | undefined {\n\tconst conditions = unfilteredConditions.filter(\n\t\t(c): c is Exclude => c !== undefined,\n\t);\n\n\tif (conditions.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tif (conditions.length === 1) {\n\t\treturn new SQL(conditions);\n\t}\n\n\treturn new SQL([\n\t\tnew StringChunk('('),\n\t\tsql.join(conditions, new StringChunk(' or ')),\n\t\tnew StringChunk(')'),\n\t]);\n}\n\n/**\n * Negate the meaning of an expression using the `not` keyword.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars _not_ made by GM or Ford.\n * db.select().from(cars)\n * .where(not(inArray(cars.make, ['GM', 'Ford'])))\n * ```\n */\nexport function not(condition: SQLWrapper): SQL {\n\treturn sql`not ${condition}`;\n}\n\n/**\n * Test that the first expression passed is greater than\n * the second expression.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made after 2000.\n * db.select().from(cars)\n * .where(gt(cars.year, 2000))\n * ```\n *\n * @see gte for greater-than-or-equal\n */\nexport const gt: BinaryOperator = (left: SQLWrapper, right: unknown): SQL => {\n\treturn sql`${left} > ${bindIfParam(right, left)}`;\n};\n\n/**\n * Test that the first expression passed is greater than\n * or equal to the second expression. Use `gt` to\n * test whether an expression is strictly greater\n * than another.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made on or after 2000.\n * db.select().from(cars)\n * .where(gte(cars.year, 2000))\n * ```\n *\n * @see gt for a strictly greater-than condition\n */\nexport const gte: BinaryOperator = (left: SQLWrapper, right: unknown): SQL => {\n\treturn sql`${left} >= ${bindIfParam(right, left)}`;\n};\n\n/**\n * Test that the first expression passed is less than\n * the second expression.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made before 2000.\n * db.select().from(cars)\n * .where(lt(cars.year, 2000))\n * ```\n *\n * @see lte for greater-than-or-equal\n */\nexport const lt: BinaryOperator = (left: SQLWrapper, right: unknown): SQL => {\n\treturn sql`${left} < ${bindIfParam(right, left)}`;\n};\n\n/**\n * Test that the first expression passed is less than\n * or equal to the second expression.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made before 2000.\n * db.select().from(cars)\n * .where(lte(cars.year, 2000))\n * ```\n *\n * @see lt for a strictly less-than condition\n */\nexport const lte: BinaryOperator = (left: SQLWrapper, right: unknown): SQL => {\n\treturn sql`${left} <= ${bindIfParam(right, left)}`;\n};\n\n/**\n * Test whether the first parameter, a column or expression,\n * has a value from a list passed as the second argument.\n *\n * ## Throws\n *\n * The argument passed in the second array can't be empty:\n * if an empty is provided, this method will throw.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made by Ford or GM.\n * db.select().from(cars)\n * .where(inArray(cars.make, ['Ford', 'GM']))\n * ```\n *\n * @see notInArray for the inverse of this test\n */\nexport function inArray(\n\tcolumn: SQL.Aliased,\n\tvalues: (T | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function inArray(\n\tcolumn: TColumn,\n\tvalues: (GetColumnData | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function inArray(\n\tcolumn: Exclude,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function inArray(\n\tcolumn: SQLWrapper,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL {\n\tif (Array.isArray(values)) {\n\t\tif (values.length === 0) {\n\t\t\tthrow new Error('inArray requires at least one value');\n\t\t}\n\t\treturn sql`${column} in ${values.map((v) => bindIfParam(v, column))}`;\n\t}\n\n\treturn sql`${column} in ${bindIfParam(values, column)}`;\n}\n\n/**\n * Test whether the first parameter, a column or expression,\n * has a value that is not present in a list passed as the\n * second argument.\n *\n * ## Throws\n *\n * The argument passed in the second array can't be empty:\n * if an empty is provided, this method will throw.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made by any company except Ford or GM.\n * db.select().from(cars)\n * .where(notInArray(cars.make, ['Ford', 'GM']))\n * ```\n *\n * @see inArray for the inverse of this test\n */\nexport function notInArray(\n\tcolumn: SQL.Aliased,\n\tvalues: (T | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function notInArray(\n\tcolumn: TColumn,\n\tvalues: (GetColumnData | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function notInArray(\n\tcolumn: Exclude,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function notInArray(\n\tcolumn: SQLWrapper,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL {\n\tif (Array.isArray(values)) {\n\t\tif (values.length === 0) {\n\t\t\tthrow new Error('notInArray requires at least one value');\n\t\t}\n\t\treturn sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`;\n\t}\n\n\treturn sql`${column} not in ${bindIfParam(values, column)}`;\n}\n\n/**\n * Test whether an expression is NULL. By the SQL standard,\n * NULL is neither equal nor not equal to itself, so\n * it's recommended to use `isNull` and `notIsNull` for\n * comparisons to NULL.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars that have no discontinuedAt date.\n * db.select().from(cars)\n * .where(isNull(cars.discontinuedAt))\n * ```\n *\n * @see isNotNull for the inverse of this test\n */\nexport function isNull(value: SQLWrapper): SQL {\n\treturn sql`${value} is null`;\n}\n\n/**\n * Test whether an expression is not NULL. By the SQL standard,\n * NULL is neither equal nor not equal to itself, so\n * it's recommended to use `isNull` and `notIsNull` for\n * comparisons to NULL.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars that have been discontinued.\n * db.select().from(cars)\n * .where(isNotNull(cars.discontinuedAt))\n * ```\n *\n * @see isNull for the inverse of this test\n */\nexport function isNotNull(value: SQLWrapper): SQL {\n\treturn sql`${value} is not null`;\n}\n\n/**\n * Test whether a subquery evaluates to have any rows.\n *\n * ## Examples\n *\n * ```ts\n * // Users whose `homeCity` column has a match in a cities\n * // table.\n * db\n * .select()\n * .from(users)\n * .where(\n * exists(db.select()\n * .from(cities)\n * .where(eq(users.homeCity, cities.id))),\n * );\n * ```\n *\n * @see notExists for the inverse of this test\n */\nexport function exists(subquery: SQLWrapper): SQL {\n\treturn sql`exists ${subquery}`;\n}\n\n/**\n * Test whether a subquery doesn't include any result\n * rows.\n *\n * ## Examples\n *\n * ```ts\n * // Users whose `homeCity` column doesn't match\n * // a row in the cities table.\n * db\n * .select()\n * .from(users)\n * .where(\n * notExists(db.select()\n * .from(cities)\n * .where(eq(users.homeCity, cities.id))),\n * );\n * ```\n *\n * @see exists for the inverse of this test\n */\nexport function notExists(subquery: SQLWrapper): SQL {\n\treturn sql`not exists ${subquery}`;\n}\n\n/**\n * Test whether an expression is between two values. This\n * is an easier way to express range tests, which would be\n * expressed mathematically as `x <= a <= y` but in SQL\n * would have to be like `a >= x AND a <= y`.\n *\n * Between is inclusive of the endpoints: if `column`\n * is equal to `min` or `max`, it will be TRUE.\n *\n * ## Examples\n *\n * ```ts\n * // Select cars made between 1990 and 2000\n * db.select().from(cars)\n * .where(between(cars.year, 1990, 2000))\n * ```\n *\n * @see notBetween for the inverse of this test\n */\nexport function between(\n\tcolumn: SQL.Aliased,\n\tmin: T | SQLWrapper,\n\tmax: T | SQLWrapper,\n): SQL;\nexport function between(\n\tcolumn: TColumn,\n\tmin: GetColumnData | SQLWrapper,\n\tmax: GetColumnData | SQLWrapper,\n): SQL;\nexport function between(\n\tcolumn: Exclude,\n\tmin: unknown,\n\tmax: unknown,\n): SQL;\nexport function between(column: SQLWrapper, min: unknown, max: unknown): SQL {\n\treturn sql`${column} between ${bindIfParam(min, column)} and ${\n\t\tbindIfParam(\n\t\t\tmax,\n\t\t\tcolumn,\n\t\t)\n\t}`;\n}\n\n/**\n * Test whether an expression is not between two values.\n *\n * This, like `between`, includes its endpoints, so if\n * the `column` is equal to `min` or `max`, in this case\n * it will evaluate to FALSE.\n *\n * ## Examples\n *\n * ```ts\n * // Exclude cars made in the 1970s\n * db.select().from(cars)\n * .where(notBetween(cars.year, 1970, 1979))\n * ```\n *\n * @see between for the inverse of this test\n */\nexport function notBetween(\n\tcolumn: SQL.Aliased,\n\tmin: T | SQLWrapper,\n\tmax: T | SQLWrapper,\n): SQL;\nexport function notBetween(\n\tcolumn: TColumn,\n\tmin: GetColumnData | SQLWrapper,\n\tmax: GetColumnData | SQLWrapper,\n): SQL;\nexport function notBetween(\n\tcolumn: Exclude,\n\tmin: unknown,\n\tmax: unknown,\n): SQL;\nexport function notBetween(\n\tcolumn: SQLWrapper,\n\tmin: unknown,\n\tmax: unknown,\n): SQL {\n\treturn sql`${column} not between ${\n\t\tbindIfParam(\n\t\t\tmin,\n\t\t\tcolumn,\n\t\t)\n\t} and ${bindIfParam(max, column)}`;\n}\n\n/**\n * Compare a column to a pattern, which can include `%` and `_`\n * characters to match multiple variations. Including `%`\n * in the pattern matches zero or more characters, and including\n * `_` will match a single character.\n *\n * ## Examples\n *\n * ```ts\n * // Select all cars with 'Turbo' in their names.\n * db.select().from(cars)\n * .where(like(cars.name, '%Turbo%'))\n * ```\n *\n * @see ilike for a case-insensitive version of this condition\n */\nexport function like(column: Column, value: string | SQLWrapper): SQL {\n\treturn sql`${column} like ${value}`;\n}\n\n/**\n * The inverse of like - this tests that a given column\n * does not match a pattern, which can include `%` and `_`\n * characters to match multiple variations. Including `%`\n * in the pattern matches zero or more characters, and including\n * `_` will match a single character.\n *\n * ## Examples\n *\n * ```ts\n * // Select all cars that don't have \"ROver\" in their name.\n * db.select().from(cars)\n * .where(notLike(cars.name, '%Rover%'))\n * ```\n *\n * @see like for the inverse condition\n * @see notIlike for a case-insensitive version of this condition\n */\nexport function notLike(column: Column, value: string | SQLWrapper): SQL {\n\treturn sql`${column} not like ${value}`;\n}\n\n/**\n * Case-insensitively compare a column to a pattern,\n * which can include `%` and `_`\n * characters to match multiple variations. Including `%`\n * in the pattern matches zero or more characters, and including\n * `_` will match a single character.\n *\n * Unlike like, this performs a case-insensitive comparison.\n *\n * ## Examples\n *\n * ```ts\n * // Select all cars with 'Turbo' in their names.\n * db.select().from(cars)\n * .where(ilike(cars.name, '%Turbo%'))\n * ```\n *\n * @see like for a case-sensitive version of this condition\n */\nexport function ilike(column: Column, value: string | SQLWrapper): SQL {\n\treturn sql`${column} ilike ${value}`;\n}\n\n/**\n * The inverse of ilike - this case-insensitively tests that a given column\n * does not match a pattern, which can include `%` and `_`\n * characters to match multiple variations. Including `%`\n * in the pattern matches zero or more characters, and including\n * `_` will match a single character.\n *\n * ## Examples\n *\n * ```ts\n * // Select all cars that don't have \"Rover\" in their name.\n * db.select().from(cars)\n * .where(notLike(cars.name, '%Rover%'))\n * ```\n *\n * @see ilike for the inverse condition\n * @see notLike for a case-sensitive version of this condition\n */\nexport function notIlike(column: Column, value: string | SQLWrapper): SQL {\n\treturn sql`${column} not ilike ${value}`;\n}\n\n/**\n * Test that a column or expression contains all elements of\n * the list passed as the second argument.\n *\n * ## Throws\n *\n * The argument passed in the second array can't be empty:\n * if an empty is provided, this method will throw.\n *\n * ## Examples\n *\n * ```ts\n * // Select posts where its tags contain \"Typescript\" and \"ORM\".\n * db.select().from(posts)\n * .where(arrayContains(posts.tags, ['Typescript', 'ORM']))\n * ```\n *\n * @see arrayContained to find if an array contains all elements of a column or expression\n * @see arrayOverlaps to find if a column or expression contains any elements of an array\n */\nexport function arrayContains(\n\tcolumn: SQL.Aliased,\n\tvalues: (T | Placeholder) | SQLWrapper,\n): SQL;\nexport function arrayContains(\n\tcolumn: TColumn,\n\tvalues: (GetColumnData | Placeholder) | SQLWrapper,\n): SQL;\nexport function arrayContains(\n\tcolumn: Exclude,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function arrayContains(\n\tcolumn: SQLWrapper,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL {\n\tif (Array.isArray(values)) {\n\t\tif (values.length === 0) {\n\t\t\tthrow new Error('arrayContains requires at least one value');\n\t\t}\n\t\tconst array = sql`${bindIfParam(values, column)}`;\n\t\treturn sql`${column} @> ${array}`;\n\t}\n\n\treturn sql`${column} @> ${bindIfParam(values, column)}`;\n}\n\n/**\n * Test that the list passed as the second argument contains\n * all elements of a column or expression.\n *\n * ## Throws\n *\n * The argument passed in the second array can't be empty:\n * if an empty is provided, this method will throw.\n *\n * ## Examples\n *\n * ```ts\n * // Select posts where its tags contain \"Typescript\", \"ORM\" or both,\n * // but filtering posts that have additional tags.\n * db.select().from(posts)\n * .where(arrayContained(posts.tags, ['Typescript', 'ORM']))\n * ```\n *\n * @see arrayContains to find if a column or expression contains all elements of an array\n * @see arrayOverlaps to find if a column or expression contains any elements of an array\n */\nexport function arrayContained(\n\tcolumn: SQL.Aliased,\n\tvalues: (T | Placeholder) | SQLWrapper,\n): SQL;\nexport function arrayContained(\n\tcolumn: TColumn,\n\tvalues: (GetColumnData | Placeholder) | SQLWrapper,\n): SQL;\nexport function arrayContained(\n\tcolumn: Exclude,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function arrayContained(\n\tcolumn: SQLWrapper,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL {\n\tif (Array.isArray(values)) {\n\t\tif (values.length === 0) {\n\t\t\tthrow new Error('arrayContained requires at least one value');\n\t\t}\n\t\tconst array = sql`${bindIfParam(values, column)}`;\n\t\treturn sql`${column} <@ ${array}`;\n\t}\n\n\treturn sql`${column} <@ ${bindIfParam(values, column)}`;\n}\n\n/**\n * Test that a column or expression contains any elements of\n * the list passed as the second argument.\n *\n * ## Throws\n *\n * The argument passed in the second array can't be empty:\n * if an empty is provided, this method will throw.\n *\n * ## Examples\n *\n * ```ts\n * // Select posts where its tags contain \"Typescript\", \"ORM\" or both.\n * db.select().from(posts)\n * .where(arrayOverlaps(posts.tags, ['Typescript', 'ORM']))\n * ```\n *\n * @see arrayContains to find if a column or expression contains all elements of an array\n * @see arrayContained to find if an array contains all elements of a column or expression\n */\nexport function arrayOverlaps(\n\tcolumn: SQL.Aliased,\n\tvalues: (T | Placeholder) | SQLWrapper,\n): SQL;\nexport function arrayOverlaps(\n\tcolumn: TColumn,\n\tvalues: (GetColumnData | Placeholder) | SQLWrapper,\n): SQL;\nexport function arrayOverlaps(\n\tcolumn: Exclude,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL;\nexport function arrayOverlaps(\n\tcolumn: SQLWrapper,\n\tvalues: (unknown | Placeholder)[] | SQLWrapper,\n): SQL {\n\tif (Array.isArray(values)) {\n\t\tif (values.length === 0) {\n\t\t\tthrow new Error('arrayOverlaps requires at least one value');\n\t\t}\n\t\tconst array = sql`${bindIfParam(values, column)}`;\n\t\treturn sql`${column} && ${array}`;\n\t}\n\n\treturn sql`${column} && ${bindIfParam(values, column)}`;\n}\n", "import type { AnyColumn } from '../../column.ts';\nimport type { SQL, SQLWrapper } from '../sql.ts';\nimport { sql } from '../sql.ts';\n\n/**\n * Used in sorting, this specifies that the given\n * column or expression should be sorted in ascending\n * order. By the SQL standard, ascending order is the\n * default, so it is not usually necessary to specify\n * ascending sort order.\n *\n * ## Examples\n *\n * ```ts\n * // Return cars, starting with the oldest models\n * // and going in ascending order to the newest.\n * db.select().from(cars)\n * .orderBy(asc(cars.year));\n * ```\n *\n * @see desc to sort in descending order\n */\nexport function asc(column: AnyColumn | SQLWrapper): SQL {\n\treturn sql`${column} asc`;\n}\n\n/**\n * Used in sorting, this specifies that the given\n * column or expression should be sorted in descending\n * order.\n *\n * ## Examples\n *\n * ```ts\n * // Select users, with the most recently created\n * // records coming first.\n * db.select().from(users)\n * .orderBy(desc(users.createdAt));\n * ```\n *\n * @see asc to sort in ascending order\n */\nexport function desc(column: AnyColumn | SQLWrapper): SQL {\n\treturn sql`${column} desc`;\n}\n", "import { entityKind } from '~/entity.ts';\n\nexport interface Logger {\n\tlogQuery(query: string, params: unknown[]): void;\n}\n\nexport interface LogWriter {\n\twrite(message: string): void;\n}\n\nexport class ConsoleLogWriter implements LogWriter {\n\tstatic readonly [entityKind]: string = 'ConsoleLogWriter';\n\n\twrite(message: string) {\n\t\tconsole.log(message);\n\t}\n}\n\nexport class DefaultLogger implements Logger {\n\tstatic readonly [entityKind]: string = 'DefaultLogger';\n\n\treadonly writer: LogWriter;\n\n\tconstructor(config?: { writer: LogWriter }) {\n\t\tthis.writer = config?.writer ?? new ConsoleLogWriter();\n\t}\n\n\tlogQuery(query: string, params: unknown[]): void {\n\t\tconst stringifiedParams = params.map((p) => {\n\t\t\ttry {\n\t\t\t\treturn JSON.stringify(p);\n\t\t\t} catch {\n\t\t\t\treturn String(p);\n\t\t\t}\n\t\t});\n\t\tconst paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(', ')}]` : '';\n\t\tthis.writer.write(`Query: ${query}${paramsStr}`);\n\t}\n}\n\nexport class NoopLogger implements Logger {\n\tstatic readonly [entityKind]: string = 'NoopLogger';\n\n\tlogQuery(): void {\n\t\t// noop\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\n\nexport abstract class QueryPromise implements Promise {\n\tstatic readonly [entityKind]: string = 'QueryPromise';\n\n\t[Symbol.toStringTag] = 'QueryPromise';\n\n\tcatch(\n\t\tonRejected?: ((reason: any) => TResult | PromiseLike) | null | undefined,\n\t): Promise {\n\t\treturn this.then(undefined, onRejected);\n\t}\n\n\tfinally(onFinally?: (() => void) | null | undefined): Promise {\n\t\treturn this.then(\n\t\t\t(value) => {\n\t\t\t\tonFinally?.();\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\t(reason) => {\n\t\t\t\tonFinally?.();\n\t\t\t\tthrow reason;\n\t\t\t},\n\t\t);\n\t}\n\n\tthen(\n\t\tonFulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null,\n\t\tonRejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null,\n\t): Promise {\n\t\treturn this.execute().then(onFulfilled, onRejected);\n\t}\n\n\tabstract execute(): Promise;\n}\n", "import type { BuildColumns } from '~/column-builder.ts';\nimport { entityKind } from '~/entity.ts';\nimport { Table, type TableConfig as TableConfigBase, type UpdateTableConfig } from '~/table.ts';\nimport type { CheckBuilder } from './checks.ts';\nimport type { PgColumn, PgColumnBuilder, PgColumnBuilderBase } from './columns/common.ts';\nimport type { ForeignKey, ForeignKeyBuilder } from './foreign-keys.ts';\nimport type { AnyIndexBuilder } from './indexes.ts';\nimport type { PrimaryKeyBuilder } from './primary-keys.ts';\nimport type { UniqueConstraintBuilder } from './unique-constraint.ts';\n\nexport type PgTableExtraConfig = Record<\n\tstring,\n\t| AnyIndexBuilder\n\t| CheckBuilder\n\t| ForeignKeyBuilder\n\t| PrimaryKeyBuilder\n\t| UniqueConstraintBuilder\n>;\n\nexport type TableConfig = TableConfigBase;\n\n/** @internal */\nexport const InlineForeignKeys = Symbol.for('drizzle:PgInlineForeignKeys');\n\nexport class PgTable extends Table {\n\tstatic readonly [entityKind]: string = 'PgTable';\n\n\t/** @internal */\n\tstatic override readonly Symbol = Object.assign({}, Table.Symbol, {\n\t\tInlineForeignKeys: InlineForeignKeys as typeof InlineForeignKeys,\n\t});\n\n\t/**@internal */\n\t[InlineForeignKeys]: ForeignKey[] = [];\n\n\t/** @internal */\n\toverride [Table.Symbol.ExtraConfigBuilder]: ((self: Record) => PgTableExtraConfig) | undefined =\n\t\tundefined;\n}\n\nexport type AnyPgTable = {}> = PgTable>;\n\nexport type PgTableWithColumns =\n\t& PgTable\n\t& {\n\t\t[Key in keyof T['columns']]: T['columns'][Key];\n\t};\n\n/** @internal */\nexport function pgTableWithSchema<\n\tTTableName extends string,\n\tTSchemaName extends string | undefined,\n\tTColumnsMap extends Record,\n>(\n\tname: TTableName,\n\tcolumns: TColumnsMap,\n\textraConfig: ((self: BuildColumns) => PgTableExtraConfig) | undefined,\n\tschema: TSchemaName,\n\tbaseName = name,\n): PgTableWithColumns<{\n\tname: TTableName;\n\tschema: TSchemaName;\n\tcolumns: BuildColumns;\n\tdialect: 'pg';\n}> {\n\tconst rawTable = new PgTable<{\n\t\tname: TTableName;\n\t\tschema: TSchemaName;\n\t\tcolumns: BuildColumns;\n\t\tdialect: 'pg';\n\t}>(name, schema, baseName);\n\n\tconst builtColumns = Object.fromEntries(\n\t\tObject.entries(columns).map(([name, colBuilderBase]) => {\n\t\t\tconst colBuilder = colBuilderBase as PgColumnBuilder;\n\t\t\tconst column = colBuilder.build(rawTable);\n\t\t\trawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));\n\t\t\treturn [name, column];\n\t\t}),\n\t) as unknown as BuildColumns;\n\n\tconst table = Object.assign(rawTable, builtColumns);\n\n\ttable[Table.Symbol.Columns] = builtColumns;\n\n\tif (extraConfig) {\n\t\ttable[PgTable.Symbol.ExtraConfigBuilder] = extraConfig as any;\n\t}\n\n\treturn table;\n}\n\nexport interface PgTableFn {\n\t<\n\t\tTTableName extends string,\n\t\tTColumnsMap extends Record,\n\t>(\n\t\tname: TTableName,\n\t\tcolumns: TColumnsMap,\n\t\textraConfig?: (self: BuildColumns) => PgTableExtraConfig,\n\t): PgTableWithColumns<{\n\t\tname: TTableName;\n\t\tschema: TSchema;\n\t\tcolumns: BuildColumns;\n\t\tdialect: 'pg';\n\t}>;\n}\n\nexport const pgTable: PgTableFn = (name, columns, extraConfig) => {\n\treturn pgTableWithSchema(name, columns, extraConfig, undefined);\n};\n\nexport function pgTableCreator(customizeTableName: (name: string) => string): PgTableFn {\n\treturn (name, columns, extraConfig) => {\n\t\treturn pgTableWithSchema(customizeTableName(name) as typeof name, columns, extraConfig, undefined, name);\n\t};\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { AnyPgColumn, PgColumn } from './columns/index.ts';\nimport { PgTable } from './table.ts';\n\nexport function primaryKey<\n\tTTableName extends string,\n\tTColumn extends AnyPgColumn<{ tableName: TTableName }>,\n\tTColumns extends AnyPgColumn<{ tableName: TTableName }>[],\n>(config: { name?: string; columns: [TColumn, ...TColumns] }): PrimaryKeyBuilder;\n/**\n * @deprecated: Please use primaryKey({ columns: [] }) instead of this function\n * @param columns\n */\nexport function primaryKey<\n\tTTableName extends string,\n\tTColumns extends AnyPgColumn<{ tableName: TTableName }>[],\n>(...columns: TColumns): PrimaryKeyBuilder;\nexport function primaryKey(...config: any) {\n\tif (config[0].columns) {\n\t\treturn new PrimaryKeyBuilder(config[0].columns, config[0].name);\n\t}\n\treturn new PrimaryKeyBuilder(config);\n}\n\nexport class PrimaryKeyBuilder {\n\tstatic readonly [entityKind]: string = 'PgPrimaryKeyBuilder';\n\n\t/** @internal */\n\tcolumns: PgColumn[];\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tcolumns: PgColumn[],\n\t\tname?: string,\n\t) {\n\t\tthis.columns = columns;\n\t\tthis.name = name;\n\t}\n\n\t/** @internal */\n\tbuild(table: PgTable): PrimaryKey {\n\t\treturn new PrimaryKey(table, this.columns, this.name);\n\t}\n}\n\nexport class PrimaryKey {\n\tstatic readonly [entityKind]: string = 'PgPrimaryKey';\n\n\treadonly columns: AnyPgColumn<{}>[];\n\treadonly name?: string;\n\n\tconstructor(readonly table: PgTable, columns: AnyPgColumn<{}>[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.name = name;\n\t}\n\n\tgetName(): string {\n\t\treturn this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;\n\t}\n}\n", "import { type AnyTable, type InferModelFromColumns, isTable, Table } from '~/table.ts';\nimport { type AnyColumn, Column } from './column.ts';\nimport { entityKind, is } from './entity.ts';\nimport { PrimaryKeyBuilder } from './pg-core/primary-keys.ts';\nimport {\n\tand,\n\tasc,\n\tbetween,\n\tdesc,\n\teq,\n\texists,\n\tgt,\n\tgte,\n\tilike,\n\tinArray,\n\tisNotNull,\n\tisNull,\n\tlike,\n\tlt,\n\tlte,\n\tne,\n\tnot,\n\tnotBetween,\n\tnotExists,\n\tnotIlike,\n\tnotInArray,\n\tnotLike,\n\tor,\n} from './sql/expressions/index.ts';\nimport { type Placeholder, SQL, sql } from './sql/sql.ts';\nimport type { Assume, ColumnsWithTable, Equal, Simplify, ValueOrArray } from './utils.ts';\n\nexport abstract class Relation {\n\tstatic readonly [entityKind]: string = 'Relation';\n\n\tdeclare readonly $brand: 'Relation';\n\treadonly referencedTableName: TTableName;\n\tfieldName!: string;\n\n\tconstructor(\n\t\treadonly sourceTable: Table,\n\t\treadonly referencedTable: AnyTable<{ name: TTableName }>,\n\t\treadonly relationName: string | undefined,\n\t) {\n\t\tthis.referencedTableName = referencedTable[Table.Symbol.Name] as TTableName;\n\t}\n\n\tabstract withFieldName(fieldName: string): Relation;\n}\n\nexport class Relations<\n\tTTableName extends string = string,\n\tTConfig extends Record = Record,\n> {\n\tstatic readonly [entityKind]: string = 'Relations';\n\n\tdeclare readonly $brand: 'Relations';\n\n\tconstructor(\n\t\treadonly table: AnyTable<{ name: TTableName }>,\n\t\treadonly config: (helpers: TableRelationsHelpers) => TConfig,\n\t) {}\n}\n\nexport class One<\n\tTTableName extends string = string,\n\tTIsNullable extends boolean = boolean,\n> extends Relation {\n\tstatic readonly [entityKind]: string = 'One';\n\n\tdeclare protected $relationBrand: 'One';\n\n\tconstructor(\n\t\tsourceTable: Table,\n\t\treferencedTable: AnyTable<{ name: TTableName }>,\n\t\treadonly config:\n\t\t\t| RelationConfig<\n\t\t\t\tTTableName,\n\t\t\t\tstring,\n\t\t\t\tAnyColumn<{ tableName: TTableName }>[]\n\t\t\t>\n\t\t\t| undefined,\n\t\treadonly isNullable: TIsNullable,\n\t) {\n\t\tsuper(sourceTable, referencedTable, config?.relationName);\n\t}\n\n\twithFieldName(fieldName: string): One {\n\t\tconst relation = new One(\n\t\t\tthis.sourceTable,\n\t\t\tthis.referencedTable,\n\t\t\tthis.config,\n\t\t\tthis.isNullable,\n\t\t);\n\t\trelation.fieldName = fieldName;\n\t\treturn relation;\n\t}\n}\n\nexport class Many extends Relation {\n\tstatic readonly [entityKind]: string = 'Many';\n\n\tdeclare protected $relationBrand: 'Many';\n\n\tconstructor(\n\t\tsourceTable: Table,\n\t\treferencedTable: AnyTable<{ name: TTableName }>,\n\t\treadonly config: { relationName: string } | undefined,\n\t) {\n\t\tsuper(sourceTable, referencedTable, config?.relationName);\n\t}\n\n\twithFieldName(fieldName: string): Many {\n\t\tconst relation = new Many(\n\t\t\tthis.sourceTable,\n\t\t\tthis.referencedTable,\n\t\t\tthis.config,\n\t\t);\n\t\trelation.fieldName = fieldName;\n\t\treturn relation;\n\t}\n}\n\nexport type TableRelationsKeysOnly<\n\tTSchema extends Record,\n\tTTableName extends string,\n\tK extends keyof TSchema,\n> = TSchema[K] extends Relations ? K : never;\n\nexport type ExtractTableRelationsFromSchema<\n\tTSchema extends Record,\n\tTTableName extends string,\n> = ExtractObjectValues<\n\t{\n\t\t[\n\t\t\tK in keyof TSchema as TableRelationsKeysOnly<\n\t\t\t\tTSchema,\n\t\t\t\tTTableName,\n\t\t\t\tK\n\t\t\t>\n\t\t]: TSchema[K] extends Relations ? TConfig : never;\n\t}\n>;\n\nexport type ExtractObjectValues = T[keyof T];\n\nexport type ExtractRelationsFromTableExtraConfigSchema<\n\tTConfig extends unknown[],\n> = ExtractObjectValues<\n\t{\n\t\t[\n\t\t\tK in keyof TConfig as TConfig[K] extends Relations ? K\n\t\t\t\t: never\n\t\t]: TConfig[K] extends Relations ? TRelationConfig\n\t\t\t: never;\n\t}\n>;\n\nexport function getOperators() {\n\treturn {\n\t\tand,\n\t\tbetween,\n\t\teq,\n\t\texists,\n\t\tgt,\n\t\tgte,\n\t\tilike,\n\t\tinArray,\n\t\tisNull,\n\t\tisNotNull,\n\t\tlike,\n\t\tlt,\n\t\tlte,\n\t\tne,\n\t\tnot,\n\t\tnotBetween,\n\t\tnotExists,\n\t\tnotLike,\n\t\tnotIlike,\n\t\tnotInArray,\n\t\tor,\n\t\tsql,\n\t};\n}\n\nexport type Operators = ReturnType;\n\nexport function getOrderByOperators() {\n\treturn {\n\t\tsql,\n\t\tasc,\n\t\tdesc,\n\t};\n}\n\nexport type OrderByOperators = ReturnType;\n\nexport type FindTableByDBName<\n\tTSchema extends TablesRelationalConfig,\n\tTTableName extends string,\n> = ExtractObjectValues<\n\t{\n\t\t[\n\t\t\tK in keyof TSchema as TSchema[K]['dbName'] extends TTableName ? K\n\t\t\t\t: never\n\t\t]: TSchema[K];\n\t}\n>;\n\nexport type DBQueryConfig<\n\tTRelationType extends 'one' | 'many' = 'one' | 'many',\n\tTIsRoot extends boolean = boolean,\n\tTSchema extends TablesRelationalConfig = TablesRelationalConfig,\n\tTTableConfig extends TableRelationalConfig = TableRelationalConfig,\n> =\n\t& {\n\t\tcolumns?: {\n\t\t\t[K in keyof TTableConfig['columns']]?: boolean;\n\t\t};\n\t\twith?: {\n\t\t\t[K in keyof TTableConfig['relations']]?:\n\t\t\t\t| true\n\t\t\t\t| DBQueryConfig<\n\t\t\t\t\tTTableConfig['relations'][K] extends One ? 'one' : 'many',\n\t\t\t\t\tfalse,\n\t\t\t\t\tTSchema,\n\t\t\t\t\tFindTableByDBName<\n\t\t\t\t\t\tTSchema,\n\t\t\t\t\t\tTTableConfig['relations'][K]['referencedTableName']\n\t\t\t\t\t>\n\t\t\t\t>;\n\t\t};\n\t\textras?:\n\t\t\t| Record\n\t\t\t| ((\n\t\t\t\tfields: Simplify<\n\t\t\t\t\t[TTableConfig['columns']] extends [never] ? {}\n\t\t\t\t\t\t: TTableConfig['columns']\n\t\t\t\t>,\n\t\t\t\toperators: { sql: Operators['sql'] },\n\t\t\t) => Record);\n\t}\n\t& (TRelationType extends 'many' ? \n\t\t\t& {\n\t\t\t\twhere?:\n\t\t\t\t\t| SQL\n\t\t\t\t\t| undefined\n\t\t\t\t\t| ((\n\t\t\t\t\t\tfields: Simplify<\n\t\t\t\t\t\t\t[TTableConfig['columns']] extends [never] ? {}\n\t\t\t\t\t\t\t\t: TTableConfig['columns']\n\t\t\t\t\t\t>,\n\t\t\t\t\t\toperators: Operators,\n\t\t\t\t\t) => SQL | undefined);\n\t\t\t\torderBy?:\n\t\t\t\t\t| ValueOrArray\n\t\t\t\t\t| ((\n\t\t\t\t\t\tfields: Simplify<\n\t\t\t\t\t\t\t[TTableConfig['columns']] extends [never] ? {}\n\t\t\t\t\t\t\t\t: TTableConfig['columns']\n\t\t\t\t\t\t>,\n\t\t\t\t\t\toperators: OrderByOperators,\n\t\t\t\t\t) => ValueOrArray);\n\t\t\t\tlimit?: number | Placeholder;\n\t\t\t}\n\t\t\t& (TIsRoot extends true ? {\n\t\t\t\t\toffset?: number | Placeholder;\n\t\t\t\t}\n\t\t\t\t: {})\n\t\t: {});\n\nexport interface TableRelationalConfig {\n\ttsName: string;\n\tdbName: string;\n\tcolumns: Record;\n\trelations: Record;\n\tprimaryKey: AnyColumn[];\n\tschema?: string;\n}\n\nexport type TablesRelationalConfig = Record;\n\nexport interface RelationalSchemaConfig<\n\tTSchema extends TablesRelationalConfig,\n> {\n\tfullSchema: Record;\n\tschema: TSchema;\n\ttableNamesMap: Record;\n}\n\nexport type ExtractTablesWithRelations<\n\tTSchema extends Record,\n> = {\n\t[\n\t\tK in keyof TSchema as TSchema[K] extends Table ? K\n\t\t\t: never\n\t]: TSchema[K] extends Table ? {\n\t\t\ttsName: K & string;\n\t\t\tdbName: TSchema[K]['_']['name'];\n\t\t\tcolumns: TSchema[K]['_']['columns'];\n\t\t\trelations: ExtractTableRelationsFromSchema<\n\t\t\t\tTSchema,\n\t\t\t\tTSchema[K]['_']['name']\n\t\t\t>;\n\t\t\tprimaryKey: AnyColumn[];\n\t\t}\n\t\t: never;\n};\n\nexport type ReturnTypeOrValue = T extends (...args: any[]) => infer R ? R\n\t: T;\n\nexport type BuildRelationResult<\n\tTSchema extends TablesRelationalConfig,\n\tTInclude,\n\tTRelations extends Record,\n> = {\n\t[\n\t\tK in\n\t\t\t& NonUndefinedKeysOnly\n\t\t\t& keyof TRelations\n\t]: TRelations[K] extends infer TRel extends Relation ? BuildQueryResult<\n\t\t\tTSchema,\n\t\t\tFindTableByDBName,\n\t\t\tAssume>\n\t\t> extends infer TResult ? TRel extends One ? \n\t\t\t\t\t| TResult\n\t\t\t\t\t| (Equal extends true ? null : never)\n\t\t\t: TResult[]\n\t\t: never\n\t\t: never;\n};\n\nexport type NonUndefinedKeysOnly =\n\t& ExtractObjectValues<\n\t\t{\n\t\t\t[K in keyof T as T[K] extends undefined ? never : K]: K;\n\t\t}\n\t>\n\t& keyof T;\n\nexport type BuildQueryResult<\n\tTSchema extends TablesRelationalConfig,\n\tTTableConfig extends TableRelationalConfig,\n\tTFullSelection extends true | Record,\n> = Equal extends true ? InferModelFromColumns\n\t: TFullSelection extends Record ? Simplify<\n\t\t\t& (TFullSelection['columns'] extends Record ? InferModelFromColumns<\n\t\t\t\t\t{\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tK in Equal<\n\t\t\t\t\t\t\t\tExclude<\n\t\t\t\t\t\t\t\t\tTFullSelection['columns'][\n\t\t\t\t\t\t\t\t\t\t& keyof TFullSelection['columns']\n\t\t\t\t\t\t\t\t\t\t& keyof TTableConfig['columns']\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t> extends true ? Exclude<\n\t\t\t\t\t\t\t\t\tkeyof TTableConfig['columns'],\n\t\t\t\t\t\t\t\t\tNonUndefinedKeysOnly\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t: \n\t\t\t\t\t\t\t\t\t& {\n\t\t\t\t\t\t\t\t\t\t[K in keyof TFullSelection['columns']]: Equal<\n\t\t\t\t\t\t\t\t\t\t\tTFullSelection['columns'][K],\n\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t> extends true ? K\n\t\t\t\t\t\t\t\t\t\t\t: never;\n\t\t\t\t\t\t\t\t\t}[keyof TFullSelection['columns']]\n\t\t\t\t\t\t\t\t\t& keyof TTableConfig['columns']\n\t\t\t\t\t\t]: TTableConfig['columns'][K];\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t: InferModelFromColumns)\n\t\t\t& (TFullSelection['extras'] extends\n\t\t\t\t| Record\n\t\t\t\t| ((...args: any[]) => Record) ? {\n\t\t\t\t\t[\n\t\t\t\t\t\tK in NonUndefinedKeysOnly<\n\t\t\t\t\t\t\tReturnTypeOrValue\n\t\t\t\t\t\t>\n\t\t\t\t\t]: Assume<\n\t\t\t\t\t\tReturnTypeOrValue[K],\n\t\t\t\t\t\tSQL.Aliased\n\t\t\t\t\t>['_']['type'];\n\t\t\t\t}\n\t\t\t\t: {})\n\t\t\t& (TFullSelection['with'] extends Record ? BuildRelationResult<\n\t\t\t\t\tTSchema,\n\t\t\t\t\tTFullSelection['with'],\n\t\t\t\t\tTTableConfig['relations']\n\t\t\t\t>\n\t\t\t\t: {})\n\t\t>\n\t: never;\n\nexport interface RelationConfig<\n\tTTableName extends string,\n\tTForeignTableName extends string,\n\tTColumns extends AnyColumn<{ tableName: TTableName }>[],\n> {\n\trelationName?: string;\n\tfields: TColumns;\n\treferences: ColumnsWithTable;\n}\n\nexport function extractTablesRelationalConfig<\n\tTTables extends TablesRelationalConfig,\n>(\n\tschema: Record,\n\tconfigHelpers: (table: Table) => any,\n): { tables: TTables; tableNamesMap: Record } {\n\tif (\n\t\tObject.keys(schema).length === 1\n\t\t&& 'default' in schema\n\t\t&& !is(schema['default'], Table)\n\t) {\n\t\tschema = schema['default'] as Record;\n\t}\n\n\t// table DB name -> schema table key\n\tconst tableNamesMap: Record = {};\n\t// Table relations found before their tables - need to buffer them until we know the schema table key\n\tconst relationsBuffer: Record<\n\t\tstring,\n\t\t{ relations: Record; primaryKey?: AnyColumn[] }\n\t> = {};\n\tconst tablesConfig: TablesRelationalConfig = {};\n\tfor (const [key, value] of Object.entries(schema)) {\n\t\tif (isTable(value)) {\n\t\t\tconst dbName = value[Table.Symbol.Name];\n\t\t\tconst bufferedRelations = relationsBuffer[dbName];\n\t\t\ttableNamesMap[dbName] = key;\n\t\t\ttablesConfig[key] = {\n\t\t\t\ttsName: key,\n\t\t\t\tdbName: value[Table.Symbol.Name],\n\t\t\t\tschema: value[Table.Symbol.Schema],\n\t\t\t\tcolumns: value[Table.Symbol.Columns],\n\t\t\t\trelations: bufferedRelations?.relations ?? {},\n\t\t\t\tprimaryKey: bufferedRelations?.primaryKey ?? [],\n\t\t\t};\n\n\t\t\t// Fill in primary keys\n\t\t\tfor (\n\t\t\t\tconst column of Object.values(\n\t\t\t\t\t(value as Table)[Table.Symbol.Columns],\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif (column.primary) {\n\t\t\t\t\ttablesConfig[key]!.primaryKey.push(column);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value);\n\t\t\tif (extraConfig) {\n\t\t\t\tfor (const configEntry of Object.values(extraConfig)) {\n\t\t\t\t\tif (is(configEntry, PrimaryKeyBuilder)) {\n\t\t\t\t\t\ttablesConfig[key]!.primaryKey.push(...configEntry.columns);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (is(value, Relations)) {\n\t\t\tconst dbName: string = value.table[Table.Symbol.Name];\n\t\t\tconst tableName = tableNamesMap[dbName];\n\t\t\tconst relations: Record = value.config(\n\t\t\t\tconfigHelpers(value.table),\n\t\t\t);\n\t\t\tlet primaryKey: AnyColumn[] | undefined;\n\n\t\t\tfor (const [relationName, relation] of Object.entries(relations)) {\n\t\t\t\tif (tableName) {\n\t\t\t\t\tconst tableConfig = tablesConfig[tableName]!;\n\t\t\t\t\ttableConfig.relations[relationName] = relation;\n\t\t\t\t\tif (primaryKey) {\n\t\t\t\t\t\ttableConfig.primaryKey.push(...primaryKey);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (!(dbName in relationsBuffer)) {\n\t\t\t\t\t\trelationsBuffer[dbName] = {\n\t\t\t\t\t\t\trelations: {},\n\t\t\t\t\t\t\tprimaryKey,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\trelationsBuffer[dbName]!.relations[relationName] = relation;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { tables: tablesConfig as TTables, tableNamesMap };\n}\n\nexport function relations<\n\tTTableName extends string,\n\tTRelations extends Record>,\n>(\n\ttable: AnyTable<{ name: TTableName }>,\n\trelations: (helpers: TableRelationsHelpers) => TRelations,\n): Relations {\n\treturn new Relations(\n\t\ttable,\n\t\t(helpers: TableRelationsHelpers) =>\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries(relations(helpers)).map(([key, value]) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue.withFieldName(key),\n\t\t\t\t]),\n\t\t\t) as TRelations,\n\t);\n}\n\nexport function createOne(sourceTable: Table) {\n\treturn function one<\n\t\tTForeignTable extends Table,\n\t\tTColumns extends [\n\t\t\tAnyColumn<{ tableName: TTableName }>,\n\t\t\t...AnyColumn<{ tableName: TTableName }>[],\n\t\t],\n\t>(\n\t\ttable: TForeignTable,\n\t\tconfig?: RelationConfig,\n\t): One<\n\t\tTForeignTable['_']['name'],\n\t\tEqual\n\t> {\n\t\treturn new One(\n\t\t\tsourceTable,\n\t\t\ttable,\n\t\t\tconfig,\n\t\t\t(config?.fields.reduce((res, f) => res && f.notNull, true)\n\t\t\t\t?? false) as Equal,\n\t\t);\n\t};\n}\n\nexport function createMany(sourceTable: Table) {\n\treturn function many(\n\t\treferencedTable: TForeignTable,\n\t\tconfig?: { relationName: string },\n\t): Many {\n\t\treturn new Many(sourceTable, referencedTable, config);\n\t};\n}\n\nexport interface NormalizedRelation {\n\tfields: AnyColumn[];\n\treferences: AnyColumn[];\n}\n\nexport function normalizeRelation(\n\tschema: TablesRelationalConfig,\n\ttableNamesMap: Record,\n\trelation: Relation,\n): NormalizedRelation {\n\tif (is(relation, One) && relation.config) {\n\t\treturn {\n\t\t\tfields: relation.config.fields,\n\t\t\treferences: relation.config.references,\n\t\t};\n\t}\n\n\tconst referencedTableTsName = tableNamesMap[relation.referencedTable[Table.Symbol.Name]];\n\tif (!referencedTableTsName) {\n\t\tthrow new Error(\n\t\t\t`Table \"${relation.referencedTable[Table.Symbol.Name]}\" not found in schema`,\n\t\t);\n\t}\n\n\tconst referencedTableConfig = schema[referencedTableTsName];\n\tif (!referencedTableConfig) {\n\t\tthrow new Error(`Table \"${referencedTableTsName}\" not found in schema`);\n\t}\n\n\tconst sourceTable = relation.sourceTable;\n\tconst sourceTableTsName = tableNamesMap[sourceTable[Table.Symbol.Name]];\n\tif (!sourceTableTsName) {\n\t\tthrow new Error(\n\t\t\t`Table \"${sourceTable[Table.Symbol.Name]}\" not found in schema`,\n\t\t);\n\t}\n\n\tconst reverseRelations: Relation[] = [];\n\tfor (\n\t\tconst referencedTableRelation of Object.values(\n\t\t\treferencedTableConfig.relations,\n\t\t)\n\t) {\n\t\tif (\n\t\t\t(relation.relationName\n\t\t\t\t&& relation !== referencedTableRelation\n\t\t\t\t&& referencedTableRelation.relationName === relation.relationName)\n\t\t\t|| (!relation.relationName\n\t\t\t\t&& referencedTableRelation.referencedTable === relation.sourceTable)\n\t\t) {\n\t\t\treverseRelations.push(referencedTableRelation);\n\t\t}\n\t}\n\n\tif (reverseRelations.length > 1) {\n\t\tthrow relation.relationName\n\t\t\t? new Error(\n\t\t\t\t`There are multiple relations with name \"${relation.relationName}\" in table \"${referencedTableTsName}\"`,\n\t\t\t)\n\t\t\t: new Error(\n\t\t\t\t`There are multiple relations between \"${referencedTableTsName}\" and \"${\n\t\t\t\t\trelation.sourceTable[Table.Symbol.Name]\n\t\t\t\t}\". Please specify relation name`,\n\t\t\t);\n\t}\n\n\tif (\n\t\treverseRelations[0]\n\t\t&& is(reverseRelations[0], One)\n\t\t&& reverseRelations[0].config\n\t) {\n\t\treturn {\n\t\t\tfields: reverseRelations[0].config.references,\n\t\t\treferences: reverseRelations[0].config.fields,\n\t\t};\n\t}\n\n\tthrow new Error(\n\t\t`There is not enough information to infer relation \"${sourceTableTsName}.${relation.fieldName}\"`,\n\t);\n}\n\nexport function createTableRelationsHelpers(\n\tsourceTable: AnyTable<{ name: TTableName }>,\n) {\n\treturn {\n\t\tone: createOne(sourceTable),\n\t\tmany: createMany(sourceTable),\n\t};\n}\n\nexport type TableRelationsHelpers = ReturnType<\n\ttypeof createTableRelationsHelpers\n>;\n\nexport interface BuildRelationalQueryResult<\n\tTTable extends Table = Table,\n\tTColumn extends Column = Column,\n> {\n\ttableTsKey: string;\n\tselection: {\n\t\tdbKey: string;\n\t\ttsKey: string;\n\t\tfield: TColumn | SQL | SQL.Aliased;\n\t\trelationTableTsKey: string | undefined;\n\t\tisJson: boolean;\n\t\tisExtra?: boolean;\n\t\tselection: BuildRelationalQueryResult['selection'];\n\t}[];\n\tsql: TTable | SQL;\n}\n\nexport function mapRelationalRow(\n\ttablesConfig: TablesRelationalConfig,\n\ttableConfig: TableRelationalConfig,\n\trow: unknown[],\n\tbuildQueryResultSelection: BuildRelationalQueryResult['selection'],\n\tmapColumnValue: (value: unknown) => unknown = (value) => value,\n): Record {\n\tconst result: Record = {};\n\n\tfor (\n\t\tconst [\n\t\t\tselectionItemIndex,\n\t\t\tselectionItem,\n\t\t] of buildQueryResultSelection.entries()\n\t) {\n\t\tif (selectionItem.isJson) {\n\t\t\tconst relation = tableConfig.relations[selectionItem.tsKey]!;\n\t\t\tconst rawSubRows = row[selectionItemIndex] as\n\t\t\t\t| unknown[]\n\t\t\t\t| null\n\t\t\t\t| [null]\n\t\t\t\t| string;\n\t\t\tconst subRows = typeof rawSubRows === 'string'\n\t\t\t\t? (JSON.parse(rawSubRows) as unknown[])\n\t\t\t\t: rawSubRows;\n\t\t\tresult[selectionItem.tsKey] = is(relation, One)\n\t\t\t\t? subRows\n\t\t\t\t\t&& mapRelationalRow(\n\t\t\t\t\t\ttablesConfig,\n\t\t\t\t\t\ttablesConfig[selectionItem.relationTableTsKey!]!,\n\t\t\t\t\t\tsubRows,\n\t\t\t\t\t\tselectionItem.selection,\n\t\t\t\t\t\tmapColumnValue,\n\t\t\t\t\t)\n\t\t\t\t: (subRows as unknown[][]).map((subRow) =>\n\t\t\t\t\tmapRelationalRow(\n\t\t\t\t\t\ttablesConfig,\n\t\t\t\t\t\ttablesConfig[selectionItem.relationTableTsKey!]!,\n\t\t\t\t\t\tsubRow,\n\t\t\t\t\t\tselectionItem.selection,\n\t\t\t\t\t\tmapColumnValue,\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t} else {\n\t\t\tconst value = mapColumnValue(row[selectionItemIndex]);\n\t\t\tconst field = selectionItem.field!;\n\t\t\tlet decoder;\n\t\t\tif (is(field, Column)) {\n\t\t\t\tdecoder = field;\n\t\t\t} else if (is(field, SQL)) {\n\t\t\t\tdecoder = field.decoder;\n\t\t\t} else {\n\t\t\t\tdecoder = field.sql.decoder;\n\t\t\t}\n\t\t\tresult[selectionItem.tsKey] = value === null ? null : decoder.mapFromDriverValue(value);\n\t\t}\n\t}\n\n\treturn result;\n}\n", "import { is } from '~/entity.ts';\nimport { type SQL, sql, type SQLWrapper } from '../sql.ts';\nimport { type AnyColumn, Column } from '~/column.ts';\n\n/**\n * Returns the number of values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Number employees with null values\n * db.select({ value: count() }).from(employees)\n * // Number of employees where `name` is not null\n * db.select({ value: count(employees.name) }).from(employees)\n * ```\n * \n * @see countDistinct to get the number of non-duplicate values in `expression`\n */\nexport function count(expression?: SQLWrapper): SQL {\n return sql`count(${expression || sql.raw('*')})`.mapWith(Number);\n}\n\n/**\n * Returns the number of non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Number of employees where `name` is distinct\n * db.select({ value: countDistinct(employees.name) }).from(employees)\n * ```\n * \n * @see count to get the number of values in `expression`, including duplicates\n */\nexport function countDistinct(expression: SQLWrapper): SQL {\n return sql`count(distinct ${expression})`.mapWith(Number);\n}\n\n/**\n * Returns the average (arithmetic mean) of all non-null values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Average salary of an employee\n * db.select({ value: avg(employees.salary) }).from(employees)\n * ```\n * \n * @see avgDistinct to get the average of all non-null and non-duplicate values in `expression`\n */\nexport function avg(expression: SQLWrapper): SQL {\n return sql`avg(${expression})`.mapWith(String);\n}\n\n/**\n * Returns the average (arithmetic mean) of all non-null and non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Average salary of an employee where `salary` is distinct\n * db.select({ value: avgDistinct(employees.salary) }).from(employees)\n * ```\n * \n * @see avg to get the average of all non-null values in `expression`, including duplicates\n */\nexport function avgDistinct(expression: SQLWrapper): SQL {\n return sql`avg(distinct ${expression})`.mapWith(String);\n}\n\n/**\n * Returns the sum of all non-null values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Sum of every employee's salary\n * db.select({ value: sum(employees.salary) }).from(employees)\n * ```\n * \n * @see sumDistinct to get the sum of all non-null and non-duplicate values in `expression`\n */\nexport function sum(expression: SQLWrapper): SQL {\n return sql`sum(${expression})`.mapWith(String);\n}\n\n/**\n * Returns the sum of all non-null and non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Sum of every employee's salary where `salary` is distinct (no duplicates)\n * db.select({ value: sumDistinct(employees.salary) }).from(employees)\n * ```\n * \n * @see sum to get the sum of all non-null values in `expression`, including duplicates\n */\nexport function sumDistinct(expression: SQLWrapper): SQL {\n return sql`sum(distinct ${expression})`.mapWith(String);\n}\n\n/**\n * Returns the maximum value in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // The employee with the highest salary\n * db.select({ value: max(employees.salary) }).from(employees)\n * ```\n */\nexport function max(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null> {\n return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String) as any;\n}\n\n/**\n * Returns the minimum value in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // The employee with the lowest salary\n * db.select({ value: min(employees.salary) }).from(employees)\n * ```\n */\nexport function min(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null> {\n return sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String) as any;\n}\n", "import type { AnyColumn } from './column.ts';\nimport { Column } from './column.ts';\nimport { is } from './entity.ts';\nimport type { Logger } from './logger.ts';\nimport type { SelectedFieldsOrdered } from './operations.ts';\nimport type { TableLike } from './query-builders/select.types.ts';\nimport { Param, SQL, View } from './sql/sql.ts';\nimport type { DriverValueDecoder } from './sql/sql.ts';\nimport { Subquery, SubqueryConfig } from './subquery.ts';\nimport { getTableName, Table } from './table.ts';\nimport { ViewBaseConfig } from './view-common.ts';\n\n/** @internal */\nexport function mapResultRow(\n\tcolumns: SelectedFieldsOrdered,\n\trow: unknown[],\n\tjoinsNotNullableMap: Record | undefined,\n): TResult {\n\t// Key -> nested object key, value -> table name if all fields in the nested object are from the same table, false otherwise\n\tconst nullifyMap: Record = {};\n\n\tconst result = columns.reduce>(\n\t\t(result, { path, field }, columnIndex) => {\n\t\t\tlet decoder: DriverValueDecoder;\n\t\t\tif (is(field, Column)) {\n\t\t\t\tdecoder = field;\n\t\t\t} else if (is(field, SQL)) {\n\t\t\t\tdecoder = field.decoder;\n\t\t\t} else {\n\t\t\t\tdecoder = field.sql.decoder;\n\t\t\t}\n\t\t\tlet node = result;\n\t\t\tfor (const [pathChunkIndex, pathChunk] of path.entries()) {\n\t\t\t\tif (pathChunkIndex < path.length - 1) {\n\t\t\t\t\tif (!(pathChunk in node)) {\n\t\t\t\t\t\tnode[pathChunk] = {};\n\t\t\t\t\t}\n\t\t\t\t\tnode = node[pathChunk];\n\t\t\t\t} else {\n\t\t\t\t\tconst rawValue = row[columnIndex]!;\n\t\t\t\t\tconst value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);\n\n\t\t\t\t\tif (joinsNotNullableMap && is(field, Column) && path.length === 2) {\n\t\t\t\t\t\tconst objectName = path[0]!;\n\t\t\t\t\t\tif (!(objectName in nullifyMap)) {\n\t\t\t\t\t\t\tnullifyMap[objectName] = value === null ? getTableName(field.table) : false;\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\ttypeof nullifyMap[objectName] === 'string' && nullifyMap[objectName] !== getTableName(field.table)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnullifyMap[objectName] = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t\t{},\n\t);\n\n\t// Nullify all nested objects from nullifyMap that are nullable\n\tif (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) {\n\t\tfor (const [objectName, tableName] of Object.entries(nullifyMap)) {\n\t\t\tif (typeof tableName === 'string' && !joinsNotNullableMap[tableName]) {\n\t\t\t\tresult[objectName] = null;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result as TResult;\n}\n\n/** @internal */\nexport function orderSelectedFields(\n\tfields: Record,\n\tpathPrefix?: string[],\n): SelectedFieldsOrdered {\n\treturn Object.entries(fields).reduce>((result, [name, field]) => {\n\t\tif (typeof name !== 'string') {\n\t\t\treturn result;\n\t\t}\n\n\t\tconst newPath = pathPrefix ? [...pathPrefix, name] : [name];\n\t\tif (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {\n\t\t\tresult.push({ path: newPath, field });\n\t\t} else if (is(field, Table)) {\n\t\t\tresult.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));\n\t\t} else {\n\t\t\tresult.push(...orderSelectedFields(field as Record, newPath));\n\t\t}\n\t\treturn result;\n\t}, []) as SelectedFieldsOrdered;\n}\n\nexport function haveSameKeys(left: Record, right: Record) {\n\tconst leftKeys = Object.keys(left);\n\tconst rightKeys = Object.keys(right);\n\n\tif (leftKeys.length !== rightKeys.length) {\n\t\treturn false;\n\t}\n\n\tfor (const [index, key] of leftKeys.entries()) {\n\t\tif (key !== rightKeys[index]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/** @internal */\nexport function mapUpdateSet(table: Table, values: Record): UpdateSet {\n\tconst entries: [string, UpdateSet[string]][] = Object.entries(values)\n\t\t.filter(([, value]) => value !== undefined)\n\t\t.map(([key, value]) => {\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (is(value, SQL)) {\n\t\t\t\treturn [key, value];\n\t\t\t} else {\n\t\t\t\treturn [key, new Param(value, table[Table.Symbol.Columns][key])];\n\t\t\t}\n\t\t});\n\n\tif (entries.length === 0) {\n\t\tthrow new Error('No values to set');\n\t}\n\n\treturn Object.fromEntries(entries);\n}\n\nexport type UpdateSet = Record;\n\nexport type OneOrMany = T | T[];\n\nexport type Update = Simplify<\n\t& {\n\t\t[K in Exclude]: T[K];\n\t}\n\t& TUpdate\n>;\n\nexport type Simplify =\n\t& {\n\t\t// @ts-ignore - \"Type parameter 'K' has a circular constraint\", not sure why\n\t\t[K in keyof T]: T[K];\n\t}\n\t& {};\n\nexport type SimplifyMappedType = [T] extends [unknown] ? T : never;\n\nexport type ShallowRecord = SimplifyMappedType<{ [P in K]: T }>;\n\nexport type Assume = T extends U ? T : U;\n\nexport type Equal = (() => T extends X ? 1 : 2) extends (() => T extends Y ? 1 : 2) ? true : false;\n\nexport interface DrizzleTypeError {\n\t$drizzleTypeError: T;\n}\n\nexport type ValueOrArray = T | T[];\n\n/** @internal */\nexport function applyMixins(baseClass: any, extendedClasses: any[]) {\n\tfor (const extendedClass of extendedClasses) {\n\t\tfor (const name of Object.getOwnPropertyNames(extendedClass.prototype)) {\n\t\t\tif (name === 'constructor') continue;\n\n\t\t\tObject.defineProperty(\n\t\t\t\tbaseClass.prototype,\n\t\t\t\tname,\n\t\t\t\tObject.getOwnPropertyDescriptor(extendedClass.prototype, name) || Object.create(null),\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport type Or = T1 extends true ? true : T2 extends true ? true : false;\n\nexport type IfThenElse = If extends true ? Then : Else;\n\nexport type PromiseOf = T extends Promise ? U : T;\n\nexport type Writable = {\n\t-readonly [P in keyof T]: T[P];\n};\n\nexport function getTableColumns(table: T): T['_']['columns'] {\n\treturn table[Table.Symbol.Columns];\n}\n\n/** @internal */\nexport function getTableLikeName(table: TableLike): string | undefined {\n\treturn is(table, Subquery)\n\t\t? table[SubqueryConfig].alias\n\t\t: is(table, View)\n\t\t? table[ViewBaseConfig].name\n\t\t: is(table, SQL)\n\t\t? undefined\n\t\t: table[Table.Symbol.IsAlias]\n\t\t? table[Table.Symbol.Name]\n\t\t: table[Table.Symbol.BaseName];\n}\n\nexport type ColumnsWithTable<\n\tTTableName extends string,\n\tTForeignTableName extends string,\n\tTColumns extends AnyColumn<{ tableName: TTableName }>[],\n> = { [Key in keyof TColumns]: AnyColumn<{ tableName: TForeignTableName }> };\n\nexport interface DrizzleConfig = Record> {\n\tlogger?: boolean | Logger;\n\tschema?: TSchema;\n}\nexport type ValidateShape = T extends ValidShape\n\t? Exclude extends never ? TResult\n\t: DrizzleTypeError<\n\t\t`Invalid key(s): ${Exclude<(keyof T) & (string | number | bigint | boolean | null | undefined), keyof ValidShape>}`\n\t>\n\t: never;\n\nexport type KnownKeysOnly = {\n\t[K in keyof T]: K extends keyof U ? T[K] : never;\n};\n\nexport type IsAny = 0 extends (1 & T) ? true : false;\n", "import type { BuildColumns } from '~/column-builder.ts';\nimport { entityKind } from '~/entity.ts';\nimport { Table, type TableConfig as TableConfigBase, type UpdateTableConfig } from '~/table.ts';\nimport type { CheckBuilder } from './checks.ts';\nimport type { SQLiteColumn, SQLiteColumnBuilder, SQLiteColumnBuilderBase } from './columns/common.ts';\nimport type { ForeignKey, ForeignKeyBuilder } from './foreign-keys.ts';\nimport type { IndexBuilder } from './indexes.ts';\nimport type { PrimaryKeyBuilder } from './primary-keys.ts';\nimport type { UniqueConstraintBuilder } from './unique-constraint.ts';\n\nexport type SQLiteTableExtraConfig = Record<\n\tstring,\n\t| IndexBuilder\n\t| CheckBuilder\n\t| ForeignKeyBuilder\n\t| PrimaryKeyBuilder\n\t| UniqueConstraintBuilder\n>;\n\nexport type TableConfig = TableConfigBase>;\n\n/** @internal */\nexport const InlineForeignKeys = Symbol.for('drizzle:SQLiteInlineForeignKeys');\n\nexport class SQLiteTable extends Table {\n\tstatic readonly [entityKind]: string = 'SQLiteTable';\n\n\t/** @internal */\n\tstatic override readonly Symbol = Object.assign({}, Table.Symbol, {\n\t\tInlineForeignKeys: InlineForeignKeys as typeof InlineForeignKeys,\n\t});\n\n\t/** @internal */\n\toverride [Table.Symbol.Columns]!: NonNullable;\n\n\t/** @internal */\n\t[InlineForeignKeys]: ForeignKey[] = [];\n\n\t/** @internal */\n\toverride [Table.Symbol.ExtraConfigBuilder]:\n\t\t| ((self: Record) => SQLiteTableExtraConfig)\n\t\t| undefined = undefined;\n}\n\nexport type AnySQLiteTable = {}> = SQLiteTable<\n\tUpdateTableConfig\n>;\n\nexport type SQLiteTableWithColumns =\n\t& SQLiteTable\n\t& {\n\t\t[Key in keyof T['columns']]: T['columns'][Key];\n\t};\n\nexport interface SQLiteTableFn {\n\t<\n\t\tTTableName extends string,\n\t\tTColumnsMap extends Record,\n\t>(\n\t\tname: TTableName,\n\t\tcolumns: TColumnsMap,\n\t\textraConfig?: (self: BuildColumns) => SQLiteTableExtraConfig,\n\t): SQLiteTableWithColumns<{\n\t\tname: TTableName;\n\t\tschema: TSchema;\n\t\tcolumns: BuildColumns;\n\t\tdialect: 'sqlite';\n\t}>;\n}\n\nfunction sqliteTableBase<\n\tTTableName extends string,\n\tTColumnsMap extends Record,\n\tTSchema extends string | undefined,\n>(\n\tname: TTableName,\n\tcolumns: TColumnsMap,\n\textraConfig?: (self: BuildColumns) => SQLiteTableExtraConfig,\n\tschema?: TSchema,\n\tbaseName = name,\n): SQLiteTableWithColumns<{\n\tname: TTableName;\n\tschema: TSchema;\n\tcolumns: BuildColumns;\n\tdialect: 'sqlite';\n}> {\n\tconst rawTable = new SQLiteTable<{\n\t\tname: TTableName;\n\t\tschema: TSchema;\n\t\tcolumns: BuildColumns;\n\t\tdialect: 'sqlite';\n\t}>(name, schema, baseName);\n\n\tconst builtColumns = Object.fromEntries(\n\t\tObject.entries(columns).map(([name, colBuilderBase]) => {\n\t\t\tconst colBuilder = colBuilderBase as SQLiteColumnBuilder;\n\t\t\tconst column = colBuilder.build(rawTable);\n\t\t\trawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));\n\t\t\treturn [name, column];\n\t\t}),\n\t) as unknown as BuildColumns;\n\n\tconst table = Object.assign(rawTable, builtColumns);\n\n\ttable[Table.Symbol.Columns] = builtColumns;\n\n\tif (extraConfig) {\n\t\ttable[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig as (\n\t\t\tself: Record,\n\t\t) => SQLiteTableExtraConfig;\n\t}\n\n\treturn table;\n}\n\nexport const sqliteTable: SQLiteTableFn = (name, columns, extraConfig) => {\n\treturn sqliteTableBase(name, columns, extraConfig);\n};\n\nexport function sqliteTableCreator(customizeTableName: (name: string) => string): SQLiteTableFn {\n\treturn (name, columns, extraConfig) => {\n\t\treturn sqliteTableBase(customizeTableName(name) as typeof name, columns, extraConfig, undefined, name);\n\t};\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { AnySQLiteColumn, SQLiteColumn } from './columns/index.ts';\nimport { SQLiteTable } from './table.ts';\n\nexport type UpdateDeleteAction = 'cascade' | 'restrict' | 'no action' | 'set null' | 'set default';\n\nexport type Reference = () => {\n\treadonly name?: string;\n\treadonly columns: SQLiteColumn[];\n\treadonly foreignTable: SQLiteTable;\n\treadonly foreignColumns: SQLiteColumn[];\n};\n\nexport class ForeignKeyBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteForeignKeyBuilder';\n\n\tdeclare _: {\n\t\tbrand: 'SQLiteForeignKeyBuilder';\n\t\tforeignTableName: 'TForeignTableName';\n\t};\n\n\t/** @internal */\n\treference: Reference;\n\n\t/** @internal */\n\t_onUpdate: UpdateDeleteAction | undefined;\n\n\t/** @internal */\n\t_onDelete: UpdateDeleteAction | undefined;\n\n\tconstructor(\n\t\tconfig: () => {\n\t\t\tname?: string;\n\t\t\tcolumns: SQLiteColumn[];\n\t\t\tforeignColumns: SQLiteColumn[];\n\t\t},\n\t\tactions?: {\n\t\t\tonUpdate?: UpdateDeleteAction;\n\t\t\tonDelete?: UpdateDeleteAction;\n\t\t} | undefined,\n\t) {\n\t\tthis.reference = () => {\n\t\t\tconst { name, columns, foreignColumns } = config();\n\t\t\treturn { name, columns, foreignTable: foreignColumns[0]!.table as SQLiteTable, foreignColumns };\n\t\t};\n\t\tif (actions) {\n\t\t\tthis._onUpdate = actions.onUpdate;\n\t\t\tthis._onDelete = actions.onDelete;\n\t\t}\n\t}\n\n\tonUpdate(action: UpdateDeleteAction): this {\n\t\tthis._onUpdate = action;\n\t\treturn this;\n\t}\n\n\tonDelete(action: UpdateDeleteAction): this {\n\t\tthis._onDelete = action;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): ForeignKey {\n\t\treturn new ForeignKey(table, this);\n\t}\n}\n\nexport class ForeignKey {\n\tstatic readonly [entityKind]: string = 'SQLiteForeignKey';\n\n\treadonly reference: Reference;\n\treadonly onUpdate: UpdateDeleteAction | undefined;\n\treadonly onDelete: UpdateDeleteAction | undefined;\n\n\tconstructor(readonly table: SQLiteTable, builder: ForeignKeyBuilder) {\n\t\tthis.reference = builder.reference;\n\t\tthis.onUpdate = builder._onUpdate;\n\t\tthis.onDelete = builder._onDelete;\n\t}\n\n\tgetName(): string {\n\t\tconst { name, columns, foreignColumns } = this.reference();\n\t\tconst columnNames = columns.map((column) => column.name);\n\t\tconst foreignColumnNames = foreignColumns.map((column) => column.name);\n\t\tconst chunks = [\n\t\t\tthis.table[SQLiteTable.Symbol.Name],\n\t\t\t...columnNames,\n\t\t\tforeignColumns[0]!.table[SQLiteTable.Symbol.Name],\n\t\t\t...foreignColumnNames,\n\t\t];\n\t\treturn name ?? `${chunks.join('_')}_fk`;\n\t}\n}\n\ntype ColumnsWithTable<\n\tTTableName extends string,\n\tTColumns extends SQLiteColumn[],\n> = { [Key in keyof TColumns]: AnySQLiteColumn<{ tableName: TTableName }> };\n\n/**\n * @deprecated please use `foreignKey({ columns: [], foreignColumns: [] })` syntax without callback\n * @param config\n * @returns\n */\nexport function foreignKey<\n\tTTableName extends string,\n\tTForeignTableName extends string,\n\tTColumns extends [AnySQLiteColumn<{ tableName: TTableName }>, ...AnySQLiteColumn<{ tableName: TTableName }>[]],\n>(\n\tconfig: () => {\n\t\tname?: string;\n\t\tcolumns: TColumns;\n\t\tforeignColumns: ColumnsWithTable;\n\t},\n): ForeignKeyBuilder;\nexport function foreignKey<\n\tTTableName extends string,\n\tTForeignTableName extends string,\n\tTColumns extends [AnySQLiteColumn<{ tableName: TTableName }>, ...AnySQLiteColumn<{ tableName: TTableName }>[]],\n>(\n\tconfig: {\n\t\tname?: string;\n\t\tcolumns: TColumns;\n\t\tforeignColumns: ColumnsWithTable;\n\t},\n): ForeignKeyBuilder;\nexport function foreignKey(\n\tconfig: any,\n): ForeignKeyBuilder {\n\tfunction mappedConfig() {\n\t\tif (typeof config === 'function') {\n\t\t\tconst { name, columns, foreignColumns } = config();\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tcolumns,\n\t\t\t\tforeignColumns,\n\t\t\t};\n\t\t}\n\t\treturn config;\n\t}\n\n\treturn new ForeignKeyBuilder(mappedConfig);\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { SQLiteColumn } from './columns/common.ts';\nimport { SQLiteTable } from './table.ts';\n\nexport function uniqueKeyName(table: SQLiteTable, columns: string[]) {\n\treturn `${table[SQLiteTable.Symbol.Name]}_${columns.join('_')}_unique`;\n}\n\nexport function unique(name?: string): UniqueOnConstraintBuilder {\n\treturn new UniqueOnConstraintBuilder(name);\n}\n\nexport class UniqueConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueConstraintBuilder';\n\n\t/** @internal */\n\tcolumns: SQLiteColumn[];\n\n\tconstructor(\n\t\tcolumns: SQLiteColumn[],\n\t\tprivate name?: string,\n\t) {\n\t\tthis.columns = columns;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): UniqueConstraint {\n\t\treturn new UniqueConstraint(table, this.columns, this.name);\n\t}\n}\n\nexport class UniqueOnConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueOnConstraintBuilder';\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tname?: string,\n\t) {\n\t\tthis.name = name;\n\t}\n\n\ton(...columns: [SQLiteColumn, ...SQLiteColumn[]]) {\n\t\treturn new UniqueConstraintBuilder(columns, this.name);\n\t}\n}\n\nexport class UniqueConstraint {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueConstraint';\n\n\treadonly columns: SQLiteColumn[];\n\treadonly name?: string;\n\n\tconstructor(readonly table: SQLiteTable, columns: SQLiteColumn[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));\n\t}\n\n\tgetName() {\n\t\treturn this.name;\n\t}\n}\n", "import type {\n\tColumnBuilderBase,\n\tColumnBuilderBaseConfig,\n\tColumnBuilderExtraConfig,\n\tColumnBuilderRuntimeConfig,\n\tColumnDataType,\n\tMakeColumnConfig,\n} from '~/column-builder.ts';\nimport { ColumnBuilder } from '~/column-builder.ts';\nimport { Column } from '~/column.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { ForeignKey, UpdateDeleteAction } from '~/sqlite-core/foreign-keys.ts';\nimport { ForeignKeyBuilder } from '~/sqlite-core/foreign-keys.ts';\nimport type { AnySQLiteTable, SQLiteTable } from '~/sqlite-core/table.ts';\nimport type { Update } from '~/utils.ts';\nimport { uniqueKeyName } from '../unique-constraint.ts';\n\nexport interface ReferenceConfig {\n\tref: () => SQLiteColumn;\n\tactions: {\n\t\tonUpdate?: UpdateDeleteAction;\n\t\tonDelete?: UpdateDeleteAction;\n\t};\n}\n\nexport interface SQLiteColumnBuilderBase<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTTypeConfig extends object = object,\n> extends ColumnBuilderBase {}\n\nexport abstract class SQLiteColumnBuilder<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTRuntimeConfig extends object = object,\n\tTTypeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = object,\n> extends ColumnBuilder\n\timplements SQLiteColumnBuilderBase\n{\n\tstatic readonly [entityKind]: string = 'SQLiteColumnBuilder';\n\n\tprivate foreignKeyConfigs: ReferenceConfig[] = [];\n\n\treferences(\n\t\tref: ReferenceConfig['ref'],\n\t\tactions: ReferenceConfig['actions'] = {},\n\t): this {\n\t\tthis.foreignKeyConfigs.push({ ref, actions });\n\t\treturn this;\n\t}\n\n\tunique(\n\t\tname?: string,\n\t): this {\n\t\tthis.config.isUnique = true;\n\t\tthis.config.uniqueName = name;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuildForeignKeys(column: SQLiteColumn, table: SQLiteTable): ForeignKey[] {\n\t\treturn this.foreignKeyConfigs.map(({ ref, actions }) => {\n\t\t\treturn ((ref, actions) => {\n\t\t\t\tconst builder = new ForeignKeyBuilder(() => {\n\t\t\t\t\tconst foreignColumn = ref();\n\t\t\t\t\treturn { columns: [column], foreignColumns: [foreignColumn] };\n\t\t\t\t});\n\t\t\t\tif (actions.onUpdate) {\n\t\t\t\t\tbuilder.onUpdate(actions.onUpdate);\n\t\t\t\t}\n\t\t\t\tif (actions.onDelete) {\n\t\t\t\t\tbuilder.onDelete(actions.onDelete);\n\t\t\t\t}\n\t\t\t\treturn builder.build(table);\n\t\t\t})(ref, actions);\n\t\t});\n\t}\n\n\t/** @internal */\n\tabstract build(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteColumn>;\n}\n\n// To understand how to use `SQLiteColumn` and `AnySQLiteColumn`, see `Column` and `AnyColumn` documentation.\nexport abstract class SQLiteColumn<\n\tT extends ColumnBaseConfig = ColumnBaseConfig,\n\tTRuntimeConfig extends object = object,\n> extends Column {\n\tstatic readonly [entityKind]: string = 'SQLiteColumn';\n\n\tconstructor(\n\t\toverride readonly table: SQLiteTable,\n\t\tconfig: ColumnBuilderRuntimeConfig,\n\t) {\n\t\tif (!config.uniqueName) {\n\t\t\tconfig.uniqueName = uniqueKeyName(table, [config.name]);\n\t\t}\n\t\tsuper(table, config);\n\t}\n}\n\nexport type AnySQLiteColumn> = {}> = SQLiteColumn<\n\tRequired, TPartial>>\n>;\n", "import type {\n\tColumnBuilderBaseConfig,\n\tColumnBuilderRuntimeConfig,\n\tColumnDataType,\n\tHasDefault,\n\tMakeColumnConfig,\n\tNotNull,\n} from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport { sql } from '~/sql/sql.ts';\nimport type { OnConflict } from '~/sqlite-core/utils.ts';\nimport type { Equal, Or } from '~/utils.ts';\nimport type { AnySQLiteTable } from '../table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport interface PrimaryKeyConfig {\n\tautoIncrement?: boolean;\n\tonConflict?: OnConflict;\n}\n\nexport abstract class SQLiteBaseIntegerBuilder<\n\tT extends ColumnBuilderBaseConfig,\n\tTRuntimeConfig extends object = object,\n> extends SQLiteColumnBuilder<\n\tT,\n\tTRuntimeConfig & { autoIncrement: boolean },\n\t{},\n\t{ primaryKeyHasDefault: true }\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteBaseIntegerBuilder';\n\n\tconstructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']) {\n\t\tsuper(name, dataType, columnType);\n\t\tthis.config.autoIncrement = false;\n\t}\n\n\toverride primaryKey(config?: PrimaryKeyConfig): HasDefault> {\n\t\tif (config?.autoIncrement) {\n\t\t\tthis.config.autoIncrement = true;\n\t\t}\n\t\tthis.config.hasDefault = true;\n\t\treturn super.primaryKey() as HasDefault>;\n\t}\n\n\t/** @internal */\n\tabstract override build(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteBaseInteger>;\n}\n\nexport abstract class SQLiteBaseInteger<\n\tT extends ColumnBaseConfig,\n\tTRuntimeConfig extends object = object,\n> extends SQLiteColumn {\n\tstatic readonly [entityKind]: string = 'SQLiteBaseInteger';\n\n\treadonly autoIncrement: boolean = this.config.autoIncrement;\n\n\tgetSQLType(): string {\n\t\treturn 'integer';\n\t}\n}\n\nexport type SQLiteIntegerBuilderInitial = SQLiteIntegerBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SQLiteInteger';\n\tdata: number;\n\tdriverParam: number;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteIntegerBuilder>\n\textends SQLiteBaseIntegerBuilder\n{\n\tstatic readonly [entityKind]: string = 'SQLiteIntegerBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'number', 'SQLiteInteger');\n\t}\n\n\tbuild(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteInteger> {\n\t\treturn new SQLiteInteger>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class SQLiteInteger> extends SQLiteBaseInteger {\n\tstatic readonly [entityKind]: string = 'SQLiteInteger';\n}\n\nexport type SQLiteTimestampBuilderInitial = SQLiteTimestampBuilder<{\n\tname: TName;\n\tdataType: 'date';\n\tcolumnType: 'SQLiteTimestamp';\n\tdata: Date;\n\tdriverParam: number;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteTimestampBuilder>\n\textends SQLiteBaseIntegerBuilder\n{\n\tstatic readonly [entityKind]: string = 'SQLiteTimestampBuilder';\n\n\tconstructor(name: T['name'], mode: 'timestamp' | 'timestamp_ms') {\n\t\tsuper(name, 'date', 'SQLiteTimestamp');\n\t\tthis.config.mode = mode;\n\t}\n\n\t/**\n\t * @deprecated Use `default()` with your own expression instead.\n\t *\n\t * Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.\n\t */\n\tdefaultNow(): HasDefault {\n\t\treturn this.default(sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`) as any;\n\t}\n\n\tbuild(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteTimestamp> {\n\t\treturn new SQLiteTimestamp>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class SQLiteTimestamp>\n\textends SQLiteBaseInteger\n{\n\tstatic readonly [entityKind]: string = 'SQLiteTimestamp';\n\n\treadonly mode: 'timestamp' | 'timestamp_ms' = this.config.mode;\n\n\toverride mapFromDriverValue(value: number): Date {\n\t\tif (this.config.mode === 'timestamp') {\n\t\t\treturn new Date(value * 1000);\n\t\t}\n\t\treturn new Date(value);\n\t}\n\n\toverride mapToDriverValue(value: Date): number {\n\t\tconst unix = value.getTime();\n\t\tif (this.config.mode === 'timestamp') {\n\t\t\treturn Math.floor(unix / 1000);\n\t\t}\n\t\treturn unix;\n\t}\n}\n\nexport type SQLiteBooleanBuilderInitial = SQLiteBooleanBuilder<{\n\tname: TName;\n\tdataType: 'boolean';\n\tcolumnType: 'SQLiteBoolean';\n\tdata: boolean;\n\tdriverParam: number;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteBooleanBuilder>\n\textends SQLiteBaseIntegerBuilder\n{\n\tstatic readonly [entityKind]: string = 'SQLiteBooleanBuilder';\n\n\tconstructor(name: T['name'], mode: 'boolean') {\n\t\tsuper(name, 'boolean', 'SQLiteBoolean');\n\t\tthis.config.mode = mode;\n\t}\n\n\tbuild(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteBoolean> {\n\t\treturn new SQLiteBoolean>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class SQLiteBoolean>\n\textends SQLiteBaseInteger\n{\n\tstatic readonly [entityKind]: string = 'SQLiteBoolean';\n\n\treadonly mode: 'boolean' = this.config.mode;\n\n\toverride mapFromDriverValue(value: number): boolean {\n\t\treturn Number(value) === 1;\n\t}\n\n\toverride mapToDriverValue(value: boolean): number {\n\t\treturn value ? 1 : 0;\n\t}\n}\n\nexport interface IntegerConfig<\n\tTMode extends 'number' | 'timestamp' | 'timestamp_ms' | 'boolean' =\n\t\t| 'number'\n\t\t| 'timestamp'\n\t\t| 'timestamp_ms'\n\t\t| 'boolean',\n> {\n\tmode: TMode;\n}\n\nexport function integer(\n\tname: TName,\n\tconfig?: IntegerConfig,\n): Or, Equal> extends true ? SQLiteTimestampBuilderInitial\n\t: Equal extends true ? SQLiteBooleanBuilderInitial\n\t: SQLiteIntegerBuilderInitial;\nexport function integer(name: string, config?: IntegerConfig) {\n\tif (config?.mode === 'timestamp' || config?.mode === 'timestamp_ms') {\n\t\treturn new SQLiteTimestampBuilder(name, config.mode);\n\t}\n\tif (config?.mode === 'boolean') {\n\t\treturn new SQLiteBooleanBuilder(name, config.mode);\n\t}\n\treturn new SQLiteIntegerBuilder(name);\n}\n\nexport const int = integer;\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport type { Equal, Writable } from '~/utils.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteTextBuilderInitial = SQLiteTextBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SQLiteText';\n\tdata: TEnum[number];\n\tdriverParam: string;\n\tenumValues: TEnum;\n}>;\n\nexport class SQLiteTextBuilder> extends SQLiteColumnBuilder<\n\tT,\n\t{ length: number | undefined; enumValues: T['enumValues'] }\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteTextBuilder';\n\n\tconstructor(name: T['name'], config: SQLiteTextConfig<'text', T['enumValues']>) {\n\t\tsuper(name, 'string', 'SQLiteText');\n\t\tthis.config.enumValues = config.enum;\n\t\tthis.config.length = config.length;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteText> {\n\t\treturn new SQLiteText>(table, this.config as ColumnBuilderRuntimeConfig);\n\t}\n}\n\nexport class SQLiteText>\n\textends SQLiteColumn\n{\n\tstatic readonly [entityKind]: string = 'SQLiteText';\n\n\toverride readonly enumValues = this.config.enumValues;\n\n\treadonly length: number | undefined = this.config.length;\n\n\tconstructor(\n\t\ttable: AnySQLiteTable<{ name: T['tableName'] }>,\n\t\tconfig: SQLiteTextBuilder['config'],\n\t) {\n\t\tsuper(table, config);\n\t}\n\n\tgetSQLType(): string {\n\t\treturn `text${this.config.length ? `(${this.config.length})` : ''}`;\n\t}\n}\n\nexport type SQLiteTextJsonBuilderInitial = SQLiteTextJsonBuilder<{\n\tname: TName;\n\tdataType: 'json';\n\tcolumnType: 'SQLiteTextJson';\n\tdata: unknown;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteTextJsonBuilder>\n\textends SQLiteColumnBuilder\n{\n\tstatic readonly [entityKind]: string = 'SQLiteTextJsonBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'json', 'SQLiteTextJson');\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteTextJson> {\n\t\treturn new SQLiteTextJson>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class SQLiteTextJson>\n\textends SQLiteColumn\n{\n\tstatic readonly [entityKind]: string = 'SQLiteTextJson';\n\n\tgetSQLType(): string {\n\t\treturn 'text';\n\t}\n\n\toverride mapFromDriverValue(value: string): T['data'] {\n\t\treturn JSON.parse(value);\n\t}\n\n\toverride mapToDriverValue(value: T['data']): string {\n\t\treturn JSON.stringify(value);\n\t}\n}\n\nexport type SQLiteTextConfig<\n\tTMode extends 'text' | 'json',\n\tTEnum extends readonly string[] | string[] | undefined,\n> = TMode extends 'text' ? {\n\t\tmode?: TMode;\n\t\tlength?: number;\n\t\tenum?: TEnum;\n\t}\n\t: {\n\t\tmode?: TMode;\n\t};\n\nexport function text<\n\tTName extends string,\n\tU extends string,\n\tT extends Readonly<[U, ...U[]]>,\n\tTMode extends 'text' | 'json' = 'text' | 'json',\n>(\n\tname: TName,\n\tconfig: SQLiteTextConfig> = {} as SQLiteTextConfig>,\n): Equal extends true ? SQLiteTextJsonBuilderInitial\n\t: SQLiteTextBuilderInitial>\n{\n\treturn (config.mode === 'json'\n\t\t? new SQLiteTextJsonBuilder(name)\n\t\t: new SQLiteTextBuilder(name, config as SQLiteTextConfig<'text', Writable>)) as Equal extends true\n\t\t\t? SQLiteTextJsonBuilderInitial\n\t\t\t: SQLiteTextBuilderInitial>;\n}\n", "import { ColumnAliasProxyHandler, TableAliasProxyHandler } from './alias.ts';\nimport { Column } from './column.ts';\nimport { entityKind, is } from './entity.ts';\nimport { SQL, View } from './sql/sql.ts';\nimport { Subquery, SubqueryConfig } from './subquery.ts';\nimport { ViewBaseConfig } from './view-common.ts';\n\nexport class SelectionProxyHandler | View>\n\timplements ProxyHandler | View>\n{\n\tstatic readonly [entityKind]: string = 'SelectionProxyHandler';\n\n\tprivate config: {\n\t\t/**\n\t\t * Table alias for the columns\n\t\t */\n\t\talias?: string;\n\t\t/**\n\t\t * What to do when a field is an instance of `SQL.Aliased` and it's not a selection field (from a subquery)\n\t\t *\n\t\t * `sql` - return the underlying SQL expression\n\t\t *\n\t\t * `alias` - return the field alias\n\t\t */\n\t\tsqlAliasedBehavior: 'sql' | 'alias';\n\t\t/**\n\t\t * What to do when a field is an instance of `SQL` and it doesn't have an alias declared\n\t\t *\n\t\t * `sql` - return the underlying SQL expression\n\t\t *\n\t\t * `error` - return a DrizzleTypeError on type level and throw an error on runtime\n\t\t */\n\t\tsqlBehavior: 'sql' | 'error';\n\n\t\t/**\n\t\t * Whether to replace the original name of the column with the alias\n\t\t * Should be set to `true` for views creation\n\t\t * @default false\n\t\t */\n\t\treplaceOriginalName?: boolean;\n\t};\n\n\tconstructor(config: SelectionProxyHandler['config']) {\n\t\tthis.config = { ...config };\n\t}\n\n\tget(subquery: T, prop: string | symbol): any {\n\t\tif (prop === SubqueryConfig) {\n\t\t\treturn {\n\t\t\t\t...subquery[SubqueryConfig as keyof typeof subquery],\n\t\t\t\tselection: new Proxy(\n\t\t\t\t\t(subquery as Subquery)[SubqueryConfig].selection,\n\t\t\t\t\tthis as ProxyHandler>,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tif (prop === ViewBaseConfig) {\n\t\t\treturn {\n\t\t\t\t...subquery[ViewBaseConfig as keyof typeof subquery],\n\t\t\t\tselectedFields: new Proxy(\n\t\t\t\t\t(subquery as View)[ViewBaseConfig].selectedFields,\n\t\t\t\t\tthis as ProxyHandler>,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\tif (typeof prop === 'symbol') {\n\t\t\treturn subquery[prop as keyof typeof subquery];\n\t\t}\n\n\t\tconst columns = is(subquery, Subquery)\n\t\t\t? subquery[SubqueryConfig].selection\n\t\t\t: is(subquery, View)\n\t\t\t? subquery[ViewBaseConfig].selectedFields\n\t\t\t: subquery;\n\t\tconst value: unknown = columns[prop as keyof typeof columns];\n\n\t\tif (is(value, SQL.Aliased)) {\n\t\t\t// Never return the underlying SQL expression for a field previously selected in a subquery\n\t\t\tif (this.config.sqlAliasedBehavior === 'sql' && !value.isSelectionField) {\n\t\t\t\treturn value.sql;\n\t\t\t}\n\n\t\t\tconst newValue = value.clone();\n\t\t\tnewValue.isSelectionField = true;\n\t\t\treturn newValue;\n\t\t}\n\n\t\tif (is(value, SQL)) {\n\t\t\tif (this.config.sqlBehavior === 'sql') {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tthrow new Error(\n\t\t\t\t`You tried to reference \"${prop}\" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using \".as('alias')\" method.`,\n\t\t\t);\n\t\t}\n\n\t\tif (is(value, Column)) {\n\t\t\tif (this.config.alias) {\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tvalue,\n\t\t\t\t\tnew ColumnAliasProxyHandler(\n\t\t\t\t\t\tnew Proxy(\n\t\t\t\t\t\t\tvalue.table,\n\t\t\t\t\t\t\tnew TableAliasProxyHandler(this.config.alias, this.config.replaceOriginalName ?? false),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\n\t\tif (typeof value !== 'object' || value === null) {\n\t\t\treturn value;\n\t\t}\n\n\t\treturn new Proxy(value, new SelectionProxyHandler(this.config));\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport type { Subquery } from '~/subquery.ts';\nimport { type DrizzleTypeError, orderSelectedFields } from '~/utils.ts';\nimport type { SQLiteColumn } from '../columns/common.ts';\nimport type { SelectedFieldsFlat, SelectedFieldsOrdered } from './select.types.ts';\n\nexport type SQLiteDeleteWithout<\n\tT extends AnySQLiteDeleteBase,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n> = TDynamic extends true ? T\n\t: Omit<\n\t\tSQLiteDeleteBase<\n\t\t\tT['_']['table'],\n\t\t\tT['_']['resultType'],\n\t\t\tT['_']['runResult'],\n\t\t\tT['_']['returning'],\n\t\t\tTDynamic,\n\t\t\tT['_']['excludedMethods'] | K\n\t\t>,\n\t\tT['_']['excludedMethods'] | K\n\t>;\n\nexport type SQLiteDelete<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning extends Record | undefined = undefined,\n> = SQLiteDeleteBase;\n\nexport interface SQLiteDeleteConfig {\n\twhere?: SQL | undefined;\n\ttable: SQLiteTable;\n\treturning?: SelectedFieldsOrdered;\n\twithList?: Subquery[];\n}\n\nexport type SQLiteDeleteReturningAll<\n\tT extends AnySQLiteDeleteBase,\n\tTDynamic extends boolean,\n> = SQLiteDeleteWithout<\n\tSQLiteDeleteBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tT['_']['dynamic'],\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteDeleteReturning<\n\tT extends AnySQLiteDeleteBase,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFieldsFlat,\n> = SQLiteDeleteWithout<\n\tSQLiteDeleteBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields,\n\t\tT['_']['dynamic'],\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteDeleteExecute = T['_']['returning'] extends undefined\n\t? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteDeletePrepare = SQLitePreparedQuery<{\n\ttype: T['_']['resultType'];\n\trun: T['_']['runResult'];\n\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t: T['_']['returning'][];\n\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t: T['_']['returning'] | undefined;\n\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t: any[][];\n\texecute: SQLiteDeleteExecute;\n}>;\n\nexport type SQLiteDeleteDynamic = SQLiteDelete<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type AnySQLiteDeleteBase = SQLiteDeleteBase;\n\nexport interface SQLiteDeleteBase<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTReturning extends Record | undefined = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends\n\tQueryPromise,\n\tRunnableQuery,\n\tSQLWrapper\n{\n\treadonly _: {\n\t\tdialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteDeleteBase<\n\tTTable extends SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTReturning extends Record | undefined = undefined,\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise\n\timplements RunnableQuery, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteDelete';\n\n\t/** @internal */\n\tconfig: SQLiteDeleteConfig;\n\n\tconstructor(\n\t\tprivate table: TTable,\n\t\tprivate session: SQLiteSession,\n\t\tprivate dialect: SQLiteDialect,\n\t\twithList?: Subquery[],\n\t) {\n\t\tsuper();\n\t\tthis.config = { table, withList };\n\t}\n\n\t/**\n\t * Adds a `where` clause to the query.\n\t *\n\t * Calling this method will delete only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param where the `where` clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be deleted.\n\t *\n\t * ```ts\n\t * // Delete all cars with green color\n\t * db.delete(cars).where(eq(cars.color, 'green'));\n\t * // or\n\t * db.delete(cars).where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Delete all BMW cars with a green color\n\t * db.delete(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Delete all cars with the green or blue color\n\t * db.delete(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(where: SQL | undefined): SQLiteDeleteWithout {\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `returning` clause to the query.\n\t *\n\t * Calling this method will return the specified fields of the deleted rows. If no fields are specified, all fields will be returned.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete#delete-with-return}\n\t *\n\t * @example\n\t * ```ts\n\t * // Delete all cars with the green color and return all fields\n\t * const deletedCars: Car[] = await db.delete(cars)\n\t * .where(eq(cars.color, 'green'))\n\t * .returning();\n\t *\n\t * // Delete all cars with the green color and return only their id and brand fields\n\t * const deletedCarsIdsAndBrands: { id: number, brand: string }[] = await db.delete(cars)\n\t * .where(eq(cars.color, 'green'))\n\t * .returning({ id: cars.id, brand: cars.brand });\n\t * ```\n\t */\n\treturning(): SQLiteDeleteReturningAll;\n\treturning(\n\t\tfields: TSelectedFields,\n\t): SQLiteDeleteReturning;\n\treturning(\n\t\tfields: SelectedFieldsFlat = this.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteDeleteReturning {\n\t\tthis.config.returning = orderSelectedFields(fields);\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildDeleteQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\t/** @internal */\n\t_prepare(isOneTimeQuery = true): SQLiteDeletePrepare {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteDeletePrepare;\n\t}\n\n\tprepare(): SQLiteDeletePrepare {\n\t\treturn this._prepare(false);\n\t}\n\n\trun: ReturnType['run'] = (placeholderValues) => {\n\t\treturn this._prepare().run(placeholderValues);\n\t};\n\n\tall: ReturnType['all'] = (placeholderValues) => {\n\t\treturn this._prepare().all(placeholderValues);\n\t};\n\n\tget: ReturnType['get'] = (placeholderValues) => {\n\t\treturn this._prepare().get(placeholderValues);\n\t};\n\n\tvalues: ReturnType['values'] = (placeholderValues) => {\n\t\treturn this._prepare().values(placeholderValues);\n\t};\n\n\toverride async execute(placeholderValues?: Record): Promise> {\n\t\treturn this._prepare().execute(placeholderValues) as SQLiteDeleteExecute;\n\t}\n\n\t$dynamic(): SQLiteDeleteDynamic {\n\t\treturn this as any;\n\t}\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';\nimport { Param, SQL, sql } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { IndexColumn } from '~/sqlite-core/indexes.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport type { Subquery } from '~/subquery.ts';\nimport { Table } from '~/table.ts';\nimport { type DrizzleTypeError, mapUpdateSet, orderSelectedFields, type Simplify } from '~/utils.ts';\nimport type { SQLiteColumn } from '../columns/common.ts';\nimport type { SelectedFieldsFlat, SelectedFieldsOrdered } from './select.types.ts';\nimport type { SQLiteUpdateSetSource } from './update.ts';\n\nexport interface SQLiteInsertConfig {\n\ttable: TTable;\n\tvalues: Record[];\n\twithList?: Subquery[];\n\tonConflict?: SQL;\n\treturning?: SelectedFieldsOrdered;\n}\n\nexport type SQLiteInsertValue = Simplify<\n\t{\n\t\t[Key in keyof TTable['$inferInsert']]: TTable['$inferInsert'][Key] | SQL | Placeholder;\n\t}\n>;\n\nexport class SQLiteInsertBuilder<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteInsertBuilder';\n\n\tconstructor(\n\t\tprotected table: TTable,\n\t\tprotected session: SQLiteSession,\n\t\tprotected dialect: SQLiteDialect,\n\t\tprivate withList?: Subquery[],\n\t) {}\n\n\tvalues(value: SQLiteInsertValue): SQLiteInsertBase;\n\tvalues(values: SQLiteInsertValue[]): SQLiteInsertBase;\n\tvalues(\n\t\tvalues: SQLiteInsertValue | SQLiteInsertValue[],\n\t): SQLiteInsertBase {\n\t\tvalues = Array.isArray(values) ? values : [values];\n\t\tif (values.length === 0) {\n\t\t\tthrow new Error('values() must be called with at least one value');\n\t\t}\n\t\tconst mappedValues = values.map((entry) => {\n\t\t\tconst result: Record = {};\n\t\t\tconst cols = this.table[Table.Symbol.Columns];\n\t\t\tfor (const colKey of Object.keys(entry)) {\n\t\t\t\tconst colValue = entry[colKey as keyof typeof entry];\n\t\t\t\tresult[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);\n\t\t\t}\n\t\t\treturn result;\n\t\t});\n\n\t\t// if (mappedValues.length > 1 && mappedValues.some((t) => Object.keys(t).length === 0)) {\n\t\t// \tthrow new Error(\n\t\t// \t\t`One of the values you want to insert is empty. In SQLite you can insert only one empty object per statement. For this case Drizzle with use \"INSERT INTO ... DEFAULT VALUES\" syntax`,\n\t\t// \t);\n\t\t// }\n\n\t\treturn new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);\n\t}\n}\n\nexport type SQLiteInsertWithout =\n\tTDynamic extends true ? T\n\t\t: Omit<\n\t\t\tSQLiteInsertBase<\n\t\t\t\tT['_']['table'],\n\t\t\t\tT['_']['resultType'],\n\t\t\t\tT['_']['runResult'],\n\t\t\t\tT['_']['returning'],\n\t\t\t\tTDynamic,\n\t\t\t\tT['_']['excludedMethods'] | K\n\t\t\t>,\n\t\t\tT['_']['excludedMethods'] | K\n\t\t>;\n\nexport type SQLiteInsertReturning<\n\tT extends AnySQLiteInsert,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFieldsFlat,\n> = SQLiteInsertWithout<\n\tSQLiteInsertBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteInsertReturningAll<\n\tT extends AnySQLiteInsert,\n\tTDynamic extends boolean,\n> = SQLiteInsertWithout<\n\tSQLiteInsertBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteInsertOnConflictDoUpdateConfig = {\n\ttarget: IndexColumn | IndexColumn[];\n\twhere?: SQL;\n\tset: SQLiteUpdateSetSource;\n};\n\nexport type SQLiteInsertDynamic = SQLiteInsert<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type SQLiteInsertExecute = T['_']['returning'] extends undefined ? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteInsertPrepare = SQLitePreparedQuery<\n\t{\n\t\ttype: T['_']['resultType'];\n\t\trun: T['_']['runResult'];\n\t\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'][];\n\t\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'];\n\t\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t\t: any[][];\n\t\texecute: SQLiteInsertExecute;\n\t}\n>;\n\nexport type AnySQLiteInsert = SQLiteInsertBase;\n\nexport type SQLiteInsert<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = any,\n> = SQLiteInsertBase;\n\nexport interface SQLiteInsertBase<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTReturning = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends\n\tSQLWrapper,\n\tQueryPromise,\n\tRunnableQuery\n{\n\treadonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteInsertBase<\n\tTTable extends SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTReturning = undefined,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise\n\timplements RunnableQuery, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteInsert';\n\n\t/** @internal */\n\tconfig: SQLiteInsertConfig;\n\n\tconstructor(\n\t\ttable: TTable,\n\t\tvalues: SQLiteInsertConfig['values'],\n\t\tprivate session: SQLiteSession,\n\t\tprivate dialect: SQLiteDialect,\n\t\twithList?: Subquery[],\n\t) {\n\t\tsuper();\n\t\tthis.config = { table, values, withList };\n\t}\n\n\t/**\n\t * Adds a `returning` clause to the query.\n\t *\n\t * Calling this method will return the specified fields of the inserted rows. If no fields are specified, all fields will be returned.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert#insert-returning}\n\t *\n\t * @example\n\t * ```ts\n\t * // Insert one row and return all fields\n\t * const insertedCar: Car[] = await db.insert(cars)\n\t * .values({ brand: 'BMW' })\n\t * .returning();\n\t *\n\t * // Insert one row and return only the id\n\t * const insertedCarId: { id: number }[] = await db.insert(cars)\n\t * .values({ brand: 'BMW' })\n\t * .returning({ id: cars.id });\n\t * ```\n\t */\n\treturning(): SQLiteInsertReturningAll;\n\treturning(\n\t\tfields: TSelectedFields,\n\t): SQLiteInsertReturning;\n\treturning(\n\t\tfields: SelectedFieldsFlat = this.config.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteInsertWithout {\n\t\tthis.config.returning = orderSelectedFields(fields);\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `on conflict do nothing` clause to the query.\n\t *\n\t * Calling this method simply avoids inserting a row as its alternative action.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert#on-conflict-do-nothing}\n\t *\n\t * @param config The `target` and `where` clauses.\n\t *\n\t * @example\n\t * ```ts\n\t * // Insert one row and cancel the insert if there's a conflict\n\t * await db.insert(cars)\n\t * .values({ id: 1, brand: 'BMW' })\n\t * .onConflictDoNothing();\n\t *\n\t * // Explicitly specify conflict target\n\t * await db.insert(cars)\n\t * .values({ id: 1, brand: 'BMW' })\n\t * .onConflictDoNothing({ target: cars.id });\n\t * ```\n\t */\n\tonConflictDoNothing(config: { target?: IndexColumn | IndexColumn[]; where?: SQL } = {}): this {\n\t\tif (config.target === undefined) {\n\t\t\tthis.config.onConflict = sql`do nothing`;\n\t\t} else {\n\t\t\tconst targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;\n\t\t\tconst whereSql = config.where ? sql` where ${config.where}` : sql``;\n\t\t\tthis.config.onConflict = sql`${targetSql} do nothing${whereSql}`;\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds an `on conflict do update` clause to the query.\n\t *\n\t * Calling this method will update the existing row that conflicts with the row proposed for insertion as its alternative action.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert#upserts-and-conflicts}\n\t *\n\t * @param config The `target`, `set` and `where` clauses.\n\t *\n\t * @example\n\t * ```ts\n\t * // Update the row if there's a conflict\n\t * await db.insert(cars)\n\t * .values({ id: 1, brand: 'BMW' })\n\t * .onConflictDoUpdate({\n\t * target: cars.id,\n\t * set: { brand: 'Porsche' }\n\t * });\n\t *\n\t * // Upsert with 'where' clause\n\t * await db.insert(cars)\n\t * .values({ id: 1, brand: 'BMW' })\n\t * .onConflictDoUpdate({\n\t * target: cars.id,\n\t * set: { brand: 'newBMW' },\n\t * where: sql`${cars.createdAt} > '2023-01-01'::date`,\n\t * });\n\t * ```\n\t */\n\tonConflictDoUpdate(config: SQLiteInsertOnConflictDoUpdateConfig): this {\n\t\tconst targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;\n\t\tconst whereSql = config.where ? sql` where ${config.where}` : sql``;\n\t\tconst setSql = this.dialect.buildUpdateSet(this.config.table, mapUpdateSet(this.config.table, config.set));\n\t\tthis.config.onConflict = sql`${targetSql} do update set ${setSql}${whereSql}`;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildInsertQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\t/** @internal */\n\t_prepare(isOneTimeQuery = true): SQLiteInsertPrepare {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteInsertPrepare;\n\t}\n\n\tprepare(): SQLiteInsertPrepare {\n\t\treturn this._prepare(false);\n\t}\n\n\trun: ReturnType['run'] = (placeholderValues) => {\n\t\treturn this._prepare().run(placeholderValues);\n\t};\n\n\tall: ReturnType['all'] = (placeholderValues) => {\n\t\treturn this._prepare().all(placeholderValues);\n\t};\n\n\tget: ReturnType['get'] = (placeholderValues) => {\n\t\treturn this._prepare().get(placeholderValues);\n\t};\n\n\tvalues: ReturnType['values'] = (placeholderValues) => {\n\t\treturn this._prepare().values(placeholderValues);\n\t};\n\n\toverride async execute(): Promise> {\n\t\treturn (this.config.returning ? this.all() : this.run()) as SQLiteInsertExecute;\n\t}\n\n\t$dynamic(): SQLiteInsertDynamic {\n\t\treturn this as any;\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { ColumnsSelection} from '~/sql/sql.ts';\nimport { View } from '~/sql/sql.ts';\n\nexport abstract class SQLiteViewBase<\n\tTName extends string = string,\n\tTExisting extends boolean = boolean,\n\tTSelection extends ColumnsSelection = ColumnsSelection,\n> extends View {\n\tstatic readonly [entityKind]: string = 'SQLiteViewBase';\n\n\tdeclare _: View['_'] & {\n\t\tviewBrand: 'SQLiteView';\n\t};\n}\n", "import { aliasedTable, aliasedTableColumn, mapColumnsInAliasedSQLToAlias, mapColumnsInSQLToAlias } from '~/alias.ts';\nimport type { AnyColumn } from '~/column.ts';\nimport { Column } from '~/column.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { DrizzleError } from '~/errors.ts';\nimport type { MigrationConfig, MigrationMeta } from '~/migrator.ts';\nimport {\n\ttype BuildRelationalQueryResult,\n\ttype DBQueryConfig,\n\tgetOperators,\n\tgetOrderByOperators,\n\tMany,\n\tnormalizeRelation,\n\tOne,\n\ttype Relation,\n\ttype TableRelationalConfig,\n\ttype TablesRelationalConfig,\n} from '~/relations.ts';\nimport type { Name } from '~/sql/index.ts';\nimport { and, eq } from '~/sql/index.ts';\nimport { Param, type QueryWithTypings, SQL, sql, type SQLChunk } from '~/sql/sql.ts';\nimport { SQLiteColumn } from '~/sqlite-core/columns/index.ts';\nimport type { SQLiteDeleteConfig, SQLiteInsertConfig, SQLiteUpdateConfig } from '~/sqlite-core/query-builders/index.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { Subquery, SubqueryConfig } from '~/subquery.ts';\nimport { getTableName, Table } from '~/table.ts';\nimport { orderSelectedFields, type UpdateSet } from '~/utils.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport type {\n\tSelectedFieldsOrdered,\n\tSQLiteSelectConfig,\n\tSQLiteSelectJoinConfig,\n} from './query-builders/select.types.ts';\nimport type { SQLiteSession } from './session.ts';\nimport { SQLiteViewBase } from './view-base.ts';\n\nexport abstract class SQLiteDialect {\n\tstatic readonly [entityKind]: string = 'SQLiteDialect';\n\n\tescapeName(name: string): string {\n\t\treturn `\"${name}\"`;\n\t}\n\n\tescapeParam(_num: number): string {\n\t\treturn '?';\n\t}\n\n\tescapeString(str: string): string {\n\t\treturn `'${str.replace(/'/g, \"''\")}'`;\n\t}\n\n\tprivate buildWithCTE(queries: Subquery[] | undefined): SQL | undefined {\n\t\tif (!queries?.length) return undefined;\n\n\t\tconst withSqlChunks = [sql`with `];\n\t\tfor (const [i, w] of queries.entries()) {\n\t\t\twithSqlChunks.push(sql`${sql.identifier(w[SubqueryConfig].alias)} as (${w[SubqueryConfig].sql})`);\n\t\t\tif (i < queries.length - 1) {\n\t\t\t\twithSqlChunks.push(sql`, `);\n\t\t\t}\n\t\t}\n\t\twithSqlChunks.push(sql` `);\n\t\treturn sql.join(withSqlChunks);\n\t}\n\n\tbuildDeleteQuery({ table, where, returning, withList }: SQLiteDeleteConfig): SQL {\n\t\tconst withSql = this.buildWithCTE(withList);\n\n\t\tconst returningSql = returning\n\t\t\t? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}`\n\t\t\t: undefined;\n\n\t\tconst whereSql = where ? sql` where ${where}` : undefined;\n\n\t\treturn sql`${withSql}delete from ${table}${whereSql}${returningSql}`;\n\t}\n\n\tbuildUpdateSet(table: SQLiteTable, set: UpdateSet): SQL {\n\t\tconst setEntries = Object.entries(set);\n\n\t\tconst setSize = setEntries.length;\n\t\treturn sql.join(\n\t\t\tsetEntries\n\t\t\t\t.flatMap(([colName, value], i): SQL[] => {\n\t\t\t\t\tconst col: SQLiteColumn = table[Table.Symbol.Columns][colName]!;\n\t\t\t\t\tconst res = sql`${sql.identifier(col.name)} = ${value}`;\n\t\t\t\t\tif (i < setSize - 1) {\n\t\t\t\t\t\treturn [res, sql.raw(', ')];\n\t\t\t\t\t}\n\t\t\t\t\treturn [res];\n\t\t\t\t}),\n\t\t);\n\t}\n\n\tbuildUpdateQuery({ table, set, where, returning, withList }: SQLiteUpdateConfig): SQL {\n\t\tconst withSql = this.buildWithCTE(withList);\n\n\t\tconst setSql = this.buildUpdateSet(table, set);\n\n\t\tconst returningSql = returning\n\t\t\t? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}`\n\t\t\t: undefined;\n\n\t\tconst whereSql = where ? sql` where ${where}` : undefined;\n\n\t\treturn sql`${withSql}update ${table} set ${setSql}${whereSql}${returningSql}`;\n\t}\n\n\t/**\n\t * Builds selection SQL with provided fields/expressions\n\t *\n\t * Examples:\n\t *\n\t * `select from`\n\t *\n\t * `insert ... returning `\n\t *\n\t * If `isSingleTable` is true, then columns won't be prefixed with table name\n\t */\n\tprivate buildSelection(\n\t\tfields: SelectedFieldsOrdered,\n\t\t{ isSingleTable = false }: { isSingleTable?: boolean } = {},\n\t): SQL {\n\t\tconst columnsLen = fields.length;\n\n\t\tconst chunks = fields\n\t\t\t.flatMap(({ field }, i) => {\n\t\t\t\tconst chunk: SQLChunk[] = [];\n\n\t\t\t\tif (is(field, SQL.Aliased) && field.isSelectionField) {\n\t\t\t\t\tchunk.push(sql.identifier(field.fieldAlias));\n\t\t\t\t} else if (is(field, SQL.Aliased) || is(field, SQL)) {\n\t\t\t\t\tconst query = is(field, SQL.Aliased) ? field.sql : field;\n\n\t\t\t\t\tif (isSingleTable) {\n\t\t\t\t\t\tchunk.push(\n\t\t\t\t\t\t\tnew SQL(\n\t\t\t\t\t\t\t\tquery.queryChunks.map((c) => {\n\t\t\t\t\t\t\t\t\tif (is(c, Column)) {\n\t\t\t\t\t\t\t\t\t\treturn sql.identifier(c.name);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn c;\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchunk.push(query);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (is(field, SQL.Aliased)) {\n\t\t\t\t\t\tchunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);\n\t\t\t\t\t}\n\t\t\t\t} else if (is(field, Column)) {\n\t\t\t\t\tconst tableName = field.table[Table.Symbol.Name];\n\t\t\t\t\tconst columnName = field.name;\n\t\t\t\t\tif (isSingleTable) {\n\t\t\t\t\t\tchunk.push(sql.identifier(columnName));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchunk.push(sql`${sql.identifier(tableName)}.${sql.identifier(columnName)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (i < columnsLen - 1) {\n\t\t\t\t\tchunk.push(sql`, `);\n\t\t\t\t}\n\n\t\t\t\treturn chunk;\n\t\t\t});\n\n\t\treturn sql.join(chunks);\n\t}\n\n\tbuildSelectQuery(\n\t\t{\n\t\t\twithList,\n\t\t\tfields,\n\t\t\tfieldsFlat,\n\t\t\twhere,\n\t\t\thaving,\n\t\t\ttable,\n\t\t\tjoins,\n\t\t\torderBy,\n\t\t\tgroupBy,\n\t\t\tlimit,\n\t\t\toffset,\n\t\t\tdistinct,\n\t\t\tsetOperators,\n\t\t}: SQLiteSelectConfig,\n\t): SQL {\n\t\tconst fieldsList = fieldsFlat ?? orderSelectedFields(fields);\n\t\tfor (const f of fieldsList) {\n\t\t\tif (\n\t\t\t\tis(f.field, Column)\n\t\t\t\t&& getTableName(f.field.table)\n\t\t\t\t\t!== (is(table, Subquery)\n\t\t\t\t\t\t? table[SubqueryConfig].alias\n\t\t\t\t\t\t: is(table, SQLiteViewBase)\n\t\t\t\t\t\t? table[ViewBaseConfig].name\n\t\t\t\t\t\t: is(table, SQL)\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: getTableName(table))\n\t\t\t\t&& !((table) =>\n\t\t\t\t\tjoins?.some(({ alias }) =>\n\t\t\t\t\t\talias === (table[Table.Symbol.IsAlias] ? getTableName(table) : table[Table.Symbol.BaseName])\n\t\t\t\t\t))(f.field.table)\n\t\t\t) {\n\t\t\t\tconst tableName = getTableName(f.field.table);\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Your \"${\n\t\t\t\t\t\tf.path.join('->')\n\t\t\t\t\t}\" field references a column \"${tableName}\".\"${f.field.name}\", but the table \"${tableName}\" is not part of the query! Did you forget to join it?`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst isSingleTable = !joins || joins.length === 0;\n\n\t\tconst withSql = this.buildWithCTE(withList);\n\n\t\tconst distinctSql = distinct ? sql` distinct` : undefined;\n\n\t\tconst selection = this.buildSelection(fieldsList, { isSingleTable });\n\n\t\tconst tableSql = (() => {\n\t\t\tif (is(table, Table) && table[Table.Symbol.OriginalName] !== table[Table.Symbol.Name]) {\n\t\t\t\treturn sql`${sql.identifier(table[Table.Symbol.OriginalName])} ${sql.identifier(table[Table.Symbol.Name])}`;\n\t\t\t}\n\n\t\t\treturn table;\n\t\t})();\n\n\t\tconst joinsArray: SQL[] = [];\n\n\t\tif (joins) {\n\t\t\tfor (const [index, joinMeta] of joins.entries()) {\n\t\t\t\tif (index === 0) {\n\t\t\t\t\tjoinsArray.push(sql` `);\n\t\t\t\t}\n\t\t\t\tconst table = joinMeta.table;\n\n\t\t\t\tif (is(table, SQLiteTable)) {\n\t\t\t\t\tconst tableName = table[SQLiteTable.Symbol.Name];\n\t\t\t\t\tconst tableSchema = table[SQLiteTable.Symbol.Schema];\n\t\t\t\t\tconst origTableName = table[SQLiteTable.Symbol.OriginalName];\n\t\t\t\t\tconst alias = tableName === origTableName ? undefined : joinMeta.alias;\n\t\t\t\t\tjoinsArray.push(\n\t\t\t\t\t\tsql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : undefined}${\n\t\t\t\t\t\t\tsql.identifier(origTableName)\n\t\t\t\t\t\t}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tjoinsArray.push(\n\t\t\t\t\t\tsql`${sql.raw(joinMeta.joinType)} join ${table} on ${joinMeta.on}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (index < joins.length - 1) {\n\t\t\t\t\tjoinsArray.push(sql` `);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst joinsSql = sql.join(joinsArray);\n\n\t\tconst whereSql = where ? sql` where ${where}` : undefined;\n\n\t\tconst havingSql = having ? sql` having ${having}` : undefined;\n\n\t\tconst orderByList: (SQLiteColumn | SQL | SQL.Aliased)[] = [];\n\t\tif (orderBy) {\n\t\t\tfor (const [index, orderByValue] of orderBy.entries()) {\n\t\t\t\torderByList.push(orderByValue);\n\n\t\t\t\tif (index < orderBy.length - 1) {\n\t\t\t\t\torderByList.push(sql`, `);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst groupByList: (SQL | AnyColumn | SQL.Aliased)[] = [];\n\t\tif (groupBy) {\n\t\t\tfor (const [index, groupByValue] of groupBy.entries()) {\n\t\t\t\tgroupByList.push(groupByValue);\n\n\t\t\t\tif (index < groupBy.length - 1) {\n\t\t\t\t\tgroupByList.push(sql`, `);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst groupBySql = groupByList.length > 0 ? sql` group by ${sql.join(groupByList)}` : undefined;\n\n\t\tconst orderBySql = orderByList.length > 0 ? sql` order by ${sql.join(orderByList)}` : undefined;\n\n\t\tconst limitSql = limit ? sql` limit ${limit}` : undefined;\n\n\t\tconst offsetSql = offset ? sql` offset ${offset}` : undefined;\n\n\t\tconst finalQuery =\n\t\t\tsql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}`;\n\n\t\tif (setOperators.length > 0) {\n\t\t\treturn this.buildSetOperations(finalQuery, setOperators);\n\t\t}\n\n\t\treturn finalQuery;\n\t}\n\n\tbuildSetOperations(leftSelect: SQL, setOperators: SQLiteSelectConfig['setOperators']): SQL {\n\t\tconst [setOperator, ...rest] = setOperators;\n\n\t\tif (!setOperator) {\n\t\t\tthrow new Error('Cannot pass undefined values to any set operator');\n\t\t}\n\n\t\tif (rest.length === 0) {\n\t\t\treturn this.buildSetOperationQuery({ leftSelect, setOperator });\n\t\t}\n\n\t\t// Some recursive magic here\n\t\treturn this.buildSetOperations(\n\t\t\tthis.buildSetOperationQuery({ leftSelect, setOperator }),\n\t\t\trest,\n\t\t);\n\t}\n\n\tbuildSetOperationQuery({\n\t\tleftSelect,\n\t\tsetOperator: { type, isAll, rightSelect, limit, orderBy, offset },\n\t}: { leftSelect: SQL; setOperator: SQLiteSelectConfig['setOperators'][number] }): SQL {\n\t\t// SQLite doesn't support parenthesis in set operations\n\t\tconst leftChunk = sql`${leftSelect.getSQL()} `;\n\t\tconst rightChunk = sql`${rightSelect.getSQL()}`;\n\n\t\tlet orderBySql;\n\t\tif (orderBy && orderBy.length > 0) {\n\t\t\tconst orderByValues: (SQL | Name)[] = [];\n\n\t\t\t// The next bit is necessary because the sql operator replaces ${table.column} with `table`.`column`\n\t\t\t// which is invalid Sql syntax, Table from one of the SELECTs cannot be used in global ORDER clause\n\t\t\tfor (const singleOrderBy of orderBy) {\n\t\t\t\tif (is(singleOrderBy, SQLiteColumn)) {\n\t\t\t\t\torderByValues.push(sql.identifier(singleOrderBy.name));\n\t\t\t\t} else if (is(singleOrderBy, SQL)) {\n\t\t\t\t\tfor (let i = 0; i < singleOrderBy.queryChunks.length; i++) {\n\t\t\t\t\t\tconst chunk = singleOrderBy.queryChunks[i];\n\n\t\t\t\t\t\tif (is(chunk, SQLiteColumn)) {\n\t\t\t\t\t\t\tsingleOrderBy.queryChunks[i] = sql.identifier(chunk.name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\torderByValues.push(sql`${singleOrderBy}`);\n\t\t\t\t} else {\n\t\t\t\t\torderByValues.push(sql`${singleOrderBy}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\torderBySql = sql` order by ${sql.join(orderByValues, sql`, `)}`;\n\t\t}\n\n\t\tconst limitSql = limit ? sql` limit ${limit}` : undefined;\n\n\t\tconst operatorChunk = sql.raw(`${type} ${isAll ? 'all ' : ''}`);\n\n\t\tconst offsetSql = offset ? sql` offset ${offset}` : undefined;\n\n\t\treturn sql`${leftChunk}${operatorChunk}${rightChunk}${orderBySql}${limitSql}${offsetSql}`;\n\t}\n\n\tbuildInsertQuery({ table, values, onConflict, returning, withList }: SQLiteInsertConfig): SQL {\n\t\t// const isSingleValue = values.length === 1;\n\t\tconst valuesSqlList: ((SQLChunk | SQL)[] | SQL)[] = [];\n\t\tconst columns: Record = table[Table.Symbol.Columns];\n\n\t\tconst colEntries: [string, SQLiteColumn][] = Object.entries(columns);\n\t\tconst insertOrder = colEntries.map(([, column]) => sql.identifier(column.name));\n\n\t\tfor (const [valueIndex, value] of values.entries()) {\n\t\t\tconst valueList: (SQLChunk | SQL)[] = [];\n\t\t\tfor (const [fieldName, col] of colEntries) {\n\t\t\t\tconst colValue = value[fieldName];\n\t\t\t\tif (colValue === undefined || (is(colValue, Param) && colValue.value === undefined)) {\n\t\t\t\t\tlet defaultValue;\n\t\t\t\t\tif (col.default !== null && col.default !== undefined) {\n\t\t\t\t\t\tdefaultValue = is(col.default, SQL) ? col.default : sql.param(col.default, col);\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-negated-condition\n\t\t\t\t\t} else if (col.defaultFn !== undefined) {\n\t\t\t\t\t\tconst defaultFnResult = col.defaultFn();\n\t\t\t\t\t\tdefaultValue = is(defaultFnResult, SQL) ? defaultFnResult : sql.param(defaultFnResult, col);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdefaultValue = sql`null`;\n\t\t\t\t\t}\n\t\t\t\t\tvalueList.push(defaultValue);\n\t\t\t\t} else {\n\t\t\t\t\tvalueList.push(colValue);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvaluesSqlList.push(valueList);\n\t\t\tif (valueIndex < values.length - 1) {\n\t\t\t\tvaluesSqlList.push(sql`, `);\n\t\t\t}\n\t\t}\n\n\t\tconst withSql = this.buildWithCTE(withList);\n\n\t\tconst valuesSql = sql.join(valuesSqlList);\n\n\t\tconst returningSql = returning\n\t\t\t? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}`\n\t\t\t: undefined;\n\n\t\tconst onConflictSql = onConflict ? sql` on conflict ${onConflict}` : undefined;\n\n\t\t// if (isSingleValue && valuesSqlList.length === 0){\n\t\t// \treturn sql`insert into ${table} default values ${onConflictSql}${returningSql}`;\n\t\t// }\n\n\t\treturn sql`${withSql}insert into ${table} ${insertOrder} values ${valuesSql}${onConflictSql}${returningSql}`;\n\t}\n\n\tsqlToQuery(sql: SQL): QueryWithTypings {\n\t\treturn sql.toQuery({\n\t\t\tescapeName: this.escapeName,\n\t\t\tescapeParam: this.escapeParam,\n\t\t\tescapeString: this.escapeString,\n\t\t});\n\t}\n\n\tbuildRelationalQuery({\n\t\tfullSchema,\n\t\tschema,\n\t\ttableNamesMap,\n\t\ttable,\n\t\ttableConfig,\n\t\tqueryConfig: config,\n\t\ttableAlias,\n\t\tnestedQueryRelation,\n\t\tjoinOn,\n\t}: {\n\t\tfullSchema: Record;\n\t\tschema: TablesRelationalConfig;\n\t\ttableNamesMap: Record;\n\t\ttable: SQLiteTable;\n\t\ttableConfig: TableRelationalConfig;\n\t\tqueryConfig: true | DBQueryConfig<'many', true>;\n\t\ttableAlias: string;\n\t\tnestedQueryRelation?: Relation;\n\t\tjoinOn?: SQL;\n\t}): BuildRelationalQueryResult {\n\t\tlet selection: BuildRelationalQueryResult['selection'] = [];\n\t\tlet limit, offset, orderBy: SQLiteSelectConfig['orderBy'] = [], where;\n\t\tconst joins: SQLiteSelectJoinConfig[] = [];\n\n\t\tif (config === true) {\n\t\t\tconst selectionEntries = Object.entries(tableConfig.columns);\n\t\t\tselection = selectionEntries.map((\n\t\t\t\t[key, value],\n\t\t\t) => ({\n\t\t\t\tdbKey: value.name,\n\t\t\t\ttsKey: key,\n\t\t\t\tfield: aliasedTableColumn(value as SQLiteColumn, tableAlias),\n\t\t\t\trelationTableTsKey: undefined,\n\t\t\t\tisJson: false,\n\t\t\t\tselection: [],\n\t\t\t}));\n\t\t} else {\n\t\t\tconst aliasedColumns = Object.fromEntries(\n\t\t\t\tObject.entries(tableConfig.columns).map(([key, value]) => [key, aliasedTableColumn(value, tableAlias)]),\n\t\t\t);\n\n\t\t\tif (config.where) {\n\t\t\t\tconst whereSql = typeof config.where === 'function'\n\t\t\t\t\t? config.where(aliasedColumns, getOperators())\n\t\t\t\t\t: config.where;\n\t\t\t\twhere = whereSql && mapColumnsInSQLToAlias(whereSql, tableAlias);\n\t\t\t}\n\n\t\t\tconst fieldsSelection: { tsKey: string; value: SQLiteColumn | SQL.Aliased }[] = [];\n\t\t\tlet selectedColumns: string[] = [];\n\n\t\t\t// Figure out which columns to select\n\t\t\tif (config.columns) {\n\t\t\t\tlet isIncludeMode = false;\n\n\t\t\t\tfor (const [field, value] of Object.entries(config.columns)) {\n\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (field in tableConfig.columns) {\n\t\t\t\t\t\tif (!isIncludeMode && value === true) {\n\t\t\t\t\t\t\tisIncludeMode = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselectedColumns.push(field);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (selectedColumns.length > 0) {\n\t\t\t\t\tselectedColumns = isIncludeMode\n\t\t\t\t\t\t? selectedColumns.filter((c) => config.columns?.[c] === true)\n\t\t\t\t\t\t: Object.keys(tableConfig.columns).filter((key) => !selectedColumns.includes(key));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Select all columns if selection is not specified\n\t\t\t\tselectedColumns = Object.keys(tableConfig.columns);\n\t\t\t}\n\n\t\t\tfor (const field of selectedColumns) {\n\t\t\t\tconst column = tableConfig.columns[field]! as SQLiteColumn;\n\t\t\t\tfieldsSelection.push({ tsKey: field, value: column });\n\t\t\t}\n\n\t\t\tlet selectedRelations: {\n\t\t\t\ttsKey: string;\n\t\t\t\tqueryConfig: true | DBQueryConfig<'many', false>;\n\t\t\t\trelation: Relation;\n\t\t\t}[] = [];\n\n\t\t\t// Figure out which relations to select\n\t\t\tif (config.with) {\n\t\t\t\tselectedRelations = Object.entries(config.with)\n\t\t\t\t\t.filter((entry): entry is [typeof entry[0], NonNullable] => !!entry[1])\n\t\t\t\t\t.map(([tsKey, queryConfig]) => ({ tsKey, queryConfig, relation: tableConfig.relations[tsKey]! }));\n\t\t\t}\n\n\t\t\tlet extras;\n\n\t\t\t// Figure out which extras to select\n\t\t\tif (config.extras) {\n\t\t\t\textras = typeof config.extras === 'function'\n\t\t\t\t\t? config.extras(aliasedColumns, { sql })\n\t\t\t\t\t: config.extras;\n\t\t\t\tfor (const [tsKey, value] of Object.entries(extras)) {\n\t\t\t\t\tfieldsSelection.push({\n\t\t\t\t\t\ttsKey,\n\t\t\t\t\t\tvalue: mapColumnsInAliasedSQLToAlias(value, tableAlias),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Transform `fieldsSelection` into `selection`\n\t\t\t// `fieldsSelection` shouldn't be used after this point\n\t\t\tfor (const { tsKey, value } of fieldsSelection) {\n\t\t\t\tselection.push({\n\t\t\t\t\tdbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey]!.name,\n\t\t\t\t\ttsKey,\n\t\t\t\t\tfield: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,\n\t\t\t\t\trelationTableTsKey: undefined,\n\t\t\t\t\tisJson: false,\n\t\t\t\t\tselection: [],\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet orderByOrig = typeof config.orderBy === 'function'\n\t\t\t\t? config.orderBy(aliasedColumns, getOrderByOperators())\n\t\t\t\t: config.orderBy ?? [];\n\t\t\tif (!Array.isArray(orderByOrig)) {\n\t\t\t\torderByOrig = [orderByOrig];\n\t\t\t}\n\t\t\torderBy = orderByOrig.map((orderByValue) => {\n\t\t\t\tif (is(orderByValue, Column)) {\n\t\t\t\t\treturn aliasedTableColumn(orderByValue, tableAlias) as SQLiteColumn;\n\t\t\t\t}\n\t\t\t\treturn mapColumnsInSQLToAlias(orderByValue, tableAlias);\n\t\t\t});\n\n\t\t\tlimit = config.limit;\n\t\t\toffset = config.offset;\n\n\t\t\t// Process all relations\n\t\t\tfor (\n\t\t\t\tconst {\n\t\t\t\t\ttsKey: selectedRelationTsKey,\n\t\t\t\t\tqueryConfig: selectedRelationConfigValue,\n\t\t\t\t\trelation,\n\t\t\t\t} of selectedRelations\n\t\t\t) {\n\t\t\t\tconst normalizedRelation = normalizeRelation(schema, tableNamesMap, relation);\n\t\t\t\tconst relationTableName = relation.referencedTable[Table.Symbol.Name];\n\t\t\t\tconst relationTableTsName = tableNamesMap[relationTableName]!;\n\t\t\t\tconst relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`;\n\t\t\t\t// const relationTable = schema[relationTableTsName]!;\n\t\t\t\tconst joinOn = and(\n\t\t\t\t\t...normalizedRelation.fields.map((field, i) =>\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\taliasedTableColumn(normalizedRelation.references[i]!, relationTableAlias),\n\t\t\t\t\t\t\taliasedTableColumn(field, tableAlias),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst builtRelation = this.buildRelationalQuery({\n\t\t\t\t\tfullSchema,\n\t\t\t\t\tschema,\n\t\t\t\t\ttableNamesMap,\n\t\t\t\t\ttable: fullSchema[relationTableTsName] as SQLiteTable,\n\t\t\t\t\ttableConfig: schema[relationTableTsName]!,\n\t\t\t\t\tqueryConfig: is(relation, One)\n\t\t\t\t\t\t? (selectedRelationConfigValue === true\n\t\t\t\t\t\t\t? { limit: 1 }\n\t\t\t\t\t\t\t: { ...selectedRelationConfigValue, limit: 1 })\n\t\t\t\t\t\t: selectedRelationConfigValue,\n\t\t\t\t\ttableAlias: relationTableAlias,\n\t\t\t\t\tjoinOn,\n\t\t\t\t\tnestedQueryRelation: relation,\n\t\t\t\t});\n\t\t\t\tconst field = (sql`(${builtRelation.sql})`).as(selectedRelationTsKey);\n\t\t\t\tselection.push({\n\t\t\t\t\tdbKey: selectedRelationTsKey,\n\t\t\t\t\ttsKey: selectedRelationTsKey,\n\t\t\t\t\tfield,\n\t\t\t\t\trelationTableTsKey: relationTableTsName,\n\t\t\t\t\tisJson: true,\n\t\t\t\t\tselection: builtRelation.selection,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (selection.length === 0) {\n\t\t\tthrow new DrizzleError({\n\t\t\t\tmessage:\n\t\t\t\t\t`No fields selected for table \"${tableConfig.tsName}\" (\"${tableAlias}\"). You need to have at least one item in \"columns\", \"with\" or \"extras\". If you need to select all columns, omit the \"columns\" key or set it to undefined.`,\n\t\t\t});\n\t\t}\n\n\t\tlet result;\n\n\t\twhere = and(joinOn, where);\n\n\t\tif (nestedQueryRelation) {\n\t\t\tlet field = sql`json_array(${\n\t\t\t\tsql.join(\n\t\t\t\t\tselection.map(({ field }) =>\n\t\t\t\t\t\tis(field, SQLiteColumn) ? sql.identifier(field.name) : is(field, SQL.Aliased) ? field.sql : field\n\t\t\t\t\t),\n\t\t\t\t\tsql`, `,\n\t\t\t\t)\n\t\t\t})`;\n\t\t\tif (is(nestedQueryRelation, Many)) {\n\t\t\t\tfield = sql`coalesce(json_group_array(${field}), json_array())`;\n\t\t\t}\n\t\t\tconst nestedSelection = [{\n\t\t\t\tdbKey: 'data',\n\t\t\t\ttsKey: 'data',\n\t\t\t\tfield: field.as('data'),\n\t\t\t\tisJson: true,\n\t\t\t\trelationTableTsKey: tableConfig.tsName,\n\t\t\t\tselection,\n\t\t\t}];\n\n\t\t\tconst needsSubquery = limit !== undefined || offset !== undefined || orderBy.length > 0;\n\n\t\t\tif (needsSubquery) {\n\t\t\t\tresult = this.buildSelectQuery({\n\t\t\t\t\ttable: aliasedTable(table, tableAlias),\n\t\t\t\t\tfields: {},\n\t\t\t\t\tfieldsFlat: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpath: [],\n\t\t\t\t\t\t\tfield: sql.raw('*'),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\twhere,\n\t\t\t\t\tlimit,\n\t\t\t\t\toffset,\n\t\t\t\t\torderBy,\n\t\t\t\t\tsetOperators: [],\n\t\t\t\t});\n\n\t\t\t\twhere = undefined;\n\t\t\t\tlimit = undefined;\n\t\t\t\toffset = undefined;\n\t\t\t\torderBy = undefined;\n\t\t\t} else {\n\t\t\t\tresult = aliasedTable(table, tableAlias);\n\t\t\t}\n\n\t\t\tresult = this.buildSelectQuery({\n\t\t\t\ttable: is(result, SQLiteTable) ? result : new Subquery(result, {}, tableAlias),\n\t\t\t\tfields: {},\n\t\t\t\tfieldsFlat: nestedSelection.map(({ field }) => ({\n\t\t\t\t\tpath: [],\n\t\t\t\t\tfield: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field,\n\t\t\t\t})),\n\t\t\t\tjoins,\n\t\t\t\twhere,\n\t\t\t\tlimit,\n\t\t\t\toffset,\n\t\t\t\torderBy,\n\t\t\t\tsetOperators: [],\n\t\t\t});\n\t\t} else {\n\t\t\tresult = this.buildSelectQuery({\n\t\t\t\ttable: aliasedTable(table, tableAlias),\n\t\t\t\tfields: {},\n\t\t\t\tfieldsFlat: selection.map(({ field }) => ({\n\t\t\t\t\tpath: [],\n\t\t\t\t\tfield: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field,\n\t\t\t\t})),\n\t\t\t\tjoins,\n\t\t\t\twhere,\n\t\t\t\tlimit,\n\t\t\t\toffset,\n\t\t\t\torderBy,\n\t\t\t\tsetOperators: [],\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\ttableTsKey: tableConfig.tsName,\n\t\t\tsql: result,\n\t\t\tselection,\n\t\t};\n\t}\n}\n\nexport class SQLiteSyncDialect extends SQLiteDialect {\n\tstatic readonly [entityKind]: string = 'SQLiteSyncDialect';\n\n\tmigrate(\n\t\tmigrations: MigrationMeta[],\n\t\tsession: SQLiteSession<'sync', unknown, Record, TablesRelationalConfig>,\n\t\tconfig?: string | MigrationConfig,\n\t): void {\n\t\tconst migrationsTable = config === undefined\n\t\t\t? '__drizzle_migrations'\n\t\t\t: typeof config === 'string'\n\t\t\t? '__drizzle_migrations'\n\t\t\t: config.migrationsTable ?? '__drizzle_migrations';\n\n\t\tconst migrationTableCreate = sql`\n\t\t\tCREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (\n\t\t\t\tid SERIAL PRIMARY KEY,\n\t\t\t\thash text NOT NULL,\n\t\t\t\tcreated_at numeric\n\t\t\t)\n\t\t`;\n\t\tsession.run(migrationTableCreate);\n\n\t\tconst dbMigrations = session.values<[number, string, string]>(\n\t\t\tsql`SELECT id, hash, created_at FROM ${sql.identifier(migrationsTable)} ORDER BY created_at DESC LIMIT 1`,\n\t\t);\n\n\t\tconst lastDbMigration = dbMigrations[0] ?? undefined;\n\t\tsession.run(sql`BEGIN`);\n\n\t\ttry {\n\t\t\tfor (const migration of migrations) {\n\t\t\t\tif (!lastDbMigration || Number(lastDbMigration[2])! < migration.folderMillis) {\n\t\t\t\t\tfor (const stmt of migration.sql) {\n\t\t\t\t\t\tsession.run(sql.raw(stmt));\n\t\t\t\t\t}\n\t\t\t\t\tsession.run(\n\t\t\t\t\t\tsql`INSERT INTO ${\n\t\t\t\t\t\t\tsql.identifier(migrationsTable)\n\t\t\t\t\t\t} (\"hash\", \"created_at\") VALUES(${migration.hash}, ${migration.folderMillis})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsession.run(sql`COMMIT`);\n\t\t} catch (e) {\n\t\t\tsession.run(sql`ROLLBACK`);\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n\nexport class SQLiteAsyncDialect extends SQLiteDialect {\n\tstatic readonly [entityKind]: string = 'SQLiteAsyncDialect';\n\n\tasync migrate(\n\t\tmigrations: MigrationMeta[],\n\t\tsession: SQLiteSession<'async', unknown, Record, TablesRelationalConfig>,\n\t\tconfig: string | MigrationConfig,\n\t): Promise {\n\t\tconst migrationsTable = typeof config === 'string'\n\t\t\t? '__drizzle_migrations'\n\t\t\t: config.migrationsTable ?? '__drizzle_migrations';\n\n\t\tconst migrationTableCreate = sql`\n\t\t\tCREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (\n\t\t\t\tid SERIAL PRIMARY KEY,\n\t\t\t\thash text NOT NULL,\n\t\t\t\tcreated_at numeric\n\t\t\t)\n\t\t`;\n\t\tawait session.run(migrationTableCreate);\n\n\t\tconst dbMigrations = await session.values<[number, string, string]>(\n\t\t\tsql`SELECT id, hash, created_at FROM ${sql.identifier(migrationsTable)} ORDER BY created_at DESC LIMIT 1`,\n\t\t);\n\n\t\tconst lastDbMigration = dbMigrations[0] ?? undefined;\n\n\t\tawait session.transaction(async (tx) => {\n\t\t\tfor (const migration of migrations) {\n\t\t\t\tif (!lastDbMigration || Number(lastDbMigration[2])! < migration.folderMillis) {\n\t\t\t\t\tfor (const stmt of migration.sql) {\n\t\t\t\t\t\tawait tx.run(sql.raw(stmt));\n\t\t\t\t\t}\n\t\t\t\t\tawait tx.run(\n\t\t\t\t\t\tsql`INSERT INTO ${\n\t\t\t\t\t\t\tsql.identifier(migrationsTable)\n\t\t\t\t\t\t} (\"hash\", \"created_at\") VALUES(${migration.hash}, ${migration.folderMillis})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { SQL, SQLWrapper } from '~/sql/index.ts';\n\nexport abstract class TypedQueryBuilder implements SQLWrapper {\n\tstatic readonly [entityKind]: string = 'TypedQueryBuilder';\n\n\tdeclare _: {\n\t\tselectedFields: TSelection;\n\t\tresult: TResult;\n\t};\n\n\t/** @internal */\n\tgetSelectedFields(): TSelection {\n\t\treturn this._.selectedFields;\n\t}\n\n\tabstract getSQL(): SQL;\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tGetSelectTableSelection,\n\tJoinNullability,\n\tJoinType,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { SQL, View } from '~/sql/sql.ts';\nimport type { ColumnsSelection, Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteColumn } from '~/sqlite-core/columns/index.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLiteSession } from '~/sqlite-core/session.ts';\nimport type { SubqueryWithSelection } from '~/sqlite-core/subquery.ts';\nimport type { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { Subquery, SubqueryConfig } from '~/subquery.ts';\nimport { Table } from '~/table.ts';\nimport {\n\tapplyMixins,\n\tgetTableColumns,\n\tgetTableLikeName,\n\thaveSameKeys,\n\torderSelectedFields,\n\ttype ValueOrArray,\n} from '~/utils.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport { SQLiteViewBase } from '../view-base.ts';\nimport type {\n\tAnySQLiteSelect,\n\tCreateSQLiteSelectFromBuilderMode,\n\tGetSQLiteSetOperators,\n\tSelectedFields,\n\tSetOperatorRightSelect,\n\tSQLiteCreateSetOperatorFn,\n\tSQLiteJoinFn,\n\tSQLiteSelectConfig,\n\tSQLiteSelectDynamic,\n\tSQLiteSelectExecute,\n\tSQLiteSelectHKT,\n\tSQLiteSelectHKTBase,\n\tSQLiteSelectPrepare,\n\tSQLiteSelectWithout,\n\tSQLiteSetOperatorExcludedMethods,\n\tSQLiteSetOperatorWithResult,\n} from './select.types.ts';\n\nexport class SQLiteSelectBuilder<\n\tTSelection extends SelectedFields | undefined,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTBuilderMode extends 'db' | 'qb' = 'db',\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteSelectBuilder';\n\n\tprivate fields: TSelection;\n\tprivate session: SQLiteSession | undefined;\n\tprivate dialect: SQLiteDialect;\n\tprivate withList: Subquery[] | undefined;\n\tprivate distinct: boolean | undefined;\n\n\tconstructor(\n\t\tconfig: {\n\t\t\tfields: TSelection;\n\t\t\tsession: SQLiteSession | undefined;\n\t\t\tdialect: SQLiteDialect;\n\t\t\twithList?: Subquery[];\n\t\t\tdistinct?: boolean;\n\t\t},\n\t) {\n\t\tthis.fields = config.fields;\n\t\tthis.session = config.session;\n\t\tthis.dialect = config.dialect;\n\t\tthis.withList = config.withList;\n\t\tthis.distinct = config.distinct;\n\t}\n\n\tfrom(\n\t\tsource: TFrom,\n\t): CreateSQLiteSelectFromBuilderMode<\n\t\tTBuilderMode,\n\t\tGetSelectTableName,\n\t\tTResultType,\n\t\tTRunResult,\n\t\tTSelection extends undefined ? GetSelectTableSelection : TSelection,\n\t\tTSelection extends undefined ? 'single' : 'partial'\n\t> {\n\t\tconst isPartialSelect = !!this.fields;\n\n\t\tlet fields: SelectedFields;\n\t\tif (this.fields) {\n\t\t\tfields = this.fields;\n\t\t} else if (is(source, Subquery)) {\n\t\t\t// This is required to use the proxy handler to get the correct field values from the subquery\n\t\t\tfields = Object.fromEntries(\n\t\t\t\tObject.keys(source[SubqueryConfig].selection).map((\n\t\t\t\t\tkey,\n\t\t\t\t) => [key, source[key as unknown as keyof typeof source] as unknown as SelectedFields[string]]),\n\t\t\t);\n\t\t} else if (is(source, SQLiteViewBase)) {\n\t\t\tfields = source[ViewBaseConfig].selectedFields as SelectedFields;\n\t\t} else if (is(source, SQL)) {\n\t\t\tfields = {};\n\t\t} else {\n\t\t\tfields = getTableColumns(source);\n\t\t}\n\n\t\treturn new SQLiteSelectBase({\n\t\t\ttable: source,\n\t\t\tfields,\n\t\t\tisPartialSelect,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\twithList: this.withList,\n\t\t\tdistinct: this.distinct,\n\t\t}) as any;\n\t}\n}\n\nexport abstract class SQLiteSelectQueryBuilderBase<\n\tTHKT extends SQLiteSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record = TTableName extends string ? Record\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection,\n> extends TypedQueryBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteSelectQueryBuilder';\n\n\toverride readonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly hkt: THKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n\n\t/** @internal */\n\tconfig: SQLiteSelectConfig;\n\tprotected joinsNotNullableMap: Record;\n\tprivate tableName: string | undefined;\n\tprivate isPartialSelect: boolean;\n\tprotected session: SQLiteSession | undefined;\n\tprotected dialect: SQLiteDialect;\n\n\tconstructor(\n\t\t{ table, fields, isPartialSelect, session, dialect, withList, distinct }: {\n\t\t\ttable: SQLiteSelectConfig['table'];\n\t\t\tfields: SQLiteSelectConfig['fields'];\n\t\t\tisPartialSelect: boolean;\n\t\t\tsession: SQLiteSession | undefined;\n\t\t\tdialect: SQLiteDialect;\n\t\t\twithList: Subquery[] | undefined;\n\t\t\tdistinct: boolean | undefined;\n\t\t},\n\t) {\n\t\tsuper();\n\t\tthis.config = {\n\t\t\twithList,\n\t\t\ttable,\n\t\t\tfields: { ...fields },\n\t\t\tdistinct,\n\t\t\tsetOperators: [],\n\t\t};\n\t\tthis.isPartialSelect = isPartialSelect;\n\t\tthis.session = session;\n\t\tthis.dialect = dialect;\n\t\tthis._ = {\n\t\t\tselectedFields: fields as TSelectedFields,\n\t\t} as this['_'];\n\t\tthis.tableName = getTableLikeName(table);\n\t\tthis.joinsNotNullableMap = typeof this.tableName === 'string' ? { [this.tableName]: true } : {};\n\t}\n\n\tprivate createJoin(\n\t\tjoinType: TJoinType,\n\t): SQLiteJoinFn {\n\t\treturn (\n\t\t\ttable: SQLiteTable | Subquery | SQLiteViewBase | SQL,\n\t\t\ton: ((aliases: TSelection) => SQL | undefined) | SQL | undefined,\n\t\t) => {\n\t\t\tconst baseTableName = this.tableName;\n\t\t\tconst tableName = getTableLikeName(table);\n\n\t\t\tif (typeof tableName === 'string' && this.config.joins?.some((join) => join.alias === tableName)) {\n\t\t\t\tthrow new Error(`Alias \"${tableName}\" is already used in this query`);\n\t\t\t}\n\n\t\t\tif (!this.isPartialSelect) {\n\t\t\t\t// If this is the first join and this is not a partial select and we're not selecting from raw SQL, \"move\" the fields from the main table to the nested object\n\t\t\t\tif (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === 'string') {\n\t\t\t\t\tthis.config.fields = {\n\t\t\t\t\t\t[baseTableName]: this.config.fields,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (typeof tableName === 'string' && !is(table, SQL)) {\n\t\t\t\t\tconst selection = is(table, Subquery)\n\t\t\t\t\t\t? table[SubqueryConfig].selection\n\t\t\t\t\t\t: is(table, View)\n\t\t\t\t\t\t? table[ViewBaseConfig].selectedFields\n\t\t\t\t\t\t: table[Table.Symbol.Columns];\n\t\t\t\t\tthis.config.fields[tableName] = selection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof on === 'function') {\n\t\t\t\ton = on(\n\t\t\t\t\tnew Proxy(\n\t\t\t\t\t\tthis.config.fields,\n\t\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t\t) as TSelection,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!this.config.joins) {\n\t\t\t\tthis.config.joins = [];\n\t\t\t}\n\t\t\tthis.config.joins.push({ on, table, joinType, alias: tableName });\n\n\t\t\tif (typeof tableName === 'string') {\n\t\t\t\tswitch (joinType) {\n\t\t\t\t\tcase 'left': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'right': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'inner': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'full': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this as any;\n\t\t};\n\t}\n\n\t/**\n\t * Executes a `left join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tleftJoin = this.createJoin('left');\n\n\t/**\n\t * Executes a `right join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\trightJoin = this.createJoin('right');\n\n\t/**\n\t * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet }[] = await db.select()\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tinnerJoin = this.createJoin('inner');\n\n\t/**\n\t * Executes a `full join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select()\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tfullJoin = this.createJoin('full');\n\n\tprivate createSetOperator(\n\t\ttype: SetOperator,\n\t\tisAll: boolean,\n\t): >(\n\t\trightSelection:\n\t\t\t| ((setOperators: GetSQLiteSetOperators) => SetOperatorRightSelect)\n\t\t\t| SetOperatorRightSelect,\n\t) => SQLiteSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tSQLiteSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\treturn (rightSelection) => {\n\t\t\tconst rightSelect = (typeof rightSelection === 'function'\n\t\t\t\t? rightSelection(getSQLiteSetOperators())\n\t\t\t\t: rightSelection) as TypedQueryBuilder<\n\t\t\t\t\tany,\n\t\t\t\t\tTResult\n\t\t\t\t>;\n\n\t\t\tif (!haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.config.setOperators.push({ type, isAll, rightSelect });\n\t\t\treturn this as any;\n\t\t};\n\t}\n\n\t/**\n\t * Adds `union` set operator to the query.\n\t *\n\t * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all unique names from customers and users tables\n\t * await db.select({ name: users.name })\n\t * .from(users)\n\t * .union(\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * // or\n\t * import { union } from 'drizzle-orm/sqlite-core'\n\t *\n\t * await union(\n\t * db.select({ name: users.name }).from(users),\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * ```\n\t */\n\tunion = this.createSetOperator('union', false);\n\n\t/**\n\t * Adds `union all` set operator to the query.\n\t *\n\t * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all transaction ids from both online and in-store sales\n\t * await db.select({ transaction: onlineSales.transactionId })\n\t * .from(onlineSales)\n\t * .unionAll(\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * // or\n\t * import { unionAll } from 'drizzle-orm/sqlite-core'\n\t *\n\t * await unionAll(\n\t * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * ```\n\t */\n\tunionAll = this.createSetOperator('union', true);\n\n\t/**\n\t * Adds `intersect` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select course names that are offered in both departments A and B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .intersect(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { intersect } from 'drizzle-orm/sqlite-core'\n\t *\n\t * await intersect(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\tintersect = this.createSetOperator('intersect', false);\n\n\t/**\n\t * Adds `except` set operator to the query.\n\t *\n\t * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all courses offered in department A but not in department B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .except(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { except } from 'drizzle-orm/sqlite-core'\n\t *\n\t * await except(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\texcept = this.createSetOperator('except', false);\n\n\t/** @internal */\n\taddSetOperators(setOperators: SQLiteSelectConfig['setOperators']): SQLiteSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tSQLiteSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\tthis.config.setOperators.push(...setOperators);\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `where` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#filtering}\n\t *\n\t * @param where the `where` clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be selected.\n\t *\n\t * ```ts\n\t * // Select all cars with green color\n\t * await db.select().from(cars).where(eq(cars.color, 'green'));\n\t * // or\n\t * await db.select().from(cars).where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Select all BMW cars with a green color\n\t * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Select all cars with the green or blue color\n\t * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(\n\t\twhere: ((aliases: TSelection) => SQL | undefined) | SQL | undefined,\n\t): SQLiteSelectWithout {\n\t\tif (typeof where === 'function') {\n\t\t\twhere = where(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `having` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @param having the `having` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all brands with more than one car\n\t * await db.select({\n\t * \tbrand: cars.brand,\n\t * \tcount: sql`cast(count(${cars.id}) as int)`,\n\t * })\n\t * .from(cars)\n\t * .groupBy(cars.brand)\n\t * .having(({ count }) => gt(count, 1));\n\t * ```\n\t */\n\thaving(\n\t\thaving: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): SQLiteSelectWithout {\n\t\tif (typeof having === 'function') {\n\t\t\thaving = having(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.having = having;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `group by` clause to the query.\n\t *\n\t * Calling this method will group rows that have the same values into summary rows, often used for aggregation purposes.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Group and count people by their last names\n\t * await db.select({\n\t * lastName: people.lastName,\n\t * count: sql`cast(count(*) as int)`\n\t * })\n\t * .from(people)\n\t * .groupBy(people.lastName);\n\t * ```\n\t */\n\tgroupBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray,\n\t): SQLiteSelectWithout;\n\tgroupBy(...columns: (SQLiteColumn | SQL)[]): SQLiteSelectWithout;\n\tgroupBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray]\n\t\t\t| (SQLiteColumn | SQL | SQL.Aliased)[]\n\t): SQLiteSelectWithout {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst groupBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t\tthis.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy];\n\t\t} else {\n\t\t\tthis.config.groupBy = columns as (SQLiteColumn | SQL | SQL.Aliased)[];\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `order by` clause to the query.\n\t *\n\t * Calling this method will sort the result-set in ascending or descending order. By default, the sort order is ascending.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#order-by}\n\t *\n\t * @example\n\t *\n\t * ```\n\t * // Select cars ordered by year\n\t * await db.select().from(cars).orderBy(cars.year);\n\t * ```\n\t *\n\t * You can specify whether results are in ascending or descending order with the `asc()` and `desc()` operators.\n\t *\n\t * ```ts\n\t * // Select cars ordered by year in descending order\n\t * await db.select().from(cars).orderBy(desc(cars.year));\n\t *\n\t * // Select cars ordered by year and price\n\t * await db.select().from(cars).orderBy(asc(cars.year), desc(cars.price));\n\t * ```\n\t */\n\torderBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray,\n\t): SQLiteSelectWithout;\n\torderBy(...columns: (SQLiteColumn | SQL)[]): SQLiteSelectWithout;\n\torderBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray]\n\t\t\t| (SQLiteColumn | SQL | SQL.Aliased)[]\n\t): SQLiteSelectWithout {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst orderBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\n\t\t\tconst orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t} else {\n\t\t\tconst orderByArray = columns as (SQLiteColumn | SQL | SQL.Aliased)[];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `limit` clause to the query.\n\t *\n\t * Calling this method will set the maximum number of rows that will be returned by this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param limit the `limit` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the first 10 people from this query.\n\t * await db.select().from(people).limit(10);\n\t * ```\n\t */\n\tlimit(limit: number | Placeholder): SQLiteSelectWithout {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.limit = limit;\n\t\t} else {\n\t\t\tthis.config.limit = limit;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `offset` clause to the query.\n\t *\n\t * Calling this method will skip a number of rows when returning results from this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param offset the `offset` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the 10th-20th people from this query.\n\t * await db.select().from(people).offset(10).limit(10);\n\t * ```\n\t */\n\toffset(offset: number | Placeholder): SQLiteSelectWithout {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.offset = offset;\n\t\t} else {\n\t\t\tthis.config.offset = offset;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildSelectQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tas(\n\t\talias: TAlias,\n\t): SubqueryWithSelection {\n\t\treturn new Proxy(\n\t\t\tnew Subquery(this.getSQL(), this.config.fields, alias),\n\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as SubqueryWithSelection;\n\t}\n\n\t/** @internal */\n\toverride getSelectedFields(): this['_']['selectedFields'] {\n\t\treturn new Proxy(\n\t\t\tthis.config.fields,\n\t\t\tnew SelectionProxyHandler({ alias: this.tableName, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as this['_']['selectedFields'];\n\t}\n\n\t$dynamic(): SQLiteSelectDynamic {\n\t\treturn this;\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface SQLiteSelectBase<\n\tTTableName extends string | undefined,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode = 'single',\n\tTNullabilityMap extends Record = TTableName extends string ? Record\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection,\n> extends\n\tSQLiteSelectQueryBuilderBase<\n\t\tSQLiteSelectHKT,\n\t\tTTableName,\n\t\tTResultType,\n\t\tTRunResult,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tQueryPromise\n{}\n\nexport class SQLiteSelectBase<\n\tTTableName extends string | undefined,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTSelection,\n\tTSelectMode extends SelectMode = 'single',\n\tTNullabilityMap extends Record = TTableName extends string ? Record\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult = SelectResult[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection,\n> extends SQLiteSelectQueryBuilderBase<\n\tSQLiteSelectHKT,\n\tTTableName,\n\tTResultType,\n\tTRunResult,\n\tTSelection,\n\tTSelectMode,\n\tTNullabilityMap,\n\tTDynamic,\n\tTExcludedMethods,\n\tTResult,\n\tTSelectedFields\n> implements RunnableQuery, SQLWrapper {\n\tstatic readonly [entityKind]: string = 'SQLiteSelect';\n\n\t/** @internal */\n\t_prepare(isOneTimeQuery = true): SQLiteSelectPrepare {\n\t\tif (!this.session) {\n\t\t\tthrow new Error('Cannot execute a query on a query builder. Please use a database instance instead.');\n\t\t}\n\t\tconst fieldsList = orderSelectedFields(this.config.fields);\n\t\tconst query = this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tfieldsList,\n\t\t\t'all',\n\t\t);\n\t\tquery.joinsNotNullableMap = this.joinsNotNullableMap;\n\t\treturn query as ReturnType;\n\t}\n\n\tprepare(): SQLiteSelectPrepare {\n\t\treturn this._prepare(false);\n\t}\n\n\trun: ReturnType['run'] = (placeholderValues) => {\n\t\treturn this._prepare().run(placeholderValues);\n\t};\n\n\tall: ReturnType['all'] = (placeholderValues) => {\n\t\treturn this._prepare().all(placeholderValues);\n\t};\n\n\tget: ReturnType['get'] = (placeholderValues) => {\n\t\treturn this._prepare().get(placeholderValues);\n\t};\n\n\tvalues: ReturnType['values'] = (placeholderValues) => {\n\t\treturn this._prepare().values(placeholderValues);\n\t};\n\n\tasync execute(): Promise> {\n\t\treturn this.all() as SQLiteSelectExecute;\n\t}\n}\n\napplyMixins(SQLiteSelectBase, [QueryPromise]);\n\nfunction createSetOperator(type: SetOperator, isAll: boolean): SQLiteCreateSetOperatorFn {\n\treturn (leftSelect, rightSelect, ...restSelects) => {\n\t\tconst setOperators = [rightSelect, ...restSelects].map((select) => ({\n\t\t\ttype,\n\t\t\tisAll,\n\t\t\trightSelect: select as AnySQLiteSelect,\n\t\t}));\n\n\t\tfor (const setOperator of setOperators) {\n\t\t\tif (!haveSameKeys((leftSelect as any).getSelectedFields(), setOperator.rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn (leftSelect as AnySQLiteSelect).addSetOperators(setOperators) as any;\n\t};\n}\n\nconst getSQLiteSetOperators = () => ({\n\tunion,\n\tunionAll,\n\tintersect,\n\texcept,\n});\n\n/**\n * Adds `union` set operator to the query.\n *\n * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n *\n * @example\n *\n * ```ts\n * // Select all unique names from customers and users tables\n * import { union } from 'drizzle-orm/sqlite-core'\n *\n * await union(\n * db.select({ name: users.name }).from(users),\n * db.select({ name: customers.name }).from(customers)\n * );\n * // or\n * await db.select({ name: users.name })\n * .from(users)\n * .union(\n * db.select({ name: customers.name }).from(customers)\n * );\n * ```\n */\nexport const union = createSetOperator('union', false);\n\n/**\n * Adds `union all` set operator to the query.\n *\n * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n *\n * @example\n *\n * ```ts\n * // Select all transaction ids from both online and in-store sales\n * import { unionAll } from 'drizzle-orm/sqlite-core'\n *\n * await unionAll(\n * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * // or\n * await db.select({ transaction: onlineSales.transactionId })\n * .from(onlineSales)\n * .unionAll(\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * ```\n */\nexport const unionAll = createSetOperator('union', true);\n\n/**\n * Adds `intersect` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n *\n * @example\n *\n * ```ts\n * // Select course names that are offered in both departments A and B\n * import { intersect } from 'drizzle-orm/sqlite-core'\n *\n * await intersect(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .intersect(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const intersect = createSetOperator('intersect', false);\n\n/**\n * Adds `except` set operator to the query.\n *\n * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n *\n * @example\n *\n * ```ts\n * // Select all courses offered in department A but not in department B\n * import { except } from 'drizzle-orm/sqlite-core'\n *\n * await except(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .except(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const except = createSetOperator('except', false);\n", "import { entityKind } from '~/entity.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport { SQLiteSyncDialect } from '~/sqlite-core/dialect.ts';\nimport type { WithSubqueryWithSelection } from '~/sqlite-core/subquery.ts';\nimport { SQLiteSelectBuilder } from './select.ts';\nimport type { SelectedFields } from './select.types.ts';\nimport type { ColumnsSelection } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\n\nexport class QueryBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteQueryBuilder';\n\n\tprivate dialect: SQLiteSyncDialect | undefined;\n\n\t$with(alias: TAlias) {\n\t\tconst queryBuilder = this;\n\n\t\treturn {\n\t\t\tas(\n\t\t\t\tqb: TypedQueryBuilder | ((qb: QueryBuilder) => TypedQueryBuilder),\n\t\t\t): WithSubqueryWithSelection {\n\t\t\t\tif (typeof qb === 'function') {\n\t\t\t\t\tqb = qb(queryBuilder);\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tnew WithSubquery(qb.getSQL(), qb.getSelectedFields() as SelectedFields, alias, true),\n\t\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t\t) as WithSubqueryWithSelection;\n\t\t\t},\n\t\t};\n\t}\n\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\tfunction select(): SQLiteSelectBuilder;\n\t\tfunction select(\n\t\t\tfields: TSelection,\n\t\t): SQLiteSelectBuilder;\n\t\tfunction select(\n\t\t\tfields?: TSelection,\n\t\t): SQLiteSelectBuilder {\n\t\t\treturn new SQLiteSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: undefined,\n\t\t\t\tdialect: self.getDialect(),\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\tfunction selectDistinct(): SQLiteSelectBuilder;\n\t\tfunction selectDistinct(\n\t\t\tfields: TSelection,\n\t\t): SQLiteSelectBuilder;\n\t\tfunction selectDistinct(\n\t\t\tfields?: TSelection,\n\t\t): SQLiteSelectBuilder {\n\t\t\treturn new SQLiteSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: undefined,\n\t\t\t\tdialect: self.getDialect(),\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\treturn { select, selectDistinct };\n\t}\n\n\tselect(): SQLiteSelectBuilder;\n\tselect(\n\t\tfields: TSelection,\n\t): SQLiteSelectBuilder;\n\tselect(\n\t\tfields?: TSelection,\n\t): SQLiteSelectBuilder {\n\t\treturn new SQLiteSelectBuilder({ fields: fields ?? undefined, session: undefined, dialect: this.getDialect() });\n\t}\n\n\tselectDistinct(): SQLiteSelectBuilder;\n\tselectDistinct(\n\t\tfields: TSelection,\n\t): SQLiteSelectBuilder;\n\tselectDistinct(\n\t\tfields?: TSelection,\n\t): SQLiteSelectBuilder {\n\t\treturn new SQLiteSelectBuilder({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: undefined,\n\t\t\tdialect: this.getDialect(),\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t// Lazy load dialect to avoid circular dependency\n\tprivate getDialect() {\n\t\tif (!this.dialect) {\n\t\t\tthis.dialect = new SQLiteSyncDialect();\n\t\t}\n\n\t\treturn this.dialect;\n\t}\n}\n", "import type { GetColumnData } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport type { Subquery } from '~/subquery.ts';\nimport { type DrizzleTypeError, mapUpdateSet, orderSelectedFields, type UpdateSet } from '~/utils.ts';\nimport type { SQLiteColumn } from '../columns/common.ts';\nimport type { SelectedFields, SelectedFieldsOrdered } from './select.types.ts';\n\nexport interface SQLiteUpdateConfig {\n\twhere?: SQL | undefined;\n\tset: UpdateSet;\n\ttable: SQLiteTable;\n\treturning?: SelectedFieldsOrdered;\n\twithList?: Subquery[];\n}\n\nexport type SQLiteUpdateSetSource =\n\t& {\n\t\t[Key in keyof TTable['_']['columns']]?:\n\t\t\t| GetColumnData\n\t\t\t| SQL;\n\t}\n\t& {};\n\nexport class SQLiteUpdateBuilder<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteUpdateBuilder';\n\n\tdeclare readonly _: {\n\t\treadonly table: TTable;\n\t};\n\n\tconstructor(\n\t\tprotected table: TTable,\n\t\tprotected session: SQLiteSession,\n\t\tprotected dialect: SQLiteDialect,\n\t\tprivate withList?: Subquery[],\n\t) {}\n\n\tset(values: SQLiteUpdateSetSource): SQLiteUpdateBase {\n\t\treturn new SQLiteUpdateBase(\n\t\t\tthis.table,\n\t\t\tmapUpdateSet(this.table, values),\n\t\t\tthis.session,\n\t\t\tthis.dialect,\n\t\t\tthis.withList,\n\t\t);\n\t}\n}\n\nexport type SQLiteUpdateWithout<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n> = TDynamic extends true ? T : Omit<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['returning'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods'] | K\n\t>,\n\tT['_']['excludedMethods'] | K\n>;\n\nexport type SQLiteUpdateReturningAll = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateReturning<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFields,\n> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateExecute = T['_']['returning'] extends undefined ? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteUpdatePrepare = SQLitePreparedQuery<\n\t{\n\t\ttype: T['_']['resultType'];\n\t\trun: T['_']['runResult'];\n\t\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'][];\n\t\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'];\n\t\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t\t: any[][];\n\t\texecute: SQLiteUpdateExecute;\n\t}\n>;\n\nexport type SQLiteUpdateDynamic = SQLiteUpdate<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type SQLiteUpdate<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = any,\n\tTReturning extends Record | undefined = Record | undefined,\n> = SQLiteUpdateBase;\n\ntype AnySQLiteUpdate = SQLiteUpdateBase;\n\nexport interface SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends SQLWrapper, QueryPromise {\n\treadonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise\n\timplements RunnableQuery, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteUpdate';\n\n\t/** @internal */\n\tconfig: SQLiteUpdateConfig;\n\n\tconstructor(\n\t\ttable: TTable,\n\t\tset: UpdateSet,\n\t\tprivate session: SQLiteSession,\n\t\tprivate dialect: SQLiteDialect,\n\t\twithList?: Subquery[],\n\t) {\n\t\tsuper();\n\t\tthis.config = { set, table, withList };\n\t}\n\n\t/**\n\t * Adds a 'where' clause to the query.\n\t *\n\t * Calling this method will update only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param where the 'where' clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be updated.\n\t *\n\t * ```ts\n\t * // Update all cars with green color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'));\n\t * // or\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Update all BMW cars with a green color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Update all cars with the green or blue color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(where: SQL | undefined): SQLiteUpdateWithout {\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `returning` clause to the query.\n\t *\n\t * Calling this method will return the specified fields of the updated rows. If no fields are specified, all fields will be returned.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update#update-with-returning}\n\t *\n\t * @example\n\t * ```ts\n\t * // Update all cars with the green color and return all fields\n\t * const updatedCars: Car[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'))\n\t * .returning();\n\t *\n\t * // Update all cars with the green color and return only their id and brand fields\n\t * const updatedCarsIdsAndBrands: { id: number, brand: string }[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'))\n\t * .returning({ id: cars.id, brand: cars.brand });\n\t * ```\n\t */\n\treturning(): SQLiteUpdateReturningAll;\n\treturning(\n\t\tfields: TSelectedFields,\n\t): SQLiteUpdateReturning;\n\treturning(\n\t\tfields: SelectedFields = this.config.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteUpdateWithout {\n\t\tthis.config.returning = orderSelectedFields(fields);\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildUpdateQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\t/** @internal */\n\t_prepare(isOneTimeQuery = true): SQLiteUpdatePrepare {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteUpdatePrepare;\n\t}\n\n\tprepare(): SQLiteUpdatePrepare {\n\t\treturn this._prepare(false);\n\t}\n\n\trun: ReturnType['run'] = (placeholderValues) => {\n\t\treturn this._prepare().run(placeholderValues);\n\t};\n\n\tall: ReturnType['all'] = (placeholderValues) => {\n\t\treturn this._prepare().all(placeholderValues);\n\t};\n\n\tget: ReturnType['get'] = (placeholderValues) => {\n\t\treturn this._prepare().get(placeholderValues);\n\t};\n\n\tvalues: ReturnType['values'] = (placeholderValues) => {\n\t\treturn this._prepare().values(placeholderValues);\n\t};\n\n\toverride async execute(): Promise> {\n\t\treturn (this.config.returning ? this.all() : this.run()) as SQLiteUpdateExecute;\n\t}\n\n\t$dynamic(): SQLiteUpdateDynamic {\n\t\treturn this as any;\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport {\n\ttype BuildQueryResult,\n\ttype BuildRelationalQueryResult,\n\ttype DBQueryConfig,\n\tmapRelationalRow,\n\ttype TableRelationalConfig,\n\ttype TablesRelationalConfig,\n} from '~/relations.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, QueryWithTypings, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { KnownKeysOnly } from '~/utils.ts';\nimport type { SQLiteDialect } from '../dialect.ts';\nimport type { PreparedQueryConfig, SQLitePreparedQuery, SQLiteSession } from '../session.ts';\nimport type { SQLiteTable } from '../table.ts';\n\nexport type SQLiteRelationalQueryKind = TMode extends 'async'\n\t? SQLiteRelationalQuery\n\t: SQLiteSyncRelationalQuery;\n\nexport class RelationalQueryBuilder<\n\tTMode extends 'sync' | 'async',\n\tTFullSchema extends Record,\n\tTSchema extends TablesRelationalConfig,\n\tTFields extends TableRelationalConfig,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteAsyncRelationalQueryBuilder';\n\n\tconstructor(\n\t\tprotected mode: TMode,\n\t\tprotected fullSchema: Record,\n\t\tprotected schema: TSchema,\n\t\tprotected tableNamesMap: Record,\n\t\tprotected table: SQLiteTable,\n\t\tprotected tableConfig: TableRelationalConfig,\n\t\tprotected dialect: SQLiteDialect,\n\t\tprotected session: SQLiteSession<'async', unknown, TFullSchema, TSchema>,\n\t) {}\n\n\tfindMany>(\n\t\tconfig?: KnownKeysOnly>,\n\t): SQLiteRelationalQueryKind[]> {\n\t\treturn (this.mode === 'sync'\n\t\t\t? new SQLiteSyncRelationalQuery(\n\t\t\t\tthis.fullSchema,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.tableNamesMap,\n\t\t\t\tthis.table,\n\t\t\t\tthis.tableConfig,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.session,\n\t\t\t\tconfig ? (config as DBQueryConfig<'many', true>) : {},\n\t\t\t\t'many',\n\t\t\t)\n\t\t\t: new SQLiteRelationalQuery(\n\t\t\t\tthis.fullSchema,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.tableNamesMap,\n\t\t\t\tthis.table,\n\t\t\t\tthis.tableConfig,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.session,\n\t\t\t\tconfig ? (config as DBQueryConfig<'many', true>) : {},\n\t\t\t\t'many',\n\t\t\t)) as SQLiteRelationalQueryKind[]>;\n\t}\n\n\tfindFirst, 'limit'>>(\n\t\tconfig?: KnownKeysOnly, 'limit'>>,\n\t): SQLiteRelationalQueryKind | undefined> {\n\t\treturn (this.mode === 'sync'\n\t\t\t? new SQLiteSyncRelationalQuery(\n\t\t\t\tthis.fullSchema,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.tableNamesMap,\n\t\t\t\tthis.table,\n\t\t\t\tthis.tableConfig,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.session,\n\t\t\t\tconfig ? { ...(config as DBQueryConfig<'many', true> | undefined), limit: 1 } : { limit: 1 },\n\t\t\t\t'first',\n\t\t\t)\n\t\t\t: new SQLiteRelationalQuery(\n\t\t\t\tthis.fullSchema,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.tableNamesMap,\n\t\t\t\tthis.table,\n\t\t\t\tthis.tableConfig,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.session,\n\t\t\t\tconfig ? { ...(config as DBQueryConfig<'many', true> | undefined), limit: 1 } : { limit: 1 },\n\t\t\t\t'first',\n\t\t\t)) as SQLiteRelationalQueryKind | undefined>;\n\t}\n}\n\nexport class SQLiteRelationalQuery extends QueryPromise\n\timplements RunnableQuery, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteAsyncRelationalQuery';\n\n\tdeclare readonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly type: TType;\n\t\treadonly result: TResult;\n\t};\n\n\t/** @internal */\n\tmode: 'many' | 'first';\n\n\tconstructor(\n\t\tprivate fullSchema: Record,\n\t\tprivate schema: TablesRelationalConfig,\n\t\tprivate tableNamesMap: Record,\n\t\tprivate table: SQLiteTable,\n\t\tprivate tableConfig: TableRelationalConfig,\n\t\tprivate dialect: SQLiteDialect,\n\t\tprivate session: SQLiteSession<'sync' | 'async', unknown, Record, TablesRelationalConfig>,\n\t\tprivate config: DBQueryConfig<'many', true> | true,\n\t\tmode: 'many' | 'first',\n\t) {\n\t\tsuper();\n\t\tthis.mode = mode;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildRelationalQuery({\n\t\t\tfullSchema: this.fullSchema,\n\t\t\tschema: this.schema,\n\t\t\ttableNamesMap: this.tableNamesMap,\n\t\t\ttable: this.table,\n\t\t\ttableConfig: this.tableConfig,\n\t\t\tqueryConfig: this.config,\n\t\t\ttableAlias: this.tableConfig.tsName,\n\t\t}).sql as SQL;\n\t}\n\n\t/** @internal */\n\t_prepare(\n\t\tisOneTimeQuery = false,\n\t): SQLitePreparedQuery {\n\t\tconst { query, builtQuery } = this._toSQL();\n\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tbuiltQuery,\n\t\t\tundefined,\n\t\t\tthis.mode === 'first' ? 'get' : 'all',\n\t\t\t(rawRows, mapColumnValue) => {\n\t\t\t\tconst rows = rawRows.map((row) =>\n\t\t\t\t\tmapRelationalRow(this.schema, this.tableConfig, row, query.selection, mapColumnValue)\n\t\t\t\t);\n\t\t\t\tif (this.mode === 'first') {\n\t\t\t\t\treturn rows[0] as TResult;\n\t\t\t\t}\n\t\t\t\treturn rows as TResult;\n\t\t\t},\n\t\t) as SQLitePreparedQuery;\n\t}\n\n\tprepare(): SQLitePreparedQuery {\n\t\treturn this._prepare(false);\n\t}\n\n\tprivate _toSQL(): { query: BuildRelationalQueryResult; builtQuery: QueryWithTypings } {\n\t\tconst query = this.dialect.buildRelationalQuery({\n\t\t\tfullSchema: this.fullSchema,\n\t\t\tschema: this.schema,\n\t\t\ttableNamesMap: this.tableNamesMap,\n\t\t\ttable: this.table,\n\t\t\ttableConfig: this.tableConfig,\n\t\t\tqueryConfig: this.config,\n\t\t\ttableAlias: this.tableConfig.tsName,\n\t\t});\n\n\t\tconst builtQuery = this.dialect.sqlToQuery(query.sql as SQL);\n\n\t\treturn { query, builtQuery };\n\t}\n\n\ttoSQL(): Query {\n\t\treturn this._toSQL().builtQuery;\n\t}\n\n\t/** @internal */\n\texecuteRaw(): TResult {\n\t\tif (this.mode === 'first') {\n\t\t\treturn this._prepare(false).get() as TResult;\n\t\t}\n\t\treturn this._prepare(false).all() as TResult;\n\t}\n\n\toverride async execute(): Promise {\n\t\treturn this.executeRaw();\n\t}\n}\n\nexport class SQLiteSyncRelationalQuery extends SQLiteRelationalQuery<'sync', TResult> {\n\tstatic readonly [entityKind]: string = 'SQLiteSyncRelationalQuery';\n\n\tsync(): TResult {\n\t\treturn this.executeRaw();\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { SQL, SQLWrapper } from '~/index.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { PreparedQuery } from '~/session.ts';\nimport type { SQLiteAsyncDialect } from '../dialect.ts';\n\ntype SQLiteRawAction = 'all' | 'get' | 'values' | 'run';\nexport interface SQLiteRawConfig {\n\taction: SQLiteRawAction;\n}\n\nexport interface SQLiteRaw\n\textends QueryPromise, RunnableQuery, SQLWrapper, PreparedQuery\n{}\n\nexport class SQLiteRaw extends QueryPromise\n\timplements RunnableQuery, SQLWrapper, PreparedQuery\n{\n\tstatic readonly [entityKind]: string = 'SQLiteRaw';\n\n\tdeclare readonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly result: TResult;\n\t};\n\n\t/** @internal */\n\tconfig: SQLiteRawConfig;\n\n\tconstructor(\n\t\tpublic execute: () => Promise,\n\t\t/** @internal */\n\t\tpublic getSQL: () => SQL,\n\t\taction: SQLiteRawAction,\n\t\tprivate dialect: SQLiteAsyncDialect,\n\t\tprivate mapBatchResult: (result: unknown) => unknown,\n\t) {\n\t\tsuper();\n\t\tthis.config = { action };\n\t}\n\n\tgetQuery() {\n\t\treturn { ...this.dialect.sqlToQuery(this.getSQL()), method: this.config.action };\n\t}\n\n\tmapResult(result: unknown, isFromBatch?: boolean) {\n\t\treturn isFromBatch ? this.mapBatchResult(result) : result;\n\t}\n\n\t_prepare(): PreparedQuery {\n\t\treturn this;\n\t}\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport type { ColumnsSelection, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteAsyncDialect, SQLiteSyncDialect } from '~/sqlite-core/dialect.ts';\nimport {\n\tQueryBuilder,\n\tSQLiteDeleteBase,\n\tSQLiteInsertBuilder,\n\tSQLiteSelectBuilder,\n\tSQLiteUpdateBuilder,\n} from '~/sqlite-core/query-builders/index.ts';\nimport type {\n\tDBResult,\n\tResult,\n\tSQLiteSession,\n\tSQLiteTransaction,\n\tSQLiteTransactionConfig,\n} from '~/sqlite-core/session.ts';\nimport type { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { DrizzleTypeError } from '~/utils.ts';\nimport { RelationalQueryBuilder } from './query-builders/query.ts';\nimport { SQLiteRaw } from './query-builders/raw.ts';\nimport type { SelectedFields } from './query-builders/select.types.ts';\nimport type { WithSubqueryWithSelection } from './subquery.ts';\n\nexport class BaseSQLiteDatabase<\n\tTResultKind extends 'sync' | 'async',\n\tTRunResult,\n\tTFullSchema extends Record = Record,\n\tTSchema extends TablesRelationalConfig = ExtractTablesWithRelations,\n> {\n\tstatic readonly [entityKind]: string = 'BaseSQLiteDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly schema: TSchema | undefined;\n\t\treadonly tableNamesMap: Record;\n\t};\n\n\tquery: TFullSchema extends Record\n\t\t? DrizzleTypeError<'Seems like the schema generic is missing - did you forget to add it to your DB type?'>\n\t\t: {\n\t\t\t[K in keyof TSchema]: RelationalQueryBuilder;\n\t\t};\n\n\tconstructor(\n\t\tprivate resultKind: TResultKind,\n\t\t/** @internal */\n\t\treadonly dialect: { sync: SQLiteSyncDialect; async: SQLiteAsyncDialect }[TResultKind],\n\t\t/** @internal */\n\t\treadonly session: SQLiteSession,\n\t\tschema: RelationalSchemaConfig | undefined,\n\t) {\n\t\tthis._ = schema\n\t\t\t? { schema: schema.schema, tableNamesMap: schema.tableNamesMap }\n\t\t\t: { schema: undefined, tableNamesMap: {} };\n\t\tthis.query = {} as typeof this['query'];\n\t\tconst query = this.query as {\n\t\t\t[K in keyof TSchema]: RelationalQueryBuilder;\n\t\t};\n\t\tif (this._.schema) {\n\t\t\tfor (const [tableName, columns] of Object.entries(this._.schema)) {\n\t\t\t\tquery[tableName as keyof TSchema] = new RelationalQueryBuilder(\n\t\t\t\t\tresultKind,\n\t\t\t\t\tschema!.fullSchema,\n\t\t\t\t\tthis._.schema,\n\t\t\t\t\tthis._.tableNamesMap,\n\t\t\t\t\tschema!.fullSchema[tableName] as SQLiteTable,\n\t\t\t\t\tcolumns,\n\t\t\t\t\tdialect,\n\t\t\t\t\tsession as SQLiteSession as any,\n\t\t\t\t) as typeof query[keyof TSchema];\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = await db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with(alias: TAlias) {\n\t\treturn {\n\t\t\tas(\n\t\t\t\tqb: TypedQueryBuilder | ((qb: QueryBuilder) => TypedQueryBuilder),\n\t\t\t): WithSubqueryWithSelection {\n\t\t\t\tif (typeof qb === 'function') {\n\t\t\t\t\tqb = qb(new QueryBuilder());\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tnew WithSubquery(qb.getSQL(), qb.getSelectedFields() as SelectedFields, alias, true),\n\t\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t\t) as WithSubqueryWithSelection;\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = await db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): SQLiteSelectBuilder;\n\t\tfunction select(\n\t\t\tfields: TSelection,\n\t\t): SQLiteSelectBuilder;\n\t\tfunction select(\n\t\t\tfields?: SelectedFields,\n\t\t): SQLiteSelectBuilder {\n\t\t\treturn new SQLiteSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * await db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * await db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): SQLiteSelectBuilder;\n\t\tfunction selectDistinct(\n\t\t\tfields: TSelection,\n\t\t): SQLiteSelectBuilder;\n\t\tfunction selectDistinct(\n\t\t\tfields?: SelectedFields,\n\t\t): SQLiteSelectBuilder {\n\t\t\treturn new SQLiteSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * await db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t *\n\t\t * // Update with returning clause\n\t\t * const updatedCar: Car[] = await db.update(cars)\n\t\t * .set({ color: 'red' })\n\t\t * .where(eq(cars.id, 1))\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction update(table: TTable): SQLiteUpdateBuilder {\n\t\t\treturn new SQLiteUpdateBuilder(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\t/**\n\t\t * Creates an insert query.\n\t\t *\n\t\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t\t *\n\t\t * @param table The table to insert into.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Insert one row\n\t\t * await db.insert(cars).values({ brand: 'BMW' });\n\t\t *\n\t\t * // Insert multiple rows\n\t\t * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t\t *\n\t\t * // Insert with returning clause\n\t\t * const insertedCar: Car[] = await db.insert(cars)\n\t\t * .values({ brand: 'BMW' })\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction insert(into: TTable): SQLiteInsertBuilder {\n\t\t\treturn new SQLiteInsertBuilder(into, self.session, self.dialect, queries);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * await db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t\t *\n\t\t * // Delete with returning clause\n\t\t * const deletedCar: Car[] = await db.delete(cars)\n\t\t * .where(eq(cars.id, 1))\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction delete_(from: TTable): SQLiteDeleteBase {\n\t\t\treturn new SQLiteDeleteBase(from, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, update, insert, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = await db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): SQLiteSelectBuilder;\n\tselect(\n\t\tfields: TSelection,\n\t): SQLiteSelectBuilder;\n\tselect(fields?: SelectedFields): SQLiteSelectBuilder {\n\t\treturn new SQLiteSelectBuilder({ fields: fields ?? undefined, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * await db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * await db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): SQLiteSelectBuilder;\n\tselectDistinct(\n\t\tfields: TSelection,\n\t): SQLiteSelectBuilder;\n\tselectDistinct(\n\t\tfields?: SelectedFields,\n\t): SQLiteSelectBuilder {\n\t\treturn new SQLiteSelectBuilder({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * await db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t *\n\t * // Update with returning clause\n\t * const updatedCar: Car[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.id, 1))\n\t * .returning();\n\t * ```\n\t */\n\tupdate(table: TTable): SQLiteUpdateBuilder {\n\t\treturn new SQLiteUpdateBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * await db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t *\n\t * // Insert with returning clause\n\t * const insertedCar: Car[] = await db.insert(cars)\n\t * .values({ brand: 'BMW' })\n\t * .returning();\n\t * ```\n\t */\n\tinsert(into: TTable): SQLiteInsertBuilder {\n\t\treturn new SQLiteInsertBuilder(into, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * await db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t *\n\t * // Delete with returning clause\n\t * const deletedCar: Car[] = await db.delete(cars)\n\t * .where(eq(cars.id, 1))\n\t * .returning();\n\t * ```\n\t */\n\tdelete(from: TTable): SQLiteDeleteBase {\n\t\treturn new SQLiteDeleteBase(from, this.session, this.dialect);\n\t}\n\n\trun(query: SQLWrapper): DBResult {\n\t\tconst sql = query.getSQL();\n\t\tif (this.resultKind === 'async') {\n\t\t\treturn new SQLiteRaw(\n\t\t\t\tasync () => this.session.run(sql),\n\t\t\t\t() => sql,\n\t\t\t\t'run',\n\t\t\t\tthis.dialect as SQLiteAsyncDialect,\n\t\t\t\tthis.session.extractRawRunValueFromBatchResult.bind(this.session),\n\t\t\t) as DBResult;\n\t\t}\n\t\treturn this.session.run(sql) as DBResult;\n\t}\n\n\tall(query: SQLWrapper): DBResult {\n\t\tconst sql = query.getSQL();\n\t\tif (this.resultKind === 'async') {\n\t\t\treturn new SQLiteRaw(\n\t\t\t\tasync () => this.session.all(sql),\n\t\t\t\t() => sql,\n\t\t\t\t'all',\n\t\t\t\tthis.dialect as SQLiteAsyncDialect,\n\t\t\t\tthis.session.extractRawAllValueFromBatchResult.bind(this.session),\n\t\t\t) as any;\n\t\t}\n\t\treturn this.session.all(sql) as DBResult;\n\t}\n\n\tget(query: SQLWrapper): DBResult {\n\t\tconst sql = query.getSQL();\n\t\tif (this.resultKind === 'async') {\n\t\t\treturn new SQLiteRaw(\n\t\t\t\tasync () => this.session.get(sql),\n\t\t\t\t() => sql,\n\t\t\t\t'get',\n\t\t\t\tthis.dialect as SQLiteAsyncDialect,\n\t\t\t\tthis.session.extractRawGetValueFromBatchResult.bind(this.session),\n\t\t\t) as DBResult;\n\t\t}\n\t\treturn this.session.get(sql) as DBResult;\n\t}\n\n\tvalues(query: SQLWrapper): DBResult {\n\t\tconst sql = query.getSQL();\n\t\tif (this.resultKind === 'async') {\n\t\t\treturn new SQLiteRaw(\n\t\t\t\tasync () => this.session.values(sql),\n\t\t\t\t() => sql,\n\t\t\t\t'values',\n\t\t\t\tthis.dialect as SQLiteAsyncDialect,\n\t\t\t\tthis.session.extractRawValuesValueFromBatchResult.bind(this.session),\n\t\t\t) as any;\n\t\t}\n\t\treturn this.session.values(sql) as DBResult;\n\t}\n\n\ttransaction(\n\t\ttransaction: (tx: SQLiteTransaction) => Result,\n\t\tconfig?: SQLiteTransactionConfig,\n\t): Result {\n\t\treturn this.session.transaction(transaction, config);\n\t}\n}\n\nexport type SQLiteWithReplicas = Q & { $primary: Q };\n\nexport const withReplicas = <\n\tTResultKind extends 'sync' | 'async',\n\tTRunResult,\n\tTFullSchema extends Record,\n\tTSchema extends TablesRelationalConfig,\n\tQ extends BaseSQLiteDatabase<\n\t\tTResultKind,\n\t\tTRunResult,\n\t\tTFullSchema,\n\t\tTSchema extends Record ? ExtractTablesWithRelations : TSchema\n\t>,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): SQLiteWithReplicas => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst $with: Q['with'] = (...args: []) => getReplica(replicas).with(...args);\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst run: Q['run'] = (...args: [any]) => primary.run(...args);\n\tconst all: Q['all'] = (...args: [any]) => primary.all(...args);\n\tconst get: Q['get'] = (...args: [any]) => primary.get(...args);\n\tconst values: Q['values'] = (...args: [any]) => primary.values(...args);\n\tconst transaction: Q['transaction'] = (...args: [any]) => primary.transaction(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\trun,\n\t\tall,\n\t\tget,\n\t\tvalues,\n\t\ttransaction,\n\t\t$primary: primary,\n\t\tselect,\n\t\tselectDistinct,\n\t\twith: $with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas).query;\n\t\t},\n\t};\n};\n", "import { entityKind } from '~/entity.ts';\nimport { DrizzleError, TransactionRollbackError } from '~/errors.ts';\nimport type { TablesRelationalConfig } from '~/relations.ts';\nimport type { PreparedQuery } from '~/session.ts';\nimport type { Query, SQL } from '~/sql/sql.ts';\nimport type { SQLiteAsyncDialect, SQLiteSyncDialect } from '~/sqlite-core/dialect.ts';\nimport { QueryPromise } from '../index.ts';\nimport { BaseSQLiteDatabase } from './db.ts';\nimport type { SQLiteRaw } from './query-builders/raw.ts';\nimport type { SelectedFieldsOrdered } from './query-builders/select.types.ts';\n\nexport interface PreparedQueryConfig {\n\ttype: 'sync' | 'async';\n\trun: unknown;\n\tall: unknown;\n\tget: unknown;\n\tvalues: unknown;\n\texecute: unknown;\n}\n\nexport class ExecuteResultSync extends QueryPromise {\n\tstatic readonly [entityKind]: string = 'ExecuteResultSync';\n\n\tconstructor(private resultCb: () => T) {\n\t\tsuper();\n\t}\n\n\toverride async execute(): Promise {\n\t\treturn this.resultCb();\n\t}\n\n\tsync(): T {\n\t\treturn this.resultCb();\n\t}\n}\n\nexport type ExecuteResult = TType extends 'async' ? Promise\n\t: ExecuteResultSync;\n\nexport abstract class SQLitePreparedQuery implements PreparedQuery {\n\tstatic readonly [entityKind]: string = 'PreparedQuery';\n\n\t/** @internal */\n\tjoinsNotNullableMap?: Record;\n\n\tconstructor(\n\t\tprivate mode: 'sync' | 'async',\n\t\tprivate executeMethod: SQLiteExecuteMethod,\n\t\tprotected query: Query,\n\t) {}\n\n\tgetQuery(): Query {\n\t\treturn this.query;\n\t}\n\n\tabstract run(placeholderValues?: Record): Result;\n\n\tmapRunResult(result: unknown, _isFromBatch?: boolean): unknown {\n\t\treturn result;\n\t}\n\n\tabstract all(placeholderValues?: Record): Result;\n\n\tmapAllResult(_result: unknown, _isFromBatch?: boolean): unknown {\n\t\tthrow new Error('Not implemented');\n\t}\n\n\tabstract get(placeholderValues?: Record): Result;\n\n\tmapGetResult(_result: unknown, _isFromBatch?: boolean): unknown {\n\t\tthrow new Error('Not implemented');\n\t}\n\n\tabstract values(placeholderValues?: Record): Result;\n\n\texecute(placeholderValues?: Record): ExecuteResult {\n\t\tif (this.mode === 'async') {\n\t\t\treturn this[this.executeMethod](placeholderValues) as ExecuteResult;\n\t\t}\n\t\treturn new ExecuteResultSync(() => this[this.executeMethod](placeholderValues));\n\t}\n\n\tmapResult(response: unknown, isFromBatch?: boolean) {\n\t\tswitch (this.executeMethod) {\n\t\t\tcase 'run': {\n\t\t\t\treturn this.mapRunResult(response, isFromBatch);\n\t\t\t}\n\t\t\tcase 'all': {\n\t\t\t\treturn this.mapAllResult(response, isFromBatch);\n\t\t\t}\n\t\t\tcase 'get': {\n\t\t\t\treturn this.mapGetResult(response, isFromBatch);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface SQLiteTransactionConfig {\n\tbehavior?: 'deferred' | 'immediate' | 'exclusive';\n}\n\nexport type SQLiteExecuteMethod = 'run' | 'all' | 'get';\n\nexport abstract class SQLiteSession<\n\tTResultKind extends 'sync' | 'async',\n\tTRunResult,\n\tTFullSchema extends Record,\n\tTSchema extends TablesRelationalConfig,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteSession';\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: { sync: SQLiteSyncDialect; async: SQLiteAsyncDialect }[TResultKind],\n\t) {}\n\n\tabstract prepareQuery(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\texecuteMethod: SQLiteExecuteMethod,\n\t\tcustomResultMapper?: (rows: unknown[][], mapColumnValue?: (value: unknown) => unknown) => unknown,\n\t): SQLitePreparedQuery;\n\n\tprepareOneTimeQuery(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\texecuteMethod: SQLiteExecuteMethod,\n\t): SQLitePreparedQuery {\n\t\treturn this.prepareQuery(query, fields, executeMethod);\n\t}\n\n\tabstract transaction(\n\t\ttransaction: (tx: SQLiteTransaction) => Result,\n\t\tconfig?: SQLiteTransactionConfig,\n\t): Result;\n\n\trun(query: SQL): Result {\n\t\tconst staticQuery = this.dialect.sqlToQuery(query);\n\t\ttry {\n\t\t\treturn this.prepareOneTimeQuery(staticQuery, undefined, 'run').run() as Result;\n\t\t} catch (err) {\n\t\t\tthrow new DrizzleError({ cause: err, message: `Failed to run the query '${staticQuery.sql}'` });\n\t\t}\n\t}\n\n\t/** @internal */\n\textractRawRunValueFromBatchResult(result: unknown) {\n\t\treturn result;\n\t}\n\n\tall(query: SQL): Result {\n\t\treturn this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, 'run').all() as Result;\n\t}\n\n\t/** @internal */\n\textractRawAllValueFromBatchResult(_result: unknown): unknown {\n\t\tthrow new Error('Not implemented');\n\t}\n\n\tget(query: SQL): Result {\n\t\treturn this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, 'run').get() as Result;\n\t}\n\n\t/** @internal */\n\textractRawGetValueFromBatchResult(_result: unknown): unknown {\n\t\tthrow new Error('Not implemented');\n\t}\n\n\tvalues(\n\t\tquery: SQL,\n\t): Result {\n\t\treturn this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, 'run').values() as Result<\n\t\t\tTResultKind,\n\t\t\tT[]\n\t\t>;\n\t}\n\n\t/** @internal */\n\textractRawValuesValueFromBatchResult(_result: unknown): unknown {\n\t\tthrow new Error('Not implemented');\n\t}\n}\n\nexport type Result = { sync: TResult; async: Promise }[TKind];\n\nexport type DBResult = { sync: TResult; async: SQLiteRaw }[TKind];\n\nexport abstract class SQLiteTransaction<\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n\tTFullSchema extends Record,\n\tTSchema extends TablesRelationalConfig,\n> extends BaseSQLiteDatabase {\n\tstatic readonly [entityKind]: string = 'SQLiteTransaction';\n\n\tconstructor(\n\t\tresultType: TResultType,\n\t\tdialect: { sync: SQLiteSyncDialect; async: SQLiteAsyncDialect }[TResultType],\n\t\tsession: SQLiteSession,\n\t\tprotected schema: {\n\t\t\tfullSchema: Record;\n\t\t\tschema: TSchema;\n\t\t\ttableNamesMap: Record;\n\t\t} | undefined,\n\t\tprotected readonly nestedIndex = 0,\n\t) {\n\t\tsuper(resultType, dialect, session, schema);\n\t}\n\n\trollback(): never {\n\t\tthrow new TransactionRollbackError();\n\t}\n}\n", "import type { BuildColumns } from '~/column-builder.ts';\nimport { entityKind } from '~/entity.ts';\nimport { Table, type TableConfig as TableConfigBase, type UpdateTableConfig } from '~/table.ts';\nimport type { CheckBuilder } from './checks.ts';\nimport type { MySqlColumn, MySqlColumnBuilder, MySqlColumnBuilderBase } from './columns/common.ts';\nimport type { ForeignKey, ForeignKeyBuilder } from './foreign-keys.ts';\nimport type { AnyIndexBuilder } from './indexes.ts';\nimport type { PrimaryKeyBuilder } from './primary-keys.ts';\nimport type { UniqueConstraintBuilder } from './unique-constraint.ts';\n\nexport type MySqlTableExtraConfig = Record<\n\tstring,\n\t| AnyIndexBuilder\n\t| CheckBuilder\n\t| ForeignKeyBuilder\n\t| PrimaryKeyBuilder\n\t| UniqueConstraintBuilder\n>;\n\nexport type TableConfig = TableConfigBase;\n\n/** @internal */\nexport const InlineForeignKeys = Symbol.for('drizzle:MySqlInlineForeignKeys');\n\nexport class MySqlTable extends Table {\n\tstatic readonly [entityKind]: string = 'MySqlTable';\n\n\tdeclare protected $columns: T['columns'];\n\n\t/** @internal */\n\tstatic override readonly Symbol = Object.assign({}, Table.Symbol, {\n\t\tInlineForeignKeys: InlineForeignKeys as typeof InlineForeignKeys,\n\t});\n\n\t/** @internal */\n\toverride [Table.Symbol.Columns]!: NonNullable;\n\n\t/** @internal */\n\t[InlineForeignKeys]: ForeignKey[] = [];\n\n\t/** @internal */\n\toverride [Table.Symbol.ExtraConfigBuilder]:\n\t\t| ((self: Record) => MySqlTableExtraConfig)\n\t\t| undefined = undefined;\n}\n\nexport type AnyMySqlTable = {}> = MySqlTable<\n\tUpdateTableConfig\n>;\n\nexport type MySqlTableWithColumns =\n\t& MySqlTable\n\t& {\n\t\t[Key in keyof T['columns']]: T['columns'][Key];\n\t};\n\nexport function mysqlTableWithSchema<\n\tTTableName extends string,\n\tTSchemaName extends string | undefined,\n\tTColumnsMap extends Record,\n>(\n\tname: TTableName,\n\tcolumns: TColumnsMap,\n\textraConfig: ((self: BuildColumns) => MySqlTableExtraConfig) | undefined,\n\tschema: TSchemaName,\n\tbaseName = name,\n): MySqlTableWithColumns<{\n\tname: TTableName;\n\tschema: TSchemaName;\n\tcolumns: BuildColumns;\n\tdialect: 'mysql';\n}> {\n\tconst rawTable = new MySqlTable<{\n\t\tname: TTableName;\n\t\tschema: TSchemaName;\n\t\tcolumns: BuildColumns;\n\t\tdialect: 'mysql';\n\t}>(name, schema, baseName);\n\n\tconst builtColumns = Object.fromEntries(\n\t\tObject.entries(columns).map(([name, colBuilderBase]) => {\n\t\t\tconst colBuilder = colBuilderBase as MySqlColumnBuilder;\n\t\t\tconst column = colBuilder.build(rawTable);\n\t\t\trawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));\n\t\t\treturn [name, column];\n\t\t}),\n\t) as unknown as BuildColumns;\n\n\tconst table = Object.assign(rawTable, builtColumns);\n\n\ttable[Table.Symbol.Columns] = builtColumns;\n\n\tif (extraConfig) {\n\t\ttable[MySqlTable.Symbol.ExtraConfigBuilder] = extraConfig as unknown as (\n\t\t\tself: Record,\n\t\t) => MySqlTableExtraConfig;\n\t}\n\n\treturn table;\n}\n\nexport interface MySqlTableFn {\n\t<\n\t\tTTableName extends string,\n\t\tTColumnsMap extends Record,\n\t>(\n\t\tname: TTableName,\n\t\tcolumns: TColumnsMap,\n\t\textraConfig?: (self: BuildColumns) => MySqlTableExtraConfig,\n\t): MySqlTableWithColumns<{\n\t\tname: TTableName;\n\t\tschema: TSchemaName;\n\t\tcolumns: BuildColumns;\n\t\tdialect: 'mysql';\n\t}>;\n}\n\nexport const mysqlTable: MySqlTableFn = (name, columns, extraConfig) => {\n\treturn mysqlTableWithSchema(name, columns, extraConfig, undefined, name);\n};\n\nexport function mysqlTableCreator(customizeTableName: (name: string) => string): MySqlTableFn {\n\treturn (name, columns, extraConfig) => {\n\t\treturn mysqlTableWithSchema(customizeTableName(name) as typeof name, columns, extraConfig, undefined, name);\n\t};\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { AnyMySqlColumn, MySqlColumn } from './columns/index.ts';\nimport { MySqlTable } from './table.ts';\n\nexport type UpdateDeleteAction = 'cascade' | 'restrict' | 'no action' | 'set null' | 'set default';\n\nexport type Reference = () => {\n\treadonly name?: string;\n\treadonly columns: MySqlColumn[];\n\treadonly foreignTable: MySqlTable;\n\treadonly foreignColumns: MySqlColumn[];\n};\n\nexport class ForeignKeyBuilder {\n\tstatic readonly [entityKind]: string = 'MySqlForeignKeyBuilder';\n\n\t/** @internal */\n\treference: Reference;\n\n\t/** @internal */\n\t_onUpdate: UpdateDeleteAction | undefined;\n\n\t/** @internal */\n\t_onDelete: UpdateDeleteAction | undefined;\n\n\tconstructor(\n\t\tconfig: () => {\n\t\t\tname?: string;\n\t\t\tcolumns: MySqlColumn[];\n\t\t\tforeignColumns: MySqlColumn[];\n\t\t},\n\t\tactions?: {\n\t\t\tonUpdate?: UpdateDeleteAction;\n\t\t\tonDelete?: UpdateDeleteAction;\n\t\t} | undefined,\n\t) {\n\t\tthis.reference = () => {\n\t\t\tconst { name, columns, foreignColumns } = config();\n\t\t\treturn { name, columns, foreignTable: foreignColumns[0]!.table as MySqlTable, foreignColumns };\n\t\t};\n\t\tif (actions) {\n\t\t\tthis._onUpdate = actions.onUpdate;\n\t\t\tthis._onDelete = actions.onDelete;\n\t\t}\n\t}\n\n\tonUpdate(action: UpdateDeleteAction): this {\n\t\tthis._onUpdate = action;\n\t\treturn this;\n\t}\n\n\tonDelete(action: UpdateDeleteAction): this {\n\t\tthis._onDelete = action;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuild(table: MySqlTable): ForeignKey {\n\t\treturn new ForeignKey(table, this);\n\t}\n}\n\nexport type AnyForeignKeyBuilder = ForeignKeyBuilder;\n\nexport class ForeignKey {\n\tstatic readonly [entityKind]: string = 'MySqlForeignKey';\n\n\treadonly reference: Reference;\n\treadonly onUpdate: UpdateDeleteAction | undefined;\n\treadonly onDelete: UpdateDeleteAction | undefined;\n\n\tconstructor(readonly table: MySqlTable, builder: ForeignKeyBuilder) {\n\t\tthis.reference = builder.reference;\n\t\tthis.onUpdate = builder._onUpdate;\n\t\tthis.onDelete = builder._onDelete;\n\t}\n\n\tgetName(): string {\n\t\tconst { name, columns, foreignColumns } = this.reference();\n\t\tconst columnNames = columns.map((column) => column.name);\n\t\tconst foreignColumnNames = foreignColumns.map((column) => column.name);\n\t\tconst chunks = [\n\t\t\tthis.table[MySqlTable.Symbol.Name],\n\t\t\t...columnNames,\n\t\t\tforeignColumns[0]!.table[MySqlTable.Symbol.Name],\n\t\t\t...foreignColumnNames,\n\t\t];\n\t\treturn name ?? `${chunks.join('_')}_fk`;\n\t}\n}\n\ntype ColumnsWithTable<\n\tTTableName extends string,\n\tTColumns extends MySqlColumn[],\n> = { [Key in keyof TColumns]: AnyMySqlColumn<{ tableName: TTableName }> };\n\nexport type GetColumnsTable = (\n\tTColumns extends MySqlColumn ? TColumns\n\t\t: TColumns extends MySqlColumn[] ? TColumns[number]\n\t\t: never\n) extends AnyMySqlColumn<{ tableName: infer TTableName extends string }> ? TTableName\n\t: never;\n\nexport function foreignKey<\n\tTTableName extends string,\n\tTForeignTableName extends string,\n\tTColumns extends [AnyMySqlColumn<{ tableName: TTableName }>, ...AnyMySqlColumn<{ tableName: TTableName }>[]],\n>(\n\tconfig: {\n\t\tname?: string;\n\t\tcolumns: TColumns;\n\t\tforeignColumns: ColumnsWithTable;\n\t},\n): ForeignKeyBuilder {\n\tfunction mappedConfig() {\n\t\tconst { name, columns, foreignColumns } = config;\n\t\treturn {\n\t\t\tname,\n\t\t\tcolumns,\n\t\t\tforeignColumns,\n\t\t};\n\t}\n\n\treturn new ForeignKeyBuilder(mappedConfig);\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { MySqlColumn } from './columns/index.ts';\nimport { MySqlTable } from './table.ts';\n\nexport function unique(name?: string): UniqueOnConstraintBuilder {\n\treturn new UniqueOnConstraintBuilder(name);\n}\n\nexport function uniqueKeyName(table: MySqlTable, columns: string[]) {\n\treturn `${table[MySqlTable.Symbol.Name]}_${columns.join('_')}_unique`;\n}\n\nexport class UniqueConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'MySqlUniqueConstraintBuilder';\n\n\t/** @internal */\n\tcolumns: MySqlColumn[];\n\n\tconstructor(\n\t\tcolumns: MySqlColumn[],\n\t\tprivate name?: string,\n\t) {\n\t\tthis.columns = columns;\n\t}\n\n\t/** @internal */\n\tbuild(table: MySqlTable): UniqueConstraint {\n\t\treturn new UniqueConstraint(table, this.columns, this.name);\n\t}\n}\n\nexport class UniqueOnConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'MySqlUniqueOnConstraintBuilder';\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tname?: string,\n\t) {\n\t\tthis.name = name;\n\t}\n\n\ton(...columns: [MySqlColumn, ...MySqlColumn[]]) {\n\t\treturn new UniqueConstraintBuilder(columns, this.name);\n\t}\n}\n\nexport class UniqueConstraint {\n\tstatic readonly [entityKind]: string = 'MySqlUniqueConstraint';\n\n\treadonly columns: MySqlColumn[];\n\treadonly name?: string;\n\treadonly nullsNotDistinct: boolean = false;\n\n\tconstructor(readonly table: MySqlTable, columns: MySqlColumn[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));\n\t}\n\n\tgetName() {\n\t\treturn this.name;\n\t}\n}\n", "import { ColumnBuilder } from '~/column-builder.ts';\nimport type {\n\tColumnBuilderBase,\n\tColumnBuilderBaseConfig,\n\tColumnBuilderExtraConfig,\n\tColumnBuilderRuntimeConfig,\n\tColumnDataType,\n\tHasDefault,\n\tMakeColumnConfig,\n} from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { Column } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { ForeignKey, UpdateDeleteAction } from '~/mysql-core/foreign-keys.ts';\nimport { ForeignKeyBuilder } from '~/mysql-core/foreign-keys.ts';\nimport type { AnyMySqlTable, MySqlTable } from '~/mysql-core/table.ts';\nimport type { Update } from '~/utils.ts';\nimport { uniqueKeyName } from '../unique-constraint.ts';\n\nexport interface ReferenceConfig {\n\tref: () => MySqlColumn;\n\tactions: {\n\t\tonUpdate?: UpdateDeleteAction;\n\t\tonDelete?: UpdateDeleteAction;\n\t};\n}\n\nexport interface MySqlColumnBuilderBase<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTTypeConfig extends object = object,\n> extends ColumnBuilderBase {}\n\nexport abstract class MySqlColumnBuilder<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig & {\n\t\tdata: any;\n\t},\n\tTRuntimeConfig extends object = object,\n\tTTypeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig,\n> extends ColumnBuilder\n\timplements MySqlColumnBuilderBase\n{\n\tstatic readonly [entityKind]: string = 'MySqlColumnBuilder';\n\n\tprivate foreignKeyConfigs: ReferenceConfig[] = [];\n\n\treferences(ref: ReferenceConfig['ref'], actions: ReferenceConfig['actions'] = {}): this {\n\t\tthis.foreignKeyConfigs.push({ ref, actions });\n\t\treturn this;\n\t}\n\n\tunique(name?: string): this {\n\t\tthis.config.isUnique = true;\n\t\tthis.config.uniqueName = name;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuildForeignKeys(column: MySqlColumn, table: MySqlTable): ForeignKey[] {\n\t\treturn this.foreignKeyConfigs.map(({ ref, actions }) => {\n\t\t\treturn ((ref, actions) => {\n\t\t\t\tconst builder = new ForeignKeyBuilder(() => {\n\t\t\t\t\tconst foreignColumn = ref();\n\t\t\t\t\treturn { columns: [column], foreignColumns: [foreignColumn] };\n\t\t\t\t});\n\t\t\t\tif (actions.onUpdate) {\n\t\t\t\t\tbuilder.onUpdate(actions.onUpdate);\n\t\t\t\t}\n\t\t\t\tif (actions.onDelete) {\n\t\t\t\t\tbuilder.onDelete(actions.onDelete);\n\t\t\t\t}\n\t\t\t\treturn builder.build(table);\n\t\t\t})(ref, actions);\n\t\t});\n\t}\n\n\t/** @internal */\n\tabstract build(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlColumn>;\n}\n\n// To understand how to use `MySqlColumn` and `AnyMySqlColumn`, see `Column` and `AnyColumn` documentation.\nexport abstract class MySqlColumn<\n\tT extends ColumnBaseConfig = ColumnBaseConfig,\n\tTRuntimeConfig extends object = object,\n> extends Column {\n\tstatic readonly [entityKind]: string = 'MySqlColumn';\n\n\tconstructor(\n\t\toverride readonly table: MySqlTable,\n\t\tconfig: ColumnBuilderRuntimeConfig,\n\t) {\n\t\tif (!config.uniqueName) {\n\t\t\tconfig.uniqueName = uniqueKeyName(table, [config.name]);\n\t\t}\n\t\tsuper(table, config);\n\t}\n}\n\nexport type AnyMySqlColumn> = {}> = MySqlColumn<\n\tRequired, TPartial>>\n>;\n\nexport interface MySqlColumnWithAutoIncrementConfig {\n\tautoIncrement: boolean;\n}\n\nexport abstract class MySqlColumnBuilderWithAutoIncrement<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTRuntimeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig,\n> extends MySqlColumnBuilder {\n\tstatic readonly [entityKind]: string = 'MySqlColumnBuilderWithAutoIncrement';\n\n\tconstructor(name: NonNullable, dataType: T['dataType'], columnType: T['columnType']) {\n\t\tsuper(name, dataType, columnType);\n\t\tthis.config.autoIncrement = false;\n\t}\n\n\tautoincrement(): HasDefault {\n\t\tthis.config.autoIncrement = true;\n\t\tthis.config.hasDefault = true;\n\t\treturn this as HasDefault;\n\t}\n}\n\nexport abstract class MySqlColumnWithAutoIncrement<\n\tT extends ColumnBaseConfig = ColumnBaseConfig,\n\tTRuntimeConfig extends object = object,\n> extends MySqlColumn {\n\tstatic readonly [entityKind]: string = 'MySqlColumnWithAutoIncrement';\n\n\treadonly autoIncrement: boolean = this.config.autoIncrement;\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport type { Writable } from '~/utils.ts';\nimport { MySqlColumn, MySqlColumnBuilder } from './common.ts';\n\nexport type MySqlCharBuilderInitial = MySqlCharBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlChar';\n\tdata: TEnum[number];\n\tdriverParam: number | string;\n\tenumValues: TEnum;\n}>;\n\nexport class MySqlCharBuilder> extends MySqlColumnBuilder<\n\tT,\n\tMySqlCharConfig\n> {\n\tstatic readonly [entityKind]: string = 'MySqlCharBuilder';\n\n\tconstructor(name: T['name'], config: MySqlCharConfig) {\n\t\tsuper(name, 'string', 'MySqlChar');\n\t\tthis.config.length = config.length;\n\t\tthis.config.enum = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlChar & { enumValues: T['enumValues'] }> {\n\t\treturn new MySqlChar & { enumValues: T['enumValues'] }>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class MySqlChar>\n\textends MySqlColumn>\n{\n\tstatic readonly [entityKind]: string = 'MySqlChar';\n\n\treadonly length: number | undefined = this.config.length;\n\toverride readonly enumValues = this.config.enum;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `char` : `char(${this.length})`;\n\t}\n}\n\nexport interface MySqlCharConfig {\n\tlength?: number;\n\tenum?: TEnum;\n}\n\nexport function char>(\n\tname: TName,\n\tconfig: MySqlCharConfig> = {},\n): MySqlCharBuilderInitial> {\n\treturn new MySqlCharBuilder(name, config);\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport { MySqlColumn, MySqlColumnBuilder } from './common.ts';\n\nexport type MySqlVarBinaryBuilderInitial = MySqlVarBinaryBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlVarBinary';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlVarBinaryBuilder>\n\textends MySqlColumnBuilder\n{\n\tstatic readonly [entityKind]: string = 'MySqlVarBinaryBuilder';\n\n\t/** @internal */\n\tconstructor(name: T['name'], config: MySqlVarbinaryOptions) {\n\t\tsuper(name, 'string', 'MySqlVarBinary');\n\t\tthis.config.length = config?.length;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlVarBinary> {\n\t\treturn new MySqlVarBinary>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class MySqlVarBinary<\n\tT extends ColumnBaseConfig<'string', 'MySqlVarBinary'>,\n> extends MySqlColumn {\n\tstatic readonly [entityKind]: string = 'MySqlVarBinary';\n\n\tlength: number | undefined = this.config.length;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `varbinary` : `varbinary(${this.length})`;\n\t}\n}\n\nexport interface MySqlVarbinaryOptions {\n\tlength: number;\n}\n\nexport function varbinary(\n\tname: TName,\n\toptions: MySqlVarbinaryOptions,\n): MySqlVarBinaryBuilderInitial {\n\treturn new MySqlVarBinaryBuilder(name, options);\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport type { Writable } from '~/utils.ts';\nimport { MySqlColumn, MySqlColumnBuilder } from './common.ts';\n\nexport type MySqlVarCharBuilderInitial = MySqlVarCharBuilder<\n\t{\n\t\tname: TName;\n\t\tdataType: 'string';\n\t\tcolumnType: 'MySqlVarChar';\n\t\tdata: TEnum[number];\n\t\tdriverParam: number | string;\n\t\tenumValues: TEnum;\n\t}\n>;\n\nexport class MySqlVarCharBuilder>\n\textends MySqlColumnBuilder>\n{\n\tstatic readonly [entityKind]: string = 'MySqlVarCharBuilder';\n\n\t/** @internal */\n\tconstructor(name: T['name'], config: MySqlVarCharConfig) {\n\t\tsuper(name, 'string', 'MySqlVarChar');\n\t\tthis.config.length = config.length;\n\t\tthis.config.enum = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlVarChar & { enumValues: T['enumValues'] }> {\n\t\treturn new MySqlVarChar & { enumValues: T['enumValues'] }>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t);\n\t}\n}\n\nexport class MySqlVarChar>\n\textends MySqlColumn>\n{\n\tstatic readonly [entityKind]: string = 'MySqlVarChar';\n\n\treadonly length: number | undefined = this.config.length;\n\n\toverride readonly enumValues = this.config.enum;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `varchar` : `varchar(${this.length})`;\n\t}\n}\n\nexport interface MySqlVarCharConfig {\n\tlength: number;\n\tenum?: TEnum;\n}\n\nexport function varchar>(\n\tname: TName,\n\tconfig: MySqlVarCharConfig>,\n): MySqlVarCharBuilderInitial> {\n\treturn new MySqlVarCharBuilder(name, config);\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { AnyPgColumn, PgColumn } from './columns/index.ts';\nimport { PgTable } from './table.ts';\n\nexport type UpdateDeleteAction = 'cascade' | 'restrict' | 'no action' | 'set null' | 'set default';\n\nexport type Reference = () => {\n\treadonly name?: string;\n\treadonly columns: PgColumn[];\n\treadonly foreignTable: PgTable;\n\treadonly foreignColumns: PgColumn[];\n};\n\nexport class ForeignKeyBuilder {\n\tstatic readonly [entityKind]: string = 'PgForeignKeyBuilder';\n\n\t/** @internal */\n\treference: Reference;\n\n\t/** @internal */\n\t_onUpdate: UpdateDeleteAction | undefined = 'no action';\n\n\t/** @internal */\n\t_onDelete: UpdateDeleteAction | undefined = 'no action';\n\n\tconstructor(\n\t\tconfig: () => {\n\t\t\tname?: string;\n\t\t\tcolumns: PgColumn[];\n\t\t\tforeignColumns: PgColumn[];\n\t\t},\n\t\tactions?: {\n\t\t\tonUpdate?: UpdateDeleteAction;\n\t\t\tonDelete?: UpdateDeleteAction;\n\t\t} | undefined,\n\t) {\n\t\tthis.reference = () => {\n\t\t\tconst { name, columns, foreignColumns } = config();\n\t\t\treturn { name, columns, foreignTable: foreignColumns[0]!.table as PgTable, foreignColumns };\n\t\t};\n\t\tif (actions) {\n\t\t\tthis._onUpdate = actions.onUpdate;\n\t\t\tthis._onDelete = actions.onDelete;\n\t\t}\n\t}\n\n\tonUpdate(action: UpdateDeleteAction): this {\n\t\tthis._onUpdate = action === undefined ? 'no action' : action;\n\t\treturn this;\n\t}\n\n\tonDelete(action: UpdateDeleteAction): this {\n\t\tthis._onDelete = action === undefined ? 'no action' : action;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuild(table: PgTable): ForeignKey {\n\t\treturn new ForeignKey(table, this);\n\t}\n}\n\nexport type AnyForeignKeyBuilder = ForeignKeyBuilder;\n\nexport class ForeignKey {\n\tstatic readonly [entityKind]: string = 'PgForeignKey';\n\n\treadonly reference: Reference;\n\treadonly onUpdate: UpdateDeleteAction | undefined;\n\treadonly onDelete: UpdateDeleteAction | undefined;\n\n\tconstructor(readonly table: PgTable, builder: ForeignKeyBuilder) {\n\t\tthis.reference = builder.reference;\n\t\tthis.onUpdate = builder._onUpdate;\n\t\tthis.onDelete = builder._onDelete;\n\t}\n\n\tgetName(): string {\n\t\tconst { name, columns, foreignColumns } = this.reference();\n\t\tconst columnNames = columns.map((column) => column.name);\n\t\tconst foreignColumnNames = foreignColumns.map((column) => column.name);\n\t\tconst chunks = [\n\t\t\tthis.table[PgTable.Symbol.Name],\n\t\t\t...columnNames,\n\t\t\tforeignColumns[0]!.table[PgTable.Symbol.Name],\n\t\t\t...foreignColumnNames,\n\t\t];\n\t\treturn name ?? `${chunks.join('_')}_fk`;\n\t}\n}\n\ntype ColumnsWithTable<\n\tTTableName extends string,\n\tTColumns extends PgColumn[],\n> = { [Key in keyof TColumns]: AnyPgColumn<{ tableName: TTableName }> };\n\nexport function foreignKey<\n\tTTableName extends string,\n\tTForeignTableName extends string,\n\tTColumns extends [AnyPgColumn<{ tableName: TTableName }>, ...AnyPgColumn<{ tableName: TTableName }>[]],\n>(\n\tconfig: {\n\t\tname?: string;\n\t\tcolumns: TColumns;\n\t\tforeignColumns: ColumnsWithTable;\n\t},\n): ForeignKeyBuilder {\n\tfunction mappedConfig() {\n\t\tconst { name, columns, foreignColumns } = config;\n\t\treturn {\n\t\t\tname,\n\t\t\tcolumns,\n\t\t\tforeignColumns,\n\t\t};\n\t}\n\n\treturn new ForeignKeyBuilder(mappedConfig);\n}\n", "import { entityKind } from '~/entity.ts';\nimport type { PgColumn } from './columns/index.ts';\nimport { PgTable } from './table.ts';\n\nexport function unique(name?: string): UniqueOnConstraintBuilder {\n\treturn new UniqueOnConstraintBuilder(name);\n}\n\nexport function uniqueKeyName(table: PgTable, columns: string[]) {\n\treturn `${table[PgTable.Symbol.Name]}_${columns.join('_')}_unique`;\n}\n\nexport class UniqueConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'PgUniqueConstraintBuilder';\n\n\t/** @internal */\n\tcolumns: PgColumn[];\n\t/** @internal */\n\tnullsNotDistinctConfig = false;\n\n\tconstructor(\n\t\tcolumns: PgColumn[],\n\t\tprivate name?: string,\n\t) {\n\t\tthis.columns = columns;\n\t}\n\n\tnullsNotDistinct() {\n\t\tthis.nullsNotDistinctConfig = true;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuild(table: PgTable): UniqueConstraint {\n\t\treturn new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);\n\t}\n}\n\nexport class UniqueOnConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'PgUniqueOnConstraintBuilder';\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tname?: string,\n\t) {\n\t\tthis.name = name;\n\t}\n\n\ton(...columns: [PgColumn, ...PgColumn[]]) {\n\t\treturn new UniqueConstraintBuilder(columns, this.name);\n\t}\n}\n\nexport class UniqueConstraint {\n\tstatic readonly [entityKind]: string = 'PgUniqueConstraint';\n\n\treadonly columns: PgColumn[];\n\treadonly name?: string;\n\treadonly nullsNotDistinct: boolean = false;\n\n\tconstructor(readonly table: PgTable, columns: PgColumn[], nullsNotDistinct: boolean, name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));\n\t\tthis.nullsNotDistinct = nullsNotDistinct;\n\t}\n\n\tgetName() {\n\t\treturn this.name;\n\t}\n}\n", "function parsePgArrayValue(arrayString: string, startFrom: number, inQuotes: boolean): [string, number] {\n\tfor (let i = startFrom; i < arrayString.length; i++) {\n\t\tconst char = arrayString[i];\n\n\t\tif (char === '\\\\') {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === '\"') {\n\t\t\treturn [arrayString.slice(startFrom, i).replace(/\\\\/g, ''), i + 1];\n\t\t}\n\n\t\tif (inQuotes) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === ',' || char === '}') {\n\t\t\treturn [arrayString.slice(startFrom, i).replace(/\\\\/g, ''), i];\n\t\t}\n\t}\n\n\treturn [arrayString.slice(startFrom).replace(/\\\\/g, ''), arrayString.length];\n}\n\nexport function parsePgNestedArray(arrayString: string, startFrom = 0): [any[], number] {\n\tconst result: any[] = [];\n\tlet i = startFrom;\n\tlet lastCharIsComma = false;\n\n\twhile (i < arrayString.length) {\n\t\tconst char = arrayString[i];\n\n\t\tif (char === ',') {\n\t\t\tif (lastCharIsComma || i === startFrom) {\n\t\t\t\tresult.push('');\n\t\t\t}\n\t\t\tlastCharIsComma = true;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tlastCharIsComma = false;\n\n\t\tif (char === '\\\\') {\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === '\"') {\n\t\t\tconst [value, startFrom] = parsePgArrayValue(arrayString, i + 1, true);\n\t\t\tresult.push(value);\n\t\t\ti = startFrom;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === '}') {\n\t\t\treturn [result, i + 1];\n\t\t}\n\n\t\tif (char === '{') {\n\t\t\tconst [value, startFrom] = parsePgNestedArray(arrayString, i + 1);\n\t\t\tresult.push(value);\n\t\t\ti = startFrom;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);\n\t\tresult.push(value);\n\t\ti = newStartFrom;\n\t}\n\n\treturn [result, i];\n}\n\nexport function parsePgArray(arrayString: string): any[] {\n\tconst [result] = parsePgNestedArray(arrayString, 1);\n\treturn result;\n}\n\nexport function makePgArray(array: any[]): string {\n\treturn `{${\n\t\tarray.map((item) => {\n\t\t\tif (Array.isArray(item)) {\n\t\t\t\treturn makePgArray(item);\n\t\t\t}\n\n\t\t\tif (typeof item === 'string') {\n\t\t\t\treturn `\"${item.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"`;\n\t\t\t}\n\n\t\t\treturn `${item}`;\n\t\t}).join(',')\n\t}}`;\n}\n", "import type {\n\tColumnBuilderBase,\n\tColumnBuilderBaseConfig,\n\tColumnBuilderExtraConfig,\n\tColumnBuilderRuntimeConfig,\n\tColumnDataType,\n\tMakeColumnConfig,\n} from '~/column-builder.ts';\nimport { ColumnBuilder } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { Column } from '~/column.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport type { Update } from '~/utils.ts';\n\nimport type { ForeignKey, UpdateDeleteAction } from '~/pg-core/foreign-keys.ts';\nimport { ForeignKeyBuilder } from '~/pg-core/foreign-keys.ts';\nimport type { AnyPgTable, PgTable } from '~/pg-core/table.ts';\nimport { uniqueKeyName } from '../unique-constraint.ts';\nimport { makePgArray, parsePgArray } from '../utils/array.ts';\nimport { iife } from '~/tracing-utils.ts';\n\nexport interface ReferenceConfig {\n\tref: () => PgColumn;\n\tactions: {\n\t\tonUpdate?: UpdateDeleteAction;\n\t\tonDelete?: UpdateDeleteAction;\n\t};\n}\n\nexport interface PgColumnBuilderBase<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTTypeConfig extends object = object,\n> extends ColumnBuilderBase {}\n\nexport abstract class PgColumnBuilder<\n\tT extends ColumnBuilderBaseConfig = ColumnBuilderBaseConfig,\n\tTRuntimeConfig extends object = object,\n\tTTypeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig,\n> extends ColumnBuilder\n\timplements PgColumnBuilderBase\n{\n\tprivate foreignKeyConfigs: ReferenceConfig[] = [];\n\n\tstatic readonly [entityKind]: string = 'PgColumnBuilder';\n\n\tarray(size?: number): PgArrayBuilder<\n\t\t& {\n\t\t\tname: T['name'];\n\t\t\tdataType: 'array';\n\t\t\tcolumnType: 'PgArray';\n\t\t\tdata: T['data'][];\n\t\t\tdriverParam: T['driverParam'][] | string;\n\t\t\tenumValues: T['enumValues'];\n\t\t}\n\t\t& (T extends { notNull: true } ? { notNull: true } : {})\n\t\t& (T extends { hasDefault: true } ? { hasDefault: true } : {}),\n\t\tT\n\t> {\n\t\treturn new PgArrayBuilder(this.config.name, this as PgColumnBuilder, size);\n\t}\n\n\treferences(\n\t\tref: ReferenceConfig['ref'],\n\t\tactions: ReferenceConfig['actions'] = {},\n\t): this {\n\t\tthis.foreignKeyConfigs.push({ ref, actions });\n\t\treturn this;\n\t}\n\n\tunique(\n\t\tname?: string,\n\t\tconfig?: { nulls: 'distinct' | 'not distinct' },\n\t): this {\n\t\tthis.config.isUnique = true;\n\t\tthis.config.uniqueName = name;\n\t\tthis.config.uniqueType = config?.nulls;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuildForeignKeys(column: PgColumn, table: PgTable): ForeignKey[] {\n\t\treturn this.foreignKeyConfigs.map(({ ref, actions }) => {\n\t\t\treturn iife(\n\t\t\t\t(ref, actions) => {\n\t\t\t\t\tconst builder = new ForeignKeyBuilder(() => {\n\t\t\t\t\t\tconst foreignColumn = ref();\n\t\t\t\t\t\treturn { columns: [column], foreignColumns: [foreignColumn] };\n\t\t\t\t\t});\n\t\t\t\t\tif (actions.onUpdate) {\n\t\t\t\t\t\tbuilder.onUpdate(actions.onUpdate);\n\t\t\t\t\t}\n\t\t\t\t\tif (actions.onDelete) {\n\t\t\t\t\t\tbuilder.onDelete(actions.onDelete);\n\t\t\t\t\t}\n\t\t\t\t\treturn builder.build(table);\n\t\t\t\t},\n\t\t\t\tref,\n\t\t\t\tactions,\n\t\t\t);\n\t\t});\n\t}\n\n\t/** @internal */\n\tabstract build(\n\t\ttable: AnyPgTable<{ name: TTableName }>,\n\t): PgColumn>;\n}\n\n// To understand how to use `PgColumn` and `PgColumn`, see `Column` and `AnyColumn` documentation.\nexport abstract class PgColumn<\n\tT extends ColumnBaseConfig = ColumnBaseConfig,\n\tTRuntimeConfig extends object = {},\n\tTTypeConfig extends object = {},\n> extends Column {\n\tstatic readonly [entityKind]: string = 'PgColumn';\n\n\tconstructor(\n\t\toverride readonly table: PgTable,\n\t\tconfig: ColumnBuilderRuntimeConfig,\n\t) {\n\t\tif (!config.uniqueName) {\n\t\t\tconfig.uniqueName = uniqueKeyName(table, [config.name]);\n\t\t}\n\t\tsuper(table, config);\n\t}\n}\n\nexport type AnyPgColumn> = {}> = PgColumn<\n\tRequired, TPartial>>\n>;\n\nexport class PgArrayBuilder<\n\tT extends ColumnBuilderBaseConfig<'array', 'PgArray'>,\n\tTBase extends ColumnBuilderBaseConfig,\n> extends PgColumnBuilder<\n\tT,\n\t{\n\t\tbaseBuilder: PgColumnBuilder;\n\t\tsize: number | undefined;\n\t},\n\t{\n\t\tbaseBuilder: PgColumnBuilder;\n\t}\n> {\n\tstatic override readonly [entityKind] = 'PgArrayBuilder';\n\n\tconstructor(\n\t\tname: string,\n\t\tbaseBuilder: PgArrayBuilder['config']['baseBuilder'],\n\t\tsize: number | undefined,\n\t) {\n\t\tsuper(name, 'array', 'PgArray');\n\t\tthis.config.baseBuilder = baseBuilder;\n\t\tthis.config.size = size;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyPgTable<{ name: TTableName }>,\n\t): PgArray, TBase> {\n\t\tconst baseColumn = this.config.baseBuilder.build(table);\n\t\treturn new PgArray, TBase>(\n\t\t\ttable as AnyPgTable<{ name: MakeColumnConfig['tableName'] }>,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig,\n\t\t\tbaseColumn,\n\t\t);\n\t}\n}\n\nexport class PgArray<\n\tT extends ColumnBaseConfig<'array', 'PgArray'>,\n\tTBase extends ColumnBuilderBaseConfig,\n> extends PgColumn {\n\treadonly size: number | undefined;\n\n\tstatic readonly [entityKind]: string = 'PgArray';\n\n\tconstructor(\n\t\ttable: AnyPgTable<{ name: T['tableName'] }>,\n\t\tconfig: PgArrayBuilder['config'],\n\t\treadonly baseColumn: PgColumn,\n\t\treadonly range?: [number | undefined, number | undefined],\n\t) {\n\t\tsuper(table, config);\n\t\tthis.size = config.size;\n\t}\n\n\tgetSQLType(): string {\n\t\treturn `${this.baseColumn.getSQLType()}[${typeof this.size === 'number' ? this.size : ''}]`;\n\t}\n\n\toverride mapFromDriverValue(value: unknown[] | string): T['data'] {\n\t\tif (typeof value === 'string') {\n\t\t\t// Thank you node-postgres for not parsing enum arrays\n\t\t\tvalue = parsePgArray(value);\n\t\t}\n\t\treturn value.map((v) => this.baseColumn.mapFromDriverValue(v));\n\t}\n\n\toverride mapToDriverValue(value: unknown[], isNestedArray = false): unknown[] | string {\n\t\tconst a = value.map((v) =>\n\t\t\tv === null\n\t\t\t\t? null\n\t\t\t\t: is(this.baseColumn, PgArray)\n\t\t\t\t? this.baseColumn.mapToDriverValue(v as unknown[], true)\n\t\t\t\t: this.baseColumn.mapToDriverValue(v)\n\t\t);\n\t\tif (isNestedArray) return a;\n\t\treturn makePgArray(a);\n\t}\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyPgTable } from '~/pg-core/table.ts';\nimport type { Writable } from '~/utils.ts';\nimport { PgColumn, PgColumnBuilder } from './common.ts';\n\nexport type PgCharBuilderInitial = PgCharBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'PgChar';\n\tdata: TEnum[number];\n\tenumValues: TEnum;\n\tdriverParam: string;\n}>;\n\nexport class PgCharBuilder> extends PgColumnBuilder<\n\tT,\n\t{ length: number | undefined; enumValues: T['enumValues'] }\n> {\n\tstatic readonly [entityKind]: string = 'PgCharBuilder';\n\n\tconstructor(name: string, config: PgCharConfig) {\n\t\tsuper(name, 'string', 'PgChar');\n\t\tthis.config.length = config.length;\n\t\tthis.config.enumValues = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyPgTable<{ name: TTableName }>,\n\t): PgChar> {\n\t\treturn new PgChar>(table, this.config as ColumnBuilderRuntimeConfig);\n\t}\n}\n\nexport class PgChar>\n\textends PgColumn\n{\n\tstatic readonly [entityKind]: string = 'PgChar';\n\n\treadonly length = this.config.length;\n\toverride readonly enumValues = this.config.enumValues;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `char` : `char(${this.length})`;\n\t}\n}\n\nexport interface PgCharConfig {\n\tlength?: number;\n\tenum?: TEnum;\n}\n\nexport function char>(\n\tname: TName,\n\tconfig: PgCharConfig> = {},\n): PgCharBuilderInitial> {\n\treturn new PgCharBuilder(name, config);\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyPgTable } from '~/pg-core/table.ts';\nimport { sql } from '~/sql/sql.ts';\nimport { PgColumn, PgColumnBuilder } from './common.ts';\n\nexport type PgUUIDBuilderInitial = PgUUIDBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'PgUUID';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class PgUUIDBuilder> extends PgColumnBuilder {\n\tstatic readonly [entityKind]: string = 'PgUUIDBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'PgUUID');\n\t}\n\n\t/**\n\t * Adds `default gen_random_uuid()` to the column definition.\n\t */\n\tdefaultRandom(): ReturnType {\n\t\treturn this.default(sql`gen_random_uuid()`) as ReturnType;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyPgTable<{ name: TTableName }>,\n\t): PgUUID> {\n\t\treturn new PgUUID>(table, this.config as ColumnBuilderRuntimeConfig);\n\t}\n}\n\nexport class PgUUID> extends PgColumn {\n\tstatic readonly [entityKind]: string = 'PgUUID';\n\n\tgetSQLType(): string {\n\t\treturn 'uuid';\n\t}\n}\n\nexport function uuid(name: TName): PgUUIDBuilderInitial {\n\treturn new PgUUIDBuilder(name);\n}\n", "import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyPgTable } from '~/pg-core/table.ts';\nimport type { Writable } from '~/utils.ts';\nimport { PgColumn, PgColumnBuilder } from './common.ts';\n\nexport type PgVarcharBuilderInitial = PgVarcharBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'PgVarchar';\n\tdata: TEnum[number];\n\tdriverParam: string;\n\tenumValues: TEnum;\n}>;\n\nexport class PgVarcharBuilder> extends PgColumnBuilder<\n\tT,\n\t{ length: number | undefined; enumValues: T['enumValues'] }\n> {\n\tstatic readonly [entityKind]: string = 'PgVarcharBuilder';\n\n\tconstructor(name: string, config: PgVarcharConfig) {\n\t\tsuper(name, 'string', 'PgVarchar');\n\t\tthis.config.length = config.length;\n\t\tthis.config.enumValues = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyPgTable<{ name: TTableName }>,\n\t): PgVarchar> {\n\t\treturn new PgVarchar>(table, this.config as ColumnBuilderRuntimeConfig);\n\t}\n}\n\nexport class PgVarchar>\n\textends PgColumn\n{\n\tstatic readonly [entityKind]: string = 'PgVarchar';\n\n\treadonly length = this.config.length;\n\toverride readonly enumValues = this.config.enumValues;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `varchar` : `varchar(${this.length})`;\n\t}\n}\n\nexport interface PgVarcharConfig {\n\tlength?: number;\n\tenum?: TEnum;\n}\n\nexport function varchar>(\n\tname: TName,\n\tconfig: PgVarcharConfig> = {},\n): PgVarcharBuilderInitial> {\n\treturn new PgVarcharBuilder(name, config);\n}\n", "export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n", "export var util;\n(function (util) {\n util.assertEqual = (_) => { };\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nexport var objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nexport const ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n", "import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0];\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n", "import { ZodIssueCode } from \"../ZodError.js\";\nimport { util, ZodParsedType } from \"../helpers/util.js\";\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"bigint\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\nexport default errorMap;\n", "import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n", "import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n", "export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n", "import { ZodError, ZodIssueCode, } from \"./ZodError.js\";\nimport { defaultErrorMap, getErrorMap } from \"./errors.js\";\nimport { errorUtil } from \"./helpers/errorUtil.js\";\nimport { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from \"./helpers/parseUtil.js\";\nimport { util, ZodParsedType, getParsedType } from \"./helpers/util.js\";\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nexport class ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if (err?.message?.toLowerCase()?.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&\u2019*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? \"+\" : \"?\"; // require seconds if precision is nonzero\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n if (!header)\n return false;\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (\"typ\" in decoded && decoded?.typ !== \"JWT\")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nexport class ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nexport class ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" || (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" || ch.kind === \"int\" || ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nexport class ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nexport class ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nexport class ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nexport class ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nexport class ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nexport class ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nexport class ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nexport class ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // (def: Def) =>\n // (\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge(\n // merging: Incoming\n // ): //ZodObject = (merging) => {\n // ZodObject<\n // extendShape>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nexport class ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nexport class ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\n// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];\nexport class ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nexport class ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexport class ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nexport class ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nexport class ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexport class ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nexport class ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nexport class ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\nZodEnum.create = createZodEnum;\nexport class ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nexport class ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nexport class ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return INVALID;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result,\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nexport { ZodEffects as ZodTransformer };\nexport class ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nexport class ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nexport class ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\" ? params.default : () => params.default,\n ...processCreateParams(params),\n });\n};\nexport class ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nexport class ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexport const BRAND = Symbol(\"zod_brand\");\nexport class ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexport class ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexport class ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\" ? params(data) : typeof params === \"string\" ? { message: params } : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nexport function custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nexport { ZodType as Schema, ZodType as ZodSchema };\nexport const late = {\n object: ZodObject.lazycreate,\n};\nexport var ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\n// requires TS 4.4+\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (\n// const instanceOfType = any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nexport const coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexport { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };\nexport const NEVER = INVALID;\n", null, "import { integer, sqliteTable, text, index } from \"drizzle-orm/sqlite-core\";\nimport { createInsertSchema } from \"drizzle-zod\";\nimport * as z from \"zod\";\n\n// ==================== API Keys \u8868 ====================\nexport const apiKeys = sqliteTable(\"api_keys\", {\n id: text(\"id\").primaryKey(),\n key: text(\"key\").notNull().unique(), // API Key \u503C\n keyPrefix: text(\"key_prefix\").notNull(), // Key \u524D\u7F00\u7528\u4E8E\u663E\u793A (\u5982 vmail_xxx...)\n name: text(\"name\"), // API Key \u540D\u79F0\n rateLimit: integer(\"rate_limit\").default(100), // \u6BCF\u5206\u949F\u8BF7\u6C42\u9650\u5236\n isActive: integer(\"is_active\", { mode: \"boolean\" }).default(true).notNull(),\n lastUsedAt: integer(\"last_used_at\", { mode: \"timestamp\" }),\n expiresAt: integer(\"expires_at\", { mode: \"timestamp\" }),\n createdAt: integer(\"created_at\", { mode: \"timestamp\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp\" }).notNull(),\n});\n\nexport const insertApiKeySchema = createInsertSchema(apiKeys);\nexport type InsertApiKey = z.infer;\nexport type ApiKey = typeof apiKeys.$inferSelect;\n\n// ==================== Mailboxes \u8868 ====================\nexport const mailboxes = sqliteTable(\"mailboxes\", {\n id: text(\"id\").primaryKey(),\n address: text(\"address\").notNull().unique(), // \u5B8C\u6574\u90AE\u7BB1\u5730\u5740\n domain: text(\"domain\").notNull(), // \u90AE\u7BB1\u57DF\u540D\n expiresAt: integer(\"expires_at\", { mode: \"timestamp\" }),\n apiKeyId: text(\"api_key_id\").notNull(), // \u5173\u8054\u7684 API Key ID\n createdAt: integer(\"created_at\", { mode: \"timestamp\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp\" }).notNull(),\n});\n\nexport const insertMailboxSchema = createInsertSchema(mailboxes);\nexport type InsertMailbox = z.infer;\nexport type Mailbox = typeof mailboxes.$inferSelect;\n\n// \u5B9A\u4E49 Header \u7C7B\u578B\uFF0C\u7528\u4E8E\u5B58\u50A8\u90AE\u4EF6\u5934\u4FE1\u606F\nexport type Header = Record;\n\n// \u5B9A\u4E49 Address \u7C7B\u578B\uFF0C\u7528\u4E8E\u5B58\u50A8\u53D1\u4EF6\u4EBA\u3001\u6536\u4EF6\u4EBA\u7B49\u5730\u5740\u4FE1\u606F\nexport type Address = {\n address: string;\n name: string;\n};\n\n// \u5B9A\u4E49 Email \u7C7B\u578B\uFF0C\u901A\u8FC7 drizzle-orm \u4ECE\u6570\u636E\u5E93\u8868\u7ED3\u6784\u63A8\u65AD\u5F97\u51FA\nexport type Email = typeof emails.$inferSelect;\n\n// \u4F7F\u7528 drizzle-orm \u5B9A\u4E49 emails \u8868\u7684\u7ED3\u6784\nexport const emails = sqliteTable(\"emails\", {\n id: text(\"id\").primaryKey(),\n messageFrom: text(\"message_from\").notNull(),\n messageTo: text(\"message_to\").notNull(),\n headers: text(\"headers\", { mode: \"json\" }).$type().notNull(),\n from: text(\"from\", { mode: \"json\" }).$type
().notNull(),\n sender: text(\"sender\", { mode: \"json\" }).$type
(),\n replyTo: text(\"reply_to\", { mode: \"json\" }).$type(),\n deliveredTo: text(\"delivered_to\"),\n returnPath: text(\"return_path\"),\n to: text(\"to\", { mode: \"json\" }).$type(),\n cc: text(\"cc\", { mode: \"json\" }).$type(),\n bcc: text(\"bcc\", { mode: \"json\" }).$type(),\n subject: text(\"subject\"),\n messageId: text(\"message_id\").notNull(),\n inReplyTo: text(\"in_reply_to\"),\n references: text(\"references\"),\n date: text(\"date\"),\n html: text(\"html\"),\n text: text(\"text\"),\n createdAt: integer(\"created_at\", { mode: \"timestamp\" }).notNull(),\n updatedAt: integer(\"updated_at\", { mode: \"timestamp\" }).notNull(),\n});\n\n// \u4F7F\u7528 Zod \u5B9A\u4E49 Address \u5BF9\u8C61\u7684\u9A8C\u8BC1 schema\nconst AddressSchema = z.object({\n address: z.string(),\n name: z.string(),\n});\n\n// \u4F7F\u7528 drizzle-zod \u57FA\u4E8E emails \u8868\u7ED3\u6784\u521B\u5EFA\u7528\u4E8E\u63D2\u5165\u64CD\u4F5C\u7684 Zod schema\nexport const insertEmailSchema = createInsertSchema(emails, {\n headers: z.array(z.record(z.string())),\n from: AddressSchema,\n sender: AddressSchema.optional(),\n replyTo: z.array(AddressSchema).optional(),\n to: z.array(AddressSchema).optional(),\n cc: z.array(AddressSchema).optional(),\n bcc: z.array(AddressSchema).optional(),\n});\n\n// \u5B9A\u4E49 InsertEmail \u7C7B\u578B\uFF0C\u4ECE Zod schema \u63A8\u65AD\nexport type InsertEmail = z.infer;", "import { count, desc, asc, eq, and, inArray, lt } from \"drizzle-orm\";\n// fix: \u5C06\u6570\u636E\u5E93\u7C7B\u578B\u4ECE LibSQLDatabase \u66F4\u6539\u4E3A DrizzleD1Database\uFF0C\u4EE5\u5339\u914D Cloudflare D1\nimport { DrizzleD1Database } from \"drizzle-orm/d1\";\n// refactor: \u66F4\u65B0 schema \u7684\u5BFC\u5165\u8DEF\u5F84\nimport { emails, InsertEmail, apiKeys, InsertApiKey, mailboxes, InsertMailbox } from \"./schema\";\n\nexport async function insertEmail(db: DrizzleD1Database, email: InsertEmail) {\n try {\n await db.insert(emails).values(email).execute();\n } catch (e) {\n console.error(e);\n }\n}\n\nexport async function getEmails(db: DrizzleD1Database) {\n try {\n return await db.select().from(emails).execute();\n } catch (e) {\n return [];\n }\n}\n\n// \u51FD\u6570\u91CD\u547D\u540D\uFF1A\u5C06 getEmail \u91CD\u547D\u540D\u4E3A findEmailById \u4EE5\u5339\u914D worker \u4E2D\u7684\u8C03\u7528\nexport async function findEmailById(db: DrizzleD1Database, id: string) {\n try {\n const result = await db\n .select()\n .from(emails)\n .where(and(eq(emails.id, id)))\n .execute();\n if (result.length != 1) {\n return null;\n }\n return result[0];\n } catch (e) {\n return null;\n }\n}\n\n// \u8BE5\u51FD\u6570\u5DF2\u4E0D\u518D\u9700\u8981\uFF0C\u56E0\u4E3A\u5BC6\u7801\u73B0\u5728\u662F\u90AE\u7BB1\u5730\u5740\u7684\u52A0\u5BC6\u7248\u672C\n// export async function getEmailByPassword(db: DrizzleD1Database, id: string) {\n// ...\n// }\n\nexport async function getEmailsByMessageTo(\n db: DrizzleD1Database,\n messageTo: string\n) {\n try {\n return await db\n .select()\n .from(emails)\n .where(eq(emails.messageTo, messageTo))\n .orderBy(desc(emails.createdAt))\n .execute();\n } catch (e) {\n return [];\n }\n}\n\nexport async function getEmailsCount(db: DrizzleD1Database) {\n try {\n const res = await db.select({ count: count() }).from(emails);\n return res[0]?.count;\n } catch (e) {\n return 0;\n }\n}\n\n// \u65B0\u589E\u51FD\u6570\uFF1A\u6DFB\u52A0 worker \u4E2D\u7F3A\u5931\u7684 deleteEmails \u51FD\u6570\nexport async function deleteEmails(db: DrizzleD1Database, ids: string[]) {\n if (!ids || ids.length === 0) {\n return { count: 0 };\n }\n try {\n const result = await db.delete(emails).where(inArray(emails.id, ids));\n return { count: result.rowsAffected };\n } catch (e) {\n console.error(e);\n return { count: 0 };\n }\n}\n\n/**\n * \u65B0\u589E\u51FD\u6570\uFF1A\u6839\u636E\u63D0\u4F9B\u7684\u8FC7\u671F\u65F6\u95F4\u5220\u9664\u6B64\u65F6\u95F4\u4E4B\u524D\u7684\u6240\u6709\u90AE\u4EF6\u3002\n * @param db Drizzle \u6570\u636E\u5E93\u5B9E\u4F8B\u3002\n * @param expirationTime \u4E00\u4E2A Date \u5BF9\u8C61\uFF0C\u8868\u793A\u8FC7\u671F\u65F6\u95F4\u70B9\u3002\n * @returns \u8FD4\u56DE\u4E00\u4E2A\u5305\u542B\u5DF2\u5220\u9664\u90AE\u4EF6\u6570\u91CF\u7684\u5BF9\u8C61\uFF0C\u6216\u5728\u51FA\u9519\u65F6\u8FD4\u56DE { count: 0 }\u3002\n */\nexport async function deleteExpiredEmails(db: DrizzleD1Database, expirationTime: Date) {\n try {\n // \u4F7F\u7528Drizzle\u7684lt\uFF08\u5C0F\u4E8E\uFF09\u64CD\u4F5C\u7B26\u6765\u6BD4\u8F83createdAt\u5B57\u6BB5\u548CexpirationTime\n const result = await db.delete(emails).where(lt(emails.createdAt, expirationTime)).execute();\n // \u8FD4\u56DE\u53D7\u5F71\u54CD\u7684\u884C\u6570\uFF0C\u5373\u5DF2\u5220\u9664\u7684\u90AE\u4EF6\u6570\u91CF\n return { count: result.rowsAffected };\n } catch (e) {\n // \u5982\u679C\u5728\u5220\u9664\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF\uFF0C\u5219\u5728\u63A7\u5236\u53F0\u6253\u5370\u9519\u8BEF\u4FE1\u606F\n console.error('\u6E05\u7406\u8FC7\u671F\u90AE\u4EF6\u5931\u8D25:', e);\n // \u5E76\u8FD4\u56DE\u4E00\u4E2A\u8868\u793A\u5220\u9664\u6570\u91CF\u4E3A0\u7684\u5BF9\u8C61\n return { count: 0 };\n }\n}\n\n// ==================== API Key \u76F8\u5173\u51FD\u6570 ====================\n\n/**\n * \u901A\u8FC7 API Key \u503C\u67E5\u627E\u8BB0\u5F55\n */\nexport async function findApiKeyByKey(db: DrizzleD1Database, key: string) {\n try {\n const result = await db\n .select()\n .from(apiKeys)\n .where(eq(apiKeys.key, key))\n .execute();\n return result.length === 1 ? result[0] : null;\n } catch (e) {\n console.error('findApiKeyByKey error:', e);\n return null;\n }\n}\n\n/**\n * \u66F4\u65B0 API Key \u6700\u540E\u4F7F\u7528\u65F6\u95F4\n */\nexport async function updateApiKeyLastUsed(db: DrizzleD1Database, id: string) {\n try {\n await db\n .update(apiKeys)\n .set({ lastUsedAt: new Date(), updatedAt: new Date() })\n .where(eq(apiKeys.id, id))\n .execute();\n } catch (e) {\n console.error('updateApiKeyLastUsed error:', e);\n }\n}\n\n/**\n * \u521B\u5EFA API Key\n */\nexport async function insertApiKey(db: DrizzleD1Database, apiKey: InsertApiKey) {\n try {\n await db.insert(apiKeys).values(apiKey).execute();\n return apiKey;\n } catch (e) {\n console.error('insertApiKey error:', e);\n return null;\n }\n}\n\n// ==================== Mailbox \u76F8\u5173\u51FD\u6570 ====================\n\n/**\n * \u521B\u5EFA\u90AE\u7BB1\n */\nexport async function insertMailbox(db: DrizzleD1Database, mailbox: InsertMailbox) {\n try {\n await db.insert(mailboxes).values(mailbox).execute();\n return mailbox;\n } catch (e) {\n console.error('insertMailbox error:', e);\n throw e;\n }\n}\n\n/**\n * \u901A\u8FC7 ID \u67E5\u627E\u90AE\u7BB1\n */\nexport async function findMailboxById(db: DrizzleD1Database, id: string) {\n try {\n const result = await db\n .select()\n .from(mailboxes)\n .where(eq(mailboxes.id, id))\n .execute();\n return result.length === 1 ? result[0] : null;\n } catch (e) {\n console.error('findMailboxById error:', e);\n return null;\n }\n}\n\n/**\n * \u901A\u8FC7\u90AE\u7BB1\u5730\u5740\u67E5\u627E\u90AE\u7BB1\n */\nexport async function findMailboxByAddress(db: DrizzleD1Database, address: string) {\n try {\n const result = await db\n .select()\n .from(mailboxes)\n .where(eq(mailboxes.address, address))\n .execute();\n return result.length === 1 ? result[0] : null;\n } catch (e) {\n console.error('findMailboxByAddress error:', e);\n return null;\n }\n}\n\n/**\n * \u83B7\u53D6\u90AE\u7BB1\u7684\u90AE\u4EF6\u5217\u8868\uFF08\u5E26\u5206\u9875\uFF09\n */\nexport async function getMailboxMessages(\n db: DrizzleD1Database,\n address: string,\n options: { page: number; limit: number; sort: 'asc' | 'desc' }\n) {\n try {\n const offset = (options.page - 1) * options.limit;\n const orderFn = options.sort === 'asc' ? asc : desc;\n\n const [messages, countResult] = await Promise.all([\n db\n .select()\n .from(emails)\n .where(eq(emails.messageTo, address))\n .orderBy(orderFn(emails.createdAt))\n .limit(options.limit)\n .offset(offset)\n .execute(),\n db\n .select({ count: count() })\n .from(emails)\n .where(eq(emails.messageTo, address))\n .execute(),\n ]);\n\n const total = countResult[0]?.count || 0;\n\n return {\n messages,\n total,\n totalPages: Math.ceil(total / options.limit),\n };\n } catch (e) {\n console.error('getMailboxMessages error:', e);\n return { messages: [], total: 0, totalPages: 0 };\n }\n}\n\n/**\n * \u83B7\u53D6\u7279\u5B9A\u90AE\u7BB1\u7684\u7279\u5B9A\u90AE\u4EF6\uFF08\u9A8C\u8BC1\u6240\u5C5E\u5173\u7CFB\uFF09\n */\nexport async function findMailboxMessage(\n db: DrizzleD1Database,\n address: string,\n messageId: string\n) {\n try {\n const result = await db\n .select()\n .from(emails)\n .where(and(eq(emails.id, messageId), eq(emails.messageTo, address)))\n .execute();\n return result.length === 1 ? result[0] : null;\n } catch (e) {\n console.error('findMailboxMessage error:', e);\n return null;\n }\n}\n\n/**\n * \u5220\u9664\u7279\u5B9A\u90AE\u7BB1\u7684\u7279\u5B9A\u90AE\u4EF6\uFF08\u9A8C\u8BC1\u6240\u5C5E\u5173\u7CFB\uFF09\n */\nexport async function deleteMailboxMessage(\n db: DrizzleD1Database,\n address: string,\n messageId: string\n) {\n try {\n const result = await db\n .delete(emails)\n .where(and(eq(emails.id, messageId), eq(emails.messageTo, address)))\n .execute();\n return result.rowsAffected > 0;\n } catch (e) {\n console.error('deleteMailboxMessage error:', e);\n return false;\n }\n}\n\n/**\n * \u83B7\u53D6\u90AE\u7BB1\u7684\u90AE\u4EF6\u6570\u91CF\n */\nexport async function getMailboxMessageCount(\n db: DrizzleD1Database,\n address: string\n) {\n try {\n const result = await db\n .select({ count: count() })\n .from(emails)\n .where(eq(emails.messageTo, address))\n .execute();\n return result[0]?.count || 0;\n } catch (e) {\n console.error('getMailboxMessageCount error:', e);\n return 0;\n }\n}\n\n/**\n * \u5220\u9664\u8FC7\u671F\u7684\u90AE\u7BB1\n */\nexport async function deleteExpiredMailboxes(db: DrizzleD1Database) {\n try {\n const now = new Date();\n const result = await db\n .delete(mailboxes)\n .where(lt(mailboxes.expiresAt, now))\n .execute();\n return { count: result.rowsAffected };\n } catch (e) {\n console.error('deleteExpiredMailboxes error:', e);\n return { count: 0 };\n }\n}", "/// \n\nimport type { BatchItem } from '~/batch.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport type { PreparedQuery } from '~/session.ts';\nimport { fillPlaceholders, type Query, sql } from '~/sql/sql.ts';\nimport type { SQLiteAsyncDialect } from '~/sqlite-core/dialect.ts';\nimport { SQLiteTransaction } from '~/sqlite-core/index.ts';\nimport type { SelectedFieldsOrdered } from '~/sqlite-core/query-builders/select.types.ts';\nimport type {\n\tPreparedQueryConfig as PreparedQueryConfigBase,\n\tSQLiteExecuteMethod,\n\tSQLiteTransactionConfig,\n} from '~/sqlite-core/session.ts';\nimport { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { mapResultRow } from '~/utils.ts';\n\nexport interface SQLiteD1SessionOptions {\n\tlogger?: Logger;\n}\n\ntype PreparedQueryConfig = Omit;\n\nexport class SQLiteD1Session<\n\tTFullSchema extends Record,\n\tTSchema extends TablesRelationalConfig,\n> extends SQLiteSession<'async', D1Result, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'SQLiteD1Session';\n\n\tprivate logger: Logger;\n\n\tconstructor(\n\t\tprivate client: D1Database,\n\t\tdialect: SQLiteAsyncDialect,\n\t\tprivate schema: RelationalSchemaConfig | undefined,\n\t\tprivate options: SQLiteD1SessionOptions = {},\n\t) {\n\t\tsuper(dialect);\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t}\n\n\tprepareQuery(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\texecuteMethod: SQLiteExecuteMethod,\n\t\tcustomResultMapper?: (rows: unknown[][]) => unknown,\n\t): D1PreparedQuery {\n\t\tconst stmt = this.client.prepare(query.sql);\n\t\treturn new D1PreparedQuery(stmt, query, this.logger, fields, executeMethod, customResultMapper);\n\t}\n\n\t/*override */ async batch>(queries: T) {\n\t\tconst preparedQueries: PreparedQuery[] = [];\n\t\tconst builtQueries: D1PreparedStatement[] = [];\n\n\t\tfor (const query of queries) {\n\t\t\tconst preparedQuery = query._prepare();\n\t\t\tconst builtQuery = preparedQuery.getQuery();\n\t\t\tpreparedQueries.push(preparedQuery);\n\t\t\tif (builtQuery.params.length > 0) {\n\t\t\t\tbuiltQueries.push((preparedQuery as D1PreparedQuery).stmt.bind(...builtQuery.params));\n\t\t\t} else {\n\t\t\t\tconst builtQuery = preparedQuery.getQuery();\n\t\t\t\tbuiltQueries.push(\n\t\t\t\t\tthis.client.prepare(builtQuery.sql).bind(...builtQuery.params),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// const queryToType: (\n\t\t// \t| { mode: 'all' }\n\t\t// \t| {\n\t\t// \t\tmode: 'all_mapped';\n\t\t// \t\tconfig: { fields: SelectedFieldsOrdered; joinsNotNullableMap?: Record };\n\t\t// \t}\n\t\t// \t| { mode: 'get' }\n\t\t// \t| { mode: 'values' }\n\t\t// \t| { mode: 'raw' }\n\t\t// \t| { mode: 'rqb'; mapper: any }\n\t\t// )[] = [];\n\n\t\t// const builtQueries: D1PreparedStatement[] = queries.map((query) => {\n\t\t// \tif (is(query, SQLiteSelectBase)) {\n\t\t// \t\tconst prepared = query.prepare() as D1PreparedQuery;\n\t\t// \t\tprepared.fields === undefined\n\t\t// \t\t\t? queryToType.push({ mode: 'all' })\n\t\t// \t\t\t: queryToType.push({\n\t\t// \t\t\t\tmode: 'all_mapped',\n\t\t// \t\t\t\tconfig: { fields: prepared.fields, joinsNotNullableMap: prepared.joinsNotNullableMap },\n\t\t// \t\t\t});\n\t\t// \t\treturn prepared.stmt.bind(...prepared.params);\n\t\t// \t} else if (\n\t\t// \t\tis(query, SQLiteInsertBase) || is(query, SQLiteUpdateBase)\n\t\t// \t\t|| is(query, SQLiteDeleteBase)\n\t\t// \t) {\n\t\t// \t\tconst prepared = query.prepare() as D1PreparedQuery;\n\t\t// \t\tqueryToType.push(\n\t\t// \t\t\tquery.config.returning\n\t\t// \t\t\t\t? {\n\t\t// \t\t\t\t\tmode: 'all_mapped',\n\t\t// \t\t\t\t\tconfig: { fields: query.config.returning },\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\t: { mode: 'raw' },\n\t\t// \t\t);\n\t\t// \t\treturn prepared.stmt.bind(...prepared.params);\n\t\t// \t} else if (is(query, SQLiteRaw)) {\n\t\t// \t\tconst builtQuery = this.dialect.sqlToQuery(query.getSQL());\n\t\t// \t\tqueryToType.push(\n\t\t// \t\t\tquery.config.action === 'run' ? { mode: 'raw' } : { mode: query.config.action },\n\t\t// \t\t);\n\t\t// \t\treturn this.client.prepare(builtQuery.sql).bind(...builtQuery.params);\n\t\t// \t} else if (is(query, SQLiteRelationalQuery)) {\n\t\t// \t\tconst preparedRqb = query.prepare() as D1PreparedQuery;\n\t\t// \t\tqueryToType.push({ mode: 'rqb', mapper: preparedRqb.customResultMapper });\n\t\t// \t\treturn preparedRqb.stmt.bind(...preparedRqb.params);\n\t\t// \t}\n\t\t// \tthrow new DrizzleError({ message: 'You can use only drizzle queries in D1 batch API' });\n\t\t// });\n\n\t\tconst batchResults = await this.client.batch(builtQueries);\n\t\treturn batchResults.map((result, i) => preparedQueries[i]!.mapResult(result, true));\n\n\t\t// const res = this.client.batch(builtQueries).then((stmt) =>\n\t\t// \tstmt.map(({ results }, index) => {\n\t\t// \t\tconst action = queryToType[index]!;\n\t\t// \t\tif (action.mode === 'all') {\n\t\t// \t\t\treturn results;\n\t\t// \t\t}\n\t\t// \t\tif (action.mode === 'all_mapped') {\n\t\t// \t\t\tconst mappedRows = this.d1ToRawMapping(results);\n\t\t// \t\t\treturn mappedRows!.map((row) => {\n\t\t// \t\t\t\treturn mapResultRow(\n\t\t// \t\t\t\t\taction.config.fields,\n\t\t// \t\t\t\t\trow,\n\t\t// \t\t\t\t\taction.config.joinsNotNullableMap,\n\t\t// \t\t\t\t);\n\t\t// \t\t\t});\n\t\t// \t\t}\n\t\t// \t\tif (action.mode === 'get') {\n\t\t// \t\t\treturn results![0] as unknown[];\n\t\t// \t\t}\n\t\t// \t\tif (action.mode === 'values') {\n\t\t// \t\t\treturn this.d1ToRawMapping(results);\n\t\t// \t\t}\n\t\t// \t\tif (action.mode === 'raw') {\n\t\t// \t\t\treturn stmt[index];\n\t\t// \t\t}\n\t\t// \t\treturn action.mapper(this.d1ToRawMapping(results));\n\t\t// \t})\n\t\t// );\n\t\t// return res;\n\t}\n\n\toverride extractRawAllValueFromBatchResult(result: unknown): unknown {\n\t\treturn (result as D1Result).results;\n\t}\n\n\toverride extractRawGetValueFromBatchResult(result: unknown): unknown {\n\t\treturn (result as D1Result).results[0];\n\t}\n\n\toverride extractRawValuesValueFromBatchResult(result: unknown): unknown {\n\t\treturn d1ToRawMapping((result as D1Result).results);\n\t}\n\n\toverride async transaction(\n\t\ttransaction: (tx: D1Transaction) => T | Promise,\n\t\tconfig?: SQLiteTransactionConfig,\n\t): Promise {\n\t\tconst tx = new D1Transaction('async', this.dialect, this, this.schema);\n\t\tawait this.run(sql.raw(`begin${config?.behavior ? ' ' + config.behavior : ''}`));\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait this.run(sql`commit`);\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait this.run(sql`rollback`);\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport class D1Transaction<\n\tTFullSchema extends Record,\n\tTSchema extends TablesRelationalConfig,\n> extends SQLiteTransaction<'async', D1Result, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'D1Transaction';\n\n\toverride async transaction(transaction: (tx: D1Transaction) => Promise): Promise {\n\t\tconst savepointName = `sp${this.nestedIndex}`;\n\t\tconst tx = new D1Transaction('async', this.dialect, this.session, this.schema, this.nestedIndex + 1);\n\t\tawait this.session.run(sql.raw(`savepoint ${savepointName}`));\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait this.session.run(sql.raw(`release savepoint ${savepointName}`));\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\n/**\n * This function was taken from the D1 implementation: https://github.com/cloudflare/workerd/blob/4aae9f4c7ae30a59a88ca868c4aff88bda85c956/src/cloudflare/internal/d1-api.ts#L287\n * It may cause issues with duplicated column names in join queries, which should be fixed on the D1 side.\n * @param results\n * @returns\n */\nfunction d1ToRawMapping(results: any) {\n\tconst rows: unknown[][] = [];\n\tfor (const row of results) {\n\t\tconst entry = Object.keys(row).map((k) => row[k]);\n\t\trows.push(entry);\n\t}\n\treturn rows;\n}\n\nexport class D1PreparedQuery extends SQLitePreparedQuery<\n\t{ type: 'async'; run: D1Result; all: T['all']; get: T['get']; values: T['values']; execute: T['execute'] }\n> {\n\tstatic readonly [entityKind]: string = 'D1PreparedQuery';\n\n\t/** @internal */\n\tcustomResultMapper?: (rows: unknown[][], mapColumnValue?: (value: unknown) => unknown) => unknown;\n\n\t/** @internal */\n\tfields?: SelectedFieldsOrdered;\n\n\t/** @internal */\n\tstmt: D1PreparedStatement;\n\n\tconstructor(\n\t\tstmt: D1PreparedStatement,\n\t\tquery: Query,\n\t\tprivate logger: Logger,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\texecuteMethod: SQLiteExecuteMethod,\n\t\tcustomResultMapper?: (rows: unknown[][]) => unknown,\n\t) {\n\t\tsuper('async', executeMethod, query);\n\t\tthis.customResultMapper = customResultMapper;\n\t\tthis.fields = fields;\n\t\tthis.stmt = stmt;\n\t}\n\n\trun(placeholderValues?: Record): Promise {\n\t\tconst params = fillPlaceholders(this.query.params, placeholderValues ?? {});\n\t\tthis.logger.logQuery(this.query.sql, params);\n\t\treturn this.stmt.bind(...params).run();\n\t}\n\n\tasync all(placeholderValues?: Record): Promise {\n\t\tconst { fields, query, logger, stmt, customResultMapper } = this;\n\t\tif (!fields && !customResultMapper) {\n\t\t\tconst params = fillPlaceholders(query.params, placeholderValues ?? {});\n\t\t\tlogger.logQuery(query.sql, params);\n\t\t\treturn stmt.bind(...params).all().then(({ results }) => this.mapAllResult(results!));\n\t\t}\n\n\t\tconst rows = await this.values(placeholderValues);\n\n\t\treturn this.mapAllResult(rows);\n\t}\n\n\toverride mapAllResult(rows: unknown, isFromBatch?: boolean): unknown {\n\t\tif (isFromBatch) {\n\t\t\trows = d1ToRawMapping((rows as D1Result).results);\n\t\t}\n\n\t\tif (!this.fields && !this.customResultMapper) {\n\t\t\treturn rows;\n\t\t}\n\n\t\tif (this.customResultMapper) {\n\t\t\treturn this.customResultMapper(rows as unknown[][]);\n\t\t}\n\n\t\treturn (rows as unknown[][]).map((row) => mapResultRow(this.fields!, row, this.joinsNotNullableMap));\n\t}\n\n\tasync get(placeholderValues?: Record): Promise {\n\t\tconst { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;\n\t\tif (!fields && !customResultMapper) {\n\t\t\tconst params = fillPlaceholders(query.params, placeholderValues ?? {});\n\t\t\tlogger.logQuery(query.sql, params);\n\t\t\treturn stmt.bind(...params).all().then(({ results }) => results![0]);\n\t\t}\n\n\t\tconst rows = await this.values(placeholderValues);\n\n\t\tif (!rows[0]) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (customResultMapper) {\n\t\t\treturn customResultMapper(rows) as T['all'];\n\t\t}\n\n\t\treturn mapResultRow(fields!, rows[0], joinsNotNullableMap);\n\t}\n\n\toverride mapGetResult(result: unknown, isFromBatch?: boolean): unknown {\n\t\tif (isFromBatch) {\n\t\t\tresult = d1ToRawMapping((result as D1Result).results)[0];\n\t\t}\n\n\t\tif (!this.fields && !this.customResultMapper) {\n\t\t\treturn result;\n\t\t}\n\n\t\tif (this.customResultMapper) {\n\t\t\treturn this.customResultMapper([result as unknown[]]) as T['all'];\n\t\t}\n\n\t\treturn mapResultRow(this.fields!, result as unknown[], this.joinsNotNullableMap);\n\t}\n\n\tvalues(placeholderValues?: Record): Promise {\n\t\tconst params = fillPlaceholders(this.query.params, placeholderValues ?? {});\n\t\tthis.logger.logQuery(this.query.sql, params);\n\t\treturn this.stmt.bind(...params).raw();\n\t}\n}\n", "/// \nimport type { BatchItem, BatchResponse } from '~/batch.ts';\nimport { entityKind } from '~/entity.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport {\n\tcreateTableRelationsHelpers,\n\textractTablesRelationalConfig,\n\ttype ExtractTablesWithRelations,\n\ttype RelationalSchemaConfig,\n\ttype TablesRelationalConfig,\n} from '~/relations.ts';\nimport { BaseSQLiteDatabase } from '~/sqlite-core/db.ts';\nimport { SQLiteAsyncDialect } from '~/sqlite-core/dialect.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport { SQLiteD1Session } from './session.ts';\n\nexport class DrizzleD1Database<\n\tTSchema extends Record = Record,\n> extends BaseSQLiteDatabase<'async', D1Result, TSchema> {\n\tstatic readonly [entityKind]: string = 'LibSQLDatabase';\n\n\t/** @internal */\n\tdeclare readonly session: SQLiteD1Session>;\n\n\tasync batch, T extends Readonly<[U, ...U[]]>>(\n\t\tbatch: T,\n\t): Promise> {\n\t\treturn this.session.batch(batch) as Promise>;\n\t}\n}\n\nexport function drizzle = Record>(\n\tclient: D1Database,\n\tconfig: DrizzleConfig = {},\n): DrizzleD1Database {\n\tconst dialect = new SQLiteAsyncDialect();\n\tlet logger;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\tlet schema: RelationalSchemaConfig | undefined;\n\tif (config.schema) {\n\t\tconst tablesConfig = extractTablesRelationalConfig(\n\t\t\tconfig.schema,\n\t\t\tcreateTableRelationsHelpers,\n\t\t);\n\t\tschema = {\n\t\t\tfullSchema: config.schema,\n\t\t\tschema: tablesConfig.tables,\n\t\t\ttableNamesMap: tablesConfig.tableNamesMap,\n\t\t};\n\t}\n\n\tconst session = new SQLiteD1Session(client, dialect, schema, { logger });\n\treturn new DrizzleD1Database('async', dialect, session, schema) as DrizzleD1Database;\n}\n", "import { drizzle, DrizzleD1Database } from \"drizzle-orm/d1\";\n\n// \u4FEE\u6539 getWebTursoDB \u4E3A getD1DB\uFF0C\u5E76\u9002\u914D D1 \u6570\u636E\u5E93\nexport function getD1DB(db: D1Database): DrizzleD1Database {\n return drizzle(db);\n}", "/* @ts-self-types=\"./index.d.ts\" */\nlet urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\nexport let customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = ''\n let i = size | 0\n while (i--) {\n id += alphabet[(Math.random() * alphabet.length) | 0]\n }\n return id\n }\n}\nexport let nanoid = (size = 21) => {\n let id = ''\n let i = size | 0\n while (i--) {\n id += urlAlphabet[(Math.random() * 64) | 0]\n }\n return id\n}\n", "export const textEncoder = new TextEncoder();\n\nconst base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n// Use a lookup table to find the index.\nconst base64Lookup = new Uint8Array(256);\nfor (var i = 0; i < base64Chars.length; i++) {\n base64Lookup[base64Chars.charCodeAt(i)] = i;\n}\n\nexport function decodeBase64(base64) {\n let bufferLength = Math.ceil(base64.length / 4) * 3;\n const len = base64.length;\n\n let p = 0;\n\n if (base64.length % 4 === 3) {\n bufferLength--;\n } else if (base64.length % 4 === 2) {\n bufferLength -= 2;\n } else if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n\n const arrayBuffer = new ArrayBuffer(bufferLength);\n const bytes = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < len; i += 4) {\n let encoded1 = base64Lookup[base64.charCodeAt(i)];\n let encoded2 = base64Lookup[base64.charCodeAt(i + 1)];\n let encoded3 = base64Lookup[base64.charCodeAt(i + 2)];\n let encoded4 = base64Lookup[base64.charCodeAt(i + 3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arrayBuffer;\n}\n\nexport function getDecoder(charset) {\n charset = charset || 'utf8';\n let decoder;\n\n try {\n decoder = new TextDecoder(charset);\n } catch (err) {\n decoder = new TextDecoder('windows-1252');\n }\n\n return decoder;\n}\n\n/**\n * Converts a Blob into an ArrayBuffer\n * @param {Blob} blob Blob to convert\n * @returns {ArrayBuffer} Converted value\n */\nexport async function blobToArrayBuffer(blob) {\n if ('arrayBuffer' in blob) {\n return await blob.arrayBuffer();\n }\n\n const fr = new FileReader();\n\n return new Promise((resolve, reject) => {\n fr.onload = function (e) {\n resolve(e.target.result);\n };\n\n fr.onerror = function (e) {\n reject(fr.error);\n };\n\n fr.readAsArrayBuffer(blob);\n });\n}\n\nexport function getHex(c) {\n if (\n (c >= 0x30 /* 0 */ && c <= 0x39) /* 9 */ ||\n (c >= 0x61 /* a */ && c <= 0x66) /* f */ ||\n (c >= 0x41 /* A */ && c <= 0x46) /* F */\n ) {\n return String.fromCharCode(c);\n }\n return false;\n}\n\n/**\n * Decode a complete mime word encoded string\n *\n * @param {String} str Mime word encoded string\n * @return {String} Decoded unicode string\n */\nexport function decodeWord(charset, encoding, str) {\n // RFC2231 added language tag to the encoding\n // see: https://tools.ietf.org/html/rfc2231#section-5\n // this implementation silently ignores this tag\n let splitPos = charset.indexOf('*');\n if (splitPos >= 0) {\n charset = charset.substr(0, splitPos);\n }\n\n encoding = encoding.toUpperCase();\n\n let byteStr;\n\n if (encoding === 'Q') {\n str = str\n // remove spaces between = and hex char, this might indicate invalidly applied line splitting\n .replace(/=\\s+([0-9a-fA-F])/g, '=$1')\n // convert all underscores to spaces\n .replace(/[_\\s]/g, ' ');\n\n let buf = textEncoder.encode(str);\n let encodedBytes = [];\n for (let i = 0, len = buf.length; i < len; i++) {\n let c = buf[i];\n if (i <= len - 2 && c === 0x3d /* = */) {\n let c1 = getHex(buf[i + 1]);\n let c2 = getHex(buf[i + 2]);\n if (c1 && c2) {\n let c = parseInt(c1 + c2, 16);\n encodedBytes.push(c);\n i += 2;\n continue;\n }\n }\n encodedBytes.push(c);\n }\n byteStr = new ArrayBuffer(encodedBytes.length);\n let dataView = new DataView(byteStr);\n for (let i = 0, len = encodedBytes.length; i < len; i++) {\n dataView.setUint8(i, encodedBytes[i]);\n }\n } else if (encoding === 'B') {\n byteStr = decodeBase64(str.replace(/[^a-zA-Z0-9\\+\\/=]+/g, ''));\n } else {\n // keep as is, convert ArrayBuffer to unicode string, assume utf8\n byteStr = textEncoder.encode(str);\n }\n\n return getDecoder(charset).decode(byteStr);\n}\n\nexport function decodeWords(str) {\n let joinString = true;\n let done = false;\n\n while (!done) {\n let result = (str || '')\n .toString()\n // find base64 words that can be joined\n .replace(\n /(=\\?([^?]+)\\?[Bb]\\?([^?]*)\\?=)\\s*(?==\\?([^?]+)\\?[Bb]\\?[^?]*\\?=)/g,\n (match, left, chLeft, encodedLeftStr, chRight) => {\n if (!joinString) {\n return match;\n }\n // only mark b64 chunks to be joined if charsets match and left side does not end with =\n if (chLeft === chRight && encodedLeftStr.length % 4 === 0 && !/=$/.test(encodedLeftStr)) {\n // set a joiner marker\n return left + '__\\x00JOIN\\x00__';\n }\n\n return match;\n }\n )\n // find QP words that can be joined\n .replace(\n /(=\\?([^?]+)\\?[Qq]\\?[^?]*\\?=)\\s*(?==\\?([^?]+)\\?[Qq]\\?[^?]*\\?=)/g,\n (match, left, chLeft, chRight) => {\n if (!joinString) {\n return match;\n }\n // only mark QP chunks to be joined if charsets match\n if (chLeft === chRight) {\n // set a joiner marker\n return left + '__\\x00JOIN\\x00__';\n }\n return match;\n }\n )\n // join base64 encoded words\n .replace(/(\\?=)?__\\x00JOIN\\x00__(=\\?([^?]+)\\?[QqBb]\\?)?/g, '')\n // remove spaces between mime encoded words\n .replace(/(=\\?[^?]+\\?[QqBb]\\?[^?]*\\?=)\\s+(?==\\?[^?]+\\?[QqBb]\\?[^?]*\\?=)/g, '$1')\n // decode words\n .replace(/=\\?([\\w_\\-*]+)\\?([QqBb])\\?([^?]*)\\?=/g, (m, charset, encoding, text) =>\n decodeWord(charset, encoding, text)\n );\n\n if (joinString && result.indexOf('\\ufffd') >= 0) {\n // text contains \\ufffd (EF BF BD), so unicode conversion failed, retry without joining strings\n joinString = false;\n } else {\n return result;\n }\n }\n}\n\nexport function decodeURIComponentWithCharset(encodedStr, charset) {\n charset = charset || 'utf-8';\n\n let encodedBytes = [];\n for (let i = 0; i < encodedStr.length; i++) {\n let c = encodedStr.charAt(i);\n if (c === '%' && /^[a-f0-9]{2}/i.test(encodedStr.substr(i + 1, 2))) {\n // encoded sequence\n let byte = encodedStr.substr(i + 1, 2);\n i += 2;\n encodedBytes.push(parseInt(byte, 16));\n } else if (c.charCodeAt(0) > 126) {\n c = textEncoder.encode(c);\n for (let j = 0; j < c.length; j++) {\n encodedBytes.push(c[j]);\n }\n } else {\n // \"normal\" char\n encodedBytes.push(c.charCodeAt(0));\n }\n }\n\n const byteStr = new ArrayBuffer(encodedBytes.length);\n const dataView = new DataView(byteStr);\n for (let i = 0, len = encodedBytes.length; i < len; i++) {\n dataView.setUint8(i, encodedBytes[i]);\n }\n\n return getDecoder(charset).decode(byteStr);\n}\n\nexport function decodeParameterValueContinuations(header) {\n // handle parameter value continuations\n // https://tools.ietf.org/html/rfc2231#section-3\n\n // preprocess values\n let paramKeys = new Map();\n\n Object.keys(header.params).forEach(key => {\n let match = key.match(/\\*((\\d+)\\*?)?$/);\n if (!match) {\n // nothing to do here, does not seem like a continuation param\n return;\n }\n\n let actualKey = key.substr(0, match.index).toLowerCase();\n let nr = Number(match[2]) || 0;\n\n let paramVal;\n if (!paramKeys.has(actualKey)) {\n paramVal = {\n charset: false,\n values: []\n };\n paramKeys.set(actualKey, paramVal);\n } else {\n paramVal = paramKeys.get(actualKey);\n }\n\n let value = header.params[key];\n if (nr === 0 && match[0].charAt(match[0].length - 1) === '*' && (match = value.match(/^([^']*)'[^']*'(.*)$/))) {\n paramVal.charset = match[1] || 'utf-8';\n value = match[2];\n }\n\n paramVal.values.push({ nr, value });\n\n // remove the old reference\n delete header.params[key];\n });\n\n paramKeys.forEach((paramVal, key) => {\n header.params[key] = decodeURIComponentWithCharset(\n paramVal.values\n .sort((a, b) => a.nr - b.nr)\n .map(a => a.value)\n .join(''),\n paramVal.charset\n );\n });\n}\n", "import { blobToArrayBuffer } from './decode-strings.js';\n\nexport default class PassThroughDecoder {\n constructor() {\n this.chunks = [];\n }\n\n update(line) {\n this.chunks.push(line);\n this.chunks.push('\\n');\n }\n\n finalize() {\n // convert an array of arraybuffers into a blob and then back into a single arraybuffer\n return blobToArrayBuffer(new Blob(this.chunks, { type: 'application/octet-stream' }));\n }\n}\n", "import { decodeBase64, blobToArrayBuffer } from './decode-strings.js';\n\nexport default class Base64Decoder {\n constructor(opts) {\n opts = opts || {};\n\n this.decoder = opts.decoder || new TextDecoder();\n\n this.maxChunkSize = 100 * 1024;\n\n this.chunks = [];\n\n this.remainder = '';\n }\n\n update(buffer) {\n let str = this.decoder.decode(buffer);\n\n if (/[^a-zA-Z0-9+\\/]/.test(str)) {\n str = str.replace(/[^a-zA-Z0-9+\\/]+/g, '');\n }\n\n this.remainder += str;\n\n if (this.remainder.length >= this.maxChunkSize) {\n let allowedBytes = Math.floor(this.remainder.length / 4) * 4;\n let base64Str;\n\n if (allowedBytes === this.remainder.length) {\n base64Str = this.remainder;\n this.remainder = '';\n } else {\n base64Str = this.remainder.substr(0, allowedBytes);\n this.remainder = this.remainder.substr(allowedBytes);\n }\n\n if (base64Str.length) {\n this.chunks.push(decodeBase64(base64Str));\n }\n }\n }\n\n finalize() {\n if (this.remainder && !/^=+$/.test(this.remainder)) {\n this.chunks.push(decodeBase64(this.remainder));\n }\n\n return blobToArrayBuffer(new Blob(this.chunks, { type: 'application/octet-stream' }));\n }\n}\n", "import { blobToArrayBuffer } from './decode-strings.js';\n\n// Regex patterns compiled once for performance\nconst VALID_QP_REGEX = /^=[a-f0-9]{2}$/i;\nconst QP_SPLIT_REGEX = /(?==[a-f0-9]{2})/i;\nconst SOFT_LINE_BREAK_REGEX = /=\\r?\\n/g;\nconst PARTIAL_QP_ENDING_REGEX = /=[a-fA-F0-9]?$/;\n\nexport default class QPDecoder {\n constructor(opts) {\n opts = opts || {};\n\n this.decoder = opts.decoder || new TextDecoder();\n\n this.maxChunkSize = 100 * 1024;\n\n this.remainder = '';\n\n this.chunks = [];\n }\n\n decodeQPBytes(encodedBytes) {\n let buf = new ArrayBuffer(encodedBytes.length);\n let dataView = new DataView(buf);\n for (let i = 0, len = encodedBytes.length; i < len; i++) {\n dataView.setUint8(i, parseInt(encodedBytes[i], 16));\n }\n return buf;\n }\n\n decodeChunks(str) {\n // unwrap newlines\n str = str.replace(SOFT_LINE_BREAK_REGEX, '');\n\n let list = str.split(QP_SPLIT_REGEX);\n let encodedBytes = [];\n for (let part of list) {\n if (part.charAt(0) !== '=') {\n if (encodedBytes.length) {\n this.chunks.push(this.decodeQPBytes(encodedBytes));\n encodedBytes = [];\n }\n this.chunks.push(part);\n continue;\n }\n\n if (part.length === 3) {\n // Validate that this is actually a valid QP sequence\n if (VALID_QP_REGEX.test(part)) {\n encodedBytes.push(part.substr(1));\n } else {\n // Not a valid QP sequence, treat as literal text\n if (encodedBytes.length) {\n this.chunks.push(this.decodeQPBytes(encodedBytes));\n encodedBytes = [];\n }\n this.chunks.push(part);\n }\n continue;\n }\n\n if (part.length > 3) {\n // First 3 chars should be a valid QP sequence\n const firstThree = part.substr(0, 3);\n if (VALID_QP_REGEX.test(firstThree)) {\n encodedBytes.push(part.substr(1, 2));\n this.chunks.push(this.decodeQPBytes(encodedBytes));\n encodedBytes = [];\n\n part = part.substr(3);\n this.chunks.push(part);\n } else {\n // Not a valid QP sequence, treat entire part as literal\n if (encodedBytes.length) {\n this.chunks.push(this.decodeQPBytes(encodedBytes));\n encodedBytes = [];\n }\n this.chunks.push(part);\n }\n }\n }\n if (encodedBytes.length) {\n this.chunks.push(this.decodeQPBytes(encodedBytes));\n encodedBytes = [];\n }\n }\n\n update(buffer) {\n // expect full lines, so add line terminator as well\n let str = this.decoder.decode(buffer) + '\\n';\n\n str = this.remainder + str;\n\n if (str.length < this.maxChunkSize) {\n this.remainder = str;\n return;\n }\n\n this.remainder = '';\n\n let partialEnding = str.match(PARTIAL_QP_ENDING_REGEX);\n if (partialEnding) {\n if (partialEnding.index === 0) {\n this.remainder = str;\n return;\n }\n this.remainder = str.substr(partialEnding.index);\n str = str.substr(0, partialEnding.index);\n }\n\n this.decodeChunks(str);\n }\n\n finalize() {\n if (this.remainder.length) {\n this.decodeChunks(this.remainder);\n this.remainder = '';\n }\n\n // convert an array of arraybuffers into a blob and then back into a single arraybuffer\n return blobToArrayBuffer(new Blob(this.chunks, { type: 'application/octet-stream' }));\n }\n}\n", "import { getDecoder, decodeParameterValueContinuations, textEncoder } from './decode-strings.js';\nimport PassThroughDecoder from './pass-through-decoder.js';\nimport Base64Decoder from './base64-decoder.js';\nimport QPDecoder from './qp-decoder.js';\n\nexport default class MimeNode {\n constructor(options) {\n this.options = options || {};\n\n this.postalMime = this.options.postalMime;\n\n this.root = !!this.options.parentNode;\n this.childNodes = [];\n\n if (this.options.parentNode) {\n this.parentNode = this.options.parentNode;\n\n this.depth = this.parentNode.depth + 1;\n if (this.depth > this.options.maxNestingDepth) {\n throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);\n }\n\n this.options.parentNode.childNodes.push(this);\n } else {\n this.depth = 0;\n }\n\n this.state = 'header';\n\n this.headerLines = [];\n this.headerSize = 0;\n\n this.contentType = {\n value: 'text/plain',\n default: true\n };\n\n this.contentTransferEncoding = {\n value: '8bit'\n };\n\n this.contentDisposition = {\n value: ''\n };\n\n this.headers = [];\n\n this.contentDecoder = false;\n }\n\n setupContentDecoder(transferEncoding) {\n if (/base64/i.test(transferEncoding)) {\n this.contentDecoder = new Base64Decoder();\n } else if (/quoted-printable/i.test(transferEncoding)) {\n this.contentDecoder = new QPDecoder({ decoder: getDecoder(this.contentType.parsed.params.charset) });\n } else {\n this.contentDecoder = new PassThroughDecoder();\n }\n }\n\n async finalize() {\n if (this.state === 'finished') {\n return;\n }\n\n if (this.state === 'header') {\n this.processHeaders();\n }\n\n // remove self from boundary listing\n let boundaries = this.postalMime.boundaries;\n for (let i = boundaries.length - 1; i >= 0; i--) {\n let boundary = boundaries[i];\n if (boundary.node === this) {\n boundaries.splice(i, 1);\n break;\n }\n }\n\n await this.finalizeChildNodes();\n\n this.content = this.contentDecoder ? await this.contentDecoder.finalize() : null;\n\n this.state = 'finished';\n }\n\n async finalizeChildNodes() {\n for (let childNode of this.childNodes) {\n await childNode.finalize();\n }\n }\n\n parseStructuredHeader(str) {\n let response = {\n value: false,\n params: {}\n };\n\n let key = false;\n let value = '';\n let stage = 'value';\n\n let quote = false;\n let escaped = false;\n let chr;\n\n for (let i = 0, len = str.length; i < len; i++) {\n chr = str.charAt(i);\n switch (stage) {\n case 'key':\n if (chr === '=') {\n key = value.trim().toLowerCase();\n stage = 'value';\n value = '';\n break;\n }\n value += chr;\n break;\n case 'value':\n if (escaped) {\n value += chr;\n } else if (chr === '\\\\') {\n escaped = true;\n continue;\n } else if (quote && chr === quote) {\n quote = false;\n } else if (!quote && chr === '\"') {\n quote = chr;\n } else if (!quote && chr === ';') {\n if (key === false) {\n response.value = value.trim();\n } else {\n response.params[key] = value.trim();\n }\n stage = 'key';\n value = '';\n } else {\n value += chr;\n }\n escaped = false;\n break;\n }\n }\n\n // finalize remainder\n value = value.trim();\n if (stage === 'value') {\n if (key === false) {\n // default value\n response.value = value;\n } else {\n // subkey value\n response.params[key] = value;\n }\n } else if (value) {\n // treat as key without value, see emptykey:\n // Header-Key: somevalue; key=value; emptykey\n response.params[value.toLowerCase()] = '';\n }\n\n if (response.value) {\n response.value = response.value.toLowerCase();\n }\n\n // convert Parameter Value Continuations into single strings\n decodeParameterValueContinuations(response);\n\n return response;\n }\n\n decodeFlowedText(str, delSp) {\n return (\n str\n .split(/\\r?\\n/)\n // remove soft linebreaks\n // soft linebreaks are added after space symbols\n .reduce((previousValue, currentValue) => {\n if (/ $/.test(previousValue) && !/(^|\\n)-- $/.test(previousValue)) {\n if (delSp) {\n // delsp adds space to text to be able to fold it\n // these spaces can be removed once the text is unfolded\n return previousValue.slice(0, -1) + currentValue;\n } else {\n return previousValue + currentValue;\n }\n } else {\n return previousValue + '\\n' + currentValue;\n }\n })\n // remove whitespace stuffing\n // http://tools.ietf.org/html/rfc3676#section-4.4\n .replace(/^ /gm, '')\n );\n }\n\n getTextContent() {\n if (!this.content) {\n return '';\n }\n\n let str = getDecoder(this.contentType.parsed.params.charset).decode(this.content);\n\n if (/^flowed$/i.test(this.contentType.parsed.params.format)) {\n str = this.decodeFlowedText(str, /^yes$/i.test(this.contentType.parsed.params.delsp));\n }\n\n return str;\n }\n\n processHeaders() {\n for (let i = this.headerLines.length - 1; i >= 0; i--) {\n let line = this.headerLines[i];\n if (i && /^\\s/.test(line)) {\n this.headerLines[i - 1] += '\\n' + line;\n this.headerLines.splice(i, 1);\n } else {\n // remove folding and extra WS\n line = line.replace(/\\s+/g, ' ');\n let sep = line.indexOf(':');\n let key = sep < 0 ? line.trim() : line.substr(0, sep).trim();\n let value = sep < 0 ? '' : line.substr(sep + 1).trim();\n this.headers.push({ key: key.toLowerCase(), originalKey: key, value });\n\n switch (key.toLowerCase()) {\n case 'content-type':\n if (this.contentType.default) {\n this.contentType = { value, parsed: {} };\n }\n break;\n case 'content-transfer-encoding':\n this.contentTransferEncoding = { value, parsed: {} };\n break;\n case 'content-disposition':\n this.contentDisposition = { value, parsed: {} };\n break;\n case 'content-id':\n this.contentId = value;\n break;\n case 'content-description':\n this.contentDescription = value;\n break;\n }\n }\n }\n\n this.contentType.parsed = this.parseStructuredHeader(this.contentType.value);\n this.contentType.multipart = /^multipart\\//i.test(this.contentType.parsed.value)\n ? this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf('/') + 1)\n : false;\n\n if (this.contentType.multipart && this.contentType.parsed.params.boundary) {\n // add self to boundary terminator listing\n this.postalMime.boundaries.push({\n value: textEncoder.encode(this.contentType.parsed.params.boundary),\n node: this\n });\n }\n\n this.contentDisposition.parsed = this.parseStructuredHeader(this.contentDisposition.value);\n\n this.contentTransferEncoding.encoding = this.contentTransferEncoding.value\n .toLowerCase()\n .split(/[^\\w-]/)\n .shift();\n\n this.setupContentDecoder(this.contentTransferEncoding.encoding);\n }\n\n feed(line) {\n switch (this.state) {\n case 'header':\n if (!line.length) {\n this.state = 'body';\n return this.processHeaders();\n }\n\n this.headerSize += line.length;\n\n if (this.headerSize > this.options.maxHeadersSize) {\n let error = new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);\n throw error;\n }\n\n this.headerLines.push(getDecoder().decode(line));\n break;\n case 'body': {\n // add line to body\n this.contentDecoder.update(line);\n }\n }\n }\n}\n", "// Entity map from https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references\nexport const htmlEntities = {\n 'Æ': '\\u00C6',\n 'Æ': '\\u00C6',\n '&': '\\u0026',\n '&': '\\u0026',\n 'Á': '\\u00C1',\n 'Á': '\\u00C1',\n 'Ă': '\\u0102',\n 'Â': '\\u00C2',\n 'Â': '\\u00C2',\n 'А': '\\u0410',\n '𝔄': '\\uD835\\uDD04',\n 'À': '\\u00C0',\n 'À': '\\u00C0',\n 'Α': '\\u0391',\n 'Ā': '\\u0100',\n '⩓': '\\u2A53',\n 'Ą': '\\u0104',\n '𝔸': '\\uD835\\uDD38',\n '⁡': '\\u2061',\n 'Å': '\\u00C5',\n 'Å': '\\u00C5',\n '𝒜': '\\uD835\\uDC9C',\n '≔': '\\u2254',\n 'Ã': '\\u00C3',\n 'Ã': '\\u00C3',\n 'Ä': '\\u00C4',\n 'Ä': '\\u00C4',\n '∖': '\\u2216',\n '⫧': '\\u2AE7',\n '⌆': '\\u2306',\n 'Б': '\\u0411',\n '∵': '\\u2235',\n 'ℬ': '\\u212C',\n 'Β': '\\u0392',\n '𝔅': '\\uD835\\uDD05',\n '𝔹': '\\uD835\\uDD39',\n '˘': '\\u02D8',\n 'ℬ': '\\u212C',\n '≎': '\\u224E',\n 'Ч': '\\u0427',\n '©': '\\u00A9',\n '©': '\\u00A9',\n 'Ć': '\\u0106',\n '⋒': '\\u22D2',\n 'ⅅ': '\\u2145',\n 'ℭ': '\\u212D',\n 'Č': '\\u010C',\n 'Ç': '\\u00C7',\n 'Ç': '\\u00C7',\n 'Ĉ': '\\u0108',\n '∰': '\\u2230',\n 'Ċ': '\\u010A',\n '¸': '\\u00B8',\n '·': '\\u00B7',\n 'ℭ': '\\u212D',\n 'Χ': '\\u03A7',\n '⊙': '\\u2299',\n '⊖': '\\u2296',\n '⊕': '\\u2295',\n '⊗': '\\u2297',\n '∲': '\\u2232',\n '”': '\\u201D',\n '’': '\\u2019',\n '∷': '\\u2237',\n '⩴': '\\u2A74',\n '≡': '\\u2261',\n '∯': '\\u222F',\n '∮': '\\u222E',\n 'ℂ': '\\u2102',\n '∐': '\\u2210',\n '∳': '\\u2233',\n '⨯': '\\u2A2F',\n '𝒞': '\\uD835\\uDC9E',\n '⋓': '\\u22D3',\n '≍': '\\u224D',\n 'ⅅ': '\\u2145',\n '⤑': '\\u2911',\n 'Ђ': '\\u0402',\n 'Ѕ': '\\u0405',\n 'Џ': '\\u040F',\n '‡': '\\u2021',\n '↡': '\\u21A1',\n '⫤': '\\u2AE4',\n 'Ď': '\\u010E',\n 'Д': '\\u0414',\n '∇': '\\u2207',\n 'Δ': '\\u0394',\n '𝔇': '\\uD835\\uDD07',\n '´': '\\u00B4',\n '˙': '\\u02D9',\n '˝': '\\u02DD',\n '`': '\\u0060',\n '˜': '\\u02DC',\n '⋄': '\\u22C4',\n 'ⅆ': '\\u2146',\n '𝔻': '\\uD835\\uDD3B',\n '¨': '\\u00A8',\n '⃜': '\\u20DC',\n '≐': '\\u2250',\n '∯': '\\u222F',\n '¨': '\\u00A8',\n '⇓': '\\u21D3',\n '⇐': '\\u21D0',\n '⇔': '\\u21D4',\n '⫤': '\\u2AE4',\n '⟸': '\\u27F8',\n '⟺': '\\u27FA',\n '⟹': '\\u27F9',\n '⇒': '\\u21D2',\n '⊨': '\\u22A8',\n '⇑': '\\u21D1',\n '⇕': '\\u21D5',\n '∥': '\\u2225',\n '↓': '\\u2193',\n '⤓': '\\u2913',\n '⇵': '\\u21F5',\n '̑': '\\u0311',\n '⥐': '\\u2950',\n '⥞': '\\u295E',\n '↽': '\\u21BD',\n '⥖': '\\u2956',\n '⥟': '\\u295F',\n '⇁': '\\u21C1',\n '⥗': '\\u2957',\n '⊤': '\\u22A4',\n '↧': '\\u21A7',\n '⇓': '\\u21D3',\n '𝒟': '\\uD835\\uDC9F',\n 'Đ': '\\u0110',\n 'Ŋ': '\\u014A',\n 'Ð': '\\u00D0',\n 'Ð': '\\u00D0',\n 'É': '\\u00C9',\n 'É': '\\u00C9',\n 'Ě': '\\u011A',\n 'Ê': '\\u00CA',\n 'Ê': '\\u00CA',\n 'Э': '\\u042D',\n 'Ė': '\\u0116',\n '𝔈': '\\uD835\\uDD08',\n 'È': '\\u00C8',\n 'È': '\\u00C8',\n '∈': '\\u2208',\n 'Ē': '\\u0112',\n '◻': '\\u25FB',\n '▫': '\\u25AB',\n 'Ę': '\\u0118',\n '𝔼': '\\uD835\\uDD3C',\n 'Ε': '\\u0395',\n '⩵': '\\u2A75',\n '≂': '\\u2242',\n '⇌': '\\u21CC',\n 'ℰ': '\\u2130',\n '⩳': '\\u2A73',\n 'Η': '\\u0397',\n 'Ë': '\\u00CB',\n 'Ë': '\\u00CB',\n '∃': '\\u2203',\n 'ⅇ': '\\u2147',\n 'Ф': '\\u0424',\n '𝔉': '\\uD835\\uDD09',\n '◼': '\\u25FC',\n '▪': '\\u25AA',\n '𝔽': '\\uD835\\uDD3D',\n '∀': '\\u2200',\n 'ℱ': '\\u2131',\n 'ℱ': '\\u2131',\n 'Ѓ': '\\u0403',\n '>': '\\u003E',\n '>': '\\u003E',\n 'Γ': '\\u0393',\n 'Ϝ': '\\u03DC',\n 'Ğ': '\\u011E',\n 'Ģ': '\\u0122',\n 'Ĝ': '\\u011C',\n 'Г': '\\u0413',\n 'Ġ': '\\u0120',\n '𝔊': '\\uD835\\uDD0A',\n '⋙': '\\u22D9',\n '𝔾': '\\uD835\\uDD3E',\n '≥': '\\u2265',\n '⋛': '\\u22DB',\n '≧': '\\u2267',\n '⪢': '\\u2AA2',\n '≷': '\\u2277',\n '⩾': '\\u2A7E',\n '≳': '\\u2273',\n '𝒢': '\\uD835\\uDCA2',\n '≫': '\\u226B',\n 'Ъ': '\\u042A',\n 'ˇ': '\\u02C7',\n '^': '\\u005E',\n 'Ĥ': '\\u0124',\n 'ℌ': '\\u210C',\n 'ℋ': '\\u210B',\n 'ℍ': '\\u210D',\n '─': '\\u2500',\n 'ℋ': '\\u210B',\n 'Ħ': '\\u0126',\n '≎': '\\u224E',\n '≏': '\\u224F',\n 'Е': '\\u0415',\n 'IJ': '\\u0132',\n 'Ё': '\\u0401',\n 'Í': '\\u00CD',\n 'Í': '\\u00CD',\n 'Î': '\\u00CE',\n 'Î': '\\u00CE',\n 'И': '\\u0418',\n 'İ': '\\u0130',\n 'ℑ': '\\u2111',\n 'Ì': '\\u00CC',\n 'Ì': '\\u00CC',\n 'ℑ': '\\u2111',\n 'Ī': '\\u012A',\n 'ⅈ': '\\u2148',\n '⇒': '\\u21D2',\n '∬': '\\u222C',\n '∫': '\\u222B',\n '⋂': '\\u22C2',\n '⁣': '\\u2063',\n '⁢': '\\u2062',\n 'Į': '\\u012E',\n '𝕀': '\\uD835\\uDD40',\n 'Ι': '\\u0399',\n 'ℐ': '\\u2110',\n 'Ĩ': '\\u0128',\n 'І': '\\u0406',\n 'Ï': '\\u00CF',\n 'Ï': '\\u00CF',\n 'Ĵ': '\\u0134',\n 'Й': '\\u0419',\n '𝔍': '\\uD835\\uDD0D',\n '𝕁': '\\uD835\\uDD41',\n '𝒥': '\\uD835\\uDCA5',\n 'Ј': '\\u0408',\n 'Є': '\\u0404',\n 'Х': '\\u0425',\n 'Ќ': '\\u040C',\n 'Κ': '\\u039A',\n 'Ķ': '\\u0136',\n 'К': '\\u041A',\n '𝔎': '\\uD835\\uDD0E',\n '𝕂': '\\uD835\\uDD42',\n '𝒦': '\\uD835\\uDCA6',\n 'Љ': '\\u0409',\n '<': '\\u003C',\n '<': '\\u003C',\n 'Ĺ': '\\u0139',\n 'Λ': '\\u039B',\n '⟪': '\\u27EA',\n 'ℒ': '\\u2112',\n '↞': '\\u219E',\n 'Ľ': '\\u013D',\n 'Ļ': '\\u013B',\n 'Л': '\\u041B',\n '⟨': '\\u27E8',\n '←': '\\u2190',\n '⇤': '\\u21E4',\n '⇆': '\\u21C6',\n '⌈': '\\u2308',\n '⟦': '\\u27E6',\n '⥡': '\\u2961',\n '⇃': '\\u21C3',\n '⥙': '\\u2959',\n '⌊': '\\u230A',\n '↔': '\\u2194',\n '⥎': '\\u294E',\n '⊣': '\\u22A3',\n '↤': '\\u21A4',\n '⥚': '\\u295A',\n '⊲': '\\u22B2',\n '⧏': '\\u29CF',\n '⊴': '\\u22B4',\n '⥑': '\\u2951',\n '⥠': '\\u2960',\n '↿': '\\u21BF',\n '⥘': '\\u2958',\n '↼': '\\u21BC',\n '⥒': '\\u2952',\n '⇐': '\\u21D0',\n '⇔': '\\u21D4',\n '⋚': '\\u22DA',\n '≦': '\\u2266',\n '≶': '\\u2276',\n '⪡': '\\u2AA1',\n '⩽': '\\u2A7D',\n '≲': '\\u2272',\n '𝔏': '\\uD835\\uDD0F',\n '⋘': '\\u22D8',\n '⇚': '\\u21DA',\n 'Ŀ': '\\u013F',\n '⟵': '\\u27F5',\n '⟷': '\\u27F7',\n '⟶': '\\u27F6',\n '⟸': '\\u27F8',\n '⟺': '\\u27FA',\n '⟹': '\\u27F9',\n '𝕃': '\\uD835\\uDD43',\n '↙': '\\u2199',\n '↘': '\\u2198',\n 'ℒ': '\\u2112',\n '↰': '\\u21B0',\n 'Ł': '\\u0141',\n '≪': '\\u226A',\n '⤅': '\\u2905',\n 'М': '\\u041C',\n ' ': '\\u205F',\n 'ℳ': '\\u2133',\n '𝔐': '\\uD835\\uDD10',\n '∓': '\\u2213',\n '𝕄': '\\uD835\\uDD44',\n 'ℳ': '\\u2133',\n 'Μ': '\\u039C',\n 'Њ': '\\u040A',\n 'Ń': '\\u0143',\n 'Ň': '\\u0147',\n 'Ņ': '\\u0145',\n 'Н': '\\u041D',\n '​': '\\u200B',\n '​': '\\u200B',\n '​': '\\u200B',\n '​': '\\u200B',\n '≫': '\\u226B',\n '≪': '\\u226A',\n ' ': '\\u000A',\n '𝔑': '\\uD835\\uDD11',\n '⁠': '\\u2060',\n ' ': '\\u00A0',\n 'ℕ': '\\u2115',\n '⫬': '\\u2AEC',\n '≢': '\\u2262',\n '≭': '\\u226D',\n '∦': '\\u2226',\n '∉': '\\u2209',\n '≠': '\\u2260',\n '≂̸': '\\u2242\\u0338',\n '∄': '\\u2204',\n '≯': '\\u226F',\n '≱': '\\u2271',\n '≧̸': '\\u2267\\u0338',\n '≫̸': '\\u226B\\u0338',\n '≹': '\\u2279',\n '⩾̸': '\\u2A7E\\u0338',\n '≵': '\\u2275',\n '≎̸': '\\u224E\\u0338',\n '≏̸': '\\u224F\\u0338',\n '⋪': '\\u22EA',\n '⧏̸': '\\u29CF\\u0338',\n '⋬': '\\u22EC',\n '≮': '\\u226E',\n '≰': '\\u2270',\n '≸': '\\u2278',\n '≪̸': '\\u226A\\u0338',\n '⩽̸': '\\u2A7D\\u0338',\n '≴': '\\u2274',\n '⪢̸': '\\u2AA2\\u0338',\n '⪡̸': '\\u2AA1\\u0338',\n '⊀': '\\u2280',\n '⪯̸': '\\u2AAF\\u0338',\n '⋠': '\\u22E0',\n '∌': '\\u220C',\n '⋫': '\\u22EB',\n '⧐̸': '\\u29D0\\u0338',\n '⋭': '\\u22ED',\n '⊏̸': '\\u228F\\u0338',\n '⋢': '\\u22E2',\n '⊐̸': '\\u2290\\u0338',\n '⋣': '\\u22E3',\n '⊂⃒': '\\u2282\\u20D2',\n '⊈': '\\u2288',\n '⊁': '\\u2281',\n '⪰̸': '\\u2AB0\\u0338',\n '⋡': '\\u22E1',\n '≿̸': '\\u227F\\u0338',\n '⊃⃒': '\\u2283\\u20D2',\n '⊉': '\\u2289',\n '≁': '\\u2241',\n '≄': '\\u2244',\n '≇': '\\u2247',\n '≉': '\\u2249',\n '∤': '\\u2224',\n '𝒩': '\\uD835\\uDCA9',\n 'Ñ': '\\u00D1',\n 'Ñ': '\\u00D1',\n 'Ν': '\\u039D',\n 'Œ': '\\u0152',\n 'Ó': '\\u00D3',\n 'Ó': '\\u00D3',\n 'Ô': '\\u00D4',\n 'Ô': '\\u00D4',\n 'О': '\\u041E',\n 'Ő': '\\u0150',\n '𝔒': '\\uD835\\uDD12',\n 'Ò': '\\u00D2',\n 'Ò': '\\u00D2',\n 'Ō': '\\u014C',\n 'Ω': '\\u03A9',\n 'Ο': '\\u039F',\n '𝕆': '\\uD835\\uDD46',\n '“': '\\u201C',\n '‘': '\\u2018',\n '⩔': '\\u2A54',\n '𝒪': '\\uD835\\uDCAA',\n 'Ø': '\\u00D8',\n 'Ø': '\\u00D8',\n 'Õ': '\\u00D5',\n 'Õ': '\\u00D5',\n '⨷': '\\u2A37',\n 'Ö': '\\u00D6',\n 'Ö': '\\u00D6',\n '‾': '\\u203E',\n '⏞': '\\u23DE',\n '⎴': '\\u23B4',\n '⏜': '\\u23DC',\n '∂': '\\u2202',\n 'П': '\\u041F',\n '𝔓': '\\uD835\\uDD13',\n 'Φ': '\\u03A6',\n 'Π': '\\u03A0',\n '±': '\\u00B1',\n 'ℌ': '\\u210C',\n 'ℙ': '\\u2119',\n '⪻': '\\u2ABB',\n '≺': '\\u227A',\n '⪯': '\\u2AAF',\n '≼': '\\u227C',\n '≾': '\\u227E',\n '″': '\\u2033',\n '∏': '\\u220F',\n '∷': '\\u2237',\n '∝': '\\u221D',\n '𝒫': '\\uD835\\uDCAB',\n 'Ψ': '\\u03A8',\n '"': '\\u0022',\n '"': '\\u0022',\n '𝔔': '\\uD835\\uDD14',\n 'ℚ': '\\u211A',\n '𝒬': '\\uD835\\uDCAC',\n '⤐': '\\u2910',\n '®': '\\u00AE',\n '®': '\\u00AE',\n 'Ŕ': '\\u0154',\n '⟫': '\\u27EB',\n '↠': '\\u21A0',\n '⤖': '\\u2916',\n 'Ř': '\\u0158',\n 'Ŗ': '\\u0156',\n 'Р': '\\u0420',\n 'ℜ': '\\u211C',\n '∋': '\\u220B',\n '⇋': '\\u21CB',\n '⥯': '\\u296F',\n 'ℜ': '\\u211C',\n 'Ρ': '\\u03A1',\n '⟩': '\\u27E9',\n '→': '\\u2192',\n '⇥': '\\u21E5',\n '⇄': '\\u21C4',\n '⌉': '\\u2309',\n '⟧': '\\u27E7',\n '⥝': '\\u295D',\n '⇂': '\\u21C2',\n '⥕': '\\u2955',\n '⌋': '\\u230B',\n '⊢': '\\u22A2',\n '↦': '\\u21A6',\n '⥛': '\\u295B',\n '⊳': '\\u22B3',\n '⧐': '\\u29D0',\n '⊵': '\\u22B5',\n '⥏': '\\u294F',\n '⥜': '\\u295C',\n '↾': '\\u21BE',\n '⥔': '\\u2954',\n '⇀': '\\u21C0',\n '⥓': '\\u2953',\n '⇒': '\\u21D2',\n 'ℝ': '\\u211D',\n '⥰': '\\u2970',\n '⇛': '\\u21DB',\n 'ℛ': '\\u211B',\n '↱': '\\u21B1',\n '⧴': '\\u29F4',\n 'Щ': '\\u0429',\n 'Ш': '\\u0428',\n 'Ь': '\\u042C',\n 'Ś': '\\u015A',\n '⪼': '\\u2ABC',\n 'Š': '\\u0160',\n 'Ş': '\\u015E',\n 'Ŝ': '\\u015C',\n 'С': '\\u0421',\n '𝔖': '\\uD835\\uDD16',\n '↓': '\\u2193',\n '←': '\\u2190',\n '→': '\\u2192',\n '↑': '\\u2191',\n 'Σ': '\\u03A3',\n '∘': '\\u2218',\n '𝕊': '\\uD835\\uDD4A',\n '√': '\\u221A',\n '□': '\\u25A1',\n '⊓': '\\u2293',\n '⊏': '\\u228F',\n '⊑': '\\u2291',\n '⊐': '\\u2290',\n '⊒': '\\u2292',\n '⊔': '\\u2294',\n '𝒮': '\\uD835\\uDCAE',\n '⋆': '\\u22C6',\n '⋐': '\\u22D0',\n '⋐': '\\u22D0',\n '⊆': '\\u2286',\n '≻': '\\u227B',\n '⪰': '\\u2AB0',\n '≽': '\\u227D',\n '≿': '\\u227F',\n '∋': '\\u220B',\n '∑': '\\u2211',\n '⋑': '\\u22D1',\n '⊃': '\\u2283',\n '⊇': '\\u2287',\n '⋑': '\\u22D1',\n 'Þ': '\\u00DE',\n 'Þ': '\\u00DE',\n '™': '\\u2122',\n 'Ћ': '\\u040B',\n 'Ц': '\\u0426',\n ' ': '\\u0009',\n 'Τ': '\\u03A4',\n 'Ť': '\\u0164',\n 'Ţ': '\\u0162',\n 'Т': '\\u0422',\n '𝔗': '\\uD835\\uDD17',\n '∴': '\\u2234',\n 'Θ': '\\u0398',\n '  ': '\\u205F\\u200A',\n ' ': '\\u2009',\n '∼': '\\u223C',\n '≃': '\\u2243',\n '≅': '\\u2245',\n '≈': '\\u2248',\n '𝕋': '\\uD835\\uDD4B',\n '⃛': '\\u20DB',\n '𝒯': '\\uD835\\uDCAF',\n 'Ŧ': '\\u0166',\n 'Ú': '\\u00DA',\n 'Ú': '\\u00DA',\n '↟': '\\u219F',\n '⥉': '\\u2949',\n 'Ў': '\\u040E',\n 'Ŭ': '\\u016C',\n 'Û': '\\u00DB',\n 'Û': '\\u00DB',\n 'У': '\\u0423',\n 'Ű': '\\u0170',\n '𝔘': '\\uD835\\uDD18',\n 'Ù': '\\u00D9',\n 'Ù': '\\u00D9',\n 'Ū': '\\u016A',\n '_': '\\u005F',\n '⏟': '\\u23DF',\n '⎵': '\\u23B5',\n '⏝': '\\u23DD',\n '⋃': '\\u22C3',\n '⊎': '\\u228E',\n 'Ų': '\\u0172',\n '𝕌': '\\uD835\\uDD4C',\n '↑': '\\u2191',\n '⤒': '\\u2912',\n '⇅': '\\u21C5',\n '↕': '\\u2195',\n '⥮': '\\u296E',\n '⊥': '\\u22A5',\n '↥': '\\u21A5',\n '⇑': '\\u21D1',\n '⇕': '\\u21D5',\n '↖': '\\u2196',\n '↗': '\\u2197',\n 'ϒ': '\\u03D2',\n 'Υ': '\\u03A5',\n 'Ů': '\\u016E',\n '𝒰': '\\uD835\\uDCB0',\n 'Ũ': '\\u0168',\n 'Ü': '\\u00DC',\n 'Ü': '\\u00DC',\n '⊫': '\\u22AB',\n '⫫': '\\u2AEB',\n 'В': '\\u0412',\n '⊩': '\\u22A9',\n '⫦': '\\u2AE6',\n '⋁': '\\u22C1',\n '‖': '\\u2016',\n '‖': '\\u2016',\n '∣': '\\u2223',\n '|': '\\u007C',\n '❘': '\\u2758',\n '≀': '\\u2240',\n ' ': '\\u200A',\n '𝔙': '\\uD835\\uDD19',\n '𝕍': '\\uD835\\uDD4D',\n '𝒱': '\\uD835\\uDCB1',\n '⊪': '\\u22AA',\n 'Ŵ': '\\u0174',\n '⋀': '\\u22C0',\n '𝔚': '\\uD835\\uDD1A',\n '𝕎': '\\uD835\\uDD4E',\n '𝒲': '\\uD835\\uDCB2',\n '𝔛': '\\uD835\\uDD1B',\n 'Ξ': '\\u039E',\n '𝕏': '\\uD835\\uDD4F',\n '𝒳': '\\uD835\\uDCB3',\n 'Я': '\\u042F',\n 'Ї': '\\u0407',\n 'Ю': '\\u042E',\n 'Ý': '\\u00DD',\n 'Ý': '\\u00DD',\n 'Ŷ': '\\u0176',\n 'Ы': '\\u042B',\n '𝔜': '\\uD835\\uDD1C',\n '𝕐': '\\uD835\\uDD50',\n '𝒴': '\\uD835\\uDCB4',\n 'Ÿ': '\\u0178',\n 'Ж': '\\u0416',\n 'Ź': '\\u0179',\n 'Ž': '\\u017D',\n 'З': '\\u0417',\n 'Ż': '\\u017B',\n '​': '\\u200B',\n 'Ζ': '\\u0396',\n 'ℨ': '\\u2128',\n 'ℤ': '\\u2124',\n '𝒵': '\\uD835\\uDCB5',\n 'á': '\\u00E1',\n 'á': '\\u00E1',\n 'ă': '\\u0103',\n '∾': '\\u223E',\n '∾̳': '\\u223E\\u0333',\n '∿': '\\u223F',\n 'â': '\\u00E2',\n 'â': '\\u00E2',\n '´': '\\u00B4',\n '´': '\\u00B4',\n 'а': '\\u0430',\n 'æ': '\\u00E6',\n 'æ': '\\u00E6',\n '⁡': '\\u2061',\n '𝔞': '\\uD835\\uDD1E',\n 'à': '\\u00E0',\n 'à': '\\u00E0',\n 'ℵ': '\\u2135',\n 'ℵ': '\\u2135',\n 'α': '\\u03B1',\n 'ā': '\\u0101',\n '⨿': '\\u2A3F',\n '&': '\\u0026',\n '&': '\\u0026',\n '∧': '\\u2227',\n '⩕': '\\u2A55',\n '⩜': '\\u2A5C',\n '⩘': '\\u2A58',\n '⩚': '\\u2A5A',\n '∠': '\\u2220',\n '⦤': '\\u29A4',\n '∠': '\\u2220',\n '∡': '\\u2221',\n '⦨': '\\u29A8',\n '⦩': '\\u29A9',\n '⦪': '\\u29AA',\n '⦫': '\\u29AB',\n '⦬': '\\u29AC',\n '⦭': '\\u29AD',\n '⦮': '\\u29AE',\n '⦯': '\\u29AF',\n '∟': '\\u221F',\n '⊾': '\\u22BE',\n '⦝': '\\u299D',\n '∢': '\\u2222',\n 'Å': '\\u00C5',\n '⍼': '\\u237C',\n 'ą': '\\u0105',\n '𝕒': '\\uD835\\uDD52',\n '≈': '\\u2248',\n '⩰': '\\u2A70',\n '⩯': '\\u2A6F',\n '≊': '\\u224A',\n '≋': '\\u224B',\n ''': '\\u0027',\n '≈': '\\u2248',\n '≊': '\\u224A',\n 'å': '\\u00E5',\n 'å': '\\u00E5',\n '𝒶': '\\uD835\\uDCB6',\n '*': '\\u002A',\n '≈': '\\u2248',\n '≍': '\\u224D',\n 'ã': '\\u00E3',\n 'ã': '\\u00E3',\n 'ä': '\\u00E4',\n 'ä': '\\u00E4',\n '∳': '\\u2233',\n '⨑': '\\u2A11',\n '⫭': '\\u2AED',\n '≌': '\\u224C',\n '϶': '\\u03F6',\n '‵': '\\u2035',\n '∽': '\\u223D',\n '⋍': '\\u22CD',\n '⊽': '\\u22BD',\n '⌅': '\\u2305',\n '⌅': '\\u2305',\n '⎵': '\\u23B5',\n '⎶': '\\u23B6',\n '≌': '\\u224C',\n 'б': '\\u0431',\n '„': '\\u201E',\n '∵': '\\u2235',\n '∵': '\\u2235',\n '⦰': '\\u29B0',\n '϶': '\\u03F6',\n 'ℬ': '\\u212C',\n 'β': '\\u03B2',\n 'ℶ': '\\u2136',\n '≬': '\\u226C',\n '𝔟': '\\uD835\\uDD1F',\n '⋂': '\\u22C2',\n '◯': '\\u25EF',\n '⋃': '\\u22C3',\n '⨀': '\\u2A00',\n '⨁': '\\u2A01',\n '⨂': '\\u2A02',\n '⨆': '\\u2A06',\n '★': '\\u2605',\n '▽': '\\u25BD',\n '△': '\\u25B3',\n '⨄': '\\u2A04',\n '⋁': '\\u22C1',\n '⋀': '\\u22C0',\n '⤍': '\\u290D',\n '⧫': '\\u29EB',\n '▪': '\\u25AA',\n '▴': '\\u25B4',\n '▾': '\\u25BE',\n '◂': '\\u25C2',\n '▸': '\\u25B8',\n '␣': '\\u2423',\n '▒': '\\u2592',\n '░': '\\u2591',\n '▓': '\\u2593',\n '█': '\\u2588',\n '=⃥': '\\u003D\\u20E5',\n '≡⃥': '\\u2261\\u20E5',\n '⌐': '\\u2310',\n '𝕓': '\\uD835\\uDD53',\n '⊥': '\\u22A5',\n '⊥': '\\u22A5',\n '⋈': '\\u22C8',\n '╗': '\\u2557',\n '╔': '\\u2554',\n '╖': '\\u2556',\n '╓': '\\u2553',\n '═': '\\u2550',\n '╦': '\\u2566',\n '╩': '\\u2569',\n '╤': '\\u2564',\n '╧': '\\u2567',\n '╝': '\\u255D',\n '╚': '\\u255A',\n '╜': '\\u255C',\n '╙': '\\u2559',\n '║': '\\u2551',\n '╬': '\\u256C',\n '╣': '\\u2563',\n '╠': '\\u2560',\n '╫': '\\u256B',\n '╢': '\\u2562',\n '╟': '\\u255F',\n '⧉': '\\u29C9',\n '╕': '\\u2555',\n '╒': '\\u2552',\n '┐': '\\u2510',\n '┌': '\\u250C',\n '─': '\\u2500',\n '╥': '\\u2565',\n '╨': '\\u2568',\n '┬': '\\u252C',\n '┴': '\\u2534',\n '⊟': '\\u229F',\n '⊞': '\\u229E',\n '⊠': '\\u22A0',\n '╛': '\\u255B',\n '╘': '\\u2558',\n '┘': '\\u2518',\n '└': '\\u2514',\n '│': '\\u2502',\n '╪': '\\u256A',\n '╡': '\\u2561',\n '╞': '\\u255E',\n '┼': '\\u253C',\n '┤': '\\u2524',\n '├': '\\u251C',\n '‵': '\\u2035',\n '˘': '\\u02D8',\n '¦': '\\u00A6',\n '¦': '\\u00A6',\n '𝒷': '\\uD835\\uDCB7',\n '⁏': '\\u204F',\n '∽': '\\u223D',\n '⋍': '\\u22CD',\n '\': '\\u005C',\n '⧅': '\\u29C5',\n '⟈': '\\u27C8',\n '•': '\\u2022',\n '•': '\\u2022',\n '≎': '\\u224E',\n '⪮': '\\u2AAE',\n '≏': '\\u224F',\n '≏': '\\u224F',\n 'ć': '\\u0107',\n '∩': '\\u2229',\n '⩄': '\\u2A44',\n '⩉': '\\u2A49',\n '⩋': '\\u2A4B',\n '⩇': '\\u2A47',\n '⩀': '\\u2A40',\n '∩︀': '\\u2229\\uFE00',\n '⁁': '\\u2041',\n 'ˇ': '\\u02C7',\n '⩍': '\\u2A4D',\n 'č': '\\u010D',\n 'ç': '\\u00E7',\n 'ç': '\\u00E7',\n 'ĉ': '\\u0109',\n '⩌': '\\u2A4C',\n '⩐': '\\u2A50',\n 'ċ': '\\u010B',\n '¸': '\\u00B8',\n '¸': '\\u00B8',\n '⦲': '\\u29B2',\n '¢': '\\u00A2',\n '¢': '\\u00A2',\n '·': '\\u00B7',\n '𝔠': '\\uD835\\uDD20',\n 'ч': '\\u0447',\n '✓': '\\u2713',\n '✓': '\\u2713',\n 'χ': '\\u03C7',\n '○': '\\u25CB',\n '⧃': '\\u29C3',\n 'ˆ': '\\u02C6',\n '≗': '\\u2257',\n '↺': '\\u21BA',\n '↻': '\\u21BB',\n '®': '\\u00AE',\n 'Ⓢ': '\\u24C8',\n '⊛': '\\u229B',\n '⊚': '\\u229A',\n '⊝': '\\u229D',\n '≗': '\\u2257',\n '⨐': '\\u2A10',\n '⫯': '\\u2AEF',\n '⧂': '\\u29C2',\n '♣': '\\u2663',\n '♣': '\\u2663',\n ':': '\\u003A',\n '≔': '\\u2254',\n '≔': '\\u2254',\n ',': '\\u002C',\n '@': '\\u0040',\n '∁': '\\u2201',\n '∘': '\\u2218',\n '∁': '\\u2201',\n 'ℂ': '\\u2102',\n '≅': '\\u2245',\n '⩭': '\\u2A6D',\n '∮': '\\u222E',\n '𝕔': '\\uD835\\uDD54',\n '∐': '\\u2210',\n '©': '\\u00A9',\n '©': '\\u00A9',\n '℗': '\\u2117',\n '↵': '\\u21B5',\n '✗': '\\u2717',\n '𝒸': '\\uD835\\uDCB8',\n '⫏': '\\u2ACF',\n '⫑': '\\u2AD1',\n '⫐': '\\u2AD0',\n '⫒': '\\u2AD2',\n '⋯': '\\u22EF',\n '⤸': '\\u2938',\n '⤵': '\\u2935',\n '⋞': '\\u22DE',\n '⋟': '\\u22DF',\n '↶': '\\u21B6',\n '⤽': '\\u293D',\n '∪': '\\u222A',\n '⩈': '\\u2A48',\n '⩆': '\\u2A46',\n '⩊': '\\u2A4A',\n '⊍': '\\u228D',\n '⩅': '\\u2A45',\n '∪︀': '\\u222A\\uFE00',\n '↷': '\\u21B7',\n '⤼': '\\u293C',\n '⋞': '\\u22DE',\n '⋟': '\\u22DF',\n '⋎': '\\u22CE',\n '⋏': '\\u22CF',\n '¤': '\\u00A4',\n '¤': '\\u00A4',\n '↶': '\\u21B6',\n '↷': '\\u21B7',\n '⋎': '\\u22CE',\n '⋏': '\\u22CF',\n '∲': '\\u2232',\n '∱': '\\u2231',\n '⌭': '\\u232D',\n '⇓': '\\u21D3',\n '⥥': '\\u2965',\n '†': '\\u2020',\n 'ℸ': '\\u2138',\n '↓': '\\u2193',\n '‐': '\\u2010',\n '⊣': '\\u22A3',\n '⤏': '\\u290F',\n '˝': '\\u02DD',\n 'ď': '\\u010F',\n 'д': '\\u0434',\n 'ⅆ': '\\u2146',\n '‡': '\\u2021',\n '⇊': '\\u21CA',\n '⩷': '\\u2A77',\n '°': '\\u00B0',\n '°': '\\u00B0',\n 'δ': '\\u03B4',\n '⦱': '\\u29B1',\n '⥿': '\\u297F',\n '𝔡': '\\uD835\\uDD21',\n '⇃': '\\u21C3',\n '⇂': '\\u21C2',\n '⋄': '\\u22C4',\n '⋄': '\\u22C4',\n '♦': '\\u2666',\n '♦': '\\u2666',\n '¨': '\\u00A8',\n 'ϝ': '\\u03DD',\n '⋲': '\\u22F2',\n '÷': '\\u00F7',\n '÷': '\\u00F7',\n '÷': '\\u00F7',\n '⋇': '\\u22C7',\n '⋇': '\\u22C7',\n 'ђ': '\\u0452',\n '⌞': '\\u231E',\n '⌍': '\\u230D',\n '$': '\\u0024',\n '𝕕': '\\uD835\\uDD55',\n '˙': '\\u02D9',\n '≐': '\\u2250',\n '≑': '\\u2251',\n '∸': '\\u2238',\n '∔': '\\u2214',\n '⊡': '\\u22A1',\n '⌆': '\\u2306',\n '↓': '\\u2193',\n '⇊': '\\u21CA',\n '⇃': '\\u21C3',\n '⇂': '\\u21C2',\n '⤐': '\\u2910',\n '⌟': '\\u231F',\n '⌌': '\\u230C',\n '𝒹': '\\uD835\\uDCB9',\n 'ѕ': '\\u0455',\n '⧶': '\\u29F6',\n 'đ': '\\u0111',\n '⋱': '\\u22F1',\n '▿': '\\u25BF',\n '▾': '\\u25BE',\n '⇵': '\\u21F5',\n '⥯': '\\u296F',\n '⦦': '\\u29A6',\n 'џ': '\\u045F',\n '⟿': '\\u27FF',\n '⩷': '\\u2A77',\n '≑': '\\u2251',\n 'é': '\\u00E9',\n 'é': '\\u00E9',\n '⩮': '\\u2A6E',\n 'ě': '\\u011B',\n '≖': '\\u2256',\n 'ê': '\\u00EA',\n 'ê': '\\u00EA',\n '≕': '\\u2255',\n 'э': '\\u044D',\n 'ė': '\\u0117',\n 'ⅇ': '\\u2147',\n '≒': '\\u2252',\n '𝔢': '\\uD835\\uDD22',\n '⪚': '\\u2A9A',\n 'è': '\\u00E8',\n 'è': '\\u00E8',\n '⪖': '\\u2A96',\n '⪘': '\\u2A98',\n '⪙': '\\u2A99',\n '⏧': '\\u23E7',\n 'ℓ': '\\u2113',\n '⪕': '\\u2A95',\n '⪗': '\\u2A97',\n 'ē': '\\u0113',\n '∅': '\\u2205',\n '∅': '\\u2205',\n '∅': '\\u2205',\n ' ': '\\u2004',\n ' ': '\\u2005',\n ' ': '\\u2003',\n 'ŋ': '\\u014B',\n ' ': '\\u2002',\n 'ę': '\\u0119',\n '𝕖': '\\uD835\\uDD56',\n '⋕': '\\u22D5',\n '⧣': '\\u29E3',\n '⩱': '\\u2A71',\n 'ε': '\\u03B5',\n 'ε': '\\u03B5',\n 'ϵ': '\\u03F5',\n '≖': '\\u2256',\n '≕': '\\u2255',\n '≂': '\\u2242',\n '⪖': '\\u2A96',\n '⪕': '\\u2A95',\n '=': '\\u003D',\n '≟': '\\u225F',\n '≡': '\\u2261',\n '⩸': '\\u2A78',\n '⧥': '\\u29E5',\n '≓': '\\u2253',\n '⥱': '\\u2971',\n 'ℯ': '\\u212F',\n '≐': '\\u2250',\n '≂': '\\u2242',\n 'η': '\\u03B7',\n 'ð': '\\u00F0',\n 'ð': '\\u00F0',\n 'ë': '\\u00EB',\n 'ë': '\\u00EB',\n '€': '\\u20AC',\n '!': '\\u0021',\n '∃': '\\u2203',\n 'ℰ': '\\u2130',\n 'ⅇ': '\\u2147',\n '≒': '\\u2252',\n 'ф': '\\u0444',\n '♀': '\\u2640',\n 'ffi': '\\uFB03',\n 'ff': '\\uFB00',\n 'ffl': '\\uFB04',\n '𝔣': '\\uD835\\uDD23',\n 'fi': '\\uFB01',\n 'fj': '\\u0066\\u006A',\n '♭': '\\u266D',\n 'fl': '\\uFB02',\n '▱': '\\u25B1',\n 'ƒ': '\\u0192',\n '𝕗': '\\uD835\\uDD57',\n '∀': '\\u2200',\n '⋔': '\\u22D4',\n '⫙': '\\u2AD9',\n '⨍': '\\u2A0D',\n '½': '\\u00BD',\n '½': '\\u00BD',\n '⅓': '\\u2153',\n '¼': '\\u00BC',\n '¼': '\\u00BC',\n '⅕': '\\u2155',\n '⅙': '\\u2159',\n '⅛': '\\u215B',\n '⅔': '\\u2154',\n '⅖': '\\u2156',\n '¾': '\\u00BE',\n '¾': '\\u00BE',\n '⅗': '\\u2157',\n '⅜': '\\u215C',\n '⅘': '\\u2158',\n '⅚': '\\u215A',\n '⅝': '\\u215D',\n '⅞': '\\u215E',\n '⁄': '\\u2044',\n '⌢': '\\u2322',\n '𝒻': '\\uD835\\uDCBB',\n '≧': '\\u2267',\n '⪌': '\\u2A8C',\n 'ǵ': '\\u01F5',\n 'γ': '\\u03B3',\n 'ϝ': '\\u03DD',\n '⪆': '\\u2A86',\n 'ğ': '\\u011F',\n 'ĝ': '\\u011D',\n 'г': '\\u0433',\n 'ġ': '\\u0121',\n '≥': '\\u2265',\n '⋛': '\\u22DB',\n '≥': '\\u2265',\n '≧': '\\u2267',\n '⩾': '\\u2A7E',\n '⩾': '\\u2A7E',\n '⪩': '\\u2AA9',\n '⪀': '\\u2A80',\n '⪂': '\\u2A82',\n '⪄': '\\u2A84',\n '⋛︀': '\\u22DB\\uFE00',\n '⪔': '\\u2A94',\n '𝔤': '\\uD835\\uDD24',\n '≫': '\\u226B',\n '⋙': '\\u22D9',\n 'ℷ': '\\u2137',\n 'ѓ': '\\u0453',\n '≷': '\\u2277',\n '⪒': '\\u2A92',\n '⪥': '\\u2AA5',\n '⪤': '\\u2AA4',\n '≩': '\\u2269',\n '⪊': '\\u2A8A',\n '⪊': '\\u2A8A',\n '⪈': '\\u2A88',\n '⪈': '\\u2A88',\n '≩': '\\u2269',\n '⋧': '\\u22E7',\n '𝕘': '\\uD835\\uDD58',\n '`': '\\u0060',\n 'ℊ': '\\u210A',\n '≳': '\\u2273',\n '⪎': '\\u2A8E',\n '⪐': '\\u2A90',\n '>': '\\u003E',\n '>': '\\u003E',\n '⪧': '\\u2AA7',\n '⩺': '\\u2A7A',\n '⋗': '\\u22D7',\n '⦕': '\\u2995',\n '⩼': '\\u2A7C',\n '⪆': '\\u2A86',\n '⥸': '\\u2978',\n '⋗': '\\u22D7',\n '⋛': '\\u22DB',\n '⪌': '\\u2A8C',\n '≷': '\\u2277',\n '≳': '\\u2273',\n '≩︀': '\\u2269\\uFE00',\n '≩︀': '\\u2269\\uFE00',\n '⇔': '\\u21D4',\n ' ': '\\u200A',\n '½': '\\u00BD',\n 'ℋ': '\\u210B',\n 'ъ': '\\u044A',\n '↔': '\\u2194',\n '⥈': '\\u2948',\n '↭': '\\u21AD',\n 'ℏ': '\\u210F',\n 'ĥ': '\\u0125',\n '♥': '\\u2665',\n '♥': '\\u2665',\n '…': '\\u2026',\n '⊹': '\\u22B9',\n '𝔥': '\\uD835\\uDD25',\n '⤥': '\\u2925',\n '⤦': '\\u2926',\n '⇿': '\\u21FF',\n '∻': '\\u223B',\n '↩': '\\u21A9',\n '↪': '\\u21AA',\n '𝕙': '\\uD835\\uDD59',\n '―': '\\u2015',\n '𝒽': '\\uD835\\uDCBD',\n 'ℏ': '\\u210F',\n 'ħ': '\\u0127',\n '⁃': '\\u2043',\n '‐': '\\u2010',\n 'í': '\\u00ED',\n 'í': '\\u00ED',\n '⁣': '\\u2063',\n 'î': '\\u00EE',\n 'î': '\\u00EE',\n 'и': '\\u0438',\n 'е': '\\u0435',\n '¡': '\\u00A1',\n '¡': '\\u00A1',\n '⇔': '\\u21D4',\n '𝔦': '\\uD835\\uDD26',\n 'ì': '\\u00EC',\n 'ì': '\\u00EC',\n 'ⅈ': '\\u2148',\n '⨌': '\\u2A0C',\n '∭': '\\u222D',\n '⧜': '\\u29DC',\n '℩': '\\u2129',\n 'ij': '\\u0133',\n 'ī': '\\u012B',\n 'ℑ': '\\u2111',\n 'ℐ': '\\u2110',\n 'ℑ': '\\u2111',\n 'ı': '\\u0131',\n '⊷': '\\u22B7',\n 'Ƶ': '\\u01B5',\n '∈': '\\u2208',\n '℅': '\\u2105',\n '∞': '\\u221E',\n '⧝': '\\u29DD',\n 'ı': '\\u0131',\n '∫': '\\u222B',\n '⊺': '\\u22BA',\n 'ℤ': '\\u2124',\n '⊺': '\\u22BA',\n '⨗': '\\u2A17',\n '⨼': '\\u2A3C',\n 'ё': '\\u0451',\n 'į': '\\u012F',\n '𝕚': '\\uD835\\uDD5A',\n 'ι': '\\u03B9',\n '⨼': '\\u2A3C',\n '¿': '\\u00BF',\n '¿': '\\u00BF',\n '𝒾': '\\uD835\\uDCBE',\n '∈': '\\u2208',\n '⋹': '\\u22F9',\n '⋵': '\\u22F5',\n '⋴': '\\u22F4',\n '⋳': '\\u22F3',\n '∈': '\\u2208',\n '⁢': '\\u2062',\n 'ĩ': '\\u0129',\n 'і': '\\u0456',\n 'ï': '\\u00EF',\n 'ï': '\\u00EF',\n 'ĵ': '\\u0135',\n 'й': '\\u0439',\n '𝔧': '\\uD835\\uDD27',\n 'ȷ': '\\u0237',\n '𝕛': '\\uD835\\uDD5B',\n '𝒿': '\\uD835\\uDCBF',\n 'ј': '\\u0458',\n 'є': '\\u0454',\n 'κ': '\\u03BA',\n 'ϰ': '\\u03F0',\n 'ķ': '\\u0137',\n 'к': '\\u043A',\n '𝔨': '\\uD835\\uDD28',\n 'ĸ': '\\u0138',\n 'х': '\\u0445',\n 'ќ': '\\u045C',\n '𝕜': '\\uD835\\uDD5C',\n '𝓀': '\\uD835\\uDCC0',\n '⇚': '\\u21DA',\n '⇐': '\\u21D0',\n '⤛': '\\u291B',\n '⤎': '\\u290E',\n '≦': '\\u2266',\n '⪋': '\\u2A8B',\n '⥢': '\\u2962',\n 'ĺ': '\\u013A',\n '⦴': '\\u29B4',\n 'ℒ': '\\u2112',\n 'λ': '\\u03BB',\n '⟨': '\\u27E8',\n '⦑': '\\u2991',\n '⟨': '\\u27E8',\n '⪅': '\\u2A85',\n '«': '\\u00AB',\n '«': '\\u00AB',\n '←': '\\u2190',\n '⇤': '\\u21E4',\n '⤟': '\\u291F',\n '⤝': '\\u291D',\n '↩': '\\u21A9',\n '↫': '\\u21AB',\n '⤹': '\\u2939',\n '⥳': '\\u2973',\n '↢': '\\u21A2',\n '⪫': '\\u2AAB',\n '⤙': '\\u2919',\n '⪭': '\\u2AAD',\n '⪭︀': '\\u2AAD\\uFE00',\n '⤌': '\\u290C',\n '❲': '\\u2772',\n '{': '\\u007B',\n '[': '\\u005B',\n '⦋': '\\u298B',\n '⦏': '\\u298F',\n '⦍': '\\u298D',\n 'ľ': '\\u013E',\n 'ļ': '\\u013C',\n '⌈': '\\u2308',\n '{': '\\u007B',\n 'л': '\\u043B',\n '⤶': '\\u2936',\n '“': '\\u201C',\n '„': '\\u201E',\n '⥧': '\\u2967',\n '⥋': '\\u294B',\n '↲': '\\u21B2',\n '≤': '\\u2264',\n '←': '\\u2190',\n '↢': '\\u21A2',\n '↽': '\\u21BD',\n '↼': '\\u21BC',\n '⇇': '\\u21C7',\n '↔': '\\u2194',\n '⇆': '\\u21C6',\n '⇋': '\\u21CB',\n '↭': '\\u21AD',\n '⋋': '\\u22CB',\n '⋚': '\\u22DA',\n '≤': '\\u2264',\n '≦': '\\u2266',\n '⩽': '\\u2A7D',\n '⩽': '\\u2A7D',\n '⪨': '\\u2AA8',\n '⩿': '\\u2A7F',\n '⪁': '\\u2A81',\n '⪃': '\\u2A83',\n '⋚︀': '\\u22DA\\uFE00',\n '⪓': '\\u2A93',\n '⪅': '\\u2A85',\n '⋖': '\\u22D6',\n '⋚': '\\u22DA',\n '⪋': '\\u2A8B',\n '≶': '\\u2276',\n '≲': '\\u2272',\n '⥼': '\\u297C',\n '⌊': '\\u230A',\n '𝔩': '\\uD835\\uDD29',\n '≶': '\\u2276',\n '⪑': '\\u2A91',\n '↽': '\\u21BD',\n '↼': '\\u21BC',\n '⥪': '\\u296A',\n '▄': '\\u2584',\n 'љ': '\\u0459',\n '≪': '\\u226A',\n '⇇': '\\u21C7',\n '⌞': '\\u231E',\n '⥫': '\\u296B',\n '◺': '\\u25FA',\n 'ŀ': '\\u0140',\n '⎰': '\\u23B0',\n '⎰': '\\u23B0',\n '≨': '\\u2268',\n '⪉': '\\u2A89',\n '⪉': '\\u2A89',\n '⪇': '\\u2A87',\n '⪇': '\\u2A87',\n '≨': '\\u2268',\n '⋦': '\\u22E6',\n '⟬': '\\u27EC',\n '⇽': '\\u21FD',\n '⟦': '\\u27E6',\n '⟵': '\\u27F5',\n '⟷': '\\u27F7',\n '⟼': '\\u27FC',\n '⟶': '\\u27F6',\n '↫': '\\u21AB',\n '↬': '\\u21AC',\n '⦅': '\\u2985',\n '𝕝': '\\uD835\\uDD5D',\n '⨭': '\\u2A2D',\n '⨴': '\\u2A34',\n '∗': '\\u2217',\n '_': '\\u005F',\n '◊': '\\u25CA',\n '◊': '\\u25CA',\n '⧫': '\\u29EB',\n '(': '\\u0028',\n '⦓': '\\u2993',\n '⇆': '\\u21C6',\n '⌟': '\\u231F',\n '⇋': '\\u21CB',\n '⥭': '\\u296D',\n '‎': '\\u200E',\n '⊿': '\\u22BF',\n '‹': '\\u2039',\n '𝓁': '\\uD835\\uDCC1',\n '↰': '\\u21B0',\n '≲': '\\u2272',\n '⪍': '\\u2A8D',\n '⪏': '\\u2A8F',\n '[': '\\u005B',\n '‘': '\\u2018',\n '‚': '\\u201A',\n 'ł': '\\u0142',\n '<': '\\u003C',\n '<': '\\u003C',\n '⪦': '\\u2AA6',\n '⩹': '\\u2A79',\n '⋖': '\\u22D6',\n '⋋': '\\u22CB',\n '⋉': '\\u22C9',\n '⥶': '\\u2976',\n '⩻': '\\u2A7B',\n '⦖': '\\u2996',\n '◃': '\\u25C3',\n '⊴': '\\u22B4',\n '◂': '\\u25C2',\n '⥊': '\\u294A',\n '⥦': '\\u2966',\n '≨︀': '\\u2268\\uFE00',\n '≨︀': '\\u2268\\uFE00',\n '∺': '\\u223A',\n '¯': '\\u00AF',\n '¯': '\\u00AF',\n '♂': '\\u2642',\n '✠': '\\u2720',\n '✠': '\\u2720',\n '↦': '\\u21A6',\n '↦': '\\u21A6',\n '↧': '\\u21A7',\n '↤': '\\u21A4',\n '↥': '\\u21A5',\n '▮': '\\u25AE',\n '⨩': '\\u2A29',\n 'м': '\\u043C',\n '—': '\\u2014',\n '∡': '\\u2221',\n '𝔪': '\\uD835\\uDD2A',\n '℧': '\\u2127',\n 'µ': '\\u00B5',\n 'µ': '\\u00B5',\n '∣': '\\u2223',\n '*': '\\u002A',\n '⫰': '\\u2AF0',\n '·': '\\u00B7',\n '·': '\\u00B7',\n '−': '\\u2212',\n '⊟': '\\u229F',\n '∸': '\\u2238',\n '⨪': '\\u2A2A',\n '⫛': '\\u2ADB',\n '…': '\\u2026',\n '∓': '\\u2213',\n '⊧': '\\u22A7',\n '𝕞': '\\uD835\\uDD5E',\n '∓': '\\u2213',\n '𝓂': '\\uD835\\uDCC2',\n '∾': '\\u223E',\n 'μ': '\\u03BC',\n '⊸': '\\u22B8',\n '⊸': '\\u22B8',\n '⋙̸': '\\u22D9\\u0338',\n '≫⃒': '\\u226B\\u20D2',\n '≫̸': '\\u226B\\u0338',\n '⇍': '\\u21CD',\n '⇎': '\\u21CE',\n '⋘̸': '\\u22D8\\u0338',\n '≪⃒': '\\u226A\\u20D2',\n '≪̸': '\\u226A\\u0338',\n '⇏': '\\u21CF',\n '⊯': '\\u22AF',\n '⊮': '\\u22AE',\n '∇': '\\u2207',\n 'ń': '\\u0144',\n '∠⃒': '\\u2220\\u20D2',\n '≉': '\\u2249',\n '⩰̸': '\\u2A70\\u0338',\n '≋̸': '\\u224B\\u0338',\n 'ʼn': '\\u0149',\n '≉': '\\u2249',\n '♮': '\\u266E',\n '♮': '\\u266E',\n 'ℕ': '\\u2115',\n ' ': '\\u00A0',\n ' ': '\\u00A0',\n '≎̸': '\\u224E\\u0338',\n '≏̸': '\\u224F\\u0338',\n '⩃': '\\u2A43',\n 'ň': '\\u0148',\n 'ņ': '\\u0146',\n '≇': '\\u2247',\n '⩭̸': '\\u2A6D\\u0338',\n '⩂': '\\u2A42',\n 'н': '\\u043D',\n '–': '\\u2013',\n '≠': '\\u2260',\n '⇗': '\\u21D7',\n '⤤': '\\u2924',\n '↗': '\\u2197',\n '↗': '\\u2197',\n '≐̸': '\\u2250\\u0338',\n '≢': '\\u2262',\n '⤨': '\\u2928',\n '≂̸': '\\u2242\\u0338',\n '∄': '\\u2204',\n '∄': '\\u2204',\n '𝔫': '\\uD835\\uDD2B',\n '≧̸': '\\u2267\\u0338',\n '≱': '\\u2271',\n '≱': '\\u2271',\n '≧̸': '\\u2267\\u0338',\n '⩾̸': '\\u2A7E\\u0338',\n '⩾̸': '\\u2A7E\\u0338',\n '≵': '\\u2275',\n '≯': '\\u226F',\n '≯': '\\u226F',\n '⇎': '\\u21CE',\n '↮': '\\u21AE',\n '⫲': '\\u2AF2',\n '∋': '\\u220B',\n '⋼': '\\u22FC',\n '⋺': '\\u22FA',\n '∋': '\\u220B',\n 'њ': '\\u045A',\n '⇍': '\\u21CD',\n '≦̸': '\\u2266\\u0338',\n '↚': '\\u219A',\n '‥': '\\u2025',\n '≰': '\\u2270',\n '↚': '\\u219A',\n '↮': '\\u21AE',\n '≰': '\\u2270',\n '≦̸': '\\u2266\\u0338',\n '⩽̸': '\\u2A7D\\u0338',\n '⩽̸': '\\u2A7D\\u0338',\n '≮': '\\u226E',\n '≴': '\\u2274',\n '≮': '\\u226E',\n '⋪': '\\u22EA',\n '⋬': '\\u22EC',\n '∤': '\\u2224',\n '𝕟': '\\uD835\\uDD5F',\n '¬': '\\u00AC',\n '¬': '\\u00AC',\n '∉': '\\u2209',\n '⋹̸': '\\u22F9\\u0338',\n '⋵̸': '\\u22F5\\u0338',\n '∉': '\\u2209',\n '⋷': '\\u22F7',\n '⋶': '\\u22F6',\n '∌': '\\u220C',\n '∌': '\\u220C',\n '⋾': '\\u22FE',\n '⋽': '\\u22FD',\n '∦': '\\u2226',\n '∦': '\\u2226',\n '⫽⃥': '\\u2AFD\\u20E5',\n '∂̸': '\\u2202\\u0338',\n '⨔': '\\u2A14',\n '⊀': '\\u2280',\n '⋠': '\\u22E0',\n '⪯̸': '\\u2AAF\\u0338',\n '⊀': '\\u2280',\n '⪯̸': '\\u2AAF\\u0338',\n '⇏': '\\u21CF',\n '↛': '\\u219B',\n '⤳̸': '\\u2933\\u0338',\n '↝̸': '\\u219D\\u0338',\n '↛': '\\u219B',\n '⋫': '\\u22EB',\n '⋭': '\\u22ED',\n '⊁': '\\u2281',\n '⋡': '\\u22E1',\n '⪰̸': '\\u2AB0\\u0338',\n '𝓃': '\\uD835\\uDCC3',\n '∤': '\\u2224',\n '∦': '\\u2226',\n '≁': '\\u2241',\n '≄': '\\u2244',\n '≄': '\\u2244',\n '∤': '\\u2224',\n '∦': '\\u2226',\n '⋢': '\\u22E2',\n '⋣': '\\u22E3',\n '⊄': '\\u2284',\n '⫅̸': '\\u2AC5\\u0338',\n '⊈': '\\u2288',\n '⊂⃒': '\\u2282\\u20D2',\n '⊈': '\\u2288',\n '⫅̸': '\\u2AC5\\u0338',\n '⊁': '\\u2281',\n '⪰̸': '\\u2AB0\\u0338',\n '⊅': '\\u2285',\n '⫆̸': '\\u2AC6\\u0338',\n '⊉': '\\u2289',\n '⊃⃒': '\\u2283\\u20D2',\n '⊉': '\\u2289',\n '⫆̸': '\\u2AC6\\u0338',\n '≹': '\\u2279',\n 'ñ': '\\u00F1',\n 'ñ': '\\u00F1',\n '≸': '\\u2278',\n '⋪': '\\u22EA',\n '⋬': '\\u22EC',\n '⋫': '\\u22EB',\n '⋭': '\\u22ED',\n 'ν': '\\u03BD',\n '#': '\\u0023',\n '№': '\\u2116',\n ' ': '\\u2007',\n '⊭': '\\u22AD',\n '⤄': '\\u2904',\n '≍⃒': '\\u224D\\u20D2',\n '⊬': '\\u22AC',\n '≥⃒': '\\u2265\\u20D2',\n '>⃒': '\\u003E\\u20D2',\n '⧞': '\\u29DE',\n '⤂': '\\u2902',\n '≤⃒': '\\u2264\\u20D2',\n '<⃒': '\\u003C\\u20D2',\n '⊴⃒': '\\u22B4\\u20D2',\n '⤃': '\\u2903',\n '⊵⃒': '\\u22B5\\u20D2',\n '∼⃒': '\\u223C\\u20D2',\n '⇖': '\\u21D6',\n '⤣': '\\u2923',\n '↖': '\\u2196',\n '↖': '\\u2196',\n '⤧': '\\u2927',\n 'Ⓢ': '\\u24C8',\n 'ó': '\\u00F3',\n 'ó': '\\u00F3',\n '⊛': '\\u229B',\n '⊚': '\\u229A',\n 'ô': '\\u00F4',\n 'ô': '\\u00F4',\n 'о': '\\u043E',\n '⊝': '\\u229D',\n 'ő': '\\u0151',\n '⨸': '\\u2A38',\n '⊙': '\\u2299',\n '⦼': '\\u29BC',\n 'œ': '\\u0153',\n '⦿': '\\u29BF',\n '𝔬': '\\uD835\\uDD2C',\n '˛': '\\u02DB',\n 'ò': '\\u00F2',\n 'ò': '\\u00F2',\n '⧁': '\\u29C1',\n '⦵': '\\u29B5',\n 'Ω': '\\u03A9',\n '∮': '\\u222E',\n '↺': '\\u21BA',\n '⦾': '\\u29BE',\n '⦻': '\\u29BB',\n '‾': '\\u203E',\n '⧀': '\\u29C0',\n 'ō': '\\u014D',\n 'ω': '\\u03C9',\n 'ο': '\\u03BF',\n '⦶': '\\u29B6',\n '⊖': '\\u2296',\n '𝕠': '\\uD835\\uDD60',\n '⦷': '\\u29B7',\n '⦹': '\\u29B9',\n '⊕': '\\u2295',\n '∨': '\\u2228',\n '↻': '\\u21BB',\n '⩝': '\\u2A5D',\n 'ℴ': '\\u2134',\n 'ℴ': '\\u2134',\n 'ª': '\\u00AA',\n 'ª': '\\u00AA',\n 'º': '\\u00BA',\n 'º': '\\u00BA',\n '⊶': '\\u22B6',\n '⩖': '\\u2A56',\n '⩗': '\\u2A57',\n '⩛': '\\u2A5B',\n 'ℴ': '\\u2134',\n 'ø': '\\u00F8',\n 'ø': '\\u00F8',\n '⊘': '\\u2298',\n 'õ': '\\u00F5',\n 'õ': '\\u00F5',\n '⊗': '\\u2297',\n '⨶': '\\u2A36',\n 'ö': '\\u00F6',\n 'ö': '\\u00F6',\n '⌽': '\\u233D',\n '∥': '\\u2225',\n '¶': '\\u00B6',\n '¶': '\\u00B6',\n '∥': '\\u2225',\n '⫳': '\\u2AF3',\n '⫽': '\\u2AFD',\n '∂': '\\u2202',\n 'п': '\\u043F',\n '%': '\\u0025',\n '.': '\\u002E',\n '‰': '\\u2030',\n '⊥': '\\u22A5',\n '‱': '\\u2031',\n '𝔭': '\\uD835\\uDD2D',\n 'φ': '\\u03C6',\n 'ϕ': '\\u03D5',\n 'ℳ': '\\u2133',\n '☎': '\\u260E',\n 'π': '\\u03C0',\n '⋔': '\\u22D4',\n 'ϖ': '\\u03D6',\n 'ℏ': '\\u210F',\n 'ℎ': '\\u210E',\n 'ℏ': '\\u210F',\n '+': '\\u002B',\n '⨣': '\\u2A23',\n '⊞': '\\u229E',\n '⨢': '\\u2A22',\n '∔': '\\u2214',\n '⨥': '\\u2A25',\n '⩲': '\\u2A72',\n '±': '\\u00B1',\n '±': '\\u00B1',\n '⨦': '\\u2A26',\n '⨧': '\\u2A27',\n '±': '\\u00B1',\n '⨕': '\\u2A15',\n '𝕡': '\\uD835\\uDD61',\n '£': '\\u00A3',\n '£': '\\u00A3',\n '≺': '\\u227A',\n '⪳': '\\u2AB3',\n '⪷': '\\u2AB7',\n '≼': '\\u227C',\n '⪯': '\\u2AAF',\n '≺': '\\u227A',\n '⪷': '\\u2AB7',\n '≼': '\\u227C',\n '⪯': '\\u2AAF',\n '⪹': '\\u2AB9',\n '⪵': '\\u2AB5',\n '⋨': '\\u22E8',\n '≾': '\\u227E',\n '′': '\\u2032',\n 'ℙ': '\\u2119',\n '⪵': '\\u2AB5',\n '⪹': '\\u2AB9',\n '⋨': '\\u22E8',\n '∏': '\\u220F',\n '⌮': '\\u232E',\n '⌒': '\\u2312',\n '⌓': '\\u2313',\n '∝': '\\u221D',\n '∝': '\\u221D',\n '≾': '\\u227E',\n '⊰': '\\u22B0',\n '𝓅': '\\uD835\\uDCC5',\n 'ψ': '\\u03C8',\n ' ': '\\u2008',\n '𝔮': '\\uD835\\uDD2E',\n '⨌': '\\u2A0C',\n '𝕢': '\\uD835\\uDD62',\n '⁗': '\\u2057',\n '𝓆': '\\uD835\\uDCC6',\n 'ℍ': '\\u210D',\n '⨖': '\\u2A16',\n '?': '\\u003F',\n '≟': '\\u225F',\n '"': '\\u0022',\n '"': '\\u0022',\n '⇛': '\\u21DB',\n '⇒': '\\u21D2',\n '⤜': '\\u291C',\n '⤏': '\\u290F',\n '⥤': '\\u2964',\n '∽̱': '\\u223D\\u0331',\n 'ŕ': '\\u0155',\n '√': '\\u221A',\n '⦳': '\\u29B3',\n '⟩': '\\u27E9',\n '⦒': '\\u2992',\n '⦥': '\\u29A5',\n '⟩': '\\u27E9',\n '»': '\\u00BB',\n '»': '\\u00BB',\n '→': '\\u2192',\n '⥵': '\\u2975',\n '⇥': '\\u21E5',\n '⤠': '\\u2920',\n '⤳': '\\u2933',\n '⤞': '\\u291E',\n '↪': '\\u21AA',\n '↬': '\\u21AC',\n '⥅': '\\u2945',\n '⥴': '\\u2974',\n '↣': '\\u21A3',\n '↝': '\\u219D',\n '⤚': '\\u291A',\n '∶': '\\u2236',\n 'ℚ': '\\u211A',\n '⤍': '\\u290D',\n '❳': '\\u2773',\n '}': '\\u007D',\n ']': '\\u005D',\n '⦌': '\\u298C',\n '⦎': '\\u298E',\n '⦐': '\\u2990',\n 'ř': '\\u0159',\n 'ŗ': '\\u0157',\n '⌉': '\\u2309',\n '}': '\\u007D',\n 'р': '\\u0440',\n '⤷': '\\u2937',\n '⥩': '\\u2969',\n '”': '\\u201D',\n '”': '\\u201D',\n '↳': '\\u21B3',\n 'ℜ': '\\u211C',\n 'ℛ': '\\u211B',\n 'ℜ': '\\u211C',\n 'ℝ': '\\u211D',\n '▭': '\\u25AD',\n '®': '\\u00AE',\n '®': '\\u00AE',\n '⥽': '\\u297D',\n '⌋': '\\u230B',\n '𝔯': '\\uD835\\uDD2F',\n '⇁': '\\u21C1',\n '⇀': '\\u21C0',\n '⥬': '\\u296C',\n 'ρ': '\\u03C1',\n 'ϱ': '\\u03F1',\n '→': '\\u2192',\n '↣': '\\u21A3',\n '⇁': '\\u21C1',\n '⇀': '\\u21C0',\n '⇄': '\\u21C4',\n '⇌': '\\u21CC',\n '⇉': '\\u21C9',\n '↝': '\\u219D',\n '⋌': '\\u22CC',\n '˚': '\\u02DA',\n '≓': '\\u2253',\n '⇄': '\\u21C4',\n '⇌': '\\u21CC',\n '‏': '\\u200F',\n '⎱': '\\u23B1',\n '⎱': '\\u23B1',\n '⫮': '\\u2AEE',\n '⟭': '\\u27ED',\n '⇾': '\\u21FE',\n '⟧': '\\u27E7',\n '⦆': '\\u2986',\n '𝕣': '\\uD835\\uDD63',\n '⨮': '\\u2A2E',\n '⨵': '\\u2A35',\n ')': '\\u0029',\n '⦔': '\\u2994',\n '⨒': '\\u2A12',\n '⇉': '\\u21C9',\n '›': '\\u203A',\n '𝓇': '\\uD835\\uDCC7',\n '↱': '\\u21B1',\n ']': '\\u005D',\n '’': '\\u2019',\n '’': '\\u2019',\n '⋌': '\\u22CC',\n '⋊': '\\u22CA',\n '▹': '\\u25B9',\n '⊵': '\\u22B5',\n '▸': '\\u25B8',\n '⧎': '\\u29CE',\n '⥨': '\\u2968',\n '℞': '\\u211E',\n 'ś': '\\u015B',\n '‚': '\\u201A',\n '≻': '\\u227B',\n '⪴': '\\u2AB4',\n '⪸': '\\u2AB8',\n 'š': '\\u0161',\n '≽': '\\u227D',\n '⪰': '\\u2AB0',\n 'ş': '\\u015F',\n 'ŝ': '\\u015D',\n '⪶': '\\u2AB6',\n '⪺': '\\u2ABA',\n '⋩': '\\u22E9',\n '⨓': '\\u2A13',\n '≿': '\\u227F',\n 'с': '\\u0441',\n '⋅': '\\u22C5',\n '⊡': '\\u22A1',\n '⩦': '\\u2A66',\n '⇘': '\\u21D8',\n '⤥': '\\u2925',\n '↘': '\\u2198',\n '↘': '\\u2198',\n '§': '\\u00A7',\n '§': '\\u00A7',\n ';': '\\u003B',\n '⤩': '\\u2929',\n '∖': '\\u2216',\n '∖': '\\u2216',\n '✶': '\\u2736',\n '𝔰': '\\uD835\\uDD30',\n '⌢': '\\u2322',\n '♯': '\\u266F',\n 'щ': '\\u0449',\n 'ш': '\\u0448',\n '∣': '\\u2223',\n '∥': '\\u2225',\n '­': '\\u00AD',\n '­': '\\u00AD',\n 'σ': '\\u03C3',\n 'ς': '\\u03C2',\n 'ς': '\\u03C2',\n '∼': '\\u223C',\n '⩪': '\\u2A6A',\n '≃': '\\u2243',\n '≃': '\\u2243',\n '⪞': '\\u2A9E',\n '⪠': '\\u2AA0',\n '⪝': '\\u2A9D',\n '⪟': '\\u2A9F',\n '≆': '\\u2246',\n '⨤': '\\u2A24',\n '⥲': '\\u2972',\n '←': '\\u2190',\n '∖': '\\u2216',\n '⨳': '\\u2A33',\n '⧤': '\\u29E4',\n '∣': '\\u2223',\n '⌣': '\\u2323',\n '⪪': '\\u2AAA',\n '⪬': '\\u2AAC',\n '⪬︀': '\\u2AAC\\uFE00',\n 'ь': '\\u044C',\n '/': '\\u002F',\n '⧄': '\\u29C4',\n '⌿': '\\u233F',\n '𝕤': '\\uD835\\uDD64',\n '♠': '\\u2660',\n '♠': '\\u2660',\n '∥': '\\u2225',\n '⊓': '\\u2293',\n '⊓︀': '\\u2293\\uFE00',\n '⊔': '\\u2294',\n '⊔︀': '\\u2294\\uFE00',\n '⊏': '\\u228F',\n '⊑': '\\u2291',\n '⊏': '\\u228F',\n '⊑': '\\u2291',\n '⊐': '\\u2290',\n '⊒': '\\u2292',\n '⊐': '\\u2290',\n '⊒': '\\u2292',\n '□': '\\u25A1',\n '□': '\\u25A1',\n '▪': '\\u25AA',\n '▪': '\\u25AA',\n '→': '\\u2192',\n '𝓈': '\\uD835\\uDCC8',\n '∖': '\\u2216',\n '⌣': '\\u2323',\n '⋆': '\\u22C6',\n '☆': '\\u2606',\n '★': '\\u2605',\n 'ϵ': '\\u03F5',\n 'ϕ': '\\u03D5',\n '¯': '\\u00AF',\n '⊂': '\\u2282',\n '⫅': '\\u2AC5',\n '⪽': '\\u2ABD',\n '⊆': '\\u2286',\n '⫃': '\\u2AC3',\n '⫁': '\\u2AC1',\n '⫋': '\\u2ACB',\n '⊊': '\\u228A',\n '⪿': '\\u2ABF',\n '⥹': '\\u2979',\n '⊂': '\\u2282',\n '⊆': '\\u2286',\n '⫅': '\\u2AC5',\n '⊊': '\\u228A',\n '⫋': '\\u2ACB',\n '⫇': '\\u2AC7',\n '⫕': '\\u2AD5',\n '⫓': '\\u2AD3',\n '≻': '\\u227B',\n '⪸': '\\u2AB8',\n '≽': '\\u227D',\n '⪰': '\\u2AB0',\n '⪺': '\\u2ABA',\n '⪶': '\\u2AB6',\n '⋩': '\\u22E9',\n '≿': '\\u227F',\n '∑': '\\u2211',\n '♪': '\\u266A',\n '¹': '\\u00B9',\n '¹': '\\u00B9',\n '²': '\\u00B2',\n '²': '\\u00B2',\n '³': '\\u00B3',\n '³': '\\u00B3',\n '⊃': '\\u2283',\n '⫆': '\\u2AC6',\n '⪾': '\\u2ABE',\n '⫘': '\\u2AD8',\n '⊇': '\\u2287',\n '⫄': '\\u2AC4',\n '⟉': '\\u27C9',\n '⫗': '\\u2AD7',\n '⥻': '\\u297B',\n '⫂': '\\u2AC2',\n '⫌': '\\u2ACC',\n '⊋': '\\u228B',\n '⫀': '\\u2AC0',\n '⊃': '\\u2283',\n '⊇': '\\u2287',\n '⫆': '\\u2AC6',\n '⊋': '\\u228B',\n '⫌': '\\u2ACC',\n '⫈': '\\u2AC8',\n '⫔': '\\u2AD4',\n '⫖': '\\u2AD6',\n '⇙': '\\u21D9',\n '⤦': '\\u2926',\n '↙': '\\u2199',\n '↙': '\\u2199',\n '⤪': '\\u292A',\n 'ß': '\\u00DF',\n 'ß': '\\u00DF',\n '⌖': '\\u2316',\n 'τ': '\\u03C4',\n '⎴': '\\u23B4',\n 'ť': '\\u0165',\n 'ţ': '\\u0163',\n 'т': '\\u0442',\n '⃛': '\\u20DB',\n '⌕': '\\u2315',\n '𝔱': '\\uD835\\uDD31',\n '∴': '\\u2234',\n '∴': '\\u2234',\n 'θ': '\\u03B8',\n 'ϑ': '\\u03D1',\n 'ϑ': '\\u03D1',\n '≈': '\\u2248',\n '∼': '\\u223C',\n ' ': '\\u2009',\n '≈': '\\u2248',\n '∼': '\\u223C',\n 'þ': '\\u00FE',\n 'þ': '\\u00FE',\n '˜': '\\u02DC',\n '×': '\\u00D7',\n '×': '\\u00D7',\n '⊠': '\\u22A0',\n '⨱': '\\u2A31',\n '⨰': '\\u2A30',\n '∭': '\\u222D',\n '⤨': '\\u2928',\n '⊤': '\\u22A4',\n '⌶': '\\u2336',\n '⫱': '\\u2AF1',\n '𝕥': '\\uD835\\uDD65',\n '⫚': '\\u2ADA',\n '⤩': '\\u2929',\n '‴': '\\u2034',\n '™': '\\u2122',\n '▵': '\\u25B5',\n '▿': '\\u25BF',\n '◃': '\\u25C3',\n '⊴': '\\u22B4',\n '≜': '\\u225C',\n '▹': '\\u25B9',\n '⊵': '\\u22B5',\n '◬': '\\u25EC',\n '≜': '\\u225C',\n '⨺': '\\u2A3A',\n '⨹': '\\u2A39',\n '⧍': '\\u29CD',\n '⨻': '\\u2A3B',\n '⏢': '\\u23E2',\n '𝓉': '\\uD835\\uDCC9',\n 'ц': '\\u0446',\n 'ћ': '\\u045B',\n 'ŧ': '\\u0167',\n '≬': '\\u226C',\n '↞': '\\u219E',\n '↠': '\\u21A0',\n '⇑': '\\u21D1',\n '⥣': '\\u2963',\n 'ú': '\\u00FA',\n 'ú': '\\u00FA',\n '↑': '\\u2191',\n 'ў': '\\u045E',\n 'ŭ': '\\u016D',\n 'û': '\\u00FB',\n 'û': '\\u00FB',\n 'у': '\\u0443',\n '⇅': '\\u21C5',\n 'ű': '\\u0171',\n '⥮': '\\u296E',\n '⥾': '\\u297E',\n '𝔲': '\\uD835\\uDD32',\n 'ù': '\\u00F9',\n 'ù': '\\u00F9',\n '↿': '\\u21BF',\n '↾': '\\u21BE',\n '▀': '\\u2580',\n '⌜': '\\u231C',\n '⌜': '\\u231C',\n '⌏': '\\u230F',\n '◸': '\\u25F8',\n 'ū': '\\u016B',\n '¨': '\\u00A8',\n '¨': '\\u00A8',\n 'ų': '\\u0173',\n '𝕦': '\\uD835\\uDD66',\n '↑': '\\u2191',\n '↕': '\\u2195',\n '↿': '\\u21BF',\n '↾': '\\u21BE',\n '⊎': '\\u228E',\n 'υ': '\\u03C5',\n 'ϒ': '\\u03D2',\n 'υ': '\\u03C5',\n '⇈': '\\u21C8',\n '⌝': '\\u231D',\n '⌝': '\\u231D',\n '⌎': '\\u230E',\n 'ů': '\\u016F',\n '◹': '\\u25F9',\n '𝓊': '\\uD835\\uDCCA',\n '⋰': '\\u22F0',\n 'ũ': '\\u0169',\n '▵': '\\u25B5',\n '▴': '\\u25B4',\n '⇈': '\\u21C8',\n 'ü': '\\u00FC',\n 'ü': '\\u00FC',\n '⦧': '\\u29A7',\n '⇕': '\\u21D5',\n '⫨': '\\u2AE8',\n '⫩': '\\u2AE9',\n '⊨': '\\u22A8',\n '⦜': '\\u299C',\n 'ϵ': '\\u03F5',\n 'ϰ': '\\u03F0',\n '∅': '\\u2205',\n 'ϕ': '\\u03D5',\n 'ϖ': '\\u03D6',\n '∝': '\\u221D',\n '↕': '\\u2195',\n 'ϱ': '\\u03F1',\n 'ς': '\\u03C2',\n '⊊︀': '\\u228A\\uFE00',\n '⫋︀': '\\u2ACB\\uFE00',\n '⊋︀': '\\u228B\\uFE00',\n '⫌︀': '\\u2ACC\\uFE00',\n 'ϑ': '\\u03D1',\n '⊲': '\\u22B2',\n '⊳': '\\u22B3',\n 'в': '\\u0432',\n '⊢': '\\u22A2',\n '∨': '\\u2228',\n '⊻': '\\u22BB',\n '≚': '\\u225A',\n '⋮': '\\u22EE',\n '|': '\\u007C',\n '|': '\\u007C',\n '𝔳': '\\uD835\\uDD33',\n '⊲': '\\u22B2',\n '⊂⃒': '\\u2282\\u20D2',\n '⊃⃒': '\\u2283\\u20D2',\n '𝕧': '\\uD835\\uDD67',\n '∝': '\\u221D',\n '⊳': '\\u22B3',\n '𝓋': '\\uD835\\uDCCB',\n '⫋︀': '\\u2ACB\\uFE00',\n '⊊︀': '\\u228A\\uFE00',\n '⫌︀': '\\u2ACC\\uFE00',\n '⊋︀': '\\u228B\\uFE00',\n '⦚': '\\u299A',\n 'ŵ': '\\u0175',\n '⩟': '\\u2A5F',\n '∧': '\\u2227',\n '≙': '\\u2259',\n '℘': '\\u2118',\n '𝔴': '\\uD835\\uDD34',\n '𝕨': '\\uD835\\uDD68',\n '℘': '\\u2118',\n '≀': '\\u2240',\n '≀': '\\u2240',\n '𝓌': '\\uD835\\uDCCC',\n '⋂': '\\u22C2',\n '◯': '\\u25EF',\n '⋃': '\\u22C3',\n '▽': '\\u25BD',\n '𝔵': '\\uD835\\uDD35',\n '⟺': '\\u27FA',\n '⟷': '\\u27F7',\n 'ξ': '\\u03BE',\n '⟸': '\\u27F8',\n '⟵': '\\u27F5',\n '⟼': '\\u27FC',\n '⋻': '\\u22FB',\n '⨀': '\\u2A00',\n '𝕩': '\\uD835\\uDD69',\n '⨁': '\\u2A01',\n '⨂': '\\u2A02',\n '⟹': '\\u27F9',\n '⟶': '\\u27F6',\n '𝓍': '\\uD835\\uDCCD',\n '⨆': '\\u2A06',\n '⨄': '\\u2A04',\n '△': '\\u25B3',\n '⋁': '\\u22C1',\n '⋀': '\\u22C0',\n 'ý': '\\u00FD',\n 'ý': '\\u00FD',\n 'я': '\\u044F',\n 'ŷ': '\\u0177',\n 'ы': '\\u044B',\n '¥': '\\u00A5',\n '¥': '\\u00A5',\n '𝔶': '\\uD835\\uDD36',\n 'ї': '\\u0457',\n '𝕪': '\\uD835\\uDD6A',\n '𝓎': '\\uD835\\uDCCE',\n 'ю': '\\u044E',\n 'ÿ': '\\u00FF',\n 'ÿ': '\\u00FF',\n 'ź': '\\u017A',\n 'ž': '\\u017E',\n 'з': '\\u0437',\n 'ż': '\\u017C',\n 'ℨ': '\\u2128',\n 'ζ': '\\u03B6',\n '𝔷': '\\uD835\\uDD37',\n 'ж': '\\u0436',\n '⇝': '\\u21DD',\n '𝕫': '\\uD835\\uDD6B',\n '𝓏': '\\uD835\\uDCCF',\n '‍': '\\u200D',\n '‌': '\\u200C'\n};\n\nexport default htmlEntities;\n", "import htmlEntities from './html-entities.js';\n\nexport function decodeHTMLEntities(str) {\n return str.replace(/&(#\\d+|#x[a-f0-9]+|[a-z]+\\d*);?/gi, (match, entity) => {\n if (typeof htmlEntities[match] === 'string') {\n return htmlEntities[match];\n }\n\n if (entity.charAt(0) !== '#' || match.charAt(match.length - 1) !== ';') {\n // keep as is, invalid or unknown sequence\n return match;\n }\n\n let codePoint;\n if (entity.charAt(1) === 'x') {\n // hex\n codePoint = parseInt(entity.substr(2), 16);\n } else {\n // dec\n codePoint = parseInt(entity.substr(1), 10);\n }\n\n var output = '';\n\n if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {\n // Invalid range, return a replacement character instead\n return '\\uFFFD';\n }\n\n if (codePoint > 0xffff) {\n codePoint -= 0x10000;\n output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);\n codePoint = 0xdc00 | (codePoint & 0x3ff);\n }\n\n output += String.fromCharCode(codePoint);\n\n return output;\n });\n}\n\nexport function escapeHtml(str) {\n return str.trim().replace(/[<>\"'?&]/g, c => {\n let hex = c.charCodeAt(0).toString(16);\n if (hex.length < 2) {\n hex = '0' + hex;\n }\n return '&#x' + hex.toUpperCase() + ';';\n });\n}\n\nexport function textToHtml(str) {\n let html = escapeHtml(str).replace(/\\n/g, '
');\n return '
' + html + '
';\n}\n\nexport function htmlToText(str) {\n str = str\n // we can't process tags on multiple lines so remove newlines first\n .replace(/\\r?\\n/g, '\\u0001')\n .replace(/<\\!\\-\\-.*?\\-\\->/gi, ' ')\n\n .replace(/]*>/gi, '\\n')\n .replace(/<\\/?(p|div|table|tr|td|th)\\b[^>]*>/gi, '\\n\\n')\n .replace(/]*>.*?<\\/script\\b[^>]*>/gi, ' ')\n .replace(/^.*]*>/i, '')\n .replace(/^.*<\\/head\\b[^>]*>/i, '')\n .replace(/^.*<\\!doctype\\b[^>]*>/i, '')\n .replace(/<\\/body\\b[^>]*>.*$/i, '')\n .replace(/<\\/html\\b[^>]*>.*$/i, '')\n\n .replace(/]*href\\s*=\\s*[\"']?([^\\s\"']+)[^>]*>/gi, ' ($1) ')\n\n .replace(/<\\/?(span|em|i|strong|b|u|a)\\b[^>]*>/gi, '')\n\n .replace(/]*>[\\n\\u0001\\s]*/gi, '* ')\n\n .replace(/]*>/g, '\\n-------------\\n')\n\n .replace(/<[^>]*>/g, ' ')\n\n // convert linebreak placeholders back to newlines\n .replace(/\\u0001/g, '\\n')\n\n .replace(/[ \\t]+/g, ' ')\n\n .replace(/^\\s+$/gm, '')\n\n .replace(/\\n\\n+/g, '\\n\\n')\n .replace(/^\\n+/, '\\n')\n .replace(/\\n+$/, '\\n');\n\n str = decodeHTMLEntities(str);\n\n return str;\n}\n\nfunction formatTextAddress(address) {\n return []\n .concat(address.name || [])\n .concat(address.name ? `<${address.address}>` : address.address)\n .join(' ');\n}\n\nfunction formatTextAddresses(addresses) {\n let parts = [];\n\n let processAddress = (address, partCounter) => {\n if (partCounter) {\n parts.push(', ');\n }\n\n if (address.group) {\n let groupStart = `${address.name}:`;\n let groupEnd = `;`;\n\n parts.push(groupStart);\n address.group.forEach(processAddress);\n parts.push(groupEnd);\n } else {\n parts.push(formatTextAddress(address));\n }\n };\n\n addresses.forEach(processAddress);\n\n return parts.join('');\n}\n\nfunction formatHtmlAddress(address) {\n return ``;\n}\n\nfunction formatHtmlAddresses(addresses) {\n let parts = [];\n\n let processAddress = (address, partCounter) => {\n if (partCounter) {\n parts.push('');\n }\n\n if (address.group) {\n let groupStart = ``;\n let groupEnd = ``;\n\n parts.push(groupStart);\n address.group.forEach(processAddress);\n parts.push(groupEnd);\n } else {\n parts.push(formatHtmlAddress(address));\n }\n };\n\n addresses.forEach(processAddress);\n\n return parts.join(' ');\n}\n\nfunction foldLines(str, lineLength, afterSpace) {\n str = (str || '').toString();\n lineLength = lineLength || 76;\n\n let pos = 0,\n len = str.length,\n result = '',\n line,\n match;\n\n while (pos < len) {\n line = str.substr(pos, lineLength);\n if (line.length < lineLength) {\n result += line;\n break;\n }\n if ((match = line.match(/^[^\\n\\r]*(\\r?\\n|\\r)/))) {\n line = match[0];\n result += line;\n pos += line.length;\n continue;\n } else if (\n (match = line.match(/(\\s+)[^\\s]*$/)) &&\n match[0].length - (afterSpace ? (match[1] || '').length : 0) < line.length\n ) {\n line = line.substr(0, line.length - (match[0].length - (afterSpace ? (match[1] || '').length : 0)));\n } else if ((match = str.substr(pos + line.length).match(/^[^\\s]+(\\s*)/))) {\n line = line + match[0].substr(0, match[0].length - (!afterSpace ? (match[1] || '').length : 0));\n }\n\n result += line;\n pos += line.length;\n if (pos < len) {\n result += '\\r\\n';\n }\n }\n\n return result;\n}\n\nexport function formatTextHeader(message) {\n let rows = [];\n\n if (message.from) {\n rows.push({ key: 'From', val: formatTextAddress(message.from) });\n }\n\n if (message.subject) {\n rows.push({ key: 'Subject', val: message.subject });\n }\n\n if (message.date) {\n let dateOptions = {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hour12: false\n };\n\n let dateStr =\n typeof Intl === 'undefined'\n ? message.date\n : new Intl.DateTimeFormat('default', dateOptions).format(new Date(message.date));\n\n rows.push({ key: 'Date', val: dateStr });\n }\n\n if (message.to && message.to.length) {\n rows.push({ key: 'To', val: formatTextAddresses(message.to) });\n }\n\n if (message.cc && message.cc.length) {\n rows.push({ key: 'Cc', val: formatTextAddresses(message.cc) });\n }\n\n if (message.bcc && message.bcc.length) {\n rows.push({ key: 'Bcc', val: formatTextAddresses(message.bcc) });\n }\n\n // Align keys and values by adding space between these two\n // Also make sure that the separator line is as long as the longest line\n // Should end up with something like this:\n /*\n -----------------------------\n From: xx xx \n Subject: Example Subject\n Date: 16/02/2021, 02:57:06\n To: not@found.com\n -----------------------------\n */\n\n let maxKeyLength = rows\n .map(r => r.key.length)\n .reduce((acc, cur) => {\n return cur > acc ? cur : acc;\n }, 0);\n\n rows = rows.flatMap(row => {\n let sepLen = maxKeyLength - row.key.length;\n let prefix = `${row.key}: ${' '.repeat(sepLen)}`;\n let emptyPrefix = `${' '.repeat(row.key.length + 1)} ${' '.repeat(sepLen)}`;\n\n let foldedLines = foldLines(row.val, 80, true)\n .split(/\\r?\\n/)\n .map(line => line.trim());\n\n return foldedLines.map((line, i) => `${i ? emptyPrefix : prefix}${line}`);\n });\n\n let maxLineLength = rows\n .map(r => r.length)\n .reduce((acc, cur) => {\n return cur > acc ? cur : acc;\n }, 0);\n\n let lineMarker = '-'.repeat(maxLineLength);\n\n let template = `\n${lineMarker}\n${rows.join('\\n')}\n${lineMarker}\n`;\n\n return template;\n}\n\nexport function formatHtmlHeader(message) {\n let rows = [];\n\n if (message.from) {\n rows.push(\n ``\n );\n }\n\n if (message.subject) {\n rows.push(\n ``\n );\n }\n\n if (message.date) {\n let dateOptions = {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hour12: false\n };\n\n let dateStr =\n typeof Intl === 'undefined'\n ? message.date\n : new Intl.DateTimeFormat('default', dateOptions).format(new Date(message.date));\n\n rows.push(\n ``\n );\n }\n\n if (message.to && message.to.length) {\n rows.push(\n ``\n );\n }\n\n if (message.cc && message.cc.length) {\n rows.push(\n ``\n );\n }\n\n if (message.bcc && message.bcc.length) {\n rows.push(\n ``\n );\n }\n\n let template = ``;\n\n return template;\n}\n", "import { decodeWords } from './decode-strings.js';\n\n/**\n * Converts tokens for a single address into an address object\n *\n * @param {Array} tokens Tokens object\n * @return {Object} Address object\n */\nfunction _handleAddress(tokens) {\n let isGroup = false;\n let state = 'text';\n let address;\n let addresses = [];\n let data = {\n address: [],\n comment: [],\n group: [],\n text: [],\n textWasQuoted: [] // Track which text tokens came from inside quotes\n };\n let i;\n let len;\n let insideQuotes = false; // Track if we're currently inside a quoted string\n\n // Filter out , (comments) and regular text\n for (i = 0, len = tokens.length; i < len; i++) {\n let token = tokens[i];\n let prevToken = i ? tokens[i - 1] : null;\n if (token.type === 'operator') {\n switch (token.value) {\n case '<':\n state = 'address';\n insideQuotes = false;\n break;\n case '(':\n state = 'comment';\n insideQuotes = false;\n break;\n case ':':\n state = 'group';\n isGroup = true;\n insideQuotes = false;\n break;\n case '\"':\n // Track quote state for text tokens\n insideQuotes = !insideQuotes;\n state = 'text';\n break;\n default:\n state = 'text';\n insideQuotes = false;\n break;\n }\n } else if (token.value) {\n if (state === 'address') {\n // handle use case where unquoted name includes a \"<\"\n // Apple Mail truncates everything between an unexpected < and an address\n // and so will we\n token.value = token.value.replace(/^[^<]*<\\s*/, '');\n }\n\n if (prevToken && prevToken.noBreak && data[state].length) {\n // join values\n data[state][data[state].length - 1] += token.value;\n if (state === 'text' && insideQuotes) {\n data.textWasQuoted[data.textWasQuoted.length - 1] = true;\n }\n } else {\n data[state].push(token.value);\n if (state === 'text') {\n data.textWasQuoted.push(insideQuotes);\n }\n }\n }\n }\n\n // If there is no text but a comment, replace the two\n if (!data.text.length && data.comment.length) {\n data.text = data.comment;\n data.comment = [];\n }\n\n if (isGroup) {\n // http://tools.ietf.org/html/rfc2822#appendix-A.1.3\n data.text = data.text.join(' ');\n\n // Parse group members, but flatten any nested groups (RFC 5322 doesn't allow nesting)\n let groupMembers = [];\n if (data.group.length) {\n let parsedGroup = addressParser(data.group.join(','));\n // Flatten: if any member is itself a group, extract its members into the sequence\n parsedGroup.forEach(member => {\n if (member.group) {\n // Nested group detected - flatten it by adding its members directly\n groupMembers = groupMembers.concat(member.group);\n } else {\n groupMembers.push(member);\n }\n });\n }\n\n addresses.push({\n name: decodeWords(data.text || (address && address.name)),\n group: groupMembers\n });\n } else {\n // If no address was found, try to detect one from regular text\n if (!data.address.length && data.text.length) {\n for (i = data.text.length - 1; i >= 0; i--) {\n // Security fix: Do not extract email addresses from quoted strings\n // RFC 5321 allows @ inside quoted local-parts like \"user@domain\"@example.com\n // Extracting emails from quoted text leads to misrouting vulnerabilities\n if (!data.textWasQuoted[i] && data.text[i].match(/^[^@\\s]+@[^@\\s]+$/)) {\n data.address = data.text.splice(i, 1);\n data.textWasQuoted.splice(i, 1);\n break;\n }\n }\n\n let _regexHandler = function (address) {\n if (!data.address.length) {\n data.address = [address.trim()];\n return ' ';\n } else {\n return address;\n }\n };\n\n // still no address\n if (!data.address.length) {\n for (i = data.text.length - 1; i >= 0; i--) {\n // Security fix: Do not extract email addresses from quoted strings\n if (!data.textWasQuoted[i]) {\n // fixed the regex to parse email address correctly when email address has more than one @\n data.text[i] = data.text[i].replace(/\\s*\\b[^@\\s]+@[^\\s]+\\b\\s*/, _regexHandler).trim();\n if (data.address.length) {\n break;\n }\n }\n }\n }\n }\n\n // If there's still is no text but a comment exixts, replace the two\n if (!data.text.length && data.comment.length) {\n data.text = data.comment;\n data.comment = [];\n }\n\n // Keep only the first address occurence, push others to regular text\n if (data.address.length > 1) {\n data.text = data.text.concat(data.address.splice(1));\n }\n\n // Join values with spaces\n data.text = data.text.join(' ');\n data.address = data.address.join(' ');\n\n if (!data.address && /^=\\?[^=]+?=$/.test(data.text.trim())) {\n // try to extract words from text content\n const parsedSubAddresses = addressParser(decodeWords(data.text));\n if (parsedSubAddresses && parsedSubAddresses.length) {\n return parsedSubAddresses;\n }\n }\n\n if (!data.address && isGroup) {\n return [];\n } else {\n address = {\n address: data.address || data.text || '',\n name: decodeWords(data.text || data.address || '')\n };\n\n if (address.address === address.name) {\n if ((address.address || '').match(/@/)) {\n address.name = '';\n } else {\n address.address = '';\n }\n }\n\n addresses.push(address);\n }\n }\n\n return addresses;\n}\n\n/**\n * Creates a Tokenizer object for tokenizing address field strings\n *\n * @constructor\n * @param {String} str Address field string\n */\nclass Tokenizer {\n constructor(str) {\n this.str = (str || '').toString();\n this.operatorCurrent = '';\n this.operatorExpecting = '';\n this.node = null;\n this.escaped = false;\n\n this.list = [];\n /**\n * Operator tokens and which tokens are expected to end the sequence\n */\n this.operators = {\n '\"': '\"',\n '(': ')',\n '<': '>',\n ',': '',\n ':': ';',\n // Semicolons are not a legal delimiter per the RFC2822 grammar other\n // than for terminating a group, but they are also not valid for any\n // other use in this context. Given that some mail clients have\n // historically allowed the semicolon as a delimiter equivalent to the\n // comma in their UI, it makes sense to treat them the same as a comma\n // when used outside of a group.\n ';': ''\n };\n }\n\n /**\n * Tokenizes the original input string\n *\n * @return {Array} An array of operator|text tokens\n */\n tokenize() {\n let list = [];\n\n for (let i = 0, len = this.str.length; i < len; i++) {\n let chr = this.str.charAt(i);\n let nextChr = i < len - 1 ? this.str.charAt(i + 1) : null;\n this.checkChar(chr, nextChr);\n }\n\n this.list.forEach(node => {\n node.value = (node.value || '').toString().trim();\n if (node.value) {\n list.push(node);\n }\n });\n\n return list;\n }\n\n /**\n * Checks if a character is an operator or text and acts accordingly\n *\n * @param {String} chr Character from the address field\n */\n checkChar(chr, nextChr) {\n if (this.escaped) {\n // ignore next condition blocks\n } else if (chr === this.operatorExpecting) {\n this.node = {\n type: 'operator',\n value: chr\n };\n\n if (nextChr && ![' ', '\\t', '\\r', '\\n', ',', ';'].includes(nextChr)) {\n this.node.noBreak = true;\n }\n\n this.list.push(this.node);\n this.node = null;\n this.operatorExpecting = '';\n this.escaped = false;\n\n return;\n } else if (!this.operatorExpecting && chr in this.operators) {\n this.node = {\n type: 'operator',\n value: chr\n };\n this.list.push(this.node);\n this.node = null;\n this.operatorExpecting = this.operators[chr];\n this.escaped = false;\n return;\n } else if (['\"', \"'\"].includes(this.operatorExpecting) && chr === '\\\\') {\n this.escaped = true;\n return;\n }\n\n if (!this.node) {\n this.node = {\n type: 'text',\n value: ''\n };\n this.list.push(this.node);\n }\n\n if (chr === '\\n') {\n // Convert newlines to spaces. Carriage return is ignored as \\r and \\n usually\n // go together anyway and there already is a WS for \\n. Lone \\r means something is fishy.\n chr = ' ';\n }\n\n if (chr.charCodeAt(0) >= 0x21 || [' ', '\\t'].includes(chr)) {\n // skip command bytes\n this.node.value += chr;\n }\n\n this.escaped = false;\n }\n}\n\n/**\n * Parses structured e-mail addresses from an address field\n *\n * Example:\n *\n * 'Name '\n *\n * will be converted to\n *\n * [{name: 'Name', address: 'address@domain'}]\n *\n * @param {String} str Address field\n * @return {Array} An array of address objects\n */\nfunction addressParser(str, options) {\n options = options || {};\n\n let tokenizer = new Tokenizer(str);\n let tokens = tokenizer.tokenize();\n\n let addresses = [];\n let address = [];\n let parsedAddresses = [];\n\n tokens.forEach(token => {\n if (token.type === 'operator' && (token.value === ',' || token.value === ';')) {\n if (address.length) {\n addresses.push(address);\n }\n address = [];\n } else {\n address.push(token);\n }\n });\n\n if (address.length) {\n addresses.push(address);\n }\n\n addresses.forEach(address => {\n address = _handleAddress(address);\n if (address.length) {\n parsedAddresses = parsedAddresses.concat(address);\n }\n });\n\n if (options.flatten) {\n let addresses = [];\n let walkAddressList = list => {\n list.forEach(address => {\n if (address.group) {\n return walkAddressList(address.group);\n } else {\n addresses.push(address);\n }\n });\n };\n walkAddressList(parsedAddresses);\n return addresses;\n }\n\n return parsedAddresses;\n}\n\n// expose to the world\nexport default addressParser;\n", "// Code from: https://gist.githubusercontent.com/jonleighton/958841/raw/fb05a8632efb75d85d43deb593df04367ce48371/base64ArrayBuffer.js\n\n// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then\n// use window.btoa' step. According to my tests, this appears to be a faster approach:\n// http://jsperf.com/encoding-xhr-image-data/5\n\n/*\nMIT LICENSE\n\nCopyright 2011 Jon Leighton\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport function base64ArrayBuffer(arrayBuffer) {\n var base64 = '';\n var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n var bytes = new Uint8Array(arrayBuffer);\n var byteLength = bytes.byteLength;\n var byteRemainder = byteLength % 3;\n var mainLength = byteLength - byteRemainder;\n\n var a, b, c, d;\n var chunk;\n\n // Main loop deals with bytes in chunks of 3\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n\n // Use bitmasks to extract 6-bit segments from the triplet\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\n b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12\n c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6\n d = chunk & 63; // 63 = 2^6 - 1\n\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\n }\n\n // Deal with the remaining bytes and padding\n if (byteRemainder == 1) {\n chunk = bytes[mainLength];\n\n a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2\n\n // Set the 4 least significant bits to zero\n b = (chunk & 3) << 4; // 3 = 2^2 - 1\n\n base64 += encodings[a] + encodings[b] + '==';\n } else if (byteRemainder == 2) {\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];\n\n a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\n\n // Set the 2 least significant bits to zero\n c = (chunk & 15) << 2; // 15 = 2^4 - 1\n\n base64 += encodings[a] + encodings[b] + encodings[c] + '=';\n }\n\n return base64;\n}\n", "import MimeNode from './mime-node.js';\nimport { textToHtml, htmlToText, formatTextHeader, formatHtmlHeader } from './text-format.js';\nimport addressParser from './address-parser.js';\nimport { decodeWords, textEncoder, blobToArrayBuffer } from './decode-strings.js';\nimport { base64ArrayBuffer } from './base64-encoder.js';\n\nexport { addressParser, decodeWords };\n\nconst MAX_NESTING_DEPTH = 256;\nconst MAX_HEADERS_SIZE = 2 * 1024 * 1024;\n\nexport default class PostalMime {\n static parse(buf, options) {\n const parser = new PostalMime(options);\n return parser.parse(buf);\n }\n\n constructor(options) {\n this.options = options || {};\n this.mimeOptions = {\n maxNestingDepth: this.options.maxNestingDepth || MAX_NESTING_DEPTH,\n maxHeadersSize: this.options.maxHeadersSize || MAX_HEADERS_SIZE\n };\n\n this.root = this.currentNode = new MimeNode({\n postalMime: this,\n ...this.mimeOptions\n });\n this.boundaries = [];\n\n this.textContent = {};\n this.attachments = [];\n\n this.attachmentEncoding =\n (this.options.attachmentEncoding || '')\n .toString()\n .replace(/[-_\\s]/g, '')\n .trim()\n .toLowerCase() || 'arraybuffer';\n\n this.started = false;\n }\n\n async finalize() {\n // close all pending nodes\n await this.root.finalize();\n }\n\n async processLine(line, isFinal) {\n let boundaries = this.boundaries;\n\n // check if this is a mime boundary\n if (boundaries.length && line.length > 2 && line[0] === 0x2d && line[1] === 0x2d) {\n // could be a boundary marker\n for (let i = boundaries.length - 1; i >= 0; i--) {\n let boundary = boundaries[i];\n\n if (line.length !== boundary.value.length + 2 && line.length !== boundary.value.length + 4) {\n continue;\n }\n\n let isTerminator = line.length === boundary.value.length + 4;\n\n if (isTerminator && (line[line.length - 2] !== 0x2d || line[line.length - 1] !== 0x2d)) {\n continue;\n }\n\n let boudaryMatches = true;\n for (let i = 0; i < boundary.value.length; i++) {\n if (line[i + 2] !== boundary.value[i]) {\n boudaryMatches = false;\n break;\n }\n }\n if (!boudaryMatches) {\n continue;\n }\n\n if (isTerminator) {\n await boundary.node.finalize();\n\n this.currentNode = boundary.node.parentNode || this.root;\n } else {\n // finalize any open child nodes (should be just one though)\n await boundary.node.finalizeChildNodes();\n\n this.currentNode = new MimeNode({\n postalMime: this,\n parentNode: boundary.node,\n ...this.mimeOptions\n });\n }\n\n if (isFinal) {\n return this.finalize();\n }\n\n return;\n }\n }\n\n this.currentNode.feed(line);\n\n if (isFinal) {\n return this.finalize();\n }\n }\n\n readLine() {\n let startPos = this.readPos;\n let endPos = this.readPos;\n\n let res = () => {\n return {\n bytes: new Uint8Array(this.buf, startPos, endPos - startPos),\n done: this.readPos >= this.av.length\n };\n };\n\n while (this.readPos < this.av.length) {\n const c = this.av[this.readPos++];\n\n if (c !== 0x0d && c !== 0x0a) {\n endPos = this.readPos;\n }\n\n if (c === 0x0a) {\n return res();\n }\n }\n\n return res();\n }\n\n async processNodeTree() {\n // get text nodes\n\n let textContent = {};\n\n let textTypes = new Set();\n let textMap = (this.textMap = new Map());\n\n let forceRfc822Attachments = this.forceRfc822Attachments();\n\n let walk = async (node, alternative, related) => {\n alternative = alternative || false;\n related = related || false;\n\n if (!node.contentType.multipart) {\n // is it inline message/rfc822\n if (this.isInlineMessageRfc822(node) && !forceRfc822Attachments) {\n const subParser = new PostalMime();\n node.subMessage = await subParser.parse(node.content);\n\n if (!textMap.has(node)) {\n textMap.set(node, {});\n }\n\n let textEntry = textMap.get(node);\n\n // default to text if there is no content\n if (node.subMessage.text || !node.subMessage.html) {\n textEntry.plain = textEntry.plain || [];\n textEntry.plain.push({ type: 'subMessage', value: node.subMessage });\n textTypes.add('plain');\n }\n\n if (node.subMessage.html) {\n textEntry.html = textEntry.html || [];\n textEntry.html.push({ type: 'subMessage', value: node.subMessage });\n textTypes.add('html');\n }\n\n if (subParser.textMap) {\n subParser.textMap.forEach((subTextEntry, subTextNode) => {\n textMap.set(subTextNode, subTextEntry);\n });\n }\n\n for (let attachment of node.subMessage.attachments || []) {\n this.attachments.push(attachment);\n }\n }\n\n // is it text?\n else if (this.isInlineTextNode(node)) {\n let textType = node.contentType.parsed.value.substr(node.contentType.parsed.value.indexOf('/') + 1);\n\n let selectorNode = alternative || node;\n if (!textMap.has(selectorNode)) {\n textMap.set(selectorNode, {});\n }\n\n let textEntry = textMap.get(selectorNode);\n textEntry[textType] = textEntry[textType] || [];\n textEntry[textType].push({ type: 'text', value: node.getTextContent() });\n textTypes.add(textType);\n }\n\n // is it an attachment\n else if (node.content) {\n const filename =\n node.contentDisposition.parsed.params.filename || node.contentType.parsed.params.name || null;\n const attachment = {\n filename: filename ? decodeWords(filename) : null,\n mimeType: node.contentType.parsed.value,\n disposition: node.contentDisposition.parsed.value || null\n };\n\n if (related && node.contentId) {\n attachment.related = true;\n }\n\n if (node.contentDescription) {\n attachment.description = node.contentDescription;\n }\n\n if (node.contentId) {\n attachment.contentId = node.contentId;\n }\n\n switch (node.contentType.parsed.value) {\n // Special handling for calendar events\n case 'text/calendar':\n case 'application/ics': {\n if (node.contentType.parsed.params.method) {\n attachment.method = node.contentType.parsed.params.method\n .toString()\n .toUpperCase()\n .trim();\n }\n\n // Enforce into unicode\n const decodedText = node.getTextContent().replace(/\\r?\\n/g, '\\n').replace(/\\n*$/, '\\n');\n attachment.content = textEncoder.encode(decodedText);\n break;\n }\n\n // Regular attachments\n default:\n attachment.content = node.content;\n }\n\n this.attachments.push(attachment);\n }\n } else if (node.contentType.multipart === 'alternative') {\n alternative = node;\n } else if (node.contentType.multipart === 'related') {\n related = node;\n }\n\n for (let childNode of node.childNodes) {\n await walk(childNode, alternative, related);\n }\n };\n\n await walk(this.root, false, []);\n\n textMap.forEach(mapEntry => {\n textTypes.forEach(textType => {\n if (!textContent[textType]) {\n textContent[textType] = [];\n }\n\n if (mapEntry[textType]) {\n mapEntry[textType].forEach(textEntry => {\n switch (textEntry.type) {\n case 'text':\n textContent[textType].push(textEntry.value);\n break;\n\n case 'subMessage':\n {\n switch (textType) {\n case 'html':\n textContent[textType].push(formatHtmlHeader(textEntry.value));\n break;\n case 'plain':\n textContent[textType].push(formatTextHeader(textEntry.value));\n break;\n }\n }\n break;\n }\n });\n } else {\n let alternativeType;\n switch (textType) {\n case 'html':\n alternativeType = 'plain';\n break;\n case 'plain':\n alternativeType = 'html';\n break;\n }\n\n (mapEntry[alternativeType] || []).forEach(textEntry => {\n switch (textEntry.type) {\n case 'text':\n switch (textType) {\n case 'html':\n textContent[textType].push(textToHtml(textEntry.value));\n break;\n case 'plain':\n textContent[textType].push(htmlToText(textEntry.value));\n break;\n }\n break;\n\n case 'subMessage':\n {\n switch (textType) {\n case 'html':\n textContent[textType].push(formatHtmlHeader(textEntry.value));\n break;\n case 'plain':\n textContent[textType].push(formatTextHeader(textEntry.value));\n break;\n }\n }\n break;\n }\n });\n }\n });\n });\n\n Object.keys(textContent).forEach(textType => {\n textContent[textType] = textContent[textType].join('\\n');\n });\n\n this.textContent = textContent;\n }\n\n isInlineTextNode(node) {\n if (node.contentDisposition.parsed.value === 'attachment') {\n // no matter the type, this is an attachment\n return false;\n }\n\n switch (node.contentType.parsed.value) {\n case 'text/html':\n case 'text/plain':\n return true;\n\n case 'text/calendar':\n case 'text/csv':\n default:\n return false;\n }\n }\n\n isInlineMessageRfc822(node) {\n if (node.contentType.parsed.value !== 'message/rfc822') {\n return false;\n }\n let disposition =\n node.contentDisposition.parsed.value || (this.options.rfc822Attachments ? 'attachment' : 'inline');\n return disposition === 'inline';\n }\n\n // Check if this is a specially crafted report email where message/rfc822 content should not be inlined\n forceRfc822Attachments() {\n if (this.options.forceRfc822Attachments) {\n return true;\n }\n\n let forceRfc822Attachments = false;\n let walk = node => {\n if (!node.contentType.multipart) {\n if (['message/delivery-status', 'message/feedback-report'].includes(node.contentType.parsed.value)) {\n forceRfc822Attachments = true;\n }\n }\n\n for (let childNode of node.childNodes) {\n walk(childNode);\n }\n };\n walk(this.root);\n return forceRfc822Attachments;\n }\n\n async resolveStream(stream) {\n let chunkLen = 0;\n let chunks = [];\n const reader = stream.getReader();\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n chunks.push(value);\n chunkLen += value.length;\n }\n\n const result = new Uint8Array(chunkLen);\n let chunkPointer = 0;\n for (let chunk of chunks) {\n result.set(chunk, chunkPointer);\n chunkPointer += chunk.length;\n }\n\n return result;\n }\n\n async parse(buf) {\n if (this.started) {\n throw new Error('Can not reuse parser, create a new PostalMime object');\n }\n this.started = true;\n\n // Check if the input is a readable stream and resolve it into an ArrayBuffer\n if (buf && typeof buf.getReader === 'function') {\n buf = await this.resolveStream(buf);\n }\n\n // Should it throw for an empty value instead of defaulting to an empty ArrayBuffer?\n buf = buf || new ArrayBuffer(0);\n\n // Cast string input to Uint8Array\n if (typeof buf === 'string') {\n buf = textEncoder.encode(buf);\n }\n\n // Cast Blob to ArrayBuffer\n if (buf instanceof Blob || Object.prototype.toString.call(buf) === '[object Blob]') {\n buf = await blobToArrayBuffer(buf);\n }\n\n // Cast Node.js Buffer object or Uint8Array into ArrayBuffer\n if (buf.buffer instanceof ArrayBuffer) {\n buf = new Uint8Array(buf).buffer;\n }\n\n this.buf = buf;\n\n this.av = new Uint8Array(buf);\n this.readPos = 0;\n\n while (this.readPos < this.av.length) {\n const line = this.readLine();\n\n await this.processLine(line.bytes, line.done);\n }\n\n await this.processNodeTree();\n\n const message = {\n headers: this.root.headers.map(entry => ({ key: entry.key, value: entry.value })).reverse()\n };\n\n for (const key of ['from', 'sender']) {\n const addressHeader = this.root.headers.find(line => line.key === key);\n if (addressHeader && addressHeader.value) {\n const addresses = addressParser(addressHeader.value);\n if (addresses && addresses.length) {\n message[key] = addresses[0];\n }\n }\n }\n\n for (const key of ['delivered-to', 'return-path']) {\n const addressHeader = this.root.headers.find(line => line.key === key);\n if (addressHeader && addressHeader.value) {\n const addresses = addressParser(addressHeader.value);\n if (addresses && addresses.length && addresses[0].address) {\n const camelKey = key.replace(/\\-(.)/g, (o, c) => c.toUpperCase());\n message[camelKey] = addresses[0].address;\n }\n }\n }\n\n for (const key of ['to', 'cc', 'bcc', 'reply-to']) {\n const addressHeaders = this.root.headers.filter(line => line.key === key);\n let addresses = [];\n\n addressHeaders\n .filter(entry => entry && entry.value)\n .map(entry => addressParser(entry.value))\n .forEach(parsed => (addresses = addresses.concat(parsed || [])));\n\n if (addresses && addresses.length) {\n const camelKey = key.replace(/\\-(.)/g, (o, c) => c.toUpperCase());\n message[camelKey] = addresses;\n }\n }\n\n for (const key of ['subject', 'message-id', 'in-reply-to', 'references']) {\n const header = this.root.headers.find(line => line.key === key);\n if (header && header.value) {\n const camelKey = key.replace(/\\-(.)/g, (o, c) => c.toUpperCase());\n message[camelKey] = decodeWords(header.value);\n }\n }\n\n let dateHeader = this.root.headers.find(line => line.key === 'date');\n if (dateHeader) {\n let date = new Date(dateHeader.value);\n if (!date || date.toString() === 'Invalid Date') {\n date = dateHeader.value;\n } else {\n // enforce ISO format if seems to be a valid date\n date = date.toISOString();\n }\n message.date = date;\n }\n\n if (this.textContent?.html) {\n message.html = this.textContent.html;\n }\n\n if (this.textContent?.plain) {\n message.text = this.textContent.plain;\n }\n\n message.attachments = this.attachments;\n\n switch (this.attachmentEncoding) {\n case 'arraybuffer':\n break;\n\n case 'base64':\n for (let attachment of message.attachments || []) {\n if (attachment?.content) {\n attachment.content = base64ArrayBuffer(attachment.content);\n attachment.encoding = 'base64';\n }\n }\n break;\n\n case 'utf8':\n let attachmentDecoder = new TextDecoder('utf8');\n for (let attachment of message.attachments || []) {\n if (attachment?.content) {\n attachment.content = attachmentDecoder.decode(attachment.content);\n attachment.encoding = 'utf8';\n }\n }\n break;\n\n default:\n throw new Error('Unknwon attachment encoding');\n }\n\n return message;\n }\n}\n", "// worker/src/utils.ts\n/**\n * \u4F7F\u7528\u5BC6\u94A5\u5BF9\u6587\u672C\u8FDB\u884C\u7B80\u5355\u7684 XOR \u52A0\u5BC6\u3002\n * @param text \u8981\u52A0\u5BC6\u7684\u6587\u672C\u3002\n * @param secret \u52A0\u5BC6\u5BC6\u94A5\u3002\n * @returns \u52A0\u5BC6\u540E\u7684 Base64 \u7F16\u7801\u5B57\u7B26\u4E32\u3002\n */\nexport function encrypt(text: string, secret: string): string {\n let result = '';\n for (let i = 0; i < text.length; i++) {\n // \u5BF9\u6BCF\u4E2A\u5B57\u7B26\u7684 ASCII \u7801\u4E0E\u5BC6\u94A5\u4E2D\u5BF9\u5E94\u4F4D\u7F6E\u7684\u5B57\u7B26 ASCII \u7801\u8FDB\u884C\u5F02\u6216\u64CD\u4F5C\n result += String.fromCharCode(text.charCodeAt(i) ^ secret.charCodeAt(i % secret.length));\n }\n // \u5C06\u52A0\u5BC6\u540E\u7684\u7ED3\u679C\u8F6C\u6362\u4E3A Base64 \u7F16\u7801\uFF0C\u4F7F\u5176\u66F4\u5B89\u5168\u5730\u4F20\u8F93\n return btoa(result);\n}\n\n/**\n * \u4F7F\u7528\u5BC6\u94A5\u5BF9 Base64 \u7F16\u7801\u7684\u52A0\u5BC6\u6587\u672C\u8FDB\u884C\u89E3\u5BC6\u3002\n * @param encryptedText \u52A0\u5BC6\u540E\u7684 Base64 \u7F16\u7801\u5B57\u7B26\u4E32\u3002\n * @param secret \u89E3\u5BC6\u5BC6\u94A5\u3002\n * @returns \u89E3\u5BC6\u540E\u7684\u539F\u59CB\u6587\u672C\u3002\n */\nexport function decrypt(encryptedText: string, secret: string): string {\n // \u9996\u5148\u5BF9 Base64 \u7F16\u7801\u7684\u5B57\u7B26\u4E32\u8FDB\u884C\u89E3\u7801\n const text = atob(encryptedText);\n let result = '';\n for (let i = 0; i < text.length; i++) {\n // \u540C\u6837\u8FDB\u884C\u5F02\u6216\u64CD\u4F5C\u6765\u8FD8\u539F\u539F\u59CB\u5B57\u7B26\n result += String.fromCharCode(text.charCodeAt(i) ^ secret.charCodeAt(i % secret.length));\n }\n return result;\n}", "import { Context, Next } from 'hono';\nimport { getD1DB } from '../../../database/db';\nimport { findApiKeyByKey, updateApiKeyLastUsed } from '../../../database/dao';\nimport type { Env } from '../../../index';\n\n/**\n * API Key \u8BA4\u8BC1\u4E2D\u95F4\u4EF6\n * \u4ECE\u8BF7\u6C42\u5934 X-API-Key \u6216 Authorization: Bearer \u4E2D\u63D0\u53D6 API Key\n */\nexport const apiKeyAuth = async (c: Context<{ Bindings: Env }>, next: Next) => {\n // 1. \u63D0\u53D6 API Key\n let apiKey = c.req.header('X-API-Key');\n\n if (!apiKey) {\n const authHeader = c.req.header('Authorization');\n if (authHeader?.startsWith('Bearer ')) {\n apiKey = authHeader.substring(7);\n }\n }\n\n if (!apiKey) {\n return c.json({\n error: {\n code: 'UNAUTHORIZED',\n message: 'Missing API Key. Provide it via X-API-Key header or Authorization: Bearer ',\n }\n }, 401);\n }\n\n // 2. \u9A8C\u8BC1 API Key\n const db = getD1DB(c.env.DB);\n const keyRecord = await findApiKeyByKey(db, apiKey);\n\n if (!keyRecord) {\n return c.json({\n error: {\n code: 'UNAUTHORIZED',\n message: 'Invalid API Key',\n }\n }, 401);\n }\n\n // 3. \u68C0\u67E5\u662F\u5426\u542F\u7528\n if (!keyRecord.isActive) {\n return c.json({\n error: {\n code: 'FORBIDDEN',\n message: 'API Key is disabled',\n }\n }, 403);\n }\n\n // 4. \u68C0\u67E5\u662F\u5426\u8FC7\u671F\n if (keyRecord.expiresAt && keyRecord.expiresAt < new Date()) {\n return c.json({\n error: {\n code: 'FORBIDDEN',\n message: 'API Key has expired',\n }\n }, 403);\n }\n\n // 5. \u66F4\u65B0\u6700\u540E\u4F7F\u7528\u65F6\u95F4 (\u5F02\u6B65\uFF0C\u4E0D\u963B\u585E\u8BF7\u6C42)\n c.executionCtx.waitUntil(updateApiKeyLastUsed(db, keyRecord.id));\n\n // 6. \u5C06 API Key \u4FE1\u606F\u5B58\u5165\u4E0A\u4E0B\u6587\n c.set('apiKey', {\n id: keyRecord.id,\n rateLimit: keyRecord.rateLimit || 100,\n });\n\n await next();\n};\n", "import { Hono } from 'hono';\nimport type { Env } from '../../../index';\nimport { getD1DB } from '../../../database/db';\nimport { nanoid } from 'nanoid/non-secure';\nimport {\n insertMailbox,\n findMailboxById,\n getMailboxMessages,\n findMailboxMessage,\n deleteMailboxMessage,\n getMailboxMessageCount,\n} from '../../../database/dao';\n\n// \u968F\u673A\u90AE\u7BB1\u540D\u79F0\u751F\u6210\nfunction generateRandomLocalPart(): string {\n const adjectives = ['quick', 'lazy', 'happy', 'sad', 'bright', 'dark', 'warm', 'cold', 'soft', 'hard'];\n const nouns = ['fox', 'dog', 'cat', 'bird', 'fish', 'lion', 'bear', 'wolf', 'deer', 'hawk'];\n const adj = adjectives[Math.floor(Math.random() * adjectives.length)];\n const noun = nouns[Math.floor(Math.random() * nouns.length)];\n const num = Math.floor(Math.random() * 1000);\n return `${adj}-${noun}-${num}`;\n}\n\nconst mailboxesRouter = new Hono<{ Bindings: Env }>();\n\n// POST /api/v1/mailboxes - \u521B\u5EFA\u90AE\u7BB1\nmailboxesRouter.post('/', async (c) => {\n const db = getD1DB(c.env.DB);\n const apiKey = c.get('apiKey') as { id: string; rateLimit: number };\n\n let body: { localPart?: string; domain?: string; expiresIn?: number } = {};\n try {\n body = await c.req.json();\n } catch {\n // \u5141\u8BB8\u7A7A\u8BF7\u6C42\u4F53\n }\n\n // \u83B7\u53D6\u53EF\u7528\u57DF\u540D\n const availableDomains = c.env.EMAIL_DOMAIN ? c.env.EMAIL_DOMAIN.split(',').map(d => d.trim()) : [];\n if (availableDomains.length === 0) {\n return c.json({\n error: {\n code: 'CONFIGURATION_ERROR',\n message: 'No email domains configured',\n }\n }, 500);\n }\n\n // \u9A8C\u8BC1\u57DF\u540D\n const domain = body.domain || availableDomains[0];\n if (!availableDomains.includes(domain)) {\n return c.json({\n error: {\n code: 'VALIDATION_ERROR',\n message: `Invalid domain. Available domains: ${availableDomains.join(', ')}`,\n details: { field: 'domain', allowed: availableDomains }\n }\n }, 400);\n }\n\n // \u751F\u6210\u90AE\u7BB1\u5730\u5740\n const localPart = body.localPart || generateRandomLocalPart();\n const address = `${localPart}@${domain}`;\n\n // \u8BA1\u7B97\u8FC7\u671F\u65F6\u95F4\n const expiresIn = body.expiresIn || 24 * 60 * 60; // \u9ED8\u8BA4 24 \u5C0F\u65F6\n const expiresAt = new Date(Date.now() + expiresIn * 1000);\n\n const now = new Date();\n const mailbox = {\n id: nanoid(),\n address,\n domain,\n expiresAt,\n apiKeyId: apiKey.id,\n createdAt: now,\n updatedAt: now,\n };\n\n try {\n await insertMailbox(db, mailbox);\n return c.json({\n data: {\n id: mailbox.id,\n address: mailbox.address,\n domain: mailbox.domain,\n expiresAt: mailbox.expiresAt.toISOString(),\n createdAt: mailbox.createdAt.toISOString(),\n }\n }, 201);\n } catch (e: any) {\n if (e.message?.includes('UNIQUE constraint failed')) {\n return c.json({\n error: {\n code: 'CONFLICT',\n message: 'Email address already exists',\n }\n }, 409);\n }\n console.error('Create mailbox error:', e);\n return c.json({\n error: {\n code: 'INTERNAL_ERROR',\n message: 'Failed to create mailbox',\n }\n }, 500);\n }\n});\n\n// GET /api/v1/mailboxes/:id - \u83B7\u53D6\u90AE\u7BB1\u4FE1\u606F\nmailboxesRouter.get('/:id', async (c) => {\n const db = getD1DB(c.env.DB);\n const apiKey = c.get('apiKey') as { id: string; rateLimit: number };\n const { id } = c.req.param();\n\n const mailbox = await findMailboxById(db, id);\n if (!mailbox) {\n return c.json({\n error: {\n code: 'NOT_FOUND',\n message: 'Mailbox not found',\n }\n }, 404);\n }\n\n // \u9A8C\u8BC1\u6240\u5C5E\u5173\u7CFB\n if (mailbox.apiKeyId !== apiKey.id) {\n return c.json({\n error: {\n code: 'FORBIDDEN',\n message: 'You do not have access to this mailbox',\n }\n }, 403);\n }\n\n const messageCount = await getMailboxMessageCount(db, mailbox.address);\n\n return c.json({\n data: {\n id: mailbox.id,\n address: mailbox.address,\n domain: mailbox.domain,\n expiresAt: mailbox.expiresAt?.toISOString() || null,\n createdAt: mailbox.createdAt.toISOString(),\n messageCount,\n }\n });\n});\n\n// GET /api/v1/mailboxes/:id/messages - \u83B7\u53D6\u6536\u4EF6\u7BB1\nmailboxesRouter.get('/:id/messages', async (c) => {\n const db = getD1DB(c.env.DB);\n const apiKey = c.get('apiKey') as { id: string; rateLimit: number };\n const { id } = c.req.param();\n\n const mailbox = await findMailboxById(db, id);\n if (!mailbox) {\n return c.json({\n error: {\n code: 'NOT_FOUND',\n message: 'Mailbox not found',\n }\n }, 404);\n }\n\n // \u9A8C\u8BC1\u6240\u5C5E\u5173\u7CFB\n if (mailbox.apiKeyId !== apiKey.id) {\n return c.json({\n error: {\n code: 'FORBIDDEN',\n message: 'You do not have access to this mailbox',\n }\n }, 403);\n }\n\n // \u89E3\u6790\u5206\u9875\u53C2\u6570\n const page = Math.max(1, parseInt(c.req.query('page') || '1', 10));\n const limit = Math.min(100, Math.max(1, parseInt(c.req.query('limit') || '20', 10)));\n const sort = c.req.query('sort') === 'asc' ? 'asc' : 'desc';\n\n const { messages, total, totalPages } = await getMailboxMessages(db, mailbox.address, { page, limit, sort });\n\n return c.json({\n data: messages.map((msg) => ({\n id: msg.id,\n from: msg.from,\n subject: msg.subject,\n preview: msg.text?.substring(0, 100) || null,\n receivedAt: msg.createdAt.toISOString(),\n })),\n pagination: {\n page,\n limit,\n total,\n totalPages,\n hasMore: page < totalPages,\n }\n });\n});\n\n// GET /api/v1/mailboxes/:id/messages/:messageId - \u83B7\u53D6\u90AE\u4EF6\u8BE6\u60C5\nmailboxesRouter.get('/:id/messages/:messageId', async (c) => {\n const db = getD1DB(c.env.DB);\n const apiKey = c.get('apiKey') as { id: string; rateLimit: number };\n const { id, messageId } = c.req.param();\n\n const mailbox = await findMailboxById(db, id);\n if (!mailbox) {\n return c.json({\n error: {\n code: 'NOT_FOUND',\n message: 'Mailbox not found',\n }\n }, 404);\n }\n\n // \u9A8C\u8BC1\u6240\u5C5E\u5173\u7CFB\n if (mailbox.apiKeyId !== apiKey.id) {\n return c.json({\n error: {\n code: 'FORBIDDEN',\n message: 'You do not have access to this mailbox',\n }\n }, 403);\n }\n\n const message = await findMailboxMessage(db, mailbox.address, messageId);\n if (!message) {\n return c.json({\n error: {\n code: 'NOT_FOUND',\n message: 'Message not found',\n }\n }, 404);\n }\n\n return c.json({\n data: {\n id: message.id,\n messageId: message.messageId,\n from: message.from,\n to: message.to,\n cc: message.cc,\n bcc: message.bcc,\n replyTo: message.replyTo,\n subject: message.subject,\n text: message.text,\n html: message.html,\n headers: message.headers,\n receivedAt: message.createdAt.toISOString(),\n }\n });\n});\n\n// DELETE /api/v1/mailboxes/:id/messages/:messageId - \u5220\u9664\u90AE\u4EF6\nmailboxesRouter.delete('/:id/messages/:messageId', async (c) => {\n const db = getD1DB(c.env.DB);\n const apiKey = c.get('apiKey') as { id: string; rateLimit: number };\n const { id, messageId } = c.req.param();\n\n const mailbox = await findMailboxById(db, id);\n if (!mailbox) {\n return c.json({\n error: {\n code: 'NOT_FOUND',\n message: 'Mailbox not found',\n }\n }, 404);\n }\n\n // \u9A8C\u8BC1\u6240\u5C5E\u5173\u7CFB\n if (mailbox.apiKeyId !== apiKey.id) {\n return c.json({\n error: {\n code: 'FORBIDDEN',\n message: 'You do not have access to this mailbox',\n }\n }, 403);\n }\n\n const deleted = await deleteMailboxMessage(db, mailbox.address, messageId);\n if (!deleted) {\n return c.json({\n error: {\n code: 'NOT_FOUND',\n message: 'Message not found',\n }\n }, 404);\n }\n\n return c.json({\n data: {\n deleted: true,\n id: messageId,\n }\n });\n});\n\nexport default mailboxesRouter;\n", "import { Hono } from 'hono';\nimport { cors } from 'hono/cors';\nimport type { Env } from '../../index';\nimport { apiKeyAuth } from './middleware/apiKeyAuth';\nimport mailboxesRouter from './routes/mailboxes';\n\nconst v1 = new Hono<{ Bindings: Env }>();\n\n// \u914D\u7F6E CORS\nv1.use('/*', cors());\n\n// \u6240\u6709 v1 \u8DEF\u7531\u90FD\u9700\u8981 API Key \u8BA4\u8BC1\nv1.use('/*', apiKeyAuth);\n\n// \u6302\u8F7D\u90AE\u7BB1\u8DEF\u7531\nv1.route('/mailboxes', mailboxesRouter);\n\nexport default v1;\n", "import { Hono } from 'hono';\nimport { serveStatic } from 'hono/cloudflare-workers';\nimport { cors } from 'hono/cors';\n// \u5BFC\u5165\u6570\u636E\u5E93\u76F8\u5173\u7684\u6A21\u5757\nimport { deleteEmails, findEmailById, getEmailsByMessageTo, insertEmail, deleteExpiredEmails, insertApiKey } from './database/dao';\nimport { getD1DB } from './database/db';\nimport { InsertEmail, insertEmailSchema } from './database/schema';\nimport { nanoid } from 'nanoid/non-secure';\nimport PostalMime from 'postal-mime';\n// \u5BFC\u5165\u52A0\u89E3\u5BC6\u5DE5\u5177\u51FD\u6570\nimport { decrypt } from './utils';\n// \u5BFC\u5165 v1 API\nimport v1Api from './api/v1';\n\n\n// \u5B9A\u4E49 Cloudflare \u7ED1\u5B9A\u548C\u73AF\u5883\u53D8\u91CF\u7684\u7C7B\u578B\nexport interface Env {\n DB: D1Database;\n ASSETS: Fetcher;\n\n // \u4ECE wrangler.toml \u4E2D\u4F20\u5165\u7684\u73AF\u5883\u53D8\u91CF\n EMAIL_DOMAIN: string;\n COOKIES_SECRET: string;\n TURNSTILE_KEY: string;\n TURNSTILE_SECRET: string;\n}\n\n// \u521D\u59CB\u5316 Hono \u5E94\u7528\nconst app = new Hono<{ Bindings: Env }>();\n\n// \u914D\u7F6E CORS\napp.use('/api/*', cors());\n\n// fix: \u589E\u5F3A\u8BF7\u6C42\u4F53\u9A8C\u8BC1\u903B\u8F91\u3002\n// \u6B64\u524D\u7684\u5B9E\u73B0\u65B9\u5F0F\u5728\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25\u65F6\u4F1A\u9759\u9ED8\u5904\u7406\uFF0C\u5BFC\u81F4\u540E\u7EED\u5904\u7406\u6D41\u7A0B\u56E0\u7F3A\u5C11\u6570\u636E\u800C\u8FD4\u56DE\u4E00\u4E2A\u6A21\u7CCA\u7684400\u9519\u8BEF\u3002\n// \u65B0\u7684\u5B9E\u73B0\u65B9\u5F0F\u4F1A\u4E25\u683C\u6821\u9A8C\u8BF7\u6C42\u4F53\uFF0C\u5982\u679C\u89E3\u6790\u4E3AJSON\u5931\u8D25\uFF08\u4F8B\u5982\u8BF7\u6C42\u4F53\u4E3A\u7A7A\u6216\u683C\u5F0F\u9519\u8BEF\uFF09\uFF0C\u5C06\u7ACB\u5373\u8FD4\u56DE\u4E00\u4E2A\u660E\u786E\u7684400\u9519\u8BEF\uFF0C\u4ECE\u800C\u963B\u6B62\u65E0\u6548\u8BF7\u6C42\u7EE7\u7EED\u6267\u884C\u3002\nconst turnstile = async (c, next) => {\n let body: any;\n try {\n // \u5C1D\u8BD5\u5C06\u8BF7\u6C42\u4F53\u89E3\u6790\u4E3AJSON\u3002\u5982\u679C\u5931\u8D25\uFF0C\u5C06\u629B\u51FA\u5F02\u5E38\u3002\n body = await c.req.json();\n } catch (e) {\n // \u6355\u83B7\u5F02\u5E38\uFF0C\u8BB0\u5F55\u9519\u8BEF\u65E5\u5FD7\uFF0C\u5E76\u8FD4\u56DE\u4E00\u4E2A\u6E05\u6670\u7684\u9519\u8BEF\u54CD\u5E94\u3002\n console.error(\"\u8BF7\u6C42\u4F53\u89E3\u6790\u4E3AJSON\u65F6\u51FA\u9519:\", e);\n return c.json({ message: '\u9519\u8BEF\u7684\u8BF7\u6C42\uFF1A\u8BF7\u6C42\u4F53\u65E0\u6548\u6216\u4E3A\u7A7A\u3002' }, 400);\n }\n\n // \u5C06\u89E3\u6790\u540E\u7684 body \u5B58\u5165\u4E0A\u4E0B\u6587\uFF0C\u4EE5\u4FBF\u4E0B\u6E38\u5904\u7406\u5668\u76F4\u63A5\u4F7F\u7528\uFF0C\u907F\u514D\u91CD\u590D\u89E3\u6790\u3002\n c.set('parsedBody', body);\n\n const token = body.token || c.req.header('cf-turnstile-token');\n const ip = c.req.header('CF-Connecting-IP');\n\n if (!token) {\n return c.json({ message: '\u7F3A\u5C11 turnstile token' }, 400);\n }\n\n // fix: \u5207\u6362\u5230 application/x-www-form-urlencoded \u683C\u5F0F\u6765\u53D1\u9001\u9A8C\u8BC1\u8BF7\u6C42\u3002\n // \u8FD9\u53EF\u4EE5\u63D0\u9AD8\u517C\u5BB9\u6027\uFF0C\u5E76\u53EF\u80FD\u89E3\u51B3\u7531 FormData \u7F16\u7801\u5F15\u8D77\u7684\u8FB9\u754C\u95EE\u9898\u3002\n const params = new URLSearchParams();\n params.append('secret', c.env.TURNSTILE_SECRET);\n params.append('response', token);\n if (ip) {\n params.append('remoteip', ip);\n }\n\n const res = await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: params.toString(),\n });\n\n const data = await res.json();\n if (!data.success) {\n // feat: \u589E\u52A0\u8BE6\u7EC6\u7684\u9519\u8BEF\u65E5\u5FD7\uFF0C\u65B9\u4FBF\u8C03\u8BD5\n console.error(\"Turnstile \u9A8C\u8BC1\u5931\u8D25:\", data['error-codes']);\n return c.json({ message: 'token \u65E0\u6548' }, 400);\n }\n\n await next();\n};\n\n// API \u8DEF\u7531\u7EC4\nconst api = app.basePath('/api');\n\n// feat: \u65B0\u589E\u4E00\u4E2A\u4E13\u95E8\u7528\u4E8E\u4EBA\u673A\u9A8C\u8BC1\u7684\u63A5\u53E3\u3002\n// \u524D\u7AEF\u5E94\u5728\u751F\u6210\u90AE\u7BB1\u5730\u5740\u524D\u5148\u8C03\u7528\u6B64\u63A5\u53E3\u3002\napi.post('/verify', turnstile, async (c) => {\n // turnstile \u4E2D\u95F4\u4EF6\u5DF2\u7ECF\u5B8C\u6210\u4E86\u9A8C\u8BC1\u5DE5\u4F5C\u3002\n // \u5982\u679C\u4EE3\u7801\u80FD\u6267\u884C\u5230\u8FD9\u91CC\uFF0C\u8BF4\u660E\u9A8C\u8BC1\u6210\u529F\u3002\n return c.json({ success: true });\n});\n\n// \u751F\u6210 API Key \u7684\u51FD\u6570\nfunction generateApiKey(): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let key = 'vmail_';\n for (let i = 0; i < 32; i++) {\n key += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return key;\n}\n\n// \u521B\u5EFA API Key \u63A5\u53E3\uFF08\u9700\u8981 Turnstile \u9A8C\u8BC1\uFF09\napi.post('/api-keys', turnstile, async (c) => {\n const db = getD1DB(c.env.DB);\n const body = c.get('parsedBody') as { name?: string };\n\n const now = new Date();\n const apiKey = generateApiKey();\n const keyPrefix = apiKey.substring(0, 12) + '...';\n\n const newApiKey = {\n id: nanoid(),\n key: apiKey,\n keyPrefix: keyPrefix,\n name: body?.name || null,\n rateLimit: 100,\n isActive: true,\n lastUsedAt: null,\n expiresAt: null,\n createdAt: now,\n updatedAt: now,\n };\n\n try {\n await insertApiKey(db, newApiKey);\n // \u53EA\u8FD4\u56DE\u4E00\u6B21\u5B8C\u6574\u7684 API Key\uFF0C\u4E4B\u540E\u65E0\u6CD5\u518D\u83B7\u53D6\n return c.json({\n data: {\n id: newApiKey.id,\n key: apiKey, // \u5B8C\u6574\u7684 API Key\uFF0C\u53EA\u5C55\u793A\u8FD9\u4E00\u6B21\n keyPrefix: keyPrefix,\n name: newApiKey.name,\n createdAt: now.toISOString(),\n },\n message: 'API Key created successfully. Please save it now, it will not be shown again!'\n }, 201);\n } catch (e: any) {\n console.error('Create API Key error:', e);\n return c.json({\n error: {\n code: 'INTERNAL_ERROR',\n message: 'Failed to create API Key',\n }\n }, 500);\n }\n});\n\n// fix: \u79FB\u9664\u83B7\u53D6\u90AE\u4EF6\u5217\u8868\u63A5\u53E3\u7684 turnstile \u9A8C\u8BC1\u3002\n// \u8FD9\u4E2A\u63A5\u53E3\u73B0\u5728\u662F\u516C\u5F00\u7684\uFF0C\u5237\u65B0\u6536\u4EF6\u7BB1\u65F6\u53EF\u4EE5\u76F4\u63A5\u8C03\u7528\uFF0C\u4E0D\u518D\u9700\u8981\u91CD\u590D\u9A8C\u8BC1\u3002\napi.post('/emails', async (c) => {\n const db = getD1DB(c.env.DB);\n let body: any;\n try {\n body = await c.req.json();\n } catch (e) {\n return c.json({ message: '\u9519\u8BEF\u7684\u8BF7\u6C42\uFF1A\u8BF7\u6C42\u4F53\u65E0\u6548\u6216\u4E3A\u7A7A\u3002' }, 400);\n }\n const address = body?.address;\n\n if (!address) {\n return c.json({ message: 'address is required' }, 400);\n }\n const emails = await getEmailsByMessageTo(db, address as string);\n return c.json(emails);\n});\n\n\n// \u83B7\u53D6\u5355\u5C01\u90AE\u4EF6\u8BE6\u60C5\napi.get('/emails/:id', async (c) => {\n const db = getD1DB(c.env.DB);\n const { id } = c.req.param();\n // \u51FD\u6570\u8C03\u7528\u4FEE\u6B63\uFF1A\u4F7F\u7528 findEmailById \u51FD\u6570\n const email = await findEmailById(db, id);\n if (!email) {\n return c.json({ message: 'Email not found'}, 404);\n }\n return c.json(email);\n});\n\n// fix: \u5220\u9664\u90AE\u4EF6\u63A5\u53E3\u4E0D\u518D\u9700\u8981 turnstile \u9A8C\u8BC1\uFF0C\u56E0\u4E3A\u901A\u5E38\u8FD9\u662F\u5728\u5DF2\u77E5\u90AE\u7BB1\u4E0A\u4E0B\u6587\u4E2D\u64CD\u4F5C\u7684\u3002\napi.post('/delete-emails', async (c) => {\n const db = getD1DB(c.env.DB);\n const body = await c.req.json();\n const ids = body?.ids;\n if (!ids || !Array.isArray(ids) || ids.length === 0) {\n return c.json({ message: 'ids are required' }, 400);\n }\n const result = await deleteEmails(db, ids as string[]);\n return c.json(result);\n});\n\n// \u4FEE\u590D\uFF1A\u79FB\u9664\u767B\u5F55\u63A5\u53E3\u7684 turnstile \u4E2D\u95F4\u4EF6\uFF0C\u4F7F\u5176\u4E0D\u518D\u9700\u8981\u4EBA\u673A\u9A8C\u8BC1\u3002\napi.post('/login', async (c) => {\n // const db = getD1DB(c.env.DB); // \u6570\u636E\u5E93\u8FDE\u63A5\u4E0D\u518D\u9700\u8981\u7528\u4E8E\u9A8C\u8BC1\n // \u4FEE\u590D\uFF1A\u7531\u4E8E\u79FB\u9664\u4E86 turnstile \u4E2D\u95F4\u4EF6\uFF0C\u73B0\u5728\u9700\u8981\u5728\u6B64\u5904\u76F4\u63A5\u89E3\u6790\u8BF7\u6C42\u4F53\u3002\n const body = await c.req.json();\n const password = body?.password;\n\n if (!password) {\n return c.json({ message: 'Password is required' }, 400);\n }\n\n try {\n // \u89E3\u5BC6\u5BC6\u7801\u4EE5\u83B7\u53D6\u90AE\u7BB1\u5730\u5740\n const address = decrypt(password, c.env.COOKIES_SECRET);\n \n // **\u6838\u5FC3\u4FEE\u590D**\uFF1A\u79FB\u9664\u6570\u636E\u5E93\u90AE\u4EF6\u68C0\u67E5\u903B\u8F91\n // \u4E0D\u518D\u9700\u8981\u67E5\u8BE2\u6570\u636E\u5E93\u4E2D\u662F\u5426\u5B58\u5728\u8BE5\u5730\u5740\u7684\u90AE\u4EF6\n // const emails = await getEmailsByMessageTo(db, address);\n // if (emails.length === 0) {\n // \u5982\u679C\u8BE5\u5730\u5740\u4ECE\u672A\u6536\u5230\u8FC7\u90AE\u4EF6\uFF0C\u5219\u89C6\u4E3A\u65E0\u6548\u5BC6\u7801\n // return c.json({ message: 'Invalid password' }, 404);\n // }\n\n // \u53EF\u9009\uFF1A\u6DFB\u52A0\u4E00\u4E2A\u7B80\u5355\u7684\u90AE\u7BB1\u5730\u5740\u683C\u5F0F\u6821\u9A8C\uFF0C\u589E\u52A0\u5065\u58EE\u6027\n // \u4F8B\u5982\uFF0C\u68C0\u67E5\u662F\u5426\u5305\u542B '@' \u7B26\u53F7\n if (!address || typeof address !== 'string' || !address.includes('@')) {\n console.error(\"\u89E3\u5BC6\u540E\u7684\u5730\u5740\u683C\u5F0F\u65E0\u6548:\", address);\n return c.json({ message: 'Invalid password' }, 400); // \u5730\u5740\u683C\u5F0F\u4E0D\u5BF9\u4E5F\u89C6\u4E3A\u5BC6\u7801\u65E0\u6548\n }\n\n // \u767B\u5F55\u6210\u529F\uFF0C\u8FD4\u56DE\u90AE\u7BB1\u5730\u5740\n return c.json({ address });\n } catch (e) {\n console.error(\"Login error:\", e);\n // \u5982\u679C\u89E3\u5BC6\u5931\u8D25\u6216\u53D1\u751F\u5176\u4ED6\u9519\u8BEF\uFF0C\u8FD4\u56DE\u65E0\u6548\u5BC6\u7801\u9519\u8BEF\n return c.json({ message: 'Invalid password' }, 400);\n }\n});\n\n\n// \u524D\u7AEF\u914D\u7F6E\u63A5\u53E3\napp.get('/config', (c) => {\n // feat: \u5C06 emailDomain \u62C6\u5206\u4E3A\u6570\u7EC4\u4EE5\u652F\u6301\u591A\u57DF\u540D\n const emailDomain = c.env.EMAIL_DOMAIN ? c.env.EMAIL_DOMAIN.split(',').map(d => d.trim()) : [];\n return c.json({\n emailDomain: emailDomain, // \u8FD4\u56DE\u57DF\u540D\u6570\u7EC4\n turnstileKey: c.env.TURNSTILE_KEY,\n cookiesSecret: c.env.COOKIES_SECRET,\n });\n});\n\n// \u6302\u8F7D v1 API \u8DEF\u7531\napp.route('/api/v1', v1Api);\n\n\n// \u9759\u6001\u8D44\u6E90\u670D\u52A1 (\u653E\u5728\u6700\u540E\uFF0C\u4F5C\u4E3A\u9ED8\u8BA4\u8DEF\u7531)\n// \u4FEE\u6B63: \u786E\u4FDD serveStatic \u6B63\u786E\u6307\u5411\u9759\u6001\u6587\u4EF6\u76EE\u5F55\n// Hono v4 \u4E2D serveStatic \u9ED8\u8BA4\u5904\u7406\u6839\u8DEF\u5F84\uFF0C\u6211\u4EEC\u9700\u8981\u786E\u4FDD\u5B83\u6307\u5411\u6B63\u786E\u7684\u5B50\u76EE\u5F55\napp.get('/*', serveStatic({ root: './' }))\napp.get('/assets/*', serveStatic({ root: './' }))\n\n\n// Worker \u4E3B\u5904\u7406\u903B\u8F91\nexport default {\n // \u90AE\u4EF6\u5904\u7406\u903B\u8F91\n async email(message: ForwardableEmail, env: Env, ctx: ExecutionContext) {\n try {\n const db = getD1DB(env.DB);\n // \u5C06\u539F\u59CB\u90AE\u4EF6\u6D41\u8F6C\u6362\u4E3A\u6587\u672C\n const raw = await new Response(message.raw).text();\n // \u4F7F\u7528 postal-mime \u89E3\u6790\u90AE\u4EF6\n const mail = await new PostalMime().parse(raw);\n const now = new Date();\n\n // **\u5173\u952E\u4FEE\u590D**\uFF1A\u663E\u5F0F\u5730\u4ECE\u89E3\u6790\u7ED3\u679C\u4E2D\u6620\u5C04\u5B57\u6BB5\uFF0C\u800C\u4E0D\u662F\u4F7F\u7528\u5BF9\u8C61\u5C55\u5F00(...)\n // \u8FD9\u6837\u53EF\u4EE5\u907F\u514D\u5C5E\u6027\u8986\u76D6\u548C\u7C7B\u578B\u4E0D\u5339\u914D\u7684\u95EE\u9898\n const newEmail: InsertEmail = {\n id: nanoid(),\n messageFrom: message.from,\n messageTo: message.to,\n headers: mail.headers || [], // \u786E\u4FDD headers \u5B58\u5728\n from: mail.from,\n sender: mail.sender,\n replyTo: mail.replyTo,\n deliveredTo: mail.deliveredTo,\n returnPath: mail.returnPath,\n to: mail.to,\n cc: mail.cc,\n bcc: mail.bcc,\n subject: mail.subject,\n messageId: mail.messageId, // messageId \u5728\u6570\u636E\u5E93\u4E2D\u662F\u5FC5\u9700\u7684\n inReplyTo: mail.inReplyTo,\n references: mail.references,\n date: mail.date,\n html: mail.html,\n text: mail.text,\n createdAt: now,\n updatedAt: now,\n };\n\n // \u9A8C\u8BC1\u5F85\u63D2\u5165\u7684\u6570\u636E\u662F\u5426\u7B26\u5408 schema\n const email = insertEmailSchema.parse(newEmail);\n // \u63D2\u5165\u6570\u636E\u5E93\n await insertEmail(db, email);\n } catch (e: any) {\n // **\u5173\u952E\u4FEE\u590D**\uFF1A\u5411 Cloudflare \u53D1\u51FA\u62D2\u7EDD\u4FE1\u53F7\n // \u5F53\u53D1\u751F\u4EFB\u4F55\u9519\u8BEF\u65F6\uFF0C\u8C03\u7528 message.setReject() \u544A\u77E5 Cloudflare \u5904\u7406\u5931\u8D25\u3002\n // \u8FD9\u4F1A\u8BA9 Cloudflare \u5C1D\u8BD5\u91CD\u65B0\u6295\u9012\u90AE\u4EF6\uFF0C\u800C\u4E0D\u662F\u76F4\u63A5\u5220\u9664\u3002\n console.error('\u5904\u7406\u90AE\u4EF6\u5931\u8D25:', e);\n message.setReject(`\u90AE\u4EF6\u5904\u7406\u5931\u8D25: ${e.message}`);\n }\n },\n\n // HTTP \u8BF7\u6C42\u5904\u7406\u903B\u8F91\n async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise {\n // \u4FEE\u6B63: \u4F7F\u7528 Hono \u7684 env.ASSETS.fetch \u6765\u5904\u7406\u9759\u6001\u8D44\u6E90\n // \u8FD9\u6837\u53EF\u4EE5\u786E\u4FDD Cloudflare Pages \u6B63\u786E\u5904\u7406\u524D\u7AEF\u6784\u5EFA\u4EA7\u7269\n const url = new URL(request.url);\n // API \u8DEF\u7531\n if (url.pathname.startsWith('/api/') || url.pathname === '/config') {\n return app.fetch(request, env, ctx);\n }\n // \u9759\u6001\u8D44\u6E90\u548C\u5176\u4ED6\u8BF7\u6C42\u7531 Pages \u7684\u9759\u6001\u8D44\u6E90\u5904\u7406\u5668\u5904\u7406\n return env.ASSETS.fetch(request);\n },\n\n // \u5B9A\u65F6\u4EFB\u52A1 (\u6E05\u7406\u8FC7\u671F\u90AE\u4EF6)\n async scheduled(event, env, ctx) {\n const db = getD1DB(env.DB);\n // \u4FEE\u590D\uFF1A\u5C06\u6E05\u7406\u65F6\u95F4\u4ECE1\u5C0F\u65F6\u4FEE\u6539\u4E3A24\u5C0F\u65F6\uFF081\u5929\uFF09\n const oneDayAgo = new Date(Date.now() - 1000 * 60 * 60 * 24);\n await deleteExpiredEmails(db, oneDayAgo);\n console.log(`\u5DF2\u6E05\u7406 ${oneDayAgo.toISOString()} \u4E4B\u524D\u7684\u8FC7\u671F\u90AE\u4EF6`); // \u6DFB\u52A0\u65E5\u5FD7\n },\n};\n", "import type { Middleware } from \"./common\";\n\nconst drainBody: Middleware = async (request, env, _ctx, middlewareCtx) => {\n\ttry {\n\t\treturn await middlewareCtx.next(request, env);\n\t} finally {\n\t\ttry {\n\t\t\tif (request.body !== null && !request.bodyUsed) {\n\t\t\t\tconst reader = request.body.getReader();\n\t\t\t\twhile (!(await reader.read()).done) {}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(\"Failed to drain the unused request body.\", e);\n\t\t}\n\t}\n};\n\nexport default drainBody;\n", "import type { Middleware } from \"./common\";\n\ninterface JsonError {\n\tmessage?: string;\n\tname?: string;\n\tstack?: string;\n\tcause?: JsonError;\n}\n\nfunction reduceError(e: any): JsonError {\n\treturn {\n\t\tname: e?.name,\n\t\tmessage: e?.message ?? String(e),\n\t\tstack: e?.stack,\n\t\tcause: e?.cause === undefined ? undefined : reduceError(e.cause),\n\t};\n}\n\n// See comment in `bundle.ts` for details on why this is needed\nconst jsonError: Middleware = async (request, env, _ctx, middlewareCtx) => {\n\ttry {\n\t\treturn await middlewareCtx.next(request, env);\n\t} catch (e: any) {\n\t\tconst error = reduceError(e);\n\t\treturn Response.json(error, {\n\t\t\tstatus: 500,\n\t\t\theaders: { \"MF-Experimental-Error-Stack\": \"true\" },\n\t\t});\n\t}\n};\n\nexport default jsonError;\n", "\t\t\t\timport worker, * as OTHER_EXPORTS from \"/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts\";\n\t\t\t\timport * as __MIDDLEWARE_0__ from \"/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts\";\nimport * as __MIDDLEWARE_1__ from \"/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts\";\n\n\t\t\t\texport * from \"/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts\";\n\n\t\t\t\texport const __INTERNAL_WRANGLER_MIDDLEWARE__ = [\n\t\t\t\t\t\n\t\t\t\t\t__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default\n\t\t\t\t]\n\t\t\t\texport default worker;", "export type Awaitable = T | Promise;\n// TODO: allow dispatching more events?\nexport type Dispatcher = (\n\ttype: \"scheduled\",\n\tinit: { cron?: string }\n) => Awaitable;\n\nexport type IncomingRequest = Request<\n\tunknown,\n\tIncomingRequestCfProperties\n>;\n\nexport interface MiddlewareContext {\n\tdispatch: Dispatcher;\n\tnext(request: IncomingRequest, env: any): Awaitable;\n}\n\nexport type Middleware = (\n\trequest: IncomingRequest,\n\tenv: any,\n\tctx: ExecutionContext,\n\tmiddlewareCtx: MiddlewareContext\n) => Awaitable;\n\nconst __facade_middleware__: Middleware[] = [];\n\n// The register functions allow for the insertion of one or many middleware,\n// We register internal middleware first in the stack, but have no way of controlling\n// the order that addMiddleware is run in service workers so need an internal function.\nexport function __facade_register__(...args: (Middleware | Middleware[])[]) {\n\t__facade_middleware__.push(...args.flat());\n}\nexport function __facade_registerInternal__(\n\t...args: (Middleware | Middleware[])[]\n) {\n\t__facade_middleware__.unshift(...args.flat());\n}\n\nfunction __facade_invokeChain__(\n\trequest: IncomingRequest,\n\tenv: any,\n\tctx: ExecutionContext,\n\tdispatch: Dispatcher,\n\tmiddlewareChain: Middleware[]\n): Awaitable {\n\tconst [head, ...tail] = middlewareChain;\n\tconst middlewareCtx: MiddlewareContext = {\n\t\tdispatch,\n\t\tnext(newRequest, newEnv) {\n\t\t\treturn __facade_invokeChain__(newRequest, newEnv, ctx, dispatch, tail);\n\t\t},\n\t};\n\treturn head(request, env, ctx, middlewareCtx);\n}\n\nexport function __facade_invoke__(\n\trequest: IncomingRequest,\n\tenv: any,\n\tctx: ExecutionContext,\n\tdispatch: Dispatcher,\n\tfinalMiddleware: Middleware\n): Awaitable {\n\treturn __facade_invokeChain__(request, env, ctx, dispatch, [\n\t\t...__facade_middleware__,\n\t\tfinalMiddleware,\n\t]);\n}\n", "// This loads all middlewares exposed on the middleware object and then starts\n// the invocation chain. The big idea is that we can add these to the middleware\n// export dynamically through wrangler, or we can potentially let users directly\n// add them as a sort of \"plugin\" system.\n\nimport ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from \"/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js\";\nimport { __facade_invoke__, __facade_register__, Dispatcher } from \"/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts\";\nimport type { WorkerEntrypointConstructor } from \"/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js\";\n\n// Preserve all the exports from the worker\nexport * from \"/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-caThGl/middleware-insertion-facade.js\";\n\nclass __Facade_ScheduledController__ implements ScheduledController {\n\treadonly #noRetry: ScheduledController[\"noRetry\"];\n\n\tconstructor(\n\t\treadonly scheduledTime: number,\n\t\treadonly cron: string,\n\t\tnoRetry: ScheduledController[\"noRetry\"]\n\t) {\n\t\tthis.#noRetry = noRetry;\n\t}\n\n\tnoRetry() {\n\t\tif (!(this instanceof __Facade_ScheduledController__)) {\n\t\t\tthrow new TypeError(\"Illegal invocation\");\n\t\t}\n\t\t// Need to call native method immediately in case uncaught error thrown\n\t\tthis.#noRetry();\n\t}\n}\n\nfunction wrapExportedHandler(worker: ExportedHandler): ExportedHandler {\n\t// If we don't have any middleware defined, just return the handler as is\n\tif (\n\t\t__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||\n\t\t__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0\n\t) {\n\t\treturn worker;\n\t}\n\t// Otherwise, register all middleware once\n\tfor (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {\n\t\t__facade_register__(middleware);\n\t}\n\n\tconst fetchDispatcher: ExportedHandlerFetchHandler = function (\n\t\trequest,\n\t\tenv,\n\t\tctx\n\t) {\n\t\tif (worker.fetch === undefined) {\n\t\t\tthrow new Error(\"Handler does not export a fetch() function.\");\n\t\t}\n\t\treturn worker.fetch(request, env, ctx);\n\t};\n\n\treturn {\n\t\t...worker,\n\t\tfetch(request, env, ctx) {\n\t\t\tconst dispatcher: Dispatcher = function (type, init) {\n\t\t\t\tif (type === \"scheduled\" && worker.scheduled !== undefined) {\n\t\t\t\t\tconst controller = new __Facade_ScheduledController__(\n\t\t\t\t\t\tDate.now(),\n\t\t\t\t\t\tinit.cron ?? \"\",\n\t\t\t\t\t\t() => {}\n\t\t\t\t\t);\n\t\t\t\t\treturn worker.scheduled(controller, env, ctx);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);\n\t\t},\n\t};\n}\n\nfunction wrapWorkerEntrypoint(\n\tklass: WorkerEntrypointConstructor\n): WorkerEntrypointConstructor {\n\t// If we don't have any middleware defined, just return the handler as is\n\tif (\n\t\t__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||\n\t\t__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0\n\t) {\n\t\treturn klass;\n\t}\n\t// Otherwise, register all middleware once\n\tfor (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {\n\t\t__facade_register__(middleware);\n\t}\n\n\t// `extend`ing `klass` here so other RPC methods remain callable\n\treturn class extends klass {\n\t\t#fetchDispatcher: ExportedHandlerFetchHandler> = (\n\t\t\trequest,\n\t\t\tenv,\n\t\t\tctx\n\t\t) => {\n\t\t\tthis.env = env;\n\t\t\tthis.ctx = ctx;\n\t\t\tif (super.fetch === undefined) {\n\t\t\t\tthrow new Error(\"Entrypoint class does not define a fetch() function.\");\n\t\t\t}\n\t\t\treturn super.fetch(request);\n\t\t};\n\n\t\t#dispatcher: Dispatcher = (type, init) => {\n\t\t\tif (type === \"scheduled\" && super.scheduled !== undefined) {\n\t\t\t\tconst controller = new __Facade_ScheduledController__(\n\t\t\t\t\tDate.now(),\n\t\t\t\t\tinit.cron ?? \"\",\n\t\t\t\t\t() => {}\n\t\t\t\t);\n\t\t\t\treturn super.scheduled(controller);\n\t\t\t}\n\t\t};\n\n\t\tfetch(request: Request) {\n\t\t\treturn __facade_invoke__(\n\t\t\t\trequest,\n\t\t\t\tthis.env,\n\t\t\t\tthis.ctx,\n\t\t\t\tthis.#dispatcher,\n\t\t\t\tthis.#fetchDispatcher\n\t\t\t);\n\t\t}\n\t};\n}\n\nlet WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;\nif (typeof ENTRY === \"object\") {\n\tWRAPPED_ENTRY = wrapExportedHandler(ENTRY);\n} else if (typeof ENTRY === \"function\") {\n\tWRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);\n}\nexport default WRAPPED_ENTRY;\n"], + "mappings": "gSAAA,SAASA,GAA0BC,EAAOC,EAAM,CAC/C,IAAMC,EAAU,IAAI,QAAQF,EAAOC,CAAI,EACvC,OAAAC,EAAQ,QAAQ,OAAO,kBAAkB,EAClCA,CACR,CAJSC,EAAAJ,GAAA,6BAMT,WAAW,MAAQ,IAAI,MAAM,WAAW,MAAO,CAC9C,MAAMK,EAAQC,EAASC,EAAU,CAChC,OAAO,QAAQ,MAAMF,EAAQC,EAAS,CACrCN,GAA0B,MAAM,KAAMO,CAAQ,CAC/C,CAAC,CACF,CACD,CAAC,ECQ+B,SAASC,EAA0BC,EAAM,CACxE,OAAO,IAAI,MAAM,WAAWA,2BAA8B,CAC3D,CAFyCC,EAAAF,EAAA,6BAGT,SAASG,GAAeF,EAAM,CAI7D,OAAO,OAAO,OAHHC,EAAA,IAAM,CAChB,MAAMF,EAA0BC,CAAI,C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CAAG,EAE9C,EAT+B,cAUyBH,CAAe,CACxE,CACD,CACD,CAxCSN,EAAAC,GAAA,uBA0CT,SAASa,GACRC,EAC8B,CAE9B,GACCZ,KAAqC,QACrCA,GAAiC,SAAW,EAE5C,OAAOY,EAGR,QAAWX,KAAcD,GACxBE,GAAoBD,CAAU,EAI/B,OAAO,cAAcW,CAAM,CAC1BC,GAAyE,CACxET,EACAC,EACAC,IACI,CAGJ,GAFA,KAAK,IAAMD,EACX,KAAK,IAAMC,EACP,MAAM,QAAU,OACnB,MAAM,IAAI,MAAM,sDAAsD,EAEvE,OAAO,MAAM,MAAMF,CAAO,CAC3B,EAEAU,GAA0B,CAACN,EAAMC,IAAS,CACzC,GAAID,IAAS,aAAe,MAAM,YAAc,OAAW,CAC1D,IAAME,EAAa,IAAIlB,GACtB,KAAK,IAAI,EACTiB,EAAK,MAAQ,GACb,IAAM,CAAC,CACR,EACA,OAAO,MAAM,UAAUC,CAAU,EAEnC,EAEA,MAAMN,EAAwD,CAC7D,OAAOG,GACNH,EACA,KAAK,IACL,KAAK,IACL,KAAKU,GACL,KAAKD,EACN,CACD,CACD,CACD,CAnDShB,EAAAc,GAAA,wBAqDT,IAAII,GACA,OAAOC,IAAU,SACpBD,GAAgBjB,GAAoBkB,EAAK,EAC/B,OAAOA,IAAU,aAC3BD,GAAgBJ,GAAqBK,EAAK,GAE3C,IAAOC,GAAQF", + "names": ["stripCfConnectingIPHeader", "input", "init", "request", "__name", "target", "thisArg", "argArray", "createNotImplementedError", "name", "__name", "notImplemented", "notImplementedClass", "name", "__name", "_timeOrigin", "_performanceNow", "nodeTiming", "PerformanceEntry", "name", "options", "__name", "PerformanceMark", "PerformanceMeasure", "PerformanceResourceTiming", "PerformanceObserverEntryList", "_name", "_type", "type", "Performance", "_fn", "_options", "createNotImplementedError", "markName", "e", "measureName", "entry", "startOrMeasureOptions", "endMark", "start", "end", "maxSize", "listener", "event", "PerformanceObserver", "callback", "fn", "thisArg", "args", "__publicField", "performance", "performance", "Performance", "PerformanceEntry", "PerformanceMark", "PerformanceMeasure", "PerformanceObserver", "PerformanceObserverEntryList", "PerformanceResourceTiming", "Writable", "noop_default", "_console", "_ignoreErrors", "_stderr", "Writable", "_stdout", "log", "noop_default", "info", "trace", "debug", "table", "error", "warn", "createTask", "notImplemented", "clear", "_console", "noop_default", "count", "countReset", "dir", "dirxml", "group", "groupEnd", "groupCollapsed", "profile", "profileEnd", "time", "timeEnd", "timeLog", "timeStamp", "Console", "notImplementedClass", "_times", "_stdoutErrorHandler", "noop_default", "_stderrErrorHandler", "workerdConsole", "assert", "clear", "context", "count", "countReset", "createTask", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "profile", "profileEnd", "table", "time", "timeEnd", "timeLog", "timeStamp", "trace", "warn", "Console", "_ignoreErrors", "_stderr", "_stderrErrorHandler", "_stdout", "_stdoutErrorHandler", "_times", "console_default", "console_default", "hrtime", "__name", "startTime", "now", "seconds", "nanos", "diffSeconds", "diffNanos", "EventEmitter", "Socket", "ReadStream", "Socket", "fd", "mode", "__name", "Socket", "WriteStream", "Socket", "fd", "dir", "callback", "x", "y", "dx", "dy", "env", "count", "__name", "Process", "EventEmitter", "impl", "prop", "value", "warning", "type", "code", "args", "eventName", "#stdin", "#stdout", "#stderr", "ReadStream", "WriteStream", "#cwd", "cwd", "createNotImplementedError", "notImplemented", "__name", "globalProcess", "getBuiltinModule", "exit", "platform", "nextTick", "unenvProcess", "Process", "hrtime", "abort", "addListener", "allowedNodeEnvironmentFlags", "hasUncaughtExceptionCaptureCallback", "setUncaughtExceptionCaptureCallback", "loadEnvFile", "sourceMapsEnabled", "arch", "argv", "argv0", "chdir", "config", "connected", "constrainedMemory", "availableMemory", "cpuUsage", "cwd", "debugPort", "dlopen", "disconnect", "emit", "emitWarning", "env", "eventNames", "execArgv", "execPath", "finalization", "features", "getActiveResourcesInfo", "getMaxListeners", "kill", "listeners", "listenerCount", "memoryUsage", "on", "off", "once", "pid", "ppid", "prependListener", "prependOnceListener", "rawListeners", "release", "removeAllListeners", "removeListener", "report", "resourceUsage", "setMaxListeners", "setSourceMapsEnabled", "stderr", "stdin", "stdout", "title", "throwDeprecation", "traceDeprecation", "umask", "uptime", "version", "versions", "domain", "initgroups", "moduleLoadList", "reallyExit", "openStdin", "assert", "binding", "send", "exitCode", "channel", "getegid", "geteuid", "getgid", "getgroups", "getuid", "setegid", "seteuid", "setgid", "setgroups", "setuid", "permission", "mainModule", "_events", "_eventsCount", "_exiting", "_maxListeners", "_debugEnd", "_debugProcess", "_fatalException", "_getActiveHandles", "_getActiveRequests", "_kill", "_preload_modules", "_rawDebug", "_startProfilerIdleNotifier", "_stopProfilerIdleNotifier", "_tickCallback", "_disconnect", "_handleQueue", "_pendingMessage", "_channel", "_send", "_linkedBinding", "_process", "process_default", "process_default", "compose", "__name", "middleware", "onError", "onNotFound", "context", "next", "index", "dispatch", "i", "res", "isError", "handler", "err", "GET_MATCH_RESULT", "parseBody", "__name", "request", "options", "all", "dot", "contentType", "HonoRequest", "parseFormData", "formData", "convertFormDataToBodyData", "form", "value", "key", "handleParsingAllValues", "handleParsingNestedValues", "nestedForm", "keys", "key2", "index", "splitPath", "__name", "path", "paths", "splitRoutingPath", "routePath", "groups", "extractGroupsFromPath", "replaceGroupMarks", "match", "index", "mark", "i", "j", "patternCache", "getPattern", "label", "next", "cacheKey", "tryDecode", "str", "decoder", "tryDecodeURI", "getPath", "request", "url", "start", "charCode", "queryIndex", "getPathNoStrict", "__name", "request", "result", "getPath", "mergePath", "base", "sub", "rest", "checkOptionalParameter", "path", "segments", "results", "basePath", "segment", "optionalSegment", "v", "_decodeURI", "value", "tryDecode", "decodeURIComponent_", "_getQueryParam", "url", "key", "multiple", "encoded", "keyIndex2", "trailingKeyCode", "valueIndex", "endIndex", "keyIndex", "nextKeyIndex", "name", "getQueryParam", "getQueryParams", "tryDecodeURIComponent", "__name", "str", "tryDecode", "decodeURIComponent_", "HonoRequest", "#validatedData", "#matchResult", "request", "path", "matchResult", "key", "#getDecodedParam", "#getAllDecodedParams", "paramKey", "param", "#getParamValue", "decoded", "keys", "value", "getQueryParam", "getQueryParams", "name", "headerData", "options", "parseBody", "#cachedBody", "bodyCache", "raw", "cachedBody", "anyCachedKey", "body", "text", "target", "data", "GET_MATCH_RESULT", "route", "HtmlEscapedCallbackPhase", "raw", "__name", "value", "callbacks", "escapedString", "resolveCallback", "__name", "str", "phase", "preserveCallbacks", "context", "buffer", "callbacks", "resStr", "c", "res", "str2", "raw", "TEXT_PLAIN", "setDefaultContentType", "__name", "contentType", "headers", "Context", "#rawRequest", "#req", "#var", "#status", "#executionCtx", "#res", "#layout", "#renderer", "#notFoundHandler", "#preparedHeaders", "#matchResult", "#path", "req", "options", "HonoRequest", "_res", "k", "v", "cookies", "cookie", "args", "content", "layout", "renderer", "name", "value", "status", "key", "#newResponse", "data", "arg", "responseHeaders", "argHeaders", "v2", "text", "object", "html", "res", "html2", "resolveCallback", "HtmlEscapedCallbackPhase", "location", "locationString", "METHOD_NAME_ALL", "METHOD_NAME_ALL_LOWERCASE", "METHODS", "MESSAGE_MATCHER_IS_ALREADY_BUILT", "UnsupportedPathError", "__name", "COMPOSED_HANDLER", "notFoundHandler", "__name", "c", "errorHandler", "err", "res", "Hono", "#path", "options", "METHODS", "METHOD_NAME_ALL_LOWERCASE", "method", "args1", "args", "#addRoute", "handler", "path", "handlers", "p", "m", "arg1", "METHOD_NAME_ALL", "strict", "optionsWithoutStrict", "getPath", "getPathNoStrict", "#clone", "clone", "#notFoundHandler", "app", "subApp", "r", "next", "compose", "COMPOSED_HANDLER", "mergePath", "applicationHandler", "replaceRequest", "optionHandler", "request", "getOptions", "options2", "executionContext", "mergedPath", "pathPrefixLength", "url", "#handleError", "#dispatch", "executionCtx", "env", "matchResult", "Context", "resolved", "composed", "context", "rest", "input", "requestInit", "Env", "event", "emptyParam", "match", "method", "path", "matchers", "match2", "__name", "method2", "path2", "matcher", "METHOD_NAME_ALL", "staticMatch", "match3", "index", "LABEL_REG_EXP_STR", "ONLY_WILDCARD_REG_EXP_STR", "TAIL_WILDCARD_REG_EXP_STR", "PATH_ERROR", "regExpMetaChars", "compareKey", "a", "b", "__name", "Node", "#index", "#varIndex", "#children", "tokens", "index", "paramMap", "context", "pathErrorCheckOnly", "token", "restTokens", "pattern", "node", "name", "regexpStr", "k", "strList", "c", "Trie", "__name", "#context", "#root", "Node", "path", "index", "pathErrorCheckOnly", "paramAssoc", "groups", "i", "replaced", "m", "mark", "tokens", "j", "regexp", "captureIndex", "indexReplacementMap", "paramReplacementMap", "_", "handlerIndex", "paramIndex", "nullMatcher", "wildcardRegExpCache", "buildWildcardRegExp", "path", "_", "metaChar", "__name", "clearWildcardRegExpCache", "buildMatcherFromPreprocessedRoutes", "routes", "trie", "Trie", "handlerData", "routesWithStaticPathFlag", "route", "isStaticA", "pathA", "isStaticB", "pathB", "staticMap", "i", "j", "len", "pathErrorCheckOnly", "handlers", "h", "emptyParam", "paramAssoc", "e", "PATH_ERROR", "UnsupportedPathError", "paramCount", "paramIndexMap", "key", "value", "regexp", "indexReplacementMap", "paramReplacementMap", "len2", "map", "keys", "k", "len3", "handlerMap", "findMiddleware", "middleware", "a", "b", "RegExpRouter", "#middleware", "#routes", "METHOD_NAME_ALL", "method", "handler", "MESSAGE_MATCHER_IS_ALREADY_BUILT", "p", "re", "m", "paths", "checkOptionalParameter", "path2", "match", "matchers", "#buildMatcher", "hasOwnRoute", "r", "ownRoute", "SmartRouter", "__name", "#routers", "#routes", "init", "method", "path", "handler", "MESSAGE_MATCHER_IS_ALREADY_BUILT", "routers", "routes", "len", "res", "router", "i2", "len2", "e", "UnsupportedPathError", "emptyParams", "Node", "__name", "#methods", "#children", "#patterns", "#order", "#params", "method", "handler", "children", "m", "path", "curNode", "parts", "splitRoutingPath", "possibleKeys", "i", "len", "p", "nextP", "pattern", "getPattern", "key", "v", "a", "#getHandlerSets", "node", "nodeParams", "params", "handlerSets", "handlerSet", "METHOD_NAME_ALL", "processedSet", "i2", "len2", "processed", "curNodes", "splitPath", "curNodesQueue", "part", "isLast", "tempNodes", "j", "nextNode", "k", "len3", "astNode", "name", "matcher", "child", "restPathString", "componentCount", "b", "TrieRouter", "__name", "#node", "Node", "method", "path", "handler", "results", "checkOptionalParameter", "i", "len", "Hono", "__name", "options", "SmartRouter", "RegExpRouter", "TrieRouter", "COMPRESSIBLE_CONTENT_TYPE_REGEX", "getMimeType", "__name", "filename", "mimes", "baseMimes", "regexp", "match", "mimeType", "_baseMimes", "baseMimes", "defaultJoin", "__name", "paths", "result", "p", "segments", "resolved", "segment", "ENCODINGS", "ENCODINGS_ORDERED_KEYS", "DEFAULT_DOCUMENT", "serveStatic", "__name", "options", "root", "optionPath", "join", "defaultJoin", "c", "next", "filename", "path", "getContent", "content", "mimeType", "getMimeType", "COMPRESSIBLE_CONTENT_TYPE_REGEX", "acceptEncodingSet", "encoding", "compressedContent", "getContentFromKVAsset", "__name", "path", "options", "ASSET_MANIFEST", "ASSET_NAMESPACE", "key", "content", "serveStatic", "__name", "options", "c", "next", "path", "getContentFromKVAsset", "module", "__name", "options", "serveStatic", "WSContext", "__name", "#init", "init", "source", "options", "code", "reason", "defineWebSocketHelper", "__name", "handler", "args", "createEvents", "options", "c", "next", "events", "result", "upgraded", "upgradeWebSocket", "defineWebSocketHelper", "c", "events", "webSocketPair", "client", "server", "wsContext", "WSContext", "code", "reason", "source", "evt", "cors", "__name", "options", "opts", "findAllowOrigin", "optsOrigin", "origin", "findAllowMethods", "optsAllowMethods", "c", "next", "set", "key", "value", "allowOrigin", "existingVary", "allowMethods", "headers", "requestHeaders", "entityKind", "hasOwnEntityKind", "is", "value", "type", "cls", "__name", "_a", "Column", "table", "config", "value", "__name", "entityKind", "__publicField", "SubqueryConfig", "_a", "Subquery", "entityKind", "sql", "selection", "alias", "isWith", "__name", "__publicField", "WithSubquery", "iife", "fn", "args", "__name", "version", "otel", "rawTracer", "tracer", "name", "fn", "version", "iife", "span", "e", "ViewBaseConfig", "TableName", "Schema", "Columns", "OriginalName", "BaseName", "IsAlias", "ExtraConfigBuilder", "IsDrizzleTable", "_a", "Table", "entityKind", "name", "schema", "baseName", "__name", "__publicField", "isTable", "table", "getTableName", "_a", "FakePrimitiveParam", "__name", "entityKind", "__publicField", "isSQLWrapper", "value", "mergeQueries", "queries", "result", "query", "StringChunk", "SQL", "_SQL", "queryChunks", "noopDecoder", "config", "tracer", "span", "chunks", "_config", "escapeName", "escapeParam", "prepareTyping", "inlineParams", "paramStartIndex", "chunk", "is", "Name", "i", "p", "Table", "schemaName", "tableName", "Column", "View", "ViewBaseConfig", "viewName", "Param", "mappedValue", "typings", "Placeholder", "Subquery", "SubqueryConfig", "escapeString", "mappedValueAsString", "alias", "decoder", "isDriverValueEncoder", "value", "__name", "noopDecoder", "noopEncoder", "noopMapper", "_a", "Param", "encoder", "SQL", "entityKind", "__publicField", "sql", "strings", "params", "queryChunks", "StringChunk", "paramIndex", "param", "SQL", "__name", "empty", "fromList", "list", "raw", "str", "join", "chunks", "separator", "result", "i", "chunk", "identifier", "value", "Name", "placeholder", "name", "Placeholder", "encoder", "Param", "Aliased", "fieldAlias", "entityKind", "_a", "__publicField", "fillPlaceholders", "params", "values", "p", "is", "Placeholder", "__name", "_a", "View", "entityKind", "ViewBaseConfig", "name", "schema", "selectedFields", "query", "SQL", "__publicField", "Column", "Table", "Subquery", "_a", "ColumnAliasProxyHandler", "table", "columnObj", "prop", "__name", "entityKind", "__publicField", "TableAliasProxyHandler", "alias", "replaceOriginalName", "target", "Table", "ViewBaseConfig", "columns", "proxiedColumns", "key", "value", "is", "Column", "RelationTableAliasProxyHandler", "aliasedTable", "tableAlias", "aliasedTableColumn", "column", "tableAlias", "ColumnAliasProxyHandler", "TableAliasProxyHandler", "__name", "mapColumnsInAliasedSQLToAlias", "query", "alias", "SQL", "mapColumnsInSQLToAlias", "sql", "c", "is", "Column", "_a", "ColumnBuilder", "name", "dataType", "columnType", "value", "fn", "__name", "entityKind", "__publicField", "_a", "DrizzleError", "message", "cause", "__name", "entityKind", "__publicField", "TransactionRollbackError", "bindIfParam", "value", "column", "isDriverValueEncoder", "isSQLWrapper", "is", "Param", "Placeholder", "Column", "Table", "View", "__name", "eq", "left", "right", "sql", "ne", "and", "unfilteredConditions", "conditions", "c", "SQL", "StringChunk", "or", "not", "condition", "gt", "gte", "lt", "lte", "inArray", "values", "v", "notInArray", "isNull", "isNotNull", "exists", "subquery", "notExists", "between", "min", "max", "notBetween", "like", "notLike", "ilike", "notIlike", "asc", "column", "sql", "__name", "desc", "_a", "ConsoleLogWriter", "message", "__name", "entityKind", "__publicField", "DefaultLogger", "config", "query", "params", "stringifiedParams", "p", "paramsStr", "NoopLogger", "_a", "QueryPromise", "entityKind", "onRejected", "onFinally", "value", "reason", "onFulfilled", "__name", "__publicField", "InlineForeignKeys", "_a", "PgTable", "Table", "entityKind", "__name", "__publicField", "_a", "PrimaryKeyBuilder", "columns", "name", "table", "PrimaryKey", "__name", "entityKind", "__publicField", "PgTable", "column", "_a", "Relation", "sourceTable", "referencedTable", "relationName", "Table", "__name", "entityKind", "__publicField", "Relations", "table", "config", "_One", "isNullable", "fieldName", "relation", "One", "_Many", "Many", "getOperators", "and", "between", "eq", "exists", "gt", "gte", "ilike", "inArray", "isNull", "isNotNull", "like", "lt", "lte", "ne", "not", "notBetween", "notExists", "notLike", "notIlike", "notInArray", "or", "sql", "getOrderByOperators", "asc", "desc", "extractTablesRelationalConfig", "schema", "configHelpers", "is", "tableNamesMap", "relationsBuffer", "tablesConfig", "key", "value", "isTable", "dbName", "bufferedRelations", "column", "extraConfig", "configEntry", "PrimaryKeyBuilder", "tableName", "relations", "primaryKey", "tableConfig", "createOne", "sourceTable", "__name", "table", "config", "One", "res", "f", "createMany", "referencedTable", "Many", "normalizeRelation", "schema", "tableNamesMap", "relation", "is", "referencedTableTsName", "Table", "referencedTableConfig", "sourceTableTsName", "reverseRelations", "referencedTableRelation", "createTableRelationsHelpers", "mapRelationalRow", "tablesConfig", "tableConfig", "row", "buildQueryResultSelection", "mapColumnValue", "value", "result", "selectionItemIndex", "selectionItem", "rawSubRows", "subRows", "subRow", "field", "decoder", "Column", "SQL", "count", "expression", "sql", "__name", "mapResultRow", "columns", "row", "joinsNotNullableMap", "nullifyMap", "result", "path", "field", "columnIndex", "decoder", "is", "Column", "SQL", "node", "pathChunkIndex", "pathChunk", "rawValue", "value", "objectName", "getTableName", "tableName", "__name", "orderSelectedFields", "fields", "pathPrefix", "name", "newPath", "Table", "haveSameKeys", "left", "right", "leftKeys", "rightKeys", "index", "key", "mapUpdateSet", "table", "values", "entries", "Param", "applyMixins", "baseClass", "extendedClasses", "extendedClass", "getTableColumns", "getTableLikeName", "Subquery", "SubqueryConfig", "View", "ViewBaseConfig", "InlineForeignKeys", "_a", "SQLiteTable", "Table", "entityKind", "__name", "__publicField", "sqliteTableBase", "name", "columns", "extraConfig", "schema", "baseName", "rawTable", "builtColumns", "colBuilderBase", "colBuilder", "column", "table", "sqliteTable", "_a", "ForeignKeyBuilder", "config", "actions", "name", "columns", "foreignColumns", "action", "table", "ForeignKey", "__name", "entityKind", "__publicField", "builder", "columnNames", "column", "foreignColumnNames", "chunks", "SQLiteTable", "uniqueKeyName", "table", "columns", "SQLiteTable", "__name", "_a", "UniqueConstraintBuilder", "columns", "name", "table", "UniqueConstraint", "__name", "entityKind", "__publicField", "UniqueOnConstraintBuilder", "uniqueKeyName", "column", "_a", "SQLiteColumnBuilder", "ColumnBuilder", "ref", "actions", "name", "column", "table", "builder", "ForeignKeyBuilder", "foreignColumn", "__name", "entityKind", "__publicField", "SQLiteColumn", "Column", "config", "uniqueKeyName", "_a", "SQLiteBaseIntegerBuilder", "SQLiteColumnBuilder", "name", "dataType", "columnType", "config", "__name", "entityKind", "__publicField", "SQLiteBaseInteger", "SQLiteColumn", "SQLiteIntegerBuilder", "table", "SQLiteInteger", "SQLiteTimestampBuilder", "mode", "sql", "SQLiteTimestamp", "value", "unix", "SQLiteBooleanBuilder", "SQLiteBoolean", "integer", "_a", "SQLiteTextBuilder", "SQLiteColumnBuilder", "name", "config", "table", "SQLiteText", "__name", "entityKind", "__publicField", "SQLiteColumn", "SQLiteTextJsonBuilder", "SQLiteTextJson", "value", "text", "_a", "_SelectionProxyHandler", "config", "subquery", "prop", "SubqueryConfig", "ViewBaseConfig", "value", "is", "Subquery", "View", "SQL", "newValue", "Column", "ColumnAliasProxyHandler", "TableAliasProxyHandler", "SelectionProxyHandler", "__name", "entityKind", "__publicField", "_a", "SQLiteDeleteBase", "QueryPromise", "table", "session", "dialect", "withList", "where", "fields", "SQLiteTable", "orderSelectedFields", "_typings", "rest", "isOneTimeQuery", "placeholderValues", "__name", "entityKind", "__publicField", "_a", "SQLiteInsertBuilder", "table", "session", "dialect", "withList", "values", "mappedValues", "entry", "result", "cols", "Table", "colKey", "colValue", "is", "SQL", "Param", "SQLiteInsertBase", "__name", "entityKind", "__publicField", "QueryPromise", "fields", "SQLiteTable", "orderSelectedFields", "config", "sql", "targetSql", "whereSql", "setSql", "mapUpdateSet", "_typings", "rest", "isOneTimeQuery", "placeholderValues", "_a", "SQLiteViewBase", "View", "__name", "entityKind", "__publicField", "_a", "SQLiteDialect", "name", "_num", "str", "queries", "withSqlChunks", "sql", "i", "w", "SubqueryConfig", "table", "where", "returning", "withList", "withSql", "returningSql", "whereSql", "set", "setEntries", "setSize", "colName", "value", "col", "Table", "res", "setSql", "fields", "isSingleTable", "columnsLen", "chunks", "field", "chunk", "is", "SQL", "query", "Column", "tableName", "columnName", "fieldsFlat", "having", "joins", "orderBy", "groupBy", "limit", "offset", "distinct", "setOperators", "fieldsList", "orderSelectedFields", "f", "getTableName", "Subquery", "SQLiteViewBase", "ViewBaseConfig", "alias", "distinctSql", "selection", "tableSql", "joinsArray", "index", "joinMeta", "SQLiteTable", "tableSchema", "origTableName", "joinsSql", "havingSql", "orderByList", "orderByValue", "groupByList", "groupByValue", "groupBySql", "orderBySql", "limitSql", "offsetSql", "finalQuery", "leftSelect", "setOperator", "rest", "type", "isAll", "rightSelect", "leftChunk", "rightChunk", "orderByValues", "singleOrderBy", "SQLiteColumn", "operatorChunk", "values", "onConflict", "valuesSqlList", "columns", "colEntries", "insertOrder", "column", "valueIndex", "valueList", "fieldName", "colValue", "Param", "defaultValue", "defaultFnResult", "valuesSql", "onConflictSql", "fullSchema", "schema", "tableNamesMap", "tableConfig", "config", "tableAlias", "nestedQueryRelation", "joinOn", "key", "aliasedTableColumn", "aliasedColumns", "getOperators", "mapColumnsInSQLToAlias", "fieldsSelection", "selectedColumns", "isIncludeMode", "c", "selectedRelations", "entry", "tsKey", "queryConfig", "extras", "mapColumnsInAliasedSQLToAlias", "orderByOrig", "getOrderByOperators", "selectedRelationTsKey", "selectedRelationConfigValue", "relation", "normalizedRelation", "normalizeRelation", "relationTableName", "relationTableTsName", "relationTableAlias", "and", "eq", "builtRelation", "One", "DrizzleError", "result", "Many", "nestedSelection", "aliasedTable", "__name", "entityKind", "__publicField", "SQLiteSyncDialect", "migrations", "session", "migrationsTable", "migrationTableCreate", "lastDbMigration", "migration", "stmt", "e", "SQLiteAsyncDialect", "tx", "_a", "TypedQueryBuilder", "__name", "entityKind", "__publicField", "_a", "SQLiteSelectBuilder", "config", "source", "isPartialSelect", "fields", "is", "Subquery", "SubqueryConfig", "key", "SQLiteViewBase", "ViewBaseConfig", "SQL", "getTableColumns", "SQLiteSelectBase", "__name", "entityKind", "__publicField", "SQLiteSelectQueryBuilderBase", "TypedQueryBuilder", "table", "session", "dialect", "withList", "distinct", "getTableLikeName", "joinType", "on", "baseTableName", "tableName", "join", "selection", "View", "Table", "SelectionProxyHandler", "type", "isAll", "rightSelection", "rightSelect", "getSQLiteSetOperators", "haveSameKeys", "setOperators", "where", "having", "columns", "groupBy", "orderBy", "orderByArray", "limit", "offset", "_typings", "rest", "alias", "isOneTimeQuery", "fieldsList", "orderSelectedFields", "query", "placeholderValues", "applyMixins", "QueryPromise", "createSetOperator", "leftSelect", "restSelects", "select", "setOperator", "union", "unionAll", "intersect", "except", "_a", "QueryBuilder", "alias", "queryBuilder", "qb", "WithSubquery", "SelectionProxyHandler", "queries", "self", "select", "fields", "SQLiteSelectBuilder", "__name", "selectDistinct", "SQLiteSyncDialect", "entityKind", "__publicField", "_a", "SQLiteUpdateBuilder", "table", "session", "dialect", "withList", "values", "SQLiteUpdateBase", "mapUpdateSet", "__name", "entityKind", "__publicField", "QueryPromise", "set", "where", "fields", "SQLiteTable", "orderSelectedFields", "_typings", "rest", "isOneTimeQuery", "placeholderValues", "_a", "RelationalQueryBuilder", "mode", "fullSchema", "schema", "tableNamesMap", "table", "tableConfig", "dialect", "session", "config", "SQLiteSyncRelationalQuery", "SQLiteRelationalQuery", "__name", "entityKind", "__publicField", "QueryPromise", "isOneTimeQuery", "query", "builtQuery", "rawRows", "mapColumnValue", "rows", "row", "mapRelationalRow", "_a", "SQLiteRaw", "QueryPromise", "execute", "getSQL", "action", "dialect", "mapBatchResult", "result", "isFromBatch", "__name", "entityKind", "__publicField", "_a", "BaseSQLiteDatabase", "resultKind", "dialect", "session", "schema", "query", "tableName", "columns", "RelationalQueryBuilder", "alias", "qb", "QueryBuilder", "WithSubquery", "SelectionProxyHandler", "queries", "self", "select", "fields", "SQLiteSelectBuilder", "__name", "selectDistinct", "update", "table", "SQLiteUpdateBuilder", "insert", "into", "SQLiteInsertBuilder", "delete_", "from", "SQLiteDeleteBase", "sql", "SQLiteRaw", "transaction", "config", "entityKind", "__publicField", "_a", "ExecuteResultSync", "QueryPromise", "resultCb", "__name", "entityKind", "__publicField", "SQLitePreparedQuery", "mode", "executeMethod", "query", "result", "_isFromBatch", "_result", "placeholderValues", "response", "isFromBatch", "SQLiteSession", "dialect", "fields", "staticQuery", "err", "DrizzleError", "SQLiteTransaction", "BaseSQLiteDatabase", "resultType", "session", "schema", "nestedIndex", "TransactionRollbackError", "InlineForeignKeys", "_a", "MySqlTable", "Table", "entityKind", "__name", "__publicField", "_a", "ForeignKeyBuilder", "config", "actions", "name", "columns", "foreignColumns", "action", "table", "ForeignKey", "__name", "entityKind", "__publicField", "builder", "columnNames", "column", "foreignColumnNames", "chunks", "MySqlTable", "uniqueKeyName", "table", "columns", "MySqlTable", "__name", "_a", "UniqueConstraintBuilder", "name", "UniqueConstraint", "entityKind", "__publicField", "UniqueOnConstraintBuilder", "column", "_a", "MySqlColumnBuilder", "ColumnBuilder", "ref", "actions", "name", "column", "table", "builder", "ForeignKeyBuilder", "foreignColumn", "__name", "entityKind", "__publicField", "MySqlColumn", "Column", "config", "uniqueKeyName", "MySqlColumnBuilderWithAutoIncrement", "dataType", "columnType", "MySqlColumnWithAutoIncrement", "_a", "MySqlCharBuilder", "MySqlColumnBuilder", "name", "config", "table", "MySqlChar", "__name", "entityKind", "__publicField", "MySqlColumn", "_a", "MySqlVarBinaryBuilder", "MySqlColumnBuilder", "name", "config", "table", "MySqlVarBinary", "__name", "entityKind", "__publicField", "MySqlColumn", "_a", "MySqlVarCharBuilder", "MySqlColumnBuilder", "name", "config", "table", "MySqlVarChar", "__name", "entityKind", "__publicField", "MySqlColumn", "_a", "ForeignKeyBuilder", "config", "actions", "name", "columns", "foreignColumns", "action", "table", "ForeignKey", "__name", "entityKind", "__publicField", "builder", "columnNames", "column", "foreignColumnNames", "chunks", "PgTable", "uniqueKeyName", "table", "columns", "PgTable", "__name", "_a", "UniqueConstraintBuilder", "name", "UniqueConstraint", "entityKind", "__publicField", "UniqueOnConstraintBuilder", "nullsNotDistinct", "column", "parsePgArrayValue", "arrayString", "startFrom", "inQuotes", "i", "char", "__name", "parsePgNestedArray", "result", "lastCharIsComma", "value", "newStartFrom", "parsePgArray", "makePgArray", "array", "item", "_a", "PgColumnBuilder", "ColumnBuilder", "size", "PgArrayBuilder", "ref", "actions", "name", "config", "column", "table", "iife", "builder", "ForeignKeyBuilder", "foreignColumn", "__name", "entityKind", "__publicField", "PgColumn", "Column", "uniqueKeyName", "baseBuilder", "baseColumn", "PgArray", "_PgArray", "range", "value", "parsePgArray", "v", "isNestedArray", "a", "is", "makePgArray", "_a", "PgCharBuilder", "PgColumnBuilder", "name", "config", "table", "PgChar", "__name", "entityKind", "__publicField", "PgColumn", "_a", "PgUUIDBuilder", "PgColumnBuilder", "name", "sql", "table", "PgUUID", "__name", "entityKind", "__publicField", "PgColumn", "_a", "PgVarcharBuilder", "PgColumnBuilder", "name", "config", "table", "PgVarchar", "__name", "entityKind", "__publicField", "PgColumn", "external_exports", "__export", "BRAND", "DIRTY", "EMPTY_PATH", "INVALID", "NEVER", "OK", "ParseStatus", "ZodType", "ZodAny", "ZodArray", "ZodBigInt", "ZodBoolean", "ZodBranded", "ZodCatch", "ZodDate", "ZodDefault", "ZodDiscriminatedUnion", "ZodEffects", "ZodEnum", "ZodError", "ZodFirstPartyTypeKind", "ZodFunction", "ZodIntersection", "ZodIssueCode", "ZodLazy", "ZodLiteral", "ZodMap", "ZodNaN", "ZodNativeEnum", "ZodNever", "ZodNull", "ZodNullable", "ZodNumber", "ZodObject", "ZodOptional", "ZodParsedType", "ZodPipeline", "ZodPromise", "ZodReadonly", "ZodRecord", "ZodSet", "ZodString", "ZodSymbol", "ZodTuple", "ZodUndefined", "ZodUnion", "ZodUnknown", "ZodVoid", "addIssueToContext", "anyType", "arrayType", "bigIntType", "booleanType", "coerce", "custom", "dateType", "datetimeRegex", "en_default", "discriminatedUnionType", "effectsType", "enumType", "functionType", "getErrorMap", "getParsedType", "instanceOfType", "intersectionType", "isAborted", "isAsync", "isDirty", "isValid", "late", "lazyType", "literalType", "makeIssue", "mapType", "nanType", "nativeEnumType", "neverType", "nullType", "nullableType", "numberType", "objectType", "objectUtil", "oboolean", "onumber", "optionalType", "ostring", "pipelineType", "preprocessType", "promiseType", "quotelessJson", "recordType", "setType", "setErrorMap", "strictObjectType", "stringType", "symbolType", "tupleType", "undefinedType", "unionType", "unknownType", "util", "voidType", "util", "_", "assertIs", "_arg", "__name", "assertNever", "_x", "items", "obj", "item", "validKeys", "k", "filtered", "e", "object", "keys", "key", "arr", "checker", "val", "joinValues", "array", "separator", "value", "objectUtil", "first", "second", "ZodParsedType", "getParsedType", "data", "ZodIssueCode", "util", "quotelessJson", "__name", "obj", "ZodError", "issues", "sub", "subs", "actualProto", "_mapper", "mapper", "issue", "fieldErrors", "processError", "error", "curr", "i", "el", "value", "formErrors", "firstEl", "errorMap", "__name", "issue", "_ctx", "message", "ZodIssueCode", "ZodParsedType", "util", "en_default", "overrideErrorMap", "en_default", "setErrorMap", "map", "overrideErrorMap", "__name", "getErrorMap", "makeIssue", "__name", "params", "data", "path", "errorMaps", "issueData", "fullPath", "fullIssue", "errorMessage", "maps", "m", "map", "EMPTY_PATH", "addIssueToContext", "ctx", "overrideMap", "getErrorMap", "issue", "en_default", "x", "ParseStatus", "status", "results", "arrayValue", "s", "INVALID", "pairs", "syncPairs", "pair", "key", "value", "finalObject", "DIRTY", "OK", "isAborted", "isDirty", "isValid", "isAsync", "errorUtil", "message", "ParseInputLazyPath", "parent", "value", "path", "key", "__name", "handleResult", "ctx", "result", "isValid", "error", "ZodError", "processCreateParams", "params", "errorMap", "invalid_type_error", "required_error", "description", "iss", "message", "ZodType", "input", "getParsedType", "ParseStatus", "isAsync", "data", "err", "maybeAsyncResult", "check", "getIssueProperties", "val", "setError", "ZodIssueCode", "refinementData", "refinement", "ZodEffects", "ZodFirstPartyTypeKind", "def", "ZodOptional", "ZodNullable", "ZodArray", "ZodPromise", "option", "ZodUnion", "incoming", "ZodIntersection", "transform", "defaultValueFunc", "ZodDefault", "ZodBranded", "catchValueFunc", "ZodCatch", "This", "target", "ZodPipeline", "ZodReadonly", "cuidRegex", "cuid2Regex", "ulidRegex", "uuidRegex", "nanoidRegex", "jwtRegex", "durationRegex", "emailRegex", "_emojiRegex", "emojiRegex", "ipv4Regex", "ipv4CidrRegex", "ipv6Regex", "ipv6CidrRegex", "base64Regex", "base64urlRegex", "dateRegexSource", "dateRegex", "timeRegexSource", "args", "secondsRegexSource", "secondsQuantifier", "timeRegex", "datetimeRegex", "regex", "opts", "isValidIP", "ip", "version", "isValidJWT", "jwt", "alg", "header", "base64", "decoded", "isValidCidr", "ZodString", "ZodParsedType", "addIssueToContext", "INVALID", "status", "tooBig", "tooSmall", "util", "validation", "errorUtil", "options", "minLength", "maxLength", "len", "ch", "min", "max", "floatSafeRemainder", "step", "valDecCount", "stepDecCount", "decCount", "valInt", "stepInt", "ZodNumber", "kind", "inclusive", "ZodBigInt", "ZodBoolean", "OK", "ZodDate", "minDate", "maxDate", "ZodSymbol", "ZodUndefined", "ZodNull", "ZodAny", "ZodUnknown", "ZodNever", "ZodVoid", "item", "i", "schema", "deepPartialify", "ZodObject", "newShape", "fieldSchema", "ZodTuple", "shape", "keys", "shapeKeys", "extraKeys", "pairs", "keyValidator", "unknownKeys", "catchall", "syncPairs", "pair", "issue", "defaultError", "augmentation", "merging", "index", "mask", "newField", "createZodEnum", "handleResults", "results", "unionErrors", "childCtx", "dirty", "issues", "types", "getDiscriminator", "type", "ZodLazy", "ZodLiteral", "ZodEnum", "ZodNativeEnum", "ZodDiscriminatedUnion", "discriminator", "discriminatorValue", "optionsMap", "discriminatorValues", "mergeValues", "a", "b", "aType", "bType", "bKeys", "sharedKeys", "newObj", "sharedValue", "newArray", "itemA", "itemB", "handleParsed", "parsedLeft", "parsedRight", "isAborted", "merged", "isDirty", "left", "right", "items", "itemIndex", "x", "rest", "schemas", "ZodRecord", "keyType", "valueType", "first", "second", "third", "ZodMap", "finalMap", "ZodSet", "finalizeSet", "elements", "parsedSet", "element", "minSize", "maxSize", "size", "ZodFunction", "makeArgsIssue", "makeIssue", "getErrorMap", "en_default", "makeReturnsIssue", "returns", "fn", "me", "parsedArgs", "e", "parsedReturns", "returnType", "func", "getter", "values", "expectedValues", "enumValues", "newDef", "opt", "nativeEnumValues", "promisified", "effect", "checkCtx", "arg", "processed", "DIRTY", "executeRefinement", "acc", "inner", "base", "preprocess", "ZodOptional", "ZodType", "input", "ZodParsedType", "OK", "__name", "type", "params", "ZodFirstPartyTypeKind", "processCreateParams", "ZodNullable", "ZodDefault", "ctx", "data", "ZodCatch", "newCtx", "result", "isAsync", "ZodError", "ZodNaN", "addIssueToContext", "ZodIssueCode", "INVALID", "BRAND", "ZodBranded", "ZodPipeline", "status", "inResult", "DIRTY", "a", "b", "ZodReadonly", "freeze", "isValid", "cleanParams", "p", "custom", "check", "_params", "fatal", "ZodAny", "r", "_fatal", "late", "ZodObject", "ZodFirstPartyTypeKind", "instanceOfType", "__name", "cls", "params", "custom", "data", "stringType", "ZodString", "numberType", "ZodNumber", "nanType", "ZodNaN", "bigIntType", "ZodBigInt", "booleanType", "ZodBoolean", "dateType", "ZodDate", "symbolType", "ZodSymbol", "undefinedType", "ZodUndefined", "nullType", "ZodNull", "anyType", "ZodAny", "unknownType", "ZodUnknown", "neverType", "ZodNever", "voidType", "ZodVoid", "arrayType", "ZodArray", "objectType", "ZodObject", "strictObjectType", "unionType", "ZodUnion", "discriminatedUnionType", "ZodDiscriminatedUnion", "intersectionType", "ZodIntersection", "tupleType", "ZodTuple", "recordType", "ZodRecord", "mapType", "ZodMap", "setType", "ZodSet", "functionType", "ZodFunction", "lazyType", "ZodLazy", "literalType", "ZodLiteral", "enumType", "ZodEnum", "nativeEnumType", "ZodNativeEnum", "promiseType", "ZodPromise", "effectsType", "ZodEffects", "optionalType", "ZodOptional", "nullableType", "ZodNullable", "preprocessType", "pipelineType", "ZodPipeline", "ostring", "onumber", "oboolean", "coerce", "arg", "NEVER", "INVALID", "literalSchema", "z", "union", "string", "number", "boolean", "null", "jsonSchema", "lazy", "array", "record", "createInsertSchema", "table", "refine", "columns", "getTableColumns", "columnEntries", "Object", "entries", "schemaEntries", "fromEntries", "map", "name", "column", "mapColumnToSchema", "assign", "refineColumn", "notNull", "hasDefault", "optional", "nullable", "object", "mapColumnToSchema", "column", "type", "Array", "isArray", "enumValues", "length", "z", "enum", "string", "is", "PgUUID", "uuid", "dataType", "any", "jsonSchema", "array", "baseColumn", "number", "bigint", "boolean", "date", "sType", "PgChar", "PgVarchar", "MySqlVarChar", "MySqlVarBinary", "MySqlChar", "SQLiteText", "max", "apiKeys", "sqliteTable", "text", "integer", "insertApiKeySchema", "c", "mailboxes", "insertMailboxSchema", "emails", "AddressSchema", "objectType", "stringType", "insertEmailSchema", "arrayType", "recordType", "insertEmail", "db", "email", "emails", "e", "__name", "findEmailById", "db", "id", "result", "emails", "and", "eq", "__name", "getEmailsByMessageTo", "messageTo", "desc", "deleteEmails", "db", "ids", "emails", "inArray", "e", "__name", "deleteExpiredEmails", "expirationTime", "lt", "findApiKeyByKey", "key", "result", "apiKeys", "eq", "updateApiKeyLastUsed", "id", "insertApiKey", "apiKey", "insertMailbox", "mailbox", "mailboxes", "findMailboxById", "getMailboxMessages", "db", "address", "options", "offset", "orderFn", "asc", "desc", "messages", "countResult", "emails", "eq", "count", "total", "e", "__name", "findMailboxMessage", "messageId", "result", "and", "deleteMailboxMessage", "getMailboxMessageCount", "_a", "SQLiteD1Session", "SQLiteSession", "client", "dialect", "schema", "options", "NoopLogger", "query", "fields", "executeMethod", "customResultMapper", "stmt", "D1PreparedQuery", "queries", "preparedQueries", "builtQueries", "preparedQuery", "builtQuery", "result", "i", "d1ToRawMapping", "transaction", "config", "tx", "D1Transaction", "sql", "err", "__name", "entityKind", "__publicField", "_D1Transaction", "SQLiteTransaction", "savepointName", "results", "rows", "row", "entry", "k", "SQLitePreparedQuery", "logger", "placeholderValues", "params", "fillPlaceholders", "isFromBatch", "mapResultRow", "joinsNotNullableMap", "_a", "DrizzleD1Database", "BaseSQLiteDatabase", "batch", "__name", "entityKind", "__publicField", "drizzle", "client", "config", "dialect", "SQLiteAsyncDialect", "logger", "DefaultLogger", "schema", "tablesConfig", "extractTablesRelationalConfig", "createTableRelationsHelpers", "session", "SQLiteD1Session", "getD1DB", "db", "drizzle", "__name", "urlAlphabet", "nanoid", "__name", "size", "id", "i", "urlAlphabet", "textEncoder", "base64Chars", "base64Lookup", "i", "decodeBase64", "base64", "bufferLength", "len", "p", "arrayBuffer", "bytes", "encoded1", "encoded2", "encoded3", "encoded4", "__name", "getDecoder", "charset", "decoder", "blobToArrayBuffer", "blob", "fr", "resolve", "reject", "e", "getHex", "c", "decodeWord", "encoding", "str", "splitPos", "byteStr", "buf", "encodedBytes", "c1", "c2", "dataView", "decodeWords", "joinString", "done", "result", "match", "left", "chLeft", "encodedLeftStr", "chRight", "m", "text", "decodeURIComponentWithCharset", "encodedStr", "byte", "j", "decodeParameterValueContinuations", "header", "paramKeys", "key", "actualKey", "nr", "paramVal", "value", "a", "b", "PassThroughDecoder", "line", "blobToArrayBuffer", "__name", "Base64Decoder", "opts", "buffer", "str", "allowedBytes", "base64Str", "decodeBase64", "blobToArrayBuffer", "__name", "VALID_QP_REGEX", "QP_SPLIT_REGEX", "SOFT_LINE_BREAK_REGEX", "PARTIAL_QP_ENDING_REGEX", "QPDecoder", "opts", "encodedBytes", "buf", "dataView", "i", "len", "str", "list", "part", "firstThree", "buffer", "partialEnding", "blobToArrayBuffer", "__name", "MimeNode", "options", "transferEncoding", "Base64Decoder", "QPDecoder", "getDecoder", "PassThroughDecoder", "boundaries", "i", "childNode", "str", "response", "key", "value", "stage", "quote", "escaped", "chr", "len", "decodeParameterValueContinuations", "delSp", "previousValue", "currentValue", "line", "sep", "textEncoder", "__name", "htmlEntities", "html_entities_default", "decodeHTMLEntities", "str", "match", "entity", "html_entities_default", "codePoint", "output", "__name", "escapeHtml", "c", "hex", "textToHtml", "htmlToText", "formatTextAddress", "address", "formatTextAddresses", "addresses", "parts", "processAddress", "partCounter", "groupStart", "groupEnd", "formatHtmlAddress", "formatHtmlAddresses", "foldLines", "lineLength", "afterSpace", "pos", "len", "result", "line", "formatTextHeader", "message", "rows", "dateOptions", "dateStr", "maxKeyLength", "r", "acc", "cur", "row", "sepLen", "prefix", "emptyPrefix", "i", "maxLineLength", "lineMarker", "formatHtmlHeader", "_handleAddress", "tokens", "isGroup", "state", "address", "addresses", "data", "i", "len", "insideQuotes", "token", "prevToken", "groupMembers", "addressParser", "member", "decodeWords", "_regexHandler", "__name", "parsedSubAddresses", "Tokenizer", "str", "list", "chr", "nextChr", "node", "options", "parsedAddresses", "walkAddressList", "address_parser_default", "base64ArrayBuffer", "arrayBuffer", "base64", "encodings", "bytes", "byteLength", "byteRemainder", "mainLength", "a", "b", "chunk", "i", "__name", "MAX_NESTING_DEPTH", "MAX_HEADERS_SIZE", "PostalMime", "buf", "options", "MimeNode", "line", "isFinal", "boundaries", "i", "boundary", "isTerminator", "boudaryMatches", "startPos", "endPos", "res", "__name", "c", "textContent", "textTypes", "textMap", "forceRfc822Attachments", "walk", "node", "alternative", "related", "subParser", "textEntry", "subTextEntry", "subTextNode", "attachment", "textType", "selectorNode", "filename", "decodeWords", "decodedText", "textEncoder", "childNode", "mapEntry", "formatHtmlHeader", "formatTextHeader", "alternativeType", "textToHtml", "htmlToText", "stream", "chunkLen", "chunks", "reader", "done", "value", "result", "chunkPointer", "chunk", "blobToArrayBuffer", "message", "entry", "key", "addressHeader", "addresses", "address_parser_default", "camelKey", "o", "addressHeaders", "parsed", "header", "dateHeader", "date", "base64ArrayBuffer", "attachmentDecoder", "decrypt", "encryptedText", "secret", "text", "result", "i", "__name", "apiKeyAuth", "__name", "c", "next", "apiKey", "authHeader", "db", "getD1DB", "keyRecord", "findApiKeyByKey", "updateApiKeyLastUsed", "generateRandomLocalPart", "adjectives", "nouns", "adj", "noun", "num", "__name", "mailboxesRouter", "Hono", "c", "db", "getD1DB", "apiKey", "body", "availableDomains", "d", "domain", "address", "expiresIn", "expiresAt", "now", "mailbox", "nanoid", "insertMailbox", "e", "id", "findMailboxById", "messageCount", "getMailboxMessageCount", "page", "limit", "sort", "messages", "total", "totalPages", "getMailboxMessages", "msg", "messageId", "message", "findMailboxMessage", "deleteMailboxMessage", "mailboxes_default", "v1", "Hono", "cors", "apiKeyAuth", "mailboxes_default", "v1_default", "app", "Hono", "cors", "turnstile", "__name", "c", "next", "body", "e", "token", "ip", "params", "data", "api", "generateApiKey", "chars", "key", "i", "db", "getD1DB", "now", "apiKey", "keyPrefix", "newApiKey", "nanoid", "insertApiKey", "address", "emails", "getEmailsByMessageTo", "id", "email", "findEmailById", "ids", "result", "deleteEmails", "password", "decrypt", "emailDomain", "d", "v1_default", "module", "src_default", "message", "env", "ctx", "raw", "mail", "PostalMime", "newEmail", "insertEmailSchema", "insertEmail", "request", "url", "event", "oneDayAgo", "deleteExpiredEmails", "drainBody", "__name", "request", "env", "_ctx", "middlewareCtx", "reader", "e", "middleware_ensure_req_body_drained_default", "reduceError", "e", "__name", "jsonError", "request", "env", "_ctx", "middlewareCtx", "error", "middleware_miniflare3_json_error_default", "__INTERNAL_WRANGLER_MIDDLEWARE__", "middleware_ensure_req_body_drained_default", "middleware_miniflare3_json_error_default", "middleware_insertion_facade_default", "src_default", "__facade_middleware__", "__facade_register__", "args", "__name", "__facade_invokeChain__", "request", "env", "ctx", "dispatch", "middlewareChain", "head", "tail", "newRequest", "newEnv", "__name", "__facade_invoke__", "finalMiddleware", "__facade_middleware__", "__Facade_ScheduledController__", "scheduledTime", "cron", "noRetry", "#noRetry", "__name", "wrapExportedHandler", "worker", "__INTERNAL_WRANGLER_MIDDLEWARE__", "middleware", "__facade_register__", "fetchDispatcher", "request", "env", "ctx", "__facade_invoke__", "type", "init", "controller", "wrapWorkerEntrypoint", "klass", "#fetchDispatcher", "#dispatcher", "WRAPPED_ENTRY", "middleware_insertion_facade_default", "middleware_loader_entry_default"] +} diff --git a/README.md b/README.md index 4b69f9c..fafa364 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ - ✈️ 支持邮件收发 - ✨ 支持保存密码,找回邮箱 - 😄 支持多域名后缀 +- 🔌 **开放 RESTful API**,支持程序化调用 - 🚀 快速部署,纯 Cloudflare 方案,无需服务器 原理: @@ -20,6 +21,45 @@ - 邮件存储 (Cloudflare D1) - 发信使用 MailChannels API +## 📖 API 文档 + +Vmail 提供完整的 RESTful API,支持通过程序化方式创建临时邮箱、查询收件箱。 + +### 获取 API Key + +访问 [API 文档页面](https://vmail.dev/api-docs) 创建免费的 API Key。 + +### API 端点 + +| 方法 | 端点 | 说明 | +|------|------|------| +| `POST` | `/api/v1/mailboxes` | 创建临时邮箱 | +| `GET` | `/api/v1/mailboxes/:id` | 获取邮箱信息 | +| `GET` | `/api/v1/mailboxes/:id/messages` | 获取收件箱(支持分页) | +| `GET` | `/api/v1/mailboxes/:id/messages/:messageId` | 获取邮件详情 | +| `DELETE` | `/api/v1/mailboxes/:id/messages/:messageId` | 删除邮件 | + +### 快速开始 + +```bash +# 1. 创建临时邮箱 +curl -X POST https://vmail.dev/api/v1/mailboxes \ + -H "X-API-Key: your-api-key" \ + -H "Content-Type: application/json" + +# 响应: { "data": { "id": "abc123", "address": "random@domain.com", ... } } + +# 2. 查询收件箱 +curl https://vmail.dev/api/v1/mailboxes/abc123/messages \ + -H "X-API-Key: your-api-key" + +# 3. 获取邮件详情 +curl https://vmail.dev/api/v1/mailboxes/abc123/messages/msg_001 \ + -H "X-API-Key: your-api-key" +``` + +完整文档请访问:[https://vmail.dev/api-docs](https://vmail.dev/api-docs) + ## 👋 自部署教程 本项目已完全基于 Cloudflare Pages 和 Cloudflare D1 构建,大大简化了部署流程。您只需要一个托管在 Cloudflare 上的域名即可。 diff --git a/docs/email-worker-source.js b/docs/email-worker-source.js deleted file mode 100644 index daa6ef3..0000000 --- a/docs/email-worker-source.js +++ /dev/null @@ -1,17909 +0,0 @@ -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => - key in obj - ? __defProp(obj, key, { - enumerable: true, - configurable: true, - writable: true, - value, - }) - : (obj[key] = value); -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/entity.js -var entityKind = Symbol.for("drizzle:entityKind"); -var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind"); -function is(value, type) { - if (!value || typeof value !== "object") { - return false; - } - if (value instanceof type) { - return true; - } - if (!Object.prototype.hasOwnProperty.call(type, entityKind)) { - throw new Error( - `Class "${type.name ?? ""}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.` - ); - } - let cls = value.constructor; - if (cls) { - while (cls) { - if (entityKind in cls && cls[entityKind] === type[entityKind]) { - return true; - } - cls = Object.getPrototypeOf(cls); - } - } - return false; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/column.js -var _a; -var Column = class { - constructor(table, config) { - this.table = table; - this.config = config; - this.name = config.name; - this.notNull = config.notNull; - this.default = config.default; - this.defaultFn = config.defaultFn; - this.hasDefault = config.hasDefault; - this.primary = config.primaryKey; - this.isUnique = config.isUnique; - this.uniqueName = config.uniqueName; - this.uniqueType = config.uniqueType; - this.dataType = config.dataType; - this.columnType = config.columnType; - } - name; - primary; - notNull; - default; - defaultFn; - hasDefault; - isUnique; - uniqueName; - uniqueType; - dataType; - columnType; - enumValues = void 0; - config; - mapFromDriverValue(value) { - return value; - } - mapToDriverValue(value) { - return value; - } -}; -_a = entityKind; -__publicField(Column, _a, "Column"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/table.js -var TableName = Symbol.for("drizzle:Name"); -var Schema = Symbol.for("drizzle:Schema"); -var Columns = Symbol.for("drizzle:Columns"); -var OriginalName = Symbol.for("drizzle:OriginalName"); -var BaseName = Symbol.for("drizzle:BaseName"); -var IsAlias = Symbol.for("drizzle:IsAlias"); -var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder"); -var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable"); -var _a2; -var Table = class { - /** - * @internal - * Can be changed if the table is aliased. - */ - [((_a2 = entityKind), TableName)]; - /** - * @internal - * Used to store the original name of the table, before any aliasing. - */ - [OriginalName]; - /** @internal */ - [Schema]; - /** @internal */ - [Columns]; - /** - * @internal - * Used to store the table name before the transformation via the `tableCreator` functions. - */ - [BaseName]; - /** @internal */ - [IsAlias] = false; - /** @internal */ - [ExtraConfigBuilder] = void 0; - [IsDrizzleTable] = true; - constructor(name, schema, baseName) { - this[TableName] = this[OriginalName] = name; - this[Schema] = schema; - this[BaseName] = baseName; - } -}; -__publicField(Table, _a2, "Table"); -/** @internal */ -__publicField(Table, "Symbol", { - Name: TableName, - Schema, - OriginalName, - Columns, - BaseName, - IsAlias, - ExtraConfigBuilder, -}); -function isTable(table) { - return typeof table === "object" && table !== null && IsDrizzleTable in table; -} -function getTableName(table) { - return table[TableName]; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/table.js -var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys"); -var _a3; -var PgTable = class extends Table { - /**@internal */ - [((_a3 = entityKind), InlineForeignKeys)] = []; - /** @internal */ - [Table.Symbol.ExtraConfigBuilder] = void 0; -}; -__publicField(PgTable, _a3, "PgTable"); -/** @internal */ -__publicField( - PgTable, - "Symbol", - Object.assign({}, Table.Symbol, { - InlineForeignKeys, - }) -); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/primary-keys.js -var _a4; -var PrimaryKeyBuilder = class { - /** @internal */ - columns; - /** @internal */ - name; - constructor(columns, name) { - this.columns = columns; - this.name = name; - } - /** @internal */ - build(table) { - return new PrimaryKey(table, this.columns, this.name); - } -}; -_a4 = entityKind; -__publicField(PrimaryKeyBuilder, _a4, "PgPrimaryKeyBuilder"); -var _a5; -var PrimaryKey = class { - constructor(table, columns, name) { - this.table = table; - this.columns = columns; - this.name = name; - } - columns; - name; - getName() { - return ( - this.name ?? - `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk` - ); - } -}; -_a5 = entityKind; -__publicField(PrimaryKey, _a5, "PgPrimaryKey"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sql/expressions/conditions.js -function bindIfParam(value, column) { - if ( - isDriverValueEncoder(column) && - !isSQLWrapper(value) && - !is(value, Param) && - !is(value, Placeholder) && - !is(value, Column) && - !is(value, Table) && - !is(value, View) - ) { - return new Param(value, column); - } - return value; -} -var eq = (left, right) => { - return sql`${left} = ${bindIfParam(right, left)}`; -}; -var ne = (left, right) => { - return sql`${left} <> ${bindIfParam(right, left)}`; -}; -function and(...unfilteredConditions) { - const conditions = unfilteredConditions.filter((c2) => c2 !== void 0); - if (conditions.length === 0) { - return void 0; - } - if (conditions.length === 1) { - return new SQL(conditions); - } - return new SQL([ - new StringChunk("("), - sql.join(conditions, new StringChunk(" and ")), - new StringChunk(")"), - ]); -} -function or(...unfilteredConditions) { - const conditions = unfilteredConditions.filter((c2) => c2 !== void 0); - if (conditions.length === 0) { - return void 0; - } - if (conditions.length === 1) { - return new SQL(conditions); - } - return new SQL([ - new StringChunk("("), - sql.join(conditions, new StringChunk(" or ")), - new StringChunk(")"), - ]); -} -function not(condition) { - return sql`not ${condition}`; -} -var gt = (left, right) => { - return sql`${left} > ${bindIfParam(right, left)}`; -}; -var gte = (left, right) => { - return sql`${left} >= ${bindIfParam(right, left)}`; -}; -var lt = (left, right) => { - return sql`${left} < ${bindIfParam(right, left)}`; -}; -var lte = (left, right) => { - return sql`${left} <= ${bindIfParam(right, left)}`; -}; -function inArray(column, values) { - if (Array.isArray(values)) { - if (values.length === 0) { - throw new Error("inArray requires at least one value"); - } - return sql`${column} in ${values.map((v) => bindIfParam(v, column))}`; - } - return sql`${column} in ${bindIfParam(values, column)}`; -} -function notInArray(column, values) { - if (Array.isArray(values)) { - if (values.length === 0) { - throw new Error("notInArray requires at least one value"); - } - return sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`; - } - return sql`${column} not in ${bindIfParam(values, column)}`; -} -function isNull(value) { - return sql`${value} is null`; -} -function isNotNull(value) { - return sql`${value} is not null`; -} -function exists(subquery) { - return sql`exists ${subquery}`; -} -function notExists(subquery) { - return sql`not exists ${subquery}`; -} -function between(column, min, max) { - return sql`${column} between ${bindIfParam(min, column)} and ${bindIfParam( - max, - column - )}`; -} -function notBetween(column, min, max) { - return sql`${column} not between ${bindIfParam( - min, - column - )} and ${bindIfParam(max, column)}`; -} -function like(column, value) { - return sql`${column} like ${value}`; -} -function notLike(column, value) { - return sql`${column} not like ${value}`; -} -function ilike(column, value) { - return sql`${column} ilike ${value}`; -} -function notIlike(column, value) { - return sql`${column} not ilike ${value}`; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sql/expressions/select.js -function asc(column) { - return sql`${column} asc`; -} -function desc(column) { - return sql`${column} desc`; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/relations.js -var _a6; -var Relation = class { - constructor(sourceTable, referencedTable, relationName) { - this.sourceTable = sourceTable; - this.referencedTable = referencedTable; - this.relationName = relationName; - this.referencedTableName = referencedTable[Table.Symbol.Name]; - } - referencedTableName; - fieldName; -}; -_a6 = entityKind; -__publicField(Relation, _a6, "Relation"); -var _a7; -var Relations = class { - constructor(table, config) { - this.table = table; - this.config = config; - } -}; -_a7 = entityKind; -__publicField(Relations, _a7, "Relations"); -var _a8; -var _One = class extends Relation { - constructor(sourceTable, referencedTable, config, isNullable) { - super(sourceTable, referencedTable, config?.relationName); - this.config = config; - this.isNullable = isNullable; - } - withFieldName(fieldName) { - const relation = new _One( - this.sourceTable, - this.referencedTable, - this.config, - this.isNullable - ); - relation.fieldName = fieldName; - return relation; - } -}; -var One = _One; -_a8 = entityKind; -__publicField(One, _a8, "One"); -var _a9; -var _Many = class extends Relation { - constructor(sourceTable, referencedTable, config) { - super(sourceTable, referencedTable, config?.relationName); - this.config = config; - } - withFieldName(fieldName) { - const relation = new _Many( - this.sourceTable, - this.referencedTable, - this.config - ); - relation.fieldName = fieldName; - return relation; - } -}; -var Many = _Many; -_a9 = entityKind; -__publicField(Many, _a9, "Many"); -function getOperators() { - return { - and, - between, - eq, - exists, - gt, - gte, - ilike, - inArray, - isNull, - isNotNull, - like, - lt, - lte, - ne, - not, - notBetween, - notExists, - notLike, - notIlike, - notInArray, - or, - sql, - }; -} -function getOrderByOperators() { - return { - sql, - asc, - desc, - }; -} -function extractTablesRelationalConfig(schema, configHelpers) { - if ( - Object.keys(schema).length === 1 && - "default" in schema && - !is(schema["default"], Table) - ) { - schema = schema["default"]; - } - const tableNamesMap = {}; - const relationsBuffer = {}; - const tablesConfig = {}; - for (const [key, value] of Object.entries(schema)) { - if (isTable(value)) { - const dbName = value[Table.Symbol.Name]; - const bufferedRelations = relationsBuffer[dbName]; - tableNamesMap[dbName] = key; - tablesConfig[key] = { - tsName: key, - dbName: value[Table.Symbol.Name], - schema: value[Table.Symbol.Schema], - columns: value[Table.Symbol.Columns], - relations: bufferedRelations?.relations ?? {}, - primaryKey: bufferedRelations?.primaryKey ?? [], - }; - for (const column of Object.values(value[Table.Symbol.Columns])) { - if (column.primary) { - tablesConfig[key].primaryKey.push(column); - } - } - const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value); - if (extraConfig) { - for (const configEntry of Object.values(extraConfig)) { - if (is(configEntry, PrimaryKeyBuilder)) { - tablesConfig[key].primaryKey.push(...configEntry.columns); - } - } - } - } else if (is(value, Relations)) { - const dbName = value.table[Table.Symbol.Name]; - const tableName = tableNamesMap[dbName]; - const relations2 = value.config(configHelpers(value.table)); - let primaryKey; - for (const [relationName, relation] of Object.entries(relations2)) { - if (tableName) { - const tableConfig = tablesConfig[tableName]; - tableConfig.relations[relationName] = relation; - if (primaryKey) { - tableConfig.primaryKey.push(...primaryKey); - } - } else { - if (!(dbName in relationsBuffer)) { - relationsBuffer[dbName] = { - relations: {}, - primaryKey, - }; - } - relationsBuffer[dbName].relations[relationName] = relation; - } - } - } - } - return { tables: tablesConfig, tableNamesMap }; -} -function createOne(sourceTable) { - return function one(table, config) { - return new One( - sourceTable, - table, - config, - config?.fields.reduce((res, f2) => res && f2.notNull, true) ?? false - ); - }; -} -function createMany(sourceTable) { - return function many(referencedTable, config) { - return new Many(sourceTable, referencedTable, config); - }; -} -function normalizeRelation(schema, tableNamesMap, relation) { - if (is(relation, One) && relation.config) { - return { - fields: relation.config.fields, - references: relation.config.references, - }; - } - const referencedTableTsName = - tableNamesMap[relation.referencedTable[Table.Symbol.Name]]; - if (!referencedTableTsName) { - throw new Error( - `Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema` - ); - } - const referencedTableConfig = schema[referencedTableTsName]; - if (!referencedTableConfig) { - throw new Error(`Table "${referencedTableTsName}" not found in schema`); - } - const sourceTable = relation.sourceTable; - const sourceTableTsName = tableNamesMap[sourceTable[Table.Symbol.Name]]; - if (!sourceTableTsName) { - throw new Error( - `Table "${sourceTable[Table.Symbol.Name]}" not found in schema` - ); - } - const reverseRelations = []; - for (const referencedTableRelation of Object.values( - referencedTableConfig.relations - )) { - if ( - (relation.relationName && - relation !== referencedTableRelation && - referencedTableRelation.relationName === relation.relationName) || - (!relation.relationName && - referencedTableRelation.referencedTable === relation.sourceTable) - ) { - reverseRelations.push(referencedTableRelation); - } - } - if (reverseRelations.length > 1) { - throw relation.relationName - ? new Error( - `There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"` - ) - : new Error( - `There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name` - ); - } - if ( - reverseRelations[0] && - is(reverseRelations[0], One) && - reverseRelations[0].config - ) { - return { - fields: reverseRelations[0].config.references, - references: reverseRelations[0].config.fields, - }; - } - throw new Error( - `There is not enough information to infer relation "${sourceTableTsName}.${relation.fieldName}"` - ); -} -function createTableRelationsHelpers(sourceTable) { - return { - one: createOne(sourceTable), - many: createMany(sourceTable), - }; -} -function mapRelationalRow( - tablesConfig, - tableConfig, - row, - buildQueryResultSelection, - mapColumnValue = (value) => value -) { - const result = {}; - for (const [ - selectionItemIndex, - selectionItem, - ] of buildQueryResultSelection.entries()) { - if (selectionItem.isJson) { - const relation = tableConfig.relations[selectionItem.tsKey]; - const rawSubRows = row[selectionItemIndex]; - const subRows = - typeof rawSubRows === "string" ? JSON.parse(rawSubRows) : rawSubRows; - result[selectionItem.tsKey] = is(relation, One) - ? subRows && - mapRelationalRow( - tablesConfig, - tablesConfig[selectionItem.relationTableTsKey], - subRows, - selectionItem.selection, - mapColumnValue - ) - : subRows.map((subRow) => - mapRelationalRow( - tablesConfig, - tablesConfig[selectionItem.relationTableTsKey], - subRow, - selectionItem.selection, - mapColumnValue - ) - ); - } else { - const value = mapColumnValue(row[selectionItemIndex]); - const field = selectionItem.field; - let decoder; - if (is(field, Column)) { - decoder = field; - } else if (is(field, SQL)) { - decoder = field.decoder; - } else { - decoder = field.sql.decoder; - } - result[selectionItem.tsKey] = - value === null ? null : decoder.mapFromDriverValue(value); - } - } - return result; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/subquery.js -var SubqueryConfig = Symbol.for("drizzle:SubqueryConfig"); -var _a10; -var Subquery = class { - /** @internal */ - [((_a10 = entityKind), SubqueryConfig)]; - constructor(sql2, selection, alias, isWith = false) { - this[SubqueryConfig] = { - sql: sql2, - selection, - alias, - isWith, - }; - } - // getSQL(): SQL { - // return new SQL([this]); - // } -}; -__publicField(Subquery, _a10, "Subquery"); -var _a11; -var WithSubquery = class extends Subquery {}; -_a11 = entityKind; -__publicField(WithSubquery, _a11, "WithSubquery"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/tracing-utils.js -function iife(fn, ...args) { - return fn(...args); -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/version.js -var version = "0.29.3"; - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/tracing.js -var otel; -var rawTracer; -var tracer = { - startActiveSpan(name, fn) { - if (!otel) { - return fn(); - } - if (!rawTracer) { - rawTracer = otel.trace.getTracer("drizzle-orm", version); - } - return iife( - (otel2, rawTracer2) => - rawTracer2.startActiveSpan(name, (span) => { - try { - return fn(span); - } catch (e) { - span.setStatus({ - code: otel2.SpanStatusCode.ERROR, - message: e instanceof Error ? e.message : "Unknown error", - // eslint-disable-line no-instanceof/no-instanceof - }); - throw e; - } finally { - span.end(); - } - }), - otel, - rawTracer - ); - }, -}; - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/view-common.js -var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sql/sql.js -var _a12; -var FakePrimitiveParam = class {}; -_a12 = entityKind; -__publicField(FakePrimitiveParam, _a12, "FakePrimitiveParam"); -function isSQLWrapper(value) { - return ( - typeof value === "object" && - value !== null && - "getSQL" in value && - typeof value.getSQL === "function" - ); -} -function mergeQueries(queries) { - const result = { sql: "", params: [] }; - for (const query of queries) { - result.sql += query.sql; - result.params.push(...query.params); - if (query.typings?.length) { - if (!result.typings) { - result.typings = []; - } - result.typings.push(...query.typings); - } - } - return result; -} -var _a13; -var StringChunk = class { - value; - constructor(value) { - this.value = Array.isArray(value) ? value : [value]; - } - getSQL() { - return new SQL([this]); - } -}; -_a13 = entityKind; -__publicField(StringChunk, _a13, "StringChunk"); -var _a14; -var _SQL = class { - constructor(queryChunks) { - this.queryChunks = queryChunks; - } - /** @internal */ - decoder = noopDecoder; - shouldInlineParams = false; - append(query) { - this.queryChunks.push(...query.queryChunks); - return this; - } - toQuery(config) { - return tracer.startActiveSpan("drizzle.buildSQL", (span) => { - const query = this.buildQueryFromSourceParams(this.queryChunks, config); - span?.setAttributes({ - "drizzle.query.text": query.sql, - "drizzle.query.params": JSON.stringify(query.params), - }); - return query; - }); - } - buildQueryFromSourceParams(chunks, _config) { - const config = Object.assign({}, _config, { - inlineParams: _config.inlineParams || this.shouldInlineParams, - paramStartIndex: _config.paramStartIndex || { value: 0 }, - }); - const { - escapeName, - escapeParam, - prepareTyping, - inlineParams, - paramStartIndex, - } = config; - return mergeQueries( - chunks.map((chunk) => { - if (is(chunk, StringChunk)) { - return { sql: chunk.value.join(""), params: [] }; - } - if (is(chunk, Name)) { - return { sql: escapeName(chunk.value), params: [] }; - } - if (chunk === void 0) { - return { sql: "", params: [] }; - } - if (Array.isArray(chunk)) { - const result = [new StringChunk("(")]; - for (const [i, p2] of chunk.entries()) { - result.push(p2); - if (i < chunk.length - 1) { - result.push(new StringChunk(", ")); - } - } - result.push(new StringChunk(")")); - return this.buildQueryFromSourceParams(result, config); - } - if (is(chunk, _SQL)) { - return this.buildQueryFromSourceParams(chunk.queryChunks, { - ...config, - inlineParams: inlineParams || chunk.shouldInlineParams, - }); - } - if (is(chunk, Table)) { - const schemaName = chunk[Table.Symbol.Schema]; - const tableName = chunk[Table.Symbol.Name]; - return { - sql: - schemaName === void 0 - ? escapeName(tableName) - : escapeName(schemaName) + "." + escapeName(tableName), - params: [], - }; - } - if (is(chunk, Column)) { - return { - sql: - escapeName(chunk.table[Table.Symbol.Name]) + - "." + - escapeName(chunk.name), - params: [], - }; - } - if (is(chunk, View)) { - const schemaName = chunk[ViewBaseConfig].schema; - const viewName = chunk[ViewBaseConfig].name; - return { - sql: - schemaName === void 0 - ? escapeName(viewName) - : escapeName(schemaName) + "." + escapeName(viewName), - params: [], - }; - } - if (is(chunk, Param)) { - const mappedValue = - chunk.value === null - ? null - : chunk.encoder.mapToDriverValue(chunk.value); - if (is(mappedValue, _SQL)) { - return this.buildQueryFromSourceParams([mappedValue], config); - } - if (inlineParams) { - return { - sql: this.mapInlineParam(mappedValue, config), - params: [], - }; - } - let typings; - if (prepareTyping !== void 0) { - typings = [prepareTyping(chunk.encoder)]; - } - return { - sql: escapeParam(paramStartIndex.value++, mappedValue), - params: [mappedValue], - typings, - }; - } - if (is(chunk, Placeholder)) { - return { - sql: escapeParam(paramStartIndex.value++, chunk), - params: [chunk], - }; - } - if (is(chunk, _SQL.Aliased) && chunk.fieldAlias !== void 0) { - return { sql: escapeName(chunk.fieldAlias), params: [] }; - } - if (is(chunk, Subquery)) { - if (chunk[SubqueryConfig].isWith) { - return { sql: escapeName(chunk[SubqueryConfig].alias), params: [] }; - } - return this.buildQueryFromSourceParams( - [ - new StringChunk("("), - chunk[SubqueryConfig].sql, - new StringChunk(") "), - new Name(chunk[SubqueryConfig].alias), - ], - config - ); - } - if (isSQLWrapper(chunk)) { - return this.buildQueryFromSourceParams( - [new StringChunk("("), chunk.getSQL(), new StringChunk(")")], - config - ); - } - if (is(chunk, Relation)) { - return this.buildQueryFromSourceParams( - [ - chunk.sourceTable, - new StringChunk("."), - sql.identifier(chunk.fieldName), - ], - config - ); - } - if (inlineParams) { - return { sql: this.mapInlineParam(chunk, config), params: [] }; - } - return { - sql: escapeParam(paramStartIndex.value++, chunk), - params: [chunk], - }; - }) - ); - } - mapInlineParam(chunk, { escapeString }) { - if (chunk === null) { - return "null"; - } - if (typeof chunk === "number" || typeof chunk === "boolean") { - return chunk.toString(); - } - if (typeof chunk === "string") { - return escapeString(chunk); - } - if (typeof chunk === "object") { - const mappedValueAsString = chunk.toString(); - if (mappedValueAsString === "[object Object]") { - return escapeString(JSON.stringify(chunk)); - } - return escapeString(mappedValueAsString); - } - throw new Error("Unexpected param value: " + chunk); - } - getSQL() { - return this; - } - as(alias) { - if (alias === void 0) { - return this; - } - return new _SQL.Aliased(this, alias); - } - mapWith(decoder) { - this.decoder = - typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder; - return this; - } - inlineParams() { - this.shouldInlineParams = true; - return this; - } -}; -var SQL = _SQL; -_a14 = entityKind; -__publicField(SQL, _a14, "SQL"); -var _a15; -var Name = class { - constructor(value) { - this.value = value; - } - brand; - getSQL() { - return new SQL([this]); - } -}; -_a15 = entityKind; -__publicField(Name, _a15, "Name"); -function isDriverValueEncoder(value) { - return ( - typeof value === "object" && - value !== null && - "mapToDriverValue" in value && - typeof value.mapToDriverValue === "function" - ); -} -var noopDecoder = { - mapFromDriverValue: (value) => value, -}; -var noopEncoder = { - mapToDriverValue: (value) => value, -}; -var noopMapper = { - ...noopDecoder, - ...noopEncoder, -}; -var _a16; -var Param = class { - /** - * @param value - Parameter value - * @param encoder - Encoder to convert the value to a driver parameter - */ - constructor(value, encoder = noopEncoder) { - this.value = value; - this.encoder = encoder; - } - brand; - getSQL() { - return new SQL([this]); - } -}; -_a16 = entityKind; -__publicField(Param, _a16, "Param"); -function sql(strings, ...params) { - const queryChunks = []; - if (params.length > 0 || (strings.length > 0 && strings[0] !== "")) { - queryChunks.push(new StringChunk(strings[0])); - } - for (const [paramIndex, param2] of params.entries()) { - queryChunks.push(param2, new StringChunk(strings[paramIndex + 1])); - } - return new SQL(queryChunks); -} -((sql2) => { - function empty() { - return new SQL([]); - } - sql2.empty = empty; - function fromList(list) { - return new SQL(list); - } - sql2.fromList = fromList; - function raw(str) { - return new SQL([new StringChunk(str)]); - } - sql2.raw = raw; - function join(chunks, separator) { - const result = []; - for (const [i, chunk] of chunks.entries()) { - if (i > 0 && separator !== void 0) { - result.push(separator); - } - result.push(chunk); - } - return new SQL(result); - } - sql2.join = join; - function identifier(value) { - return new Name(value); - } - sql2.identifier = identifier; - function placeholder2(name2) { - return new Placeholder(name2); - } - sql2.placeholder = placeholder2; - function param2(value, encoder) { - return new Param(value, encoder); - } - sql2.param = param2; -})(sql || (sql = {})); -((SQL2) => { - class Aliased { - constructor(sql2, fieldAlias) { - this.sql = sql2; - this.fieldAlias = fieldAlias; - } - static [entityKind] = "SQL.Aliased"; - /** @internal */ - isSelectionField = false; - getSQL() { - return this.sql; - } - /** @internal */ - clone() { - return new Aliased(this.sql, this.fieldAlias); - } - } - SQL2.Aliased = Aliased; -})(SQL || (SQL = {})); -var _a17; -var Placeholder = class { - constructor(name2) { - this.name = name2; - } - getSQL() { - return new SQL([this]); - } -}; -_a17 = entityKind; -__publicField(Placeholder, _a17, "Placeholder"); -function fillPlaceholders(params, values) { - return params.map((p2) => { - if (is(p2, Placeholder)) { - if (!(p2.name in values)) { - throw new Error(`No value for placeholder "${p2.name}" was provided`); - } - return values[p2.name]; - } - return p2; - }); -} -var _a18; -var View = class { - /** @internal */ - [((_a18 = entityKind), ViewBaseConfig)]; - constructor({ name: name2, schema, selectedFields, query }) { - this[ViewBaseConfig] = { - name: name2, - originalName: name2, - schema, - selectedFields, - query, - isExisting: !query, - isAlias: false, - }; - } - getSQL() { - return new SQL([this]); - } -}; -__publicField(View, _a18, "View"); -Column.prototype.getSQL = function () { - return new SQL([this]); -}; -Table.prototype.getSQL = function () { - return new SQL([this]); -}; -Subquery.prototype.getSQL = function () { - return new SQL([this]); -}; - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/alias.js -var _a19; -var ColumnAliasProxyHandler = class { - constructor(table) { - this.table = table; - } - get(columnObj, prop) { - if (prop === "table") { - return this.table; - } - return columnObj[prop]; - } -}; -_a19 = entityKind; -__publicField(ColumnAliasProxyHandler, _a19, "ColumnAliasProxyHandler"); -var _a20; -var TableAliasProxyHandler = class { - constructor(alias, replaceOriginalName) { - this.alias = alias; - this.replaceOriginalName = replaceOriginalName; - } - get(target, prop) { - if (prop === Table.Symbol.IsAlias) { - return true; - } - if (prop === Table.Symbol.Name) { - return this.alias; - } - if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) { - return this.alias; - } - if (prop === ViewBaseConfig) { - return { - ...target[ViewBaseConfig], - name: this.alias, - isAlias: true, - }; - } - if (prop === Table.Symbol.Columns) { - const columns = target[Table.Symbol.Columns]; - if (!columns) { - return columns; - } - const proxiedColumns = {}; - Object.keys(columns).map((key) => { - proxiedColumns[key] = new Proxy( - columns[key], - new ColumnAliasProxyHandler(new Proxy(target, this)) - ); - }); - return proxiedColumns; - } - const value = target[prop]; - if (is(value, Column)) { - return new Proxy( - value, - new ColumnAliasProxyHandler(new Proxy(target, this)) - ); - } - return value; - } -}; -_a20 = entityKind; -__publicField(TableAliasProxyHandler, _a20, "TableAliasProxyHandler"); -var _a21; -var RelationTableAliasProxyHandler = class { - constructor(alias) { - this.alias = alias; - } - get(target, prop) { - if (prop === "sourceTable") { - return aliasedTable(target.sourceTable, this.alias); - } - return target[prop]; - } -}; -_a21 = entityKind; -__publicField( - RelationTableAliasProxyHandler, - _a21, - "RelationTableAliasProxyHandler" -); -function aliasedTable(table, tableAlias) { - return new Proxy(table, new TableAliasProxyHandler(tableAlias, false)); -} -function aliasedTableColumn(column, tableAlias) { - return new Proxy( - column, - new ColumnAliasProxyHandler( - new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false)) - ) - ); -} -function mapColumnsInAliasedSQLToAlias(query, alias) { - return new SQL.Aliased( - mapColumnsInSQLToAlias(query.sql, alias), - query.fieldAlias - ); -} -function mapColumnsInSQLToAlias(query, alias) { - return sql.join( - query.queryChunks.map((c2) => { - if (is(c2, Column)) { - return aliasedTableColumn(c2, alias); - } - if (is(c2, SQL)) { - return mapColumnsInSQLToAlias(c2, alias); - } - if (is(c2, SQL.Aliased)) { - return mapColumnsInAliasedSQLToAlias(c2, alias); - } - return c2; - }) - ); -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/column-builder.js -var _a22; -var ColumnBuilder = class { - config; - constructor(name, dataType, columnType) { - this.config = { - name, - notNull: false, - default: void 0, - hasDefault: false, - primaryKey: false, - isUnique: false, - uniqueName: void 0, - uniqueType: void 0, - dataType, - columnType, - }; - } - /** - * Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types. - * - * @example - * ```ts - * const users = pgTable('users', { - * id: integer('id').$type().primaryKey(), - * details: json('details').$type().notNull(), - * }); - * ``` - */ - $type() { - return this; - } - /** - * Adds a `not null` clause to the column definition. - * - * Affects the `select` model of the table - columns *without* `not null` will be nullable on select. - */ - notNull() { - this.config.notNull = true; - return this; - } - /** - * Adds a `default ` clause to the column definition. - * - * Affects the `insert` model of the table - columns *with* `default` are optional on insert. - * - * If you need to set a dynamic default value, use {@link $defaultFn} instead. - */ - default(value) { - this.config.default = value; - this.config.hasDefault = true; - return this; - } - /** - * Adds a dynamic default value to the column. - * The function will be called when the row is inserted, and the returned value will be used as the column value. - * - * **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`. - */ - $defaultFn(fn) { - this.config.defaultFn = fn; - this.config.hasDefault = true; - return this; - } - /** - * Alias for {@link $defaultFn}. - */ - $default = this.$defaultFn; - /** - * Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`. - * - * In SQLite, `integer primary key` implicitly makes the column auto-incrementing. - */ - primaryKey() { - this.config.primaryKey = true; - this.config.notNull = true; - return this; - } -}; -_a22 = entityKind; -__publicField(ColumnBuilder, _a22, "ColumnBuilder"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/errors.js -var _a23; -var DrizzleError = class extends Error { - constructor({ message, cause }) { - super(message); - this.name = "DrizzleError"; - this.cause = cause; - } -}; -_a23 = entityKind; -__publicField(DrizzleError, _a23, "DrizzleError"); -var _a24; -var TransactionRollbackError = class extends DrizzleError { - constructor() { - super({ message: "Rollback" }); - } -}; -_a24 = entityKind; -__publicField(TransactionRollbackError, _a24, "TransactionRollbackError"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/logger.js -var _a25; -var ConsoleLogWriter = class { - write(message) { - console.log(message); - } -}; -_a25 = entityKind; -__publicField(ConsoleLogWriter, _a25, "ConsoleLogWriter"); -var _a26; -var DefaultLogger = class { - writer; - constructor(config) { - this.writer = config?.writer ?? new ConsoleLogWriter(); - } - logQuery(query, params) { - const stringifiedParams = params.map((p2) => { - try { - return JSON.stringify(p2); - } catch { - return String(p2); - } - }); - const paramsStr = stringifiedParams.length - ? ` -- params: [${stringifiedParams.join(", ")}]` - : ""; - this.writer.write(`Query: ${query}${paramsStr}`); - } -}; -_a26 = entityKind; -__publicField(DefaultLogger, _a26, "DefaultLogger"); -var _a27; -var NoopLogger = class { - logQuery() {} -}; -_a27 = entityKind; -__publicField(NoopLogger, _a27, "NoopLogger"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/query-promise.js -var _a28; -var QueryPromise = class { - [((_a28 = entityKind), Symbol.toStringTag)] = "QueryPromise"; - catch(onRejected) { - return this.then(void 0, onRejected); - } - finally(onFinally) { - return this.then( - (value) => { - onFinally?.(); - return value; - }, - (reason) => { - onFinally?.(); - throw reason; - } - ); - } - then(onFulfilled, onRejected) { - return this.execute().then(onFulfilled, onRejected); - } -}; -__publicField(QueryPromise, _a28, "QueryPromise"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/utils.js -function mapResultRow(columns, row, joinsNotNullableMap) { - const nullifyMap = {}; - const result = columns.reduce((result2, { path, field }, columnIndex) => { - let decoder; - if (is(field, Column)) { - decoder = field; - } else if (is(field, SQL)) { - decoder = field.decoder; - } else { - decoder = field.sql.decoder; - } - let node = result2; - for (const [pathChunkIndex, pathChunk] of path.entries()) { - if (pathChunkIndex < path.length - 1) { - if (!(pathChunk in node)) { - node[pathChunk] = {}; - } - node = node[pathChunk]; - } else { - const rawValue = row[columnIndex]; - const value = (node[pathChunk] = - rawValue === null ? null : decoder.mapFromDriverValue(rawValue)); - if (joinsNotNullableMap && is(field, Column) && path.length === 2) { - const objectName = path[0]; - if (!(objectName in nullifyMap)) { - nullifyMap[objectName] = - value === null ? getTableName(field.table) : false; - } else if ( - typeof nullifyMap[objectName] === "string" && - nullifyMap[objectName] !== getTableName(field.table) - ) { - nullifyMap[objectName] = false; - } - } - } - } - return result2; - }, {}); - if (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) { - for (const [objectName, tableName] of Object.entries(nullifyMap)) { - if (typeof tableName === "string" && !joinsNotNullableMap[tableName]) { - result[objectName] = null; - } - } - } - return result; -} -function orderSelectedFields(fields, pathPrefix) { - return Object.entries(fields).reduce((result, [name, field]) => { - if (typeof name !== "string") { - return result; - } - const newPath = pathPrefix ? [...pathPrefix, name] : [name]; - if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) { - result.push({ path: newPath, field }); - } else if (is(field, Table)) { - result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath)); - } else { - result.push(...orderSelectedFields(field, newPath)); - } - return result; - }, []); -} -function haveSameKeys(left, right) { - const leftKeys = Object.keys(left); - const rightKeys = Object.keys(right); - if (leftKeys.length !== rightKeys.length) { - return false; - } - for (const [index, key] of leftKeys.entries()) { - if (key !== rightKeys[index]) { - return false; - } - } - return true; -} -function mapUpdateSet(table, values) { - const entries = Object.entries(values) - .filter(([, value]) => value !== void 0) - .map(([key, value]) => { - if (is(value, SQL)) { - return [key, value]; - } else { - return [key, new Param(value, table[Table.Symbol.Columns][key])]; - } - }); - if (entries.length === 0) { - throw new Error("No values to set"); - } - return Object.fromEntries(entries); -} -function applyMixins(baseClass, extendedClasses) { - for (const extendedClass of extendedClasses) { - for (const name of Object.getOwnPropertyNames(extendedClass.prototype)) { - if (name === "constructor") continue; - Object.defineProperty( - baseClass.prototype, - name, - Object.getOwnPropertyDescriptor(extendedClass.prototype, name) || - /* @__PURE__ */ Object.create(null) - ); - } - } -} -function getTableColumns(table) { - return table[Table.Symbol.Columns]; -} -function getTableLikeName(table) { - return is(table, Subquery) - ? table[SubqueryConfig].alias - : is(table, View) - ? table[ViewBaseConfig].name - : is(table, SQL) - ? void 0 - : table[Table.Symbol.IsAlias] - ? table[Table.Symbol.Name] - : table[Table.Symbol.BaseName]; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/table.js -var InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys"); -var _a29; -var SQLiteTable = class extends Table { - /** @internal */ - [((_a29 = entityKind), Table.Symbol.Columns)]; - /** @internal */ - [InlineForeignKeys2] = []; - /** @internal */ - [Table.Symbol.ExtraConfigBuilder] = void 0; -}; -__publicField(SQLiteTable, _a29, "SQLiteTable"); -/** @internal */ -__publicField( - SQLiteTable, - "Symbol", - Object.assign({}, Table.Symbol, { - InlineForeignKeys: InlineForeignKeys2, - }) -); -function sqliteTableBase(name, columns, extraConfig, schema, baseName = name) { - const rawTable = new SQLiteTable(name, schema, baseName); - const builtColumns = Object.fromEntries( - Object.entries(columns).map(([name2, colBuilderBase]) => { - const colBuilder = colBuilderBase; - const column = colBuilder.build(rawTable); - rawTable[InlineForeignKeys2].push( - ...colBuilder.buildForeignKeys(column, rawTable) - ); - return [name2, column]; - }) - ); - const table = Object.assign(rawTable, builtColumns); - table[Table.Symbol.Columns] = builtColumns; - if (extraConfig) { - table[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig; - } - return table; -} -var sqliteTable = (name, columns, extraConfig) => { - return sqliteTableBase(name, columns, extraConfig); -}; - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/foreign-keys.js -var _a30; -var ForeignKeyBuilder = class { - /** @internal */ - reference; - /** @internal */ - _onUpdate; - /** @internal */ - _onDelete; - constructor(config, actions) { - this.reference = () => { - const { name, columns, foreignColumns } = config(); - return { - name, - columns, - foreignTable: foreignColumns[0].table, - foreignColumns, - }; - }; - if (actions) { - this._onUpdate = actions.onUpdate; - this._onDelete = actions.onDelete; - } - } - onUpdate(action) { - this._onUpdate = action; - return this; - } - onDelete(action) { - this._onDelete = action; - return this; - } - /** @internal */ - build(table) { - return new ForeignKey(table, this); - } -}; -_a30 = entityKind; -__publicField(ForeignKeyBuilder, _a30, "SQLiteForeignKeyBuilder"); -var _a31; -var ForeignKey = class { - constructor(table, builder) { - this.table = table; - this.reference = builder.reference; - this.onUpdate = builder._onUpdate; - this.onDelete = builder._onDelete; - } - reference; - onUpdate; - onDelete; - getName() { - const { name, columns, foreignColumns } = this.reference(); - const columnNames = columns.map((column) => column.name); - const foreignColumnNames = foreignColumns.map((column) => column.name); - const chunks = [ - this.table[SQLiteTable.Symbol.Name], - ...columnNames, - foreignColumns[0].table[SQLiteTable.Symbol.Name], - ...foreignColumnNames, - ]; - return name ?? `${chunks.join("_")}_fk`; - } -}; -_a31 = entityKind; -__publicField(ForeignKey, _a31, "SQLiteForeignKey"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/unique-constraint.js -function uniqueKeyName(table, columns) { - return `${table[SQLiteTable.Symbol.Name]}_${columns.join("_")}_unique`; -} -var _a32; -var UniqueConstraintBuilder = class { - constructor(columns, name) { - this.name = name; - this.columns = columns; - } - /** @internal */ - columns; - /** @internal */ - build(table) { - return new UniqueConstraint(table, this.columns, this.name); - } -}; -_a32 = entityKind; -__publicField(UniqueConstraintBuilder, _a32, "SQLiteUniqueConstraintBuilder"); -var _a33; -var UniqueOnConstraintBuilder = class { - /** @internal */ - name; - constructor(name) { - this.name = name; - } - on(...columns) { - return new UniqueConstraintBuilder(columns, this.name); - } -}; -_a33 = entityKind; -__publicField( - UniqueOnConstraintBuilder, - _a33, - "SQLiteUniqueOnConstraintBuilder" -); -var _a34; -var UniqueConstraint = class { - constructor(table, columns, name) { - this.table = table; - this.columns = columns; - this.name = - name ?? - uniqueKeyName( - this.table, - this.columns.map((column) => column.name) - ); - } - columns; - name; - getName() { - return this.name; - } -}; -_a34 = entityKind; -__publicField(UniqueConstraint, _a34, "SQLiteUniqueConstraint"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/columns/common.js -var _a35; -var SQLiteColumnBuilder = class extends ColumnBuilder { - foreignKeyConfigs = []; - references(ref, actions = {}) { - this.foreignKeyConfigs.push({ ref, actions }); - return this; - } - unique(name) { - this.config.isUnique = true; - this.config.uniqueName = name; - return this; - } - /** @internal */ - buildForeignKeys(column, table) { - return this.foreignKeyConfigs.map(({ ref, actions }) => { - return ((ref2, actions2) => { - const builder = new ForeignKeyBuilder(() => { - const foreignColumn = ref2(); - return { columns: [column], foreignColumns: [foreignColumn] }; - }); - if (actions2.onUpdate) { - builder.onUpdate(actions2.onUpdate); - } - if (actions2.onDelete) { - builder.onDelete(actions2.onDelete); - } - return builder.build(table); - })(ref, actions); - }); - } -}; -_a35 = entityKind; -__publicField(SQLiteColumnBuilder, _a35, "SQLiteColumnBuilder"); -var _a36; -var SQLiteColumn = class extends Column { - constructor(table, config) { - if (!config.uniqueName) { - config.uniqueName = uniqueKeyName(table, [config.name]); - } - super(table, config); - this.table = table; - } -}; -_a36 = entityKind; -__publicField(SQLiteColumn, _a36, "SQLiteColumn"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/columns/integer.js -var _a37; -var SQLiteBaseIntegerBuilder = class extends SQLiteColumnBuilder { - constructor(name, dataType, columnType) { - super(name, dataType, columnType); - this.config.autoIncrement = false; - } - primaryKey(config) { - if (config?.autoIncrement) { - this.config.autoIncrement = true; - } - this.config.hasDefault = true; - return super.primaryKey(); - } -}; -_a37 = entityKind; -__publicField(SQLiteBaseIntegerBuilder, _a37, "SQLiteBaseIntegerBuilder"); -var _a38; -var SQLiteBaseInteger = class extends SQLiteColumn { - autoIncrement = this.config.autoIncrement; - getSQLType() { - return "integer"; - } -}; -_a38 = entityKind; -__publicField(SQLiteBaseInteger, _a38, "SQLiteBaseInteger"); -var _a39; -var SQLiteIntegerBuilder = class extends SQLiteBaseIntegerBuilder { - constructor(name) { - super(name, "number", "SQLiteInteger"); - } - build(table) { - return new SQLiteInteger(table, this.config); - } -}; -_a39 = entityKind; -__publicField(SQLiteIntegerBuilder, _a39, "SQLiteIntegerBuilder"); -var _a40; -var SQLiteInteger = class extends SQLiteBaseInteger {}; -_a40 = entityKind; -__publicField(SQLiteInteger, _a40, "SQLiteInteger"); -var _a41; -var SQLiteTimestampBuilder = class extends SQLiteBaseIntegerBuilder { - constructor(name, mode) { - super(name, "date", "SQLiteTimestamp"); - this.config.mode = mode; - } - /** - * @deprecated Use `default()` with your own expression instead. - * - * Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds. - */ - defaultNow() { - return this.default( - sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))` - ); - } - build(table) { - return new SQLiteTimestamp(table, this.config); - } -}; -_a41 = entityKind; -__publicField(SQLiteTimestampBuilder, _a41, "SQLiteTimestampBuilder"); -var _a42; -var SQLiteTimestamp = class extends SQLiteBaseInteger { - mode = this.config.mode; - mapFromDriverValue(value) { - if (this.config.mode === "timestamp") { - return new Date(value * 1e3); - } - return new Date(value); - } - mapToDriverValue(value) { - const unix = value.getTime(); - if (this.config.mode === "timestamp") { - return Math.floor(unix / 1e3); - } - return unix; - } -}; -_a42 = entityKind; -__publicField(SQLiteTimestamp, _a42, "SQLiteTimestamp"); -var _a43; -var SQLiteBooleanBuilder = class extends SQLiteBaseIntegerBuilder { - constructor(name, mode) { - super(name, "boolean", "SQLiteBoolean"); - this.config.mode = mode; - } - build(table) { - return new SQLiteBoolean(table, this.config); - } -}; -_a43 = entityKind; -__publicField(SQLiteBooleanBuilder, _a43, "SQLiteBooleanBuilder"); -var _a44; -var SQLiteBoolean = class extends SQLiteBaseInteger { - mode = this.config.mode; - mapFromDriverValue(value) { - return Number(value) === 1; - } - mapToDriverValue(value) { - return value ? 1 : 0; - } -}; -_a44 = entityKind; -__publicField(SQLiteBoolean, _a44, "SQLiteBoolean"); -function integer(name, config) { - if (config?.mode === "timestamp" || config?.mode === "timestamp_ms") { - return new SQLiteTimestampBuilder(name, config.mode); - } - if (config?.mode === "boolean") { - return new SQLiteBooleanBuilder(name, config.mode); - } - return new SQLiteIntegerBuilder(name); -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/columns/text.js -var _a45; -var SQLiteTextBuilder = class extends SQLiteColumnBuilder { - constructor(name, config) { - super(name, "string", "SQLiteText"); - this.config.enumValues = config.enum; - this.config.length = config.length; - } - /** @internal */ - build(table) { - return new SQLiteText(table, this.config); - } -}; -_a45 = entityKind; -__publicField(SQLiteTextBuilder, _a45, "SQLiteTextBuilder"); -var _a46; -var SQLiteText = class extends SQLiteColumn { - enumValues = this.config.enumValues; - length = this.config.length; - constructor(table, config) { - super(table, config); - } - getSQLType() { - return `text${this.config.length ? `(${this.config.length})` : ""}`; - } -}; -_a46 = entityKind; -__publicField(SQLiteText, _a46, "SQLiteText"); -var _a47; -var SQLiteTextJsonBuilder = class extends SQLiteColumnBuilder { - constructor(name) { - super(name, "json", "SQLiteTextJson"); - } - /** @internal */ - build(table) { - return new SQLiteTextJson(table, this.config); - } -}; -_a47 = entityKind; -__publicField(SQLiteTextJsonBuilder, _a47, "SQLiteTextJsonBuilder"); -var _a48; -var SQLiteTextJson = class extends SQLiteColumn { - getSQLType() { - return "text"; - } - mapFromDriverValue(value) { - return JSON.parse(value); - } - mapToDriverValue(value) { - return JSON.stringify(value); - } -}; -_a48 = entityKind; -__publicField(SQLiteTextJson, _a48, "SQLiteTextJson"); -function text(name, config = {}) { - return config.mode === "json" - ? new SQLiteTextJsonBuilder(name) - : new SQLiteTextBuilder(name, config); -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/selection-proxy.js -var _a49; -var _SelectionProxyHandler = class { - config; - constructor(config) { - this.config = { ...config }; - } - get(subquery, prop) { - if (prop === SubqueryConfig) { - return { - ...subquery[SubqueryConfig], - selection: new Proxy(subquery[SubqueryConfig].selection, this), - }; - } - if (prop === ViewBaseConfig) { - return { - ...subquery[ViewBaseConfig], - selectedFields: new Proxy( - subquery[ViewBaseConfig].selectedFields, - this - ), - }; - } - if (typeof prop === "symbol") { - return subquery[prop]; - } - const columns = is(subquery, Subquery) - ? subquery[SubqueryConfig].selection - : is(subquery, View) - ? subquery[ViewBaseConfig].selectedFields - : subquery; - const value = columns[prop]; - if (is(value, SQL.Aliased)) { - if (this.config.sqlAliasedBehavior === "sql" && !value.isSelectionField) { - return value.sql; - } - const newValue = value.clone(); - newValue.isSelectionField = true; - return newValue; - } - if (is(value, SQL)) { - if (this.config.sqlBehavior === "sql") { - return value; - } - throw new Error( - `You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.` - ); - } - if (is(value, Column)) { - if (this.config.alias) { - return new Proxy( - value, - new ColumnAliasProxyHandler( - new Proxy( - value.table, - new TableAliasProxyHandler( - this.config.alias, - this.config.replaceOriginalName ?? false - ) - ) - ) - ); - } - return value; - } - if (typeof value !== "object" || value === null) { - return value; - } - return new Proxy(value, new _SelectionProxyHandler(this.config)); - } -}; -var SelectionProxyHandler = _SelectionProxyHandler; -_a49 = entityKind; -__publicField(SelectionProxyHandler, _a49, "SelectionProxyHandler"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/delete.js -var _a50; -var SQLiteDeleteBase = class extends QueryPromise { - constructor(table, session, dialect) { - super(); - this.table = table; - this.session = session; - this.dialect = dialect; - this.config = { table }; - } - /** @internal */ - config; - /** - * Adds a `where` clause to the query. - * - * Calling this method will delete only those rows that fulfill a specified condition. - * - * See docs: {@link https://orm.drizzle.team/docs/delete} - * - * @param where the `where` clause. - * - * @example - * You can use conditional operators and `sql function` to filter the rows to be deleted. - * - * ```ts - * // Delete all cars with green color - * db.delete(cars).where(eq(cars.color, 'green')); - * // or - * db.delete(cars).where(sql`${cars.color} = 'green'`) - * ``` - * - * You can logically combine conditional operators with `and()` and `or()` operators: - * - * ```ts - * // Delete all BMW cars with a green color - * db.delete(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW'))); - * - * // Delete all cars with the green or blue color - * db.delete(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue'))); - * ``` - */ - where(where) { - this.config.where = where; - return this; - } - returning(fields = this.table[SQLiteTable.Symbol.Columns]) { - this.config.returning = orderSelectedFields(fields); - return this; - } - /** @internal */ - getSQL() { - return this.dialect.buildDeleteQuery(this.config); - } - toSQL() { - const { typings: _typings, ...rest } = this.dialect.sqlToQuery( - this.getSQL() - ); - return rest; - } - prepare(isOneTimeQuery) { - return this.session[ - isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery" - ]( - this.dialect.sqlToQuery(this.getSQL()), - this.config.returning, - this.config.returning ? "all" : "run" - ); - } - run = (placeholderValues) => { - return this.prepare(true).run(placeholderValues); - }; - all = (placeholderValues) => { - return this.prepare(true).all(placeholderValues); - }; - get = (placeholderValues) => { - return this.prepare(true).get(placeholderValues); - }; - values = (placeholderValues) => { - return this.prepare(true).values(placeholderValues); - }; - async execute(placeholderValues) { - return this.prepare(true).execute(placeholderValues); - } - $dynamic() { - return this; - } -}; -_a50 = entityKind; -__publicField(SQLiteDeleteBase, _a50, "SQLiteDelete"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/insert.js -var _a51; -var SQLiteInsertBuilder = class { - constructor(table, session, dialect) { - this.table = table; - this.session = session; - this.dialect = dialect; - } - values(values) { - values = Array.isArray(values) ? values : [values]; - if (values.length === 0) { - throw new Error("values() must be called with at least one value"); - } - const mappedValues = values.map((entry) => { - const result = {}; - const cols = this.table[Table.Symbol.Columns]; - for (const colKey of Object.keys(entry)) { - const colValue = entry[colKey]; - result[colKey] = is(colValue, SQL) - ? colValue - : new Param(colValue, cols[colKey]); - } - return result; - }); - return new SQLiteInsertBase( - this.table, - mappedValues, - this.session, - this.dialect - ); - } -}; -_a51 = entityKind; -__publicField(SQLiteInsertBuilder, _a51, "SQLiteInsertBuilder"); -var _a52; -var SQLiteInsertBase = class extends QueryPromise { - constructor(table, values, session, dialect) { - super(); - this.session = session; - this.dialect = dialect; - this.config = { table, values }; - } - /** @internal */ - config; - returning(fields = this.config.table[SQLiteTable.Symbol.Columns]) { - this.config.returning = orderSelectedFields(fields); - return this; - } - /** - * Adds an `on conflict do nothing` clause to the query. - * - * Calling this method simply avoids inserting a row as its alternative action. - * - * See docs: {@link https://orm.drizzle.team/docs/insert#on-conflict-do-nothing} - * - * @param config The `target` and `where` clauses. - * - * @example - * ```ts - * // Insert one row and cancel the insert if there's a conflict - * await db.insert(cars) - * .values({ id: 1, brand: 'BMW' }) - * .onConflictDoNothing(); - * - * // Explicitly specify conflict target - * await db.insert(cars) - * .values({ id: 1, brand: 'BMW' }) - * .onConflictDoNothing({ target: cars.id }); - * ``` - */ - onConflictDoNothing(config = {}) { - if (config.target === void 0) { - this.config.onConflict = sql`do nothing`; - } else { - const targetSql = Array.isArray(config.target) - ? sql`${config.target}` - : sql`${[config.target]}`; - const whereSql = config.where ? sql` where ${config.where}` : sql``; - this.config.onConflict = sql`${targetSql} do nothing${whereSql}`; - } - return this; - } - /** - * Adds an `on conflict do update` clause to the query. - * - * Calling this method will update the existing row that conflicts with the row proposed for insertion as its alternative action. - * - * See docs: {@link https://orm.drizzle.team/docs/insert#upserts-and-conflicts} - * - * @param config The `target`, `set` and `where` clauses. - * - * @example - * ```ts - * // Update the row if there's a conflict - * await db.insert(cars) - * .values({ id: 1, brand: 'BMW' }) - * .onConflictDoUpdate({ - * target: cars.id, - * set: { brand: 'Porsche' } - * }); - * - * // Upsert with 'where' clause - * await db.insert(cars) - * .values({ id: 1, brand: 'BMW' }) - * .onConflictDoUpdate({ - * target: cars.id, - * set: { brand: 'newBMW' }, - * where: sql`${cars.createdAt} > '2023-01-01'::date`, - * }); - * ``` - */ - onConflictDoUpdate(config) { - const targetSql = Array.isArray(config.target) - ? sql`${config.target}` - : sql`${[config.target]}`; - const whereSql = config.where ? sql` where ${config.where}` : sql``; - const setSql = this.dialect.buildUpdateSet( - this.config.table, - mapUpdateSet(this.config.table, config.set) - ); - this.config.onConflict = sql`${targetSql} do update set ${setSql}${whereSql}`; - return this; - } - /** @internal */ - getSQL() { - return this.dialect.buildInsertQuery(this.config); - } - toSQL() { - const { typings: _typings, ...rest } = this.dialect.sqlToQuery( - this.getSQL() - ); - return rest; - } - prepare(isOneTimeQuery) { - return this.session[ - isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery" - ]( - this.dialect.sqlToQuery(this.getSQL()), - this.config.returning, - this.config.returning ? "all" : "run" - ); - } - run = (placeholderValues) => { - return this.prepare(true).run(placeholderValues); - }; - all = (placeholderValues) => { - return this.prepare(true).all(placeholderValues); - }; - get = (placeholderValues) => { - return this.prepare(true).get(placeholderValues); - }; - values = (placeholderValues) => { - return this.prepare(true).values(placeholderValues); - }; - async execute() { - return this.config.returning ? this.all() : this.run(); - } - $dynamic() { - return this; - } -}; -_a52 = entityKind; -__publicField(SQLiteInsertBase, _a52, "SQLiteInsert"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/view-base.js -var _a53; -var SQLiteViewBase = class extends View {}; -_a53 = entityKind; -__publicField(SQLiteViewBase, _a53, "SQLiteViewBase"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/dialect.js -var _a54; -var SQLiteDialect = class { - escapeName(name) { - return `"${name}"`; - } - escapeParam(_num) { - return "?"; - } - escapeString(str) { - return `'${str.replace(/'/g, "''")}'`; - } - buildDeleteQuery({ table, where, returning }) { - const returningSql = returning - ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` - : void 0; - const whereSql = where ? sql` where ${where}` : void 0; - return sql`delete from ${table}${whereSql}${returningSql}`; - } - buildUpdateSet(table, set) { - const setEntries = Object.entries(set); - const setSize = setEntries.length; - return sql.join( - setEntries.flatMap(([colName, value], i) => { - const col = table[Table.Symbol.Columns][colName]; - const res = sql`${sql.identifier(col.name)} = ${value}`; - if (i < setSize - 1) { - return [res, sql.raw(", ")]; - } - return [res]; - }) - ); - } - buildUpdateQuery({ table, set, where, returning }) { - const setSql = this.buildUpdateSet(table, set); - const returningSql = returning - ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` - : void 0; - const whereSql = where ? sql` where ${where}` : void 0; - return sql`update ${table} set ${setSql}${whereSql}${returningSql}`; - } - /** - * Builds selection SQL with provided fields/expressions - * - * Examples: - * - * `select from` - * - * `insert ... returning ` - * - * If `isSingleTable` is true, then columns won't be prefixed with table name - */ - buildSelection(fields, { isSingleTable = false } = {}) { - const columnsLen = fields.length; - const chunks = fields.flatMap(({ field }, i) => { - const chunk = []; - if (is(field, SQL.Aliased) && field.isSelectionField) { - chunk.push(sql.identifier(field.fieldAlias)); - } else if (is(field, SQL.Aliased) || is(field, SQL)) { - const query = is(field, SQL.Aliased) ? field.sql : field; - if (isSingleTable) { - chunk.push( - new SQL( - query.queryChunks.map((c2) => { - if (is(c2, Column)) { - return sql.identifier(c2.name); - } - return c2; - }) - ) - ); - } else { - chunk.push(query); - } - if (is(field, SQL.Aliased)) { - chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`); - } - } else if (is(field, Column)) { - const tableName = field.table[Table.Symbol.Name]; - const columnName = field.name; - if (isSingleTable) { - chunk.push(sql.identifier(columnName)); - } else { - chunk.push( - sql`${sql.identifier(tableName)}.${sql.identifier(columnName)}` - ); - } - } - if (i < columnsLen - 1) { - chunk.push(sql`, `); - } - return chunk; - }); - return sql.join(chunks); - } - buildSelectQuery({ - withList, - fields, - fieldsFlat, - where, - having, - table, - joins, - orderBy, - groupBy, - limit, - offset, - distinct, - setOperators, - }) { - const fieldsList = fieldsFlat ?? orderSelectedFields(fields); - for (const f2 of fieldsList) { - if ( - is(f2.field, Column) && - getTableName(f2.field.table) !== - (is(table, Subquery) - ? table[SubqueryConfig].alias - : is(table, SQLiteViewBase) - ? table[ViewBaseConfig].name - : is(table, SQL) - ? void 0 - : getTableName(table)) && - !((table2) => - joins?.some( - ({ alias }) => - alias === - (table2[Table.Symbol.IsAlias] - ? getTableName(table2) - : table2[Table.Symbol.BaseName]) - ))(f2.field.table) - ) { - const tableName = getTableName(f2.field.table); - throw new Error( - `Your "${f2.path.join("->")}" field references a column "${tableName}"."${f2.field.name}", but the table "${tableName}" is not part of the query! Did you forget to join it?` - ); - } - } - const isSingleTable = !joins || joins.length === 0; - let withSql; - if (withList?.length) { - const withSqlChunks = [sql`with `]; - for (const [i, w] of withList.entries()) { - withSqlChunks.push( - sql`${sql.identifier(w[SubqueryConfig].alias)} as (${w[SubqueryConfig].sql})` - ); - if (i < withList.length - 1) { - withSqlChunks.push(sql`, `); - } - } - withSqlChunks.push(sql` `); - withSql = sql.join(withSqlChunks); - } - const distinctSql = distinct ? sql` distinct` : void 0; - const selection = this.buildSelection(fieldsList, { isSingleTable }); - const tableSql = (() => { - if ( - is(table, Table) && - table[Table.Symbol.OriginalName] !== table[Table.Symbol.Name] - ) { - return sql`${sql.identifier(table[Table.Symbol.OriginalName])} ${sql.identifier(table[Table.Symbol.Name])}`; - } - return table; - })(); - const joinsArray = []; - if (joins) { - for (const [index, joinMeta] of joins.entries()) { - if (index === 0) { - joinsArray.push(sql` `); - } - const table2 = joinMeta.table; - if (is(table2, SQLiteTable)) { - const tableName = table2[SQLiteTable.Symbol.Name]; - const tableSchema = table2[SQLiteTable.Symbol.Schema]; - const origTableName = table2[SQLiteTable.Symbol.OriginalName]; - const alias = tableName === origTableName ? void 0 : joinMeta.alias; - joinsArray.push( - sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}` - ); - } else { - joinsArray.push( - sql`${sql.raw(joinMeta.joinType)} join ${table2} on ${joinMeta.on}` - ); - } - if (index < joins.length - 1) { - joinsArray.push(sql` `); - } - } - } - const joinsSql = sql.join(joinsArray); - const whereSql = where ? sql` where ${where}` : void 0; - const havingSql = having ? sql` having ${having}` : void 0; - const orderByList = []; - if (orderBy) { - for (const [index, orderByValue] of orderBy.entries()) { - orderByList.push(orderByValue); - if (index < orderBy.length - 1) { - orderByList.push(sql`, `); - } - } - } - const groupByList = []; - if (groupBy) { - for (const [index, groupByValue] of groupBy.entries()) { - groupByList.push(groupByValue); - if (index < groupBy.length - 1) { - groupByList.push(sql`, `); - } - } - } - const groupBySql = - groupByList.length > 0 ? sql` group by ${sql.join(groupByList)}` : void 0; - const orderBySql = - orderByList.length > 0 ? sql` order by ${sql.join(orderByList)}` : void 0; - const limitSql = limit ? sql` limit ${limit}` : void 0; - const offsetSql = offset ? sql` offset ${offset}` : void 0; - const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}`; - if (setOperators.length > 0) { - return this.buildSetOperations(finalQuery, setOperators); - } - return finalQuery; - } - buildSetOperations(leftSelect, setOperators) { - const [setOperator, ...rest] = setOperators; - if (!setOperator) { - throw new Error("Cannot pass undefined values to any set operator"); - } - if (rest.length === 0) { - return this.buildSetOperationQuery({ leftSelect, setOperator }); - } - return this.buildSetOperations( - this.buildSetOperationQuery({ leftSelect, setOperator }), - rest - ); - } - buildSetOperationQuery({ - leftSelect, - setOperator: { type, isAll, rightSelect, limit, orderBy, offset }, - }) { - const leftChunk = sql`${leftSelect.getSQL()} `; - const rightChunk = sql`${rightSelect.getSQL()}`; - let orderBySql; - if (orderBy && orderBy.length > 0) { - const orderByValues = []; - for (const singleOrderBy of orderBy) { - if (is(singleOrderBy, SQLiteColumn)) { - orderByValues.push(sql.identifier(singleOrderBy.name)); - } else if (is(singleOrderBy, SQL)) { - for (let i = 0; i < singleOrderBy.queryChunks.length; i++) { - const chunk = singleOrderBy.queryChunks[i]; - if (is(chunk, SQLiteColumn)) { - singleOrderBy.queryChunks[i] = sql.identifier(chunk.name); - } - } - orderByValues.push(sql`${singleOrderBy}`); - } else { - orderByValues.push(sql`${singleOrderBy}`); - } - } - orderBySql = sql` order by ${sql.join(orderByValues, sql`, `)}`; - } - const limitSql = limit ? sql` limit ${limit}` : void 0; - const operatorChunk = sql.raw(`${type} ${isAll ? "all " : ""}`); - const offsetSql = offset ? sql` offset ${offset}` : void 0; - return sql`${leftChunk}${operatorChunk}${rightChunk}${orderBySql}${limitSql}${offsetSql}`; - } - buildInsertQuery({ table, values, onConflict, returning }) { - const valuesSqlList = []; - const columns = table[Table.Symbol.Columns]; - const colEntries = Object.entries(columns); - const insertOrder = colEntries.map(([, column]) => - sql.identifier(column.name) - ); - for (const [valueIndex, value] of values.entries()) { - const valueList = []; - for (const [fieldName, col] of colEntries) { - const colValue = value[fieldName]; - if ( - colValue === void 0 || - (is(colValue, Param) && colValue.value === void 0) - ) { - let defaultValue; - if (col.default !== null && col.default !== void 0) { - defaultValue = is(col.default, SQL) - ? col.default - : sql.param(col.default, col); - } else if (col.defaultFn !== void 0) { - const defaultFnResult = col.defaultFn(); - defaultValue = is(defaultFnResult, SQL) - ? defaultFnResult - : sql.param(defaultFnResult, col); - } else { - defaultValue = sql`null`; - } - valueList.push(defaultValue); - } else { - valueList.push(colValue); - } - } - valuesSqlList.push(valueList); - if (valueIndex < values.length - 1) { - valuesSqlList.push(sql`, `); - } - } - const valuesSql = sql.join(valuesSqlList); - const returningSql = returning - ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` - : void 0; - const onConflictSql = onConflict ? sql` on conflict ${onConflict}` : void 0; - return sql`insert into ${table} ${insertOrder} values ${valuesSql}${onConflictSql}${returningSql}`; - } - sqlToQuery(sql2) { - return sql2.toQuery({ - escapeName: this.escapeName, - escapeParam: this.escapeParam, - escapeString: this.escapeString, - }); - } - buildRelationalQuery({ - fullSchema, - schema, - tableNamesMap, - table, - tableConfig, - queryConfig: config, - tableAlias, - nestedQueryRelation, - joinOn, - }) { - let selection = []; - let limit, - offset, - orderBy = [], - where; - const joins = []; - if (config === true) { - const selectionEntries = Object.entries(tableConfig.columns); - selection = selectionEntries.map(([key, value]) => ({ - dbKey: value.name, - tsKey: key, - field: aliasedTableColumn(value, tableAlias), - relationTableTsKey: void 0, - isJson: false, - selection: [], - })); - } else { - const aliasedColumns = Object.fromEntries( - Object.entries(tableConfig.columns).map(([key, value]) => [ - key, - aliasedTableColumn(value, tableAlias), - ]) - ); - if (config.where) { - const whereSql = - typeof config.where === "function" - ? config.where(aliasedColumns, getOperators()) - : config.where; - where = whereSql && mapColumnsInSQLToAlias(whereSql, tableAlias); - } - const fieldsSelection = []; - let selectedColumns = []; - if (config.columns) { - let isIncludeMode = false; - for (const [field, value] of Object.entries(config.columns)) { - if (value === void 0) { - continue; - } - if (field in tableConfig.columns) { - if (!isIncludeMode && value === true) { - isIncludeMode = true; - } - selectedColumns.push(field); - } - } - if (selectedColumns.length > 0) { - selectedColumns = isIncludeMode - ? selectedColumns.filter((c2) => config.columns?.[c2] === true) - : Object.keys(tableConfig.columns).filter( - (key) => !selectedColumns.includes(key) - ); - } - } else { - selectedColumns = Object.keys(tableConfig.columns); - } - for (const field of selectedColumns) { - const column = tableConfig.columns[field]; - fieldsSelection.push({ tsKey: field, value: column }); - } - let selectedRelations = []; - if (config.with) { - selectedRelations = Object.entries(config.with) - .filter((entry) => !!entry[1]) - .map(([tsKey, queryConfig]) => ({ - tsKey, - queryConfig, - relation: tableConfig.relations[tsKey], - })); - } - let extras; - if (config.extras) { - extras = - typeof config.extras === "function" - ? config.extras(aliasedColumns, { sql }) - : config.extras; - for (const [tsKey, value] of Object.entries(extras)) { - fieldsSelection.push({ - tsKey, - value: mapColumnsInAliasedSQLToAlias(value, tableAlias), - }); - } - } - for (const { tsKey, value } of fieldsSelection) { - selection.push({ - dbKey: is(value, SQL.Aliased) - ? value.fieldAlias - : tableConfig.columns[tsKey].name, - tsKey, - field: is(value, Column) - ? aliasedTableColumn(value, tableAlias) - : value, - relationTableTsKey: void 0, - isJson: false, - selection: [], - }); - } - let orderByOrig = - typeof config.orderBy === "function" - ? config.orderBy(aliasedColumns, getOrderByOperators()) - : config.orderBy ?? []; - if (!Array.isArray(orderByOrig)) { - orderByOrig = [orderByOrig]; - } - orderBy = orderByOrig.map((orderByValue) => { - if (is(orderByValue, Column)) { - return aliasedTableColumn(orderByValue, tableAlias); - } - return mapColumnsInSQLToAlias(orderByValue, tableAlias); - }); - limit = config.limit; - offset = config.offset; - for (const { - tsKey: selectedRelationTsKey, - queryConfig: selectedRelationConfigValue, - relation, - } of selectedRelations) { - const normalizedRelation = normalizeRelation( - schema, - tableNamesMap, - relation - ); - const relationTableName = relation.referencedTable[Table.Symbol.Name]; - const relationTableTsName = tableNamesMap[relationTableName]; - const relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`; - const joinOn2 = and( - ...normalizedRelation.fields.map((field2, i) => - eq( - aliasedTableColumn( - normalizedRelation.references[i], - relationTableAlias - ), - aliasedTableColumn(field2, tableAlias) - ) - ) - ); - const builtRelation = this.buildRelationalQuery({ - fullSchema, - schema, - tableNamesMap, - table: fullSchema[relationTableTsName], - tableConfig: schema[relationTableTsName], - queryConfig: is(relation, One) - ? selectedRelationConfigValue === true - ? { limit: 1 } - : { ...selectedRelationConfigValue, limit: 1 } - : selectedRelationConfigValue, - tableAlias: relationTableAlias, - joinOn: joinOn2, - nestedQueryRelation: relation, - }); - const field = sql`(${builtRelation.sql})`.as(selectedRelationTsKey); - selection.push({ - dbKey: selectedRelationTsKey, - tsKey: selectedRelationTsKey, - field, - relationTableTsKey: relationTableTsName, - isJson: true, - selection: builtRelation.selection, - }); - } - } - if (selection.length === 0) { - throw new DrizzleError({ - message: `No fields selected for table "${tableConfig.tsName}" ("${tableAlias}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`, - }); - } - let result; - where = and(joinOn, where); - if (nestedQueryRelation) { - let field = sql`json_array(${sql.join( - selection.map(({ field: field2 }) => - is(field2, SQLiteColumn) - ? sql.identifier(field2.name) - : is(field2, SQL.Aliased) - ? field2.sql - : field2 - ), - sql`, ` - )})`; - if (is(nestedQueryRelation, Many)) { - field = sql`coalesce(json_group_array(${field}), json_array())`; - } - const nestedSelection = [ - { - dbKey: "data", - tsKey: "data", - field: field.as("data"), - isJson: true, - relationTableTsKey: tableConfig.tsName, - selection, - }, - ]; - const needsSubquery = - limit !== void 0 || offset !== void 0 || orderBy.length > 0; - if (needsSubquery) { - result = this.buildSelectQuery({ - table: aliasedTable(table, tableAlias), - fields: {}, - fieldsFlat: [ - { - path: [], - field: sql.raw("*"), - }, - ], - where, - limit, - offset, - orderBy, - setOperators: [], - }); - where = void 0; - limit = void 0; - offset = void 0; - orderBy = void 0; - } else { - result = aliasedTable(table, tableAlias); - } - result = this.buildSelectQuery({ - table: is(result, SQLiteTable) - ? result - : new Subquery(result, {}, tableAlias), - fields: {}, - fieldsFlat: nestedSelection.map(({ field: field2 }) => ({ - path: [], - field: is(field2, Column) - ? aliasedTableColumn(field2, tableAlias) - : field2, - })), - joins, - where, - limit, - offset, - orderBy, - setOperators: [], - }); - } else { - result = this.buildSelectQuery({ - table: aliasedTable(table, tableAlias), - fields: {}, - fieldsFlat: selection.map(({ field }) => ({ - path: [], - field: is(field, Column) - ? aliasedTableColumn(field, tableAlias) - : field, - })), - joins, - where, - limit, - offset, - orderBy, - setOperators: [], - }); - } - return { - tableTsKey: tableConfig.tsName, - sql: result, - selection, - }; - } -}; -_a54 = entityKind; -__publicField(SQLiteDialect, _a54, "SQLiteDialect"); -var _a55; -var SQLiteSyncDialect = class extends SQLiteDialect { - migrate(migrations, session) { - const migrationTableCreate = sql` - CREATE TABLE IF NOT EXISTS "__drizzle_migrations" ( - id SERIAL PRIMARY KEY, - hash text NOT NULL, - created_at numeric - ) - `; - session.run(migrationTableCreate); - const dbMigrations = session.values( - sql`SELECT id, hash, created_at FROM "__drizzle_migrations" ORDER BY created_at DESC LIMIT 1` - ); - const lastDbMigration = dbMigrations[0] ?? void 0; - session.run(sql`BEGIN`); - try { - for (const migration of migrations) { - if ( - !lastDbMigration || - Number(lastDbMigration[2]) < migration.folderMillis - ) { - for (const stmt of migration.sql) { - session.run(sql.raw(stmt)); - } - session.run( - sql`INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES(${migration.hash}, ${migration.folderMillis})` - ); - } - } - session.run(sql`COMMIT`); - } catch (e) { - session.run(sql`ROLLBACK`); - throw e; - } - } -}; -_a55 = entityKind; -__publicField(SQLiteSyncDialect, _a55, "SQLiteSyncDialect"); -var _a56; -var SQLiteAsyncDialect = class extends SQLiteDialect { - async migrate(migrations, session) { - const migrationTableCreate = sql` - CREATE TABLE IF NOT EXISTS "__drizzle_migrations" ( - id SERIAL PRIMARY KEY, - hash text NOT NULL, - created_at numeric - ) - `; - await session.run(migrationTableCreate); - const dbMigrations = await session.values( - sql`SELECT id, hash, created_at FROM "__drizzle_migrations" ORDER BY created_at DESC LIMIT 1` - ); - const lastDbMigration = dbMigrations[0] ?? void 0; - await session.transaction(async (tx) => { - for (const migration of migrations) { - if ( - !lastDbMigration || - Number(lastDbMigration[2]) < migration.folderMillis - ) { - for (const stmt of migration.sql) { - await tx.run(sql.raw(stmt)); - } - await tx.run( - sql`INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES(${migration.hash}, ${migration.folderMillis})` - ); - } - } - }); - } -}; -_a56 = entityKind; -__publicField(SQLiteAsyncDialect, _a56, "SQLiteAsyncDialect"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/query-builders/query-builder.js -var _a57; -var TypedQueryBuilder = class { - /** @internal */ - getSelectedFields() { - return this._.selectedFields; - } -}; -_a57 = entityKind; -__publicField(TypedQueryBuilder, _a57, "TypedQueryBuilder"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/select.js -var _a58; -var SQLiteSelectBuilder = class { - fields; - session; - dialect; - withList; - distinct; - constructor(config) { - this.fields = config.fields; - this.session = config.session; - this.dialect = config.dialect; - this.withList = config.withList; - this.distinct = config.distinct; - } - from(source) { - const isPartialSelect = !!this.fields; - let fields; - if (this.fields) { - fields = this.fields; - } else if (is(source, Subquery)) { - fields = Object.fromEntries( - Object.keys(source[SubqueryConfig].selection).map((key) => [ - key, - source[key], - ]) - ); - } else if (is(source, SQLiteViewBase)) { - fields = source[ViewBaseConfig].selectedFields; - } else if (is(source, SQL)) { - fields = {}; - } else { - fields = getTableColumns(source); - } - return new SQLiteSelectBase({ - table: source, - fields, - isPartialSelect, - session: this.session, - dialect: this.dialect, - withList: this.withList, - distinct: this.distinct, - }); - } -}; -_a58 = entityKind; -__publicField(SQLiteSelectBuilder, _a58, "SQLiteSelectBuilder"); -var _a59; -var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder { - _; - /** @internal */ - config; - joinsNotNullableMap; - tableName; - isPartialSelect; - session; - dialect; - constructor({ - table, - fields, - isPartialSelect, - session, - dialect, - withList, - distinct, - }) { - super(); - this.config = { - withList, - table, - fields: { ...fields }, - distinct, - setOperators: [], - }; - this.isPartialSelect = isPartialSelect; - this.session = session; - this.dialect = dialect; - this._ = { - selectedFields: fields, - }; - this.tableName = getTableLikeName(table); - this.joinsNotNullableMap = - typeof this.tableName === "string" ? { [this.tableName]: true } : {}; - } - createJoin(joinType) { - return (table, on) => { - const baseTableName = this.tableName; - const tableName = getTableLikeName(table); - if ( - typeof tableName === "string" && - this.config.joins?.some((join) => join.alias === tableName) - ) { - throw new Error(`Alias "${tableName}" is already used in this query`); - } - if (!this.isPartialSelect) { - if ( - Object.keys(this.joinsNotNullableMap).length === 1 && - typeof baseTableName === "string" - ) { - this.config.fields = { - [baseTableName]: this.config.fields, - }; - } - if (typeof tableName === "string" && !is(table, SQL)) { - const selection = is(table, Subquery) - ? table[SubqueryConfig].selection - : is(table, View) - ? table[ViewBaseConfig].selectedFields - : table[Table.Symbol.Columns]; - this.config.fields[tableName] = selection; - } - } - if (typeof on === "function") { - on = on( - new Proxy( - this.config.fields, - new SelectionProxyHandler({ - sqlAliasedBehavior: "sql", - sqlBehavior: "sql", - }) - ) - ); - } - if (!this.config.joins) { - this.config.joins = []; - } - this.config.joins.push({ on, table, joinType, alias: tableName }); - if (typeof tableName === "string") { - switch (joinType) { - case "left": { - this.joinsNotNullableMap[tableName] = false; - break; - } - case "right": { - this.joinsNotNullableMap = Object.fromEntries( - Object.entries(this.joinsNotNullableMap).map(([key]) => [ - key, - false, - ]) - ); - this.joinsNotNullableMap[tableName] = true; - break; - } - case "inner": { - this.joinsNotNullableMap[tableName] = true; - break; - } - case "full": { - this.joinsNotNullableMap = Object.fromEntries( - Object.entries(this.joinsNotNullableMap).map(([key]) => [ - key, - false, - ]) - ); - this.joinsNotNullableMap[tableName] = false; - break; - } - } - } - return this; - }; - } - /** - * Executes a `left join` operation by adding another table to the current query. - * - * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null. - * - * See docs: {@link https://orm.drizzle.team/docs/joins#left-join} - * - * @param table the table to join. - * @param on the `on` clause. - * - * @example - * - * ```ts - * // Select all users and their pets - * const usersWithPets: { user: User; pets: Pet | null }[] = await db.select() - * .from(users) - * .leftJoin(pets, eq(users.id, pets.ownerId)) - * - * // Select userId and petId - * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ - * userId: users.id, - * petId: pets.id, - * }) - * .from(users) - * .leftJoin(pets, eq(users.id, pets.ownerId)) - * ``` - */ - leftJoin = this.createJoin("left"); - /** - * Executes a `right join` operation by adding another table to the current query. - * - * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null. - * - * See docs: {@link https://orm.drizzle.team/docs/joins#right-join} - * - * @param table the table to join. - * @param on the `on` clause. - * - * @example - * - * ```ts - * // Select all users and their pets - * const usersWithPets: { user: User | null; pets: Pet }[] = await db.select() - * .from(users) - * .rightJoin(pets, eq(users.id, pets.ownerId)) - * - * // Select userId and petId - * const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({ - * userId: users.id, - * petId: pets.id, - * }) - * .from(users) - * .rightJoin(pets, eq(users.id, pets.ownerId)) - * ``` - */ - rightJoin = this.createJoin("right"); - /** - * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values. - * - * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs. - * - * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join} - * - * @param table the table to join. - * @param on the `on` clause. - * - * @example - * - * ```ts - * // Select all users and their pets - * const usersWithPets: { user: User; pets: Pet }[] = await db.select() - * .from(users) - * .innerJoin(pets, eq(users.id, pets.ownerId)) - * - * // Select userId and petId - * const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({ - * userId: users.id, - * petId: pets.id, - * }) - * .from(users) - * .innerJoin(pets, eq(users.id, pets.ownerId)) - * ``` - */ - innerJoin = this.createJoin("inner"); - /** - * Executes a `full join` operation by combining rows from two tables into a new table. - * - * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns. - * - * See docs: {@link https://orm.drizzle.team/docs/joins#full-join} - * - * @param table the table to join. - * @param on the `on` clause. - * - * @example - * - * ```ts - * // Select all users and their pets - * const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select() - * .from(users) - * .fullJoin(pets, eq(users.id, pets.ownerId)) - * - * // Select userId and petId - * const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({ - * userId: users.id, - * petId: pets.id, - * }) - * .from(users) - * .fullJoin(pets, eq(users.id, pets.ownerId)) - * ``` - */ - fullJoin = this.createJoin("full"); - createSetOperator(type, isAll) { - return (rightSelection) => { - const rightSelect = - typeof rightSelection === "function" - ? rightSelection(getSQLiteSetOperators()) - : rightSelection; - if ( - !haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields()) - ) { - throw new Error( - "Set operator error (union / intersect / except): selected fields are not the same or are in a different order" - ); - } - this.config.setOperators.push({ type, isAll, rightSelect }); - return this; - }; - } - /** - * Adds `union` set operator to the query. - * - * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them. - * - * See docs: {@link https://orm.drizzle.team/docs/set-operations#union} - * - * @example - * - * ```ts - * // Select all unique names from customers and users tables - * await db.select({ name: users.name }) - * .from(users) - * .union( - * db.select({ name: customers.name }).from(customers) - * ); - * // or - * import { union } from 'drizzle-orm/sqlite-core' - * - * await union( - * db.select({ name: users.name }).from(users), - * db.select({ name: customers.name }).from(customers) - * ); - * ``` - */ - union = this.createSetOperator("union", false); - /** - * Adds `union all` set operator to the query. - * - * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them. - * - * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all} - * - * @example - * - * ```ts - * // Select all transaction ids from both online and in-store sales - * await db.select({ transaction: onlineSales.transactionId }) - * .from(onlineSales) - * .unionAll( - * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales) - * ); - * // or - * import { unionAll } from 'drizzle-orm/sqlite-core' - * - * await unionAll( - * db.select({ transaction: onlineSales.transactionId }).from(onlineSales), - * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales) - * ); - * ``` - */ - unionAll = this.createSetOperator("union", true); - /** - * Adds `intersect` set operator to the query. - * - * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates. - * - * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect} - * - * @example - * - * ```ts - * // Select course names that are offered in both departments A and B - * await db.select({ courseName: depA.courseName }) - * .from(depA) - * .intersect( - * db.select({ courseName: depB.courseName }).from(depB) - * ); - * // or - * import { intersect } from 'drizzle-orm/sqlite-core' - * - * await intersect( - * db.select({ courseName: depA.courseName }).from(depA), - * db.select({ courseName: depB.courseName }).from(depB) - * ); - * ``` - */ - intersect = this.createSetOperator("intersect", false); - /** - * Adds `except` set operator to the query. - * - * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query. - * - * See docs: {@link https://orm.drizzle.team/docs/set-operations#except} - * - * @example - * - * ```ts - * // Select all courses offered in department A but not in department B - * await db.select({ courseName: depA.courseName }) - * .from(depA) - * .except( - * db.select({ courseName: depB.courseName }).from(depB) - * ); - * // or - * import { except } from 'drizzle-orm/sqlite-core' - * - * await except( - * db.select({ courseName: depA.courseName }).from(depA), - * db.select({ courseName: depB.courseName }).from(depB) - * ); - * ``` - */ - except = this.createSetOperator("except", false); - /** @internal */ - addSetOperators(setOperators) { - this.config.setOperators.push(...setOperators); - return this; - } - /** - * Adds a `where` clause to the query. - * - * Calling this method will select only those rows that fulfill a specified condition. - * - * See docs: {@link https://orm.drizzle.team/docs/select#filtering} - * - * @param where the `where` clause. - * - * @example - * You can use conditional operators and `sql function` to filter the rows to be selected. - * - * ```ts - * // Select all cars with green color - * await db.select().from(cars).where(eq(cars.color, 'green')); - * // or - * await db.select().from(cars).where(sql`${cars.color} = 'green'`) - * ``` - * - * You can logically combine conditional operators with `and()` and `or()` operators: - * - * ```ts - * // Select all BMW cars with a green color - * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW'))); - * - * // Select all cars with the green or blue color - * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue'))); - * ``` - */ - where(where) { - if (typeof where === "function") { - where = where( - new Proxy( - this.config.fields, - new SelectionProxyHandler({ - sqlAliasedBehavior: "sql", - sqlBehavior: "sql", - }) - ) - ); - } - this.config.where = where; - return this; - } - /** - * Adds a `having` clause to the query. - * - * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition. - * - * See docs: {@link https://orm.drizzle.team/docs/select#aggregations} - * - * @param having the `having` clause. - * - * @example - * - * ```ts - * // Select all brands with more than one car - * await db.select({ - * brand: cars.brand, - * count: sql`cast(count(${cars.id}) as int)`, - * }) - * .from(cars) - * .groupBy(cars.brand) - * .having(({ count }) => gt(count, 1)); - * ``` - */ - having(having) { - if (typeof having === "function") { - having = having( - new Proxy( - this.config.fields, - new SelectionProxyHandler({ - sqlAliasedBehavior: "sql", - sqlBehavior: "sql", - }) - ) - ); - } - this.config.having = having; - return this; - } - groupBy(...columns) { - if (typeof columns[0] === "function") { - const groupBy = columns[0]( - new Proxy( - this.config.fields, - new SelectionProxyHandler({ - sqlAliasedBehavior: "alias", - sqlBehavior: "sql", - }) - ) - ); - this.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy]; - } else { - this.config.groupBy = columns; - } - return this; - } - orderBy(...columns) { - if (typeof columns[0] === "function") { - const orderBy = columns[0]( - new Proxy( - this.config.fields, - new SelectionProxyHandler({ - sqlAliasedBehavior: "alias", - sqlBehavior: "sql", - }) - ) - ); - const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy]; - if (this.config.setOperators.length > 0) { - this.config.setOperators.at(-1).orderBy = orderByArray; - } else { - this.config.orderBy = orderByArray; - } - } else { - const orderByArray = columns; - if (this.config.setOperators.length > 0) { - this.config.setOperators.at(-1).orderBy = orderByArray; - } else { - this.config.orderBy = orderByArray; - } - } - return this; - } - /** - * Adds a `limit` clause to the query. - * - * Calling this method will set the maximum number of rows that will be returned by this query. - * - * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset} - * - * @param limit the `limit` clause. - * - * @example - * - * ```ts - * // Get the first 10 people from this query. - * await db.select().from(people).limit(10); - * ``` - */ - limit(limit) { - if (this.config.setOperators.length > 0) { - this.config.setOperators.at(-1).limit = limit; - } else { - this.config.limit = limit; - } - return this; - } - /** - * Adds an `offset` clause to the query. - * - * Calling this method will skip a number of rows when returning results from this query. - * - * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset} - * - * @param offset the `offset` clause. - * - * @example - * - * ```ts - * // Get the 10th-20th people from this query. - * await db.select().from(people).offset(10).limit(10); - * ``` - */ - offset(offset) { - if (this.config.setOperators.length > 0) { - this.config.setOperators.at(-1).offset = offset; - } else { - this.config.offset = offset; - } - return this; - } - /** @internal */ - getSQL() { - return this.dialect.buildSelectQuery(this.config); - } - toSQL() { - const { typings: _typings, ...rest } = this.dialect.sqlToQuery( - this.getSQL() - ); - return rest; - } - as(alias) { - return new Proxy( - new Subquery(this.getSQL(), this.config.fields, alias), - new SelectionProxyHandler({ - alias, - sqlAliasedBehavior: "alias", - sqlBehavior: "error", - }) - ); - } - /** @internal */ - getSelectedFields() { - return new Proxy( - this.config.fields, - new SelectionProxyHandler({ - alias: this.tableName, - sqlAliasedBehavior: "alias", - sqlBehavior: "error", - }) - ); - } - $dynamic() { - return this; - } -}; -_a59 = entityKind; -__publicField(SQLiteSelectQueryBuilderBase, _a59, "SQLiteSelectQueryBuilder"); -var _a60; -var SQLiteSelectBase = class extends SQLiteSelectQueryBuilderBase { - prepare(isOneTimeQuery) { - if (!this.session) { - throw new Error( - "Cannot execute a query on a query builder. Please use a database instance instead." - ); - } - const fieldsList = orderSelectedFields(this.config.fields); - const query = this.session[ - isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery" - ](this.dialect.sqlToQuery(this.getSQL()), fieldsList, "all"); - query.joinsNotNullableMap = this.joinsNotNullableMap; - return query; - } - run = (placeholderValues) => { - return this.prepare(true).run(placeholderValues); - }; - all = (placeholderValues) => { - return this.prepare(true).all(placeholderValues); - }; - get = (placeholderValues) => { - return this.prepare(true).get(placeholderValues); - }; - values = (placeholderValues) => { - return this.prepare(true).values(placeholderValues); - }; - async execute() { - return this.all(); - } -}; -_a60 = entityKind; -__publicField(SQLiteSelectBase, _a60, "SQLiteSelect"); -applyMixins(SQLiteSelectBase, [QueryPromise]); -function createSetOperator(type, isAll) { - return (leftSelect, rightSelect, ...restSelects) => { - const setOperators = [rightSelect, ...restSelects].map((select) => ({ - type, - isAll, - rightSelect: select, - })); - for (const setOperator of setOperators) { - if ( - !haveSameKeys( - leftSelect.getSelectedFields(), - setOperator.rightSelect.getSelectedFields() - ) - ) { - throw new Error( - "Set operator error (union / intersect / except): selected fields are not the same or are in a different order" - ); - } - } - return leftSelect.addSetOperators(setOperators); - }; -} -var getSQLiteSetOperators = () => ({ - union, - unionAll, - intersect, - except, -}); -var union = createSetOperator("union", false); -var unionAll = createSetOperator("union", true); -var intersect = createSetOperator("intersect", false); -var except = createSetOperator("except", false); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/query-builder.js -var _a61; -var QueryBuilder = class { - dialect; - $with(alias) { - const queryBuilder = this; - return { - as(qb) { - if (typeof qb === "function") { - qb = qb(queryBuilder); - } - return new Proxy( - new WithSubquery(qb.getSQL(), qb.getSelectedFields(), alias, true), - new SelectionProxyHandler({ - alias, - sqlAliasedBehavior: "alias", - sqlBehavior: "error", - }) - ); - }, - }; - } - with(...queries) { - const self2 = this; - function select(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: void 0, - dialect: self2.getDialect(), - withList: queries, - }); - } - function selectDistinct(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: void 0, - dialect: self2.getDialect(), - withList: queries, - distinct: true, - }); - } - return { select, selectDistinct }; - } - select(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: void 0, - dialect: this.getDialect(), - }); - } - selectDistinct(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: void 0, - dialect: this.getDialect(), - distinct: true, - }); - } - // Lazy load dialect to avoid circular dependency - getDialect() { - if (!this.dialect) { - this.dialect = new SQLiteSyncDialect(); - } - return this.dialect; - } -}; -_a61 = entityKind; -__publicField(QueryBuilder, _a61, "SQLiteQueryBuilder"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/update.js -var _a62; -var SQLiteUpdateBuilder = class { - constructor(table, session, dialect) { - this.table = table; - this.session = session; - this.dialect = dialect; - } - set(values) { - return new SQLiteUpdateBase( - this.table, - mapUpdateSet(this.table, values), - this.session, - this.dialect - ); - } -}; -_a62 = entityKind; -__publicField(SQLiteUpdateBuilder, _a62, "SQLiteUpdateBuilder"); -var _a63; -var SQLiteUpdateBase = class extends QueryPromise { - constructor(table, set, session, dialect) { - super(); - this.session = session; - this.dialect = dialect; - this.config = { set, table }; - } - /** @internal */ - config; - /** - * Adds a 'where' clause to the query. - * - * Calling this method will update only those rows that fulfill a specified condition. - * - * See docs: {@link https://orm.drizzle.team/docs/update} - * - * @param where the 'where' clause. - * - * @example - * You can use conditional operators and `sql function` to filter the rows to be updated. - * - * ```ts - * // Update all cars with green color - * db.update(cars).set({ color: 'red' }) - * .where(eq(cars.color, 'green')); - * // or - * db.update(cars).set({ color: 'red' }) - * .where(sql`${cars.color} = 'green'`) - * ``` - * - * You can logically combine conditional operators with `and()` and `or()` operators: - * - * ```ts - * // Update all BMW cars with a green color - * db.update(cars).set({ color: 'red' }) - * .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW'))); - * - * // Update all cars with the green or blue color - * db.update(cars).set({ color: 'red' }) - * .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue'))); - * ``` - */ - where(where) { - this.config.where = where; - return this; - } - returning(fields = this.config.table[SQLiteTable.Symbol.Columns]) { - this.config.returning = orderSelectedFields(fields); - return this; - } - /** @internal */ - getSQL() { - return this.dialect.buildUpdateQuery(this.config); - } - toSQL() { - const { typings: _typings, ...rest } = this.dialect.sqlToQuery( - this.getSQL() - ); - return rest; - } - prepare(isOneTimeQuery) { - return this.session[ - isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery" - ]( - this.dialect.sqlToQuery(this.getSQL()), - this.config.returning, - this.config.returning ? "all" : "run" - ); - } - run = (placeholderValues) => { - return this.prepare(true).run(placeholderValues); - }; - all = (placeholderValues) => { - return this.prepare(true).all(placeholderValues); - }; - get = (placeholderValues) => { - return this.prepare(true).get(placeholderValues); - }; - values = (placeholderValues) => { - return this.prepare(true).values(placeholderValues); - }; - async execute() { - return this.config.returning ? this.all() : this.run(); - } - $dynamic() { - return this; - } -}; -_a63 = entityKind; -__publicField(SQLiteUpdateBase, _a63, "SQLiteUpdate"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/query.js -var _a64; -var RelationalQueryBuilder = class { - constructor( - mode, - fullSchema, - schema, - tableNamesMap, - table, - tableConfig, - dialect, - session - ) { - this.mode = mode; - this.fullSchema = fullSchema; - this.schema = schema; - this.tableNamesMap = tableNamesMap; - this.table = table; - this.tableConfig = tableConfig; - this.dialect = dialect; - this.session = session; - } - findMany(config) { - return this.mode === "sync" - ? new SQLiteSyncRelationalQuery( - this.fullSchema, - this.schema, - this.tableNamesMap, - this.table, - this.tableConfig, - this.dialect, - this.session, - config ? config : {}, - "many" - ) - : new SQLiteRelationalQuery( - this.fullSchema, - this.schema, - this.tableNamesMap, - this.table, - this.tableConfig, - this.dialect, - this.session, - config ? config : {}, - "many" - ); - } - findFirst(config) { - return this.mode === "sync" - ? new SQLiteSyncRelationalQuery( - this.fullSchema, - this.schema, - this.tableNamesMap, - this.table, - this.tableConfig, - this.dialect, - this.session, - config ? { ...config, limit: 1 } : { limit: 1 }, - "first" - ) - : new SQLiteRelationalQuery( - this.fullSchema, - this.schema, - this.tableNamesMap, - this.table, - this.tableConfig, - this.dialect, - this.session, - config ? { ...config, limit: 1 } : { limit: 1 }, - "first" - ); - } -}; -_a64 = entityKind; -__publicField( - RelationalQueryBuilder, - _a64, - "SQLiteAsyncRelationalQueryBuilder" -); -var _a65; -var SQLiteRelationalQuery = class extends QueryPromise { - constructor( - fullSchema, - schema, - tableNamesMap, - table, - tableConfig, - dialect, - session, - config, - mode - ) { - super(); - this.fullSchema = fullSchema; - this.schema = schema; - this.tableNamesMap = tableNamesMap; - this.table = table; - this.tableConfig = tableConfig; - this.dialect = dialect; - this.session = session; - this.config = config; - this.mode = mode; - } - /** @internal */ - mode; - /** @internal */ - getSQL() { - return this.dialect.buildRelationalQuery({ - fullSchema: this.fullSchema, - schema: this.schema, - tableNamesMap: this.tableNamesMap, - table: this.table, - tableConfig: this.tableConfig, - queryConfig: this.config, - tableAlias: this.tableConfig.tsName, - }).sql; - } - prepare() { - const { query, builtQuery } = this._toSQL(); - return this.session.prepareQuery( - builtQuery, - void 0, - this.mode === "first" ? "get" : "all", - (rawRows, mapColumnValue) => { - const rows = rawRows.map((row) => - mapRelationalRow( - this.schema, - this.tableConfig, - row, - query.selection, - mapColumnValue - ) - ); - if (this.mode === "first") { - return rows[0]; - } - return rows; - } - ); - } - _toSQL() { - const query = this.dialect.buildRelationalQuery({ - fullSchema: this.fullSchema, - schema: this.schema, - tableNamesMap: this.tableNamesMap, - table: this.table, - tableConfig: this.tableConfig, - queryConfig: this.config, - tableAlias: this.tableConfig.tsName, - }); - const builtQuery = this.dialect.sqlToQuery(query.sql); - return { query, builtQuery }; - } - toSQL() { - return this._toSQL().builtQuery; - } - /** @internal */ - executeRaw() { - if (this.mode === "first") { - return this.prepare().get(); - } - return this.prepare().all(); - } - async execute() { - return this.executeRaw(); - } -}; -_a65 = entityKind; -__publicField(SQLiteRelationalQuery, _a65, "SQLiteAsyncRelationalQuery"); -var _a66; -var SQLiteSyncRelationalQuery = class extends SQLiteRelationalQuery { - sync() { - return this.executeRaw(); - } -}; -_a66 = entityKind; -__publicField(SQLiteSyncRelationalQuery, _a66, "SQLiteSyncRelationalQuery"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/query-builders/raw.js -var _a67; -var SQLiteRaw = class extends QueryPromise { - constructor(cb, getSQLCb, action, dialect, mapBatchResult) { - super(); - this.cb = cb; - this.getSQLCb = getSQLCb; - this.dialect = dialect; - this.mapBatchResult = mapBatchResult; - this.config = { action }; - } - /** @internal */ - config; - /** @internal */ - getSQL() { - return this.getSQLCb(); - } - async execute() { - return this.cb(); - } - prepare() { - return { - getQuery: () => { - return this.dialect.sqlToQuery(this.getSQL()); - }, - mapResult: (result, isFromBatch) => { - return isFromBatch ? this.mapBatchResult(result) : result; - }, - }; - } -}; -_a67 = entityKind; -__publicField(SQLiteRaw, _a67, "SQLiteRaw"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/db.js -var _a68; -var BaseSQLiteDatabase = class { - constructor(resultKind, dialect, session, schema) { - this.resultKind = resultKind; - this.dialect = dialect; - this.session = session; - this._ = schema - ? { schema: schema.schema, tableNamesMap: schema.tableNamesMap } - : { schema: void 0, tableNamesMap: {} }; - this.query = {}; - if (this._.schema) { - for (const [tableName, columns] of Object.entries(this._.schema)) { - this.query[tableName] = new RelationalQueryBuilder( - resultKind, - schema.fullSchema, - this._.schema, - this._.tableNamesMap, - schema.fullSchema[tableName], - columns, - dialect, - session - ); - } - } - } - query; - /** - * Creates a subquery that defines a temporary named result set as a CTE. - * - * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query. - * - * See docs: {@link https://orm.drizzle.team/docs/select#with-clause} - * - * @param alias The alias for the subquery. - * - * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries. - * - * @example - * - * ```ts - * // Create a subquery with alias 'sq' and use it in the select query - * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42))); - * - * const result = await db.with(sq).select().from(sq); - * ``` - * - * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them: - * - * ```ts - * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query - * const sq = db.$with('sq').as(db.select({ - * name: sql`upper(${users.name})`.as('name'), - * }) - * .from(users)); - * - * const result = await db.with(sq).select({ name: sq.name }).from(sq); - * ``` - */ - $with(alias) { - return { - as(qb) { - if (typeof qb === "function") { - qb = qb(new QueryBuilder()); - } - return new Proxy( - new WithSubquery(qb.getSQL(), qb.getSelectedFields(), alias, true), - new SelectionProxyHandler({ - alias, - sqlAliasedBehavior: "alias", - sqlBehavior: "error", - }) - ); - }, - }; - } - /** - * Incorporates a previously defined CTE (using `$with`) into the main query. - * - * This method allows the main query to reference a temporary named result set. - * - * See docs: {@link https://orm.drizzle.team/docs/select#with-clause} - * - * @param queries The CTEs to incorporate into the main query. - * - * @example - * - * ```ts - * // Define a subquery 'sq' as a CTE using $with - * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42))); - * - * // Incorporate the CTE 'sq' into the main query and select from it - * const result = await db.with(sq).select().from(sq); - * ``` - */ - with(...queries) { - const self2 = this; - function select(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: self2.session, - dialect: self2.dialect, - withList: queries, - }); - } - function selectDistinct(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: self2.session, - dialect: self2.dialect, - withList: queries, - distinct: true, - }); - } - return { select, selectDistinct }; - } - select(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: this.session, - dialect: this.dialect, - }); - } - selectDistinct(fields) { - return new SQLiteSelectBuilder({ - fields: fields ?? void 0, - session: this.session, - dialect: this.dialect, - distinct: true, - }); - } - /** - * Creates an update query. - * - * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated. - * - * Use `.set()` method to specify which values to update. - * - * See docs: {@link https://orm.drizzle.team/docs/update} - * - * @param table The table to update. - * - * @example - * - * ```ts - * // Update all rows in the 'cars' table - * await db.update(cars).set({ color: 'red' }); - * - * // Update rows with filters and conditions - * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW')); - * - * // Update with returning clause - * const updatedCar: Car[] = await db.update(cars) - * .set({ color: 'red' }) - * .where(eq(cars.id, 1)) - * .returning(); - * ``` - */ - update(table) { - return new SQLiteUpdateBuilder(table, this.session, this.dialect); - } - /** - * Creates an insert query. - * - * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert. - * - * See docs: {@link https://orm.drizzle.team/docs/insert} - * - * @param table The table to insert into. - * - * @example - * - * ```ts - * // Insert one row - * await db.insert(cars).values({ brand: 'BMW' }); - * - * // Insert multiple rows - * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]); - * - * // Insert with returning clause - * const insertedCar: Car[] = await db.insert(cars) - * .values({ brand: 'BMW' }) - * .returning(); - * ``` - */ - insert(into) { - return new SQLiteInsertBuilder(into, this.session, this.dialect); - } - /** - * Creates a delete query. - * - * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted. - * - * See docs: {@link https://orm.drizzle.team/docs/delete} - * - * @param table The table to delete from. - * - * @example - * - * ```ts - * // Delete all rows in the 'cars' table - * await db.delete(cars); - * - * // Delete rows with filters and conditions - * await db.delete(cars).where(eq(cars.color, 'green')); - * - * // Delete with returning clause - * const deletedCar: Car[] = await db.delete(cars) - * .where(eq(cars.id, 1)) - * .returning(); - * ``` - */ - delete(from) { - return new SQLiteDeleteBase(from, this.session, this.dialect); - } - run(query) { - const sql2 = query.getSQL(); - if (this.resultKind === "async") { - return new SQLiteRaw( - async () => this.session.run(sql2), - () => sql2, - "run", - this.dialect, - this.session.extractRawRunValueFromBatchResult.bind(this.session) - ); - } - return this.session.run(sql2); - } - all(query) { - const sql2 = query.getSQL(); - if (this.resultKind === "async") { - return new SQLiteRaw( - async () => this.session.all(sql2), - () => sql2, - "all", - this.dialect, - this.session.extractRawAllValueFromBatchResult.bind(this.session) - ); - } - return this.session.all(sql2); - } - get(query) { - const sql2 = query.getSQL(); - if (this.resultKind === "async") { - return new SQLiteRaw( - async () => this.session.get(sql2), - () => sql2, - "get", - this.dialect, - this.session.extractRawGetValueFromBatchResult.bind(this.session) - ); - } - return this.session.get(sql2); - } - values(query) { - const sql2 = query.getSQL(); - if (this.resultKind === "async") { - return new SQLiteRaw( - async () => this.session.values(sql2), - () => sql2, - "values", - this.dialect, - this.session.extractRawValuesValueFromBatchResult.bind(this.session) - ); - } - return this.session.values(sql2); - } - transaction(transaction, config) { - return this.session.transaction(transaction, config); - } -}; -_a68 = entityKind; -__publicField(BaseSQLiteDatabase, _a68, "BaseSQLiteDatabase"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/sqlite-core/session.js -var _a69; -var ExecuteResultSync = class extends QueryPromise { - constructor(resultCb) { - super(); - this.resultCb = resultCb; - } - async execute() { - return this.resultCb(); - } - sync() { - return this.resultCb(); - } -}; -_a69 = entityKind; -__publicField(ExecuteResultSync, _a69, "ExecuteResultSync"); -var _a70; -var SQLitePreparedQuery = class { - constructor(mode, executeMethod, query) { - this.mode = mode; - this.executeMethod = executeMethod; - this.query = query; - } - /** @internal */ - joinsNotNullableMap; - getQuery() { - return this.query; - } - mapRunResult(result, _isFromBatch) { - return result; - } - mapAllResult(_result, _isFromBatch) { - throw new Error("Not implemented"); - } - mapGetResult(_result, _isFromBatch) { - throw new Error("Not implemented"); - } - execute(placeholderValues) { - if (this.mode === "async") { - return this[this.executeMethod](placeholderValues); - } - return new ExecuteResultSync(() => - this[this.executeMethod](placeholderValues) - ); - } - mapResult(response, isFromBatch) { - switch (this.executeMethod) { - case "run": { - return this.mapRunResult(response, isFromBatch); - } - case "all": { - return this.mapAllResult(response, isFromBatch); - } - case "get": { - return this.mapGetResult(response, isFromBatch); - } - } - } -}; -_a70 = entityKind; -__publicField(SQLitePreparedQuery, _a70, "PreparedQuery"); -var _a71; -var SQLiteSession = class { - constructor(dialect) { - this.dialect = dialect; - } - prepareOneTimeQuery(query, fields, executeMethod) { - return this.prepareQuery(query, fields, executeMethod); - } - run(query) { - const staticQuery = this.dialect.sqlToQuery(query); - try { - return this.prepareOneTimeQuery(staticQuery, void 0, "run").run(); - } catch (err) { - throw new DrizzleError({ - cause: err, - message: `Failed to run the query '${staticQuery.sql}'`, - }); - } - } - /** @internal */ - extractRawRunValueFromBatchResult(result) { - return result; - } - all(query) { - return this.prepareOneTimeQuery( - this.dialect.sqlToQuery(query), - void 0, - "run" - ).all(); - } - /** @internal */ - extractRawAllValueFromBatchResult(_result) { - throw new Error("Not implemented"); - } - get(query) { - return this.prepareOneTimeQuery( - this.dialect.sqlToQuery(query), - void 0, - "run" - ).get(); - } - /** @internal */ - extractRawGetValueFromBatchResult(_result) { - throw new Error("Not implemented"); - } - values(query) { - return this.prepareOneTimeQuery( - this.dialect.sqlToQuery(query), - void 0, - "run" - ).values(); - } - /** @internal */ - extractRawValuesValueFromBatchResult(_result) { - throw new Error("Not implemented"); - } -}; -_a71 = entityKind; -__publicField(SQLiteSession, _a71, "SQLiteSession"); -var _a72; -var SQLiteTransaction = class extends BaseSQLiteDatabase { - constructor(resultType, dialect, session, schema, nestedIndex = 0) { - super(resultType, dialect, session, schema); - this.schema = schema; - this.nestedIndex = nestedIndex; - } - rollback() { - throw new TransactionRollbackError(); - } -}; -_a72 = entityKind; -__publicField(SQLiteTransaction, _a72, "SQLiteTransaction"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/table.js -var InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys"); -var _a73; -var MySqlTable = class extends Table { - /** @internal */ - [((_a73 = entityKind), Table.Symbol.Columns)]; - /** @internal */ - [InlineForeignKeys3] = []; - /** @internal */ - [Table.Symbol.ExtraConfigBuilder] = void 0; -}; -__publicField(MySqlTable, _a73, "MySqlTable"); -/** @internal */ -__publicField( - MySqlTable, - "Symbol", - Object.assign({}, Table.Symbol, { - InlineForeignKeys: InlineForeignKeys3, - }) -); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/foreign-keys.js -var _a74; -var ForeignKeyBuilder2 = class { - /** @internal */ - reference; - /** @internal */ - _onUpdate; - /** @internal */ - _onDelete; - constructor(config, actions) { - this.reference = () => { - const { name, columns, foreignColumns } = config(); - return { - name, - columns, - foreignTable: foreignColumns[0].table, - foreignColumns, - }; - }; - if (actions) { - this._onUpdate = actions.onUpdate; - this._onDelete = actions.onDelete; - } - } - onUpdate(action) { - this._onUpdate = action; - return this; - } - onDelete(action) { - this._onDelete = action; - return this; - } - /** @internal */ - build(table) { - return new ForeignKey2(table, this); - } -}; -_a74 = entityKind; -__publicField(ForeignKeyBuilder2, _a74, "MySqlForeignKeyBuilder"); -var _a75; -var ForeignKey2 = class { - constructor(table, builder) { - this.table = table; - this.reference = builder.reference; - this.onUpdate = builder._onUpdate; - this.onDelete = builder._onDelete; - } - reference; - onUpdate; - onDelete; - getName() { - const { name, columns, foreignColumns } = this.reference(); - const columnNames = columns.map((column) => column.name); - const foreignColumnNames = foreignColumns.map((column) => column.name); - const chunks = [ - this.table[MySqlTable.Symbol.Name], - ...columnNames, - foreignColumns[0].table[MySqlTable.Symbol.Name], - ...foreignColumnNames, - ]; - return name ?? `${chunks.join("_")}_fk`; - } -}; -_a75 = entityKind; -__publicField(ForeignKey2, _a75, "MySqlForeignKey"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/unique-constraint.js -function uniqueKeyName2(table, columns) { - return `${table[MySqlTable.Symbol.Name]}_${columns.join("_")}_unique`; -} -var _a76; -var UniqueConstraintBuilder2 = class { - constructor(columns, name) { - this.name = name; - this.columns = columns; - } - /** @internal */ - columns; - /** @internal */ - build(table) { - return new UniqueConstraint2(table, this.columns, this.name); - } -}; -_a76 = entityKind; -__publicField(UniqueConstraintBuilder2, _a76, "MySqlUniqueConstraintBuilder"); -var _a77; -var UniqueOnConstraintBuilder2 = class { - /** @internal */ - name; - constructor(name) { - this.name = name; - } - on(...columns) { - return new UniqueConstraintBuilder2(columns, this.name); - } -}; -_a77 = entityKind; -__publicField( - UniqueOnConstraintBuilder2, - _a77, - "MySqlUniqueOnConstraintBuilder" -); -var _a78; -var UniqueConstraint2 = class { - constructor(table, columns, name) { - this.table = table; - this.columns = columns; - this.name = - name ?? - uniqueKeyName2( - this.table, - this.columns.map((column) => column.name) - ); - } - columns; - name; - nullsNotDistinct = false; - getName() { - return this.name; - } -}; -_a78 = entityKind; -__publicField(UniqueConstraint2, _a78, "MySqlUniqueConstraint"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/columns/common.js -var _a79; -var MySqlColumnBuilder = class extends ColumnBuilder { - foreignKeyConfigs = []; - references(ref, actions = {}) { - this.foreignKeyConfigs.push({ ref, actions }); - return this; - } - unique(name) { - this.config.isUnique = true; - this.config.uniqueName = name; - return this; - } - /** @internal */ - buildForeignKeys(column, table) { - return this.foreignKeyConfigs.map(({ ref, actions }) => { - return ((ref2, actions2) => { - const builder = new ForeignKeyBuilder2(() => { - const foreignColumn = ref2(); - return { columns: [column], foreignColumns: [foreignColumn] }; - }); - if (actions2.onUpdate) { - builder.onUpdate(actions2.onUpdate); - } - if (actions2.onDelete) { - builder.onDelete(actions2.onDelete); - } - return builder.build(table); - })(ref, actions); - }); - } -}; -_a79 = entityKind; -__publicField(MySqlColumnBuilder, _a79, "MySqlColumnBuilder"); -var _a80; -var MySqlColumn = class extends Column { - constructor(table, config) { - if (!config.uniqueName) { - config.uniqueName = uniqueKeyName2(table, [config.name]); - } - super(table, config); - this.table = table; - } -}; -_a80 = entityKind; -__publicField(MySqlColumn, _a80, "MySqlColumn"); -var _a81; -var MySqlColumnBuilderWithAutoIncrement = class extends MySqlColumnBuilder { - constructor(name, dataType, columnType) { - super(name, dataType, columnType); - this.config.autoIncrement = false; - } - autoincrement() { - this.config.autoIncrement = true; - this.config.hasDefault = true; - return this; - } -}; -_a81 = entityKind; -__publicField( - MySqlColumnBuilderWithAutoIncrement, - _a81, - "MySqlColumnBuilderWithAutoIncrement" -); -var _a82; -var MySqlColumnWithAutoIncrement = class extends MySqlColumn { - autoIncrement = this.config.autoIncrement; -}; -_a82 = entityKind; -__publicField( - MySqlColumnWithAutoIncrement, - _a82, - "MySqlColumnWithAutoIncrement" -); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/columns/char.js -var _a83; -var MySqlCharBuilder = class extends MySqlColumnBuilder { - constructor(name, config) { - super(name, "string", "MySqlChar"); - this.config.length = config.length; - this.config.enum = config.enum; - } - /** @internal */ - build(table) { - return new MySqlChar(table, this.config); - } -}; -_a83 = entityKind; -__publicField(MySqlCharBuilder, _a83, "MySqlCharBuilder"); -var _a84; -var MySqlChar = class extends MySqlColumn { - length = this.config.length; - enumValues = this.config.enum; - getSQLType() { - return this.length === void 0 ? `char` : `char(${this.length})`; - } -}; -_a84 = entityKind; -__publicField(MySqlChar, _a84, "MySqlChar"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/columns/varbinary.js -var _a85; -var MySqlVarBinaryBuilder = class extends MySqlColumnBuilder { - /** @internal */ - constructor(name, config) { - super(name, "string", "MySqlVarBinary"); - this.config.length = config?.length; - } - /** @internal */ - build(table) { - return new MySqlVarBinary(table, this.config); - } -}; -_a85 = entityKind; -__publicField(MySqlVarBinaryBuilder, _a85, "MySqlVarBinaryBuilder"); -var _a86; -var MySqlVarBinary = class extends MySqlColumn { - length = this.config.length; - getSQLType() { - return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`; - } -}; -_a86 = entityKind; -__publicField(MySqlVarBinary, _a86, "MySqlVarBinary"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/mysql-core/columns/varchar.js -var _a87; -var MySqlVarCharBuilder = class extends MySqlColumnBuilder { - /** @internal */ - constructor(name, config) { - super(name, "string", "MySqlVarChar"); - this.config.length = config.length; - this.config.enum = config.enum; - } - /** @internal */ - build(table) { - return new MySqlVarChar(table, this.config); - } -}; -_a87 = entityKind; -__publicField(MySqlVarCharBuilder, _a87, "MySqlVarCharBuilder"); -var _a88; -var MySqlVarChar = class extends MySqlColumn { - length = this.config.length; - enumValues = this.config.enum; - getSQLType() { - return this.length === void 0 ? `varchar` : `varchar(${this.length})`; - } -}; -_a88 = entityKind; -__publicField(MySqlVarChar, _a88, "MySqlVarChar"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/foreign-keys.js -var _a89; -var ForeignKeyBuilder3 = class { - /** @internal */ - reference; - /** @internal */ - _onUpdate = "no action"; - /** @internal */ - _onDelete = "no action"; - constructor(config, actions) { - this.reference = () => { - const { name, columns, foreignColumns } = config(); - return { - name, - columns, - foreignTable: foreignColumns[0].table, - foreignColumns, - }; - }; - if (actions) { - this._onUpdate = actions.onUpdate; - this._onDelete = actions.onDelete; - } - } - onUpdate(action) { - this._onUpdate = action === void 0 ? "no action" : action; - return this; - } - onDelete(action) { - this._onDelete = action === void 0 ? "no action" : action; - return this; - } - /** @internal */ - build(table) { - return new ForeignKey3(table, this); - } -}; -_a89 = entityKind; -__publicField(ForeignKeyBuilder3, _a89, "PgForeignKeyBuilder"); -var _a90; -var ForeignKey3 = class { - constructor(table, builder) { - this.table = table; - this.reference = builder.reference; - this.onUpdate = builder._onUpdate; - this.onDelete = builder._onDelete; - } - reference; - onUpdate; - onDelete; - getName() { - const { name, columns, foreignColumns } = this.reference(); - const columnNames = columns.map((column) => column.name); - const foreignColumnNames = foreignColumns.map((column) => column.name); - const chunks = [ - this.table[PgTable.Symbol.Name], - ...columnNames, - foreignColumns[0].table[PgTable.Symbol.Name], - ...foreignColumnNames, - ]; - return name ?? `${chunks.join("_")}_fk`; - } -}; -_a90 = entityKind; -__publicField(ForeignKey3, _a90, "PgForeignKey"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/unique-constraint.js -function uniqueKeyName3(table, columns) { - return `${table[PgTable.Symbol.Name]}_${columns.join("_")}_unique`; -} -var _a91; -var UniqueConstraintBuilder3 = class { - constructor(columns, name) { - this.name = name; - this.columns = columns; - } - /** @internal */ - columns; - /** @internal */ - nullsNotDistinctConfig = false; - nullsNotDistinct() { - this.nullsNotDistinctConfig = true; - return this; - } - /** @internal */ - build(table) { - return new UniqueConstraint3( - table, - this.columns, - this.nullsNotDistinctConfig, - this.name - ); - } -}; -_a91 = entityKind; -__publicField(UniqueConstraintBuilder3, _a91, "PgUniqueConstraintBuilder"); -var _a92; -var UniqueOnConstraintBuilder3 = class { - /** @internal */ - name; - constructor(name) { - this.name = name; - } - on(...columns) { - return new UniqueConstraintBuilder3(columns, this.name); - } -}; -_a92 = entityKind; -__publicField(UniqueOnConstraintBuilder3, _a92, "PgUniqueOnConstraintBuilder"); -var _a93; -var UniqueConstraint3 = class { - constructor(table, columns, nullsNotDistinct, name) { - this.table = table; - this.columns = columns; - this.name = - name ?? - uniqueKeyName3( - this.table, - this.columns.map((column) => column.name) - ); - this.nullsNotDistinct = nullsNotDistinct; - } - columns; - name; - nullsNotDistinct = false; - getName() { - return this.name; - } -}; -_a93 = entityKind; -__publicField(UniqueConstraint3, _a93, "PgUniqueConstraint"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/utils/array.js -function parsePgArrayValue(arrayString, startFrom, inQuotes) { - for (let i = startFrom; i < arrayString.length; i++) { - const char = arrayString[i]; - if (char === "\\") { - i++; - continue; - } - if (char === '"') { - return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1]; - } - if (inQuotes) { - continue; - } - if (char === "," || char === "}") { - return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i]; - } - } - return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length]; -} -function parsePgNestedArray(arrayString, startFrom = 0) { - const result = []; - let i = startFrom; - let lastCharIsComma = false; - while (i < arrayString.length) { - const char = arrayString[i]; - if (char === ",") { - if (lastCharIsComma || i === startFrom) { - result.push(""); - } - lastCharIsComma = true; - i++; - continue; - } - lastCharIsComma = false; - if (char === "\\") { - i += 2; - continue; - } - if (char === '"') { - const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true); - result.push(value2); - i = startFrom2; - continue; - } - if (char === "}") { - return [result, i + 1]; - } - if (char === "{") { - const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1); - result.push(value2); - i = startFrom2; - continue; - } - const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false); - result.push(value); - i = newStartFrom; - } - return [result, i]; -} -function parsePgArray(arrayString) { - const [result] = parsePgNestedArray(arrayString, 1); - return result; -} -function makePgArray(array2) { - return `{${array2 - .map((item) => { - if (Array.isArray(item)) { - return makePgArray(item); - } - if (typeof item === "string") { - return `"${item.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`; - } - return `${item}`; - }) - .join(",")}}`; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/columns/common.js -var _a94; -var PgColumnBuilder = class extends ColumnBuilder { - foreignKeyConfigs = []; - array(size) { - return new PgArrayBuilder(this.config.name, this, size); - } - references(ref, actions = {}) { - this.foreignKeyConfigs.push({ ref, actions }); - return this; - } - unique(name, config) { - this.config.isUnique = true; - this.config.uniqueName = name; - this.config.uniqueType = config?.nulls; - return this; - } - /** @internal */ - buildForeignKeys(column, table) { - return this.foreignKeyConfigs.map(({ ref, actions }) => { - return iife( - (ref2, actions2) => { - const builder = new ForeignKeyBuilder3(() => { - const foreignColumn = ref2(); - return { columns: [column], foreignColumns: [foreignColumn] }; - }); - if (actions2.onUpdate) { - builder.onUpdate(actions2.onUpdate); - } - if (actions2.onDelete) { - builder.onDelete(actions2.onDelete); - } - return builder.build(table); - }, - ref, - actions - ); - }); - } -}; -_a94 = entityKind; -__publicField(PgColumnBuilder, _a94, "PgColumnBuilder"); -var _a95; -var PgColumn = class extends Column { - constructor(table, config) { - if (!config.uniqueName) { - config.uniqueName = uniqueKeyName3(table, [config.name]); - } - super(table, config); - this.table = table; - } -}; -_a95 = entityKind; -__publicField(PgColumn, _a95, "PgColumn"); -var _a96; -var PgArrayBuilder = class extends PgColumnBuilder { - constructor(name, baseBuilder, size) { - super(name, "array", "PgArray"); - this.config.baseBuilder = baseBuilder; - this.config.size = size; - } - /** @internal */ - build(table) { - const baseColumn = this.config.baseBuilder.build(table); - return new PgArray(table, this.config, baseColumn); - } -}; -_a96 = entityKind; -__publicField(PgArrayBuilder, _a96, "PgArrayBuilder"); -var _a97; -var _PgArray = class extends PgColumn { - constructor(table, config, baseColumn, range) { - super(table, config); - this.baseColumn = baseColumn; - this.range = range; - this.size = config.size; - } - size; - getSQLType() { - return `${this.baseColumn.getSQLType()}[${typeof this.size === "number" ? this.size : ""}]`; - } - mapFromDriverValue(value) { - if (typeof value === "string") { - value = parsePgArray(value); - } - return value.map((v) => this.baseColumn.mapFromDriverValue(v)); - } - mapToDriverValue(value, isNestedArray = false) { - const a = value.map((v) => - v === null - ? null - : is(this.baseColumn, _PgArray) - ? this.baseColumn.mapToDriverValue(v, true) - : this.baseColumn.mapToDriverValue(v) - ); - if (isNestedArray) return a; - return makePgArray(a); - } -}; -var PgArray = _PgArray; -_a97 = entityKind; -__publicField(PgArray, _a97, "PgArray"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/columns/char.js -var _a98; -var PgCharBuilder = class extends PgColumnBuilder { - constructor(name, config) { - super(name, "string", "PgChar"); - this.config.length = config.length; - this.config.enumValues = config.enum; - } - /** @internal */ - build(table) { - return new PgChar(table, this.config); - } -}; -_a98 = entityKind; -__publicField(PgCharBuilder, _a98, "PgCharBuilder"); -var _a99; -var PgChar = class extends PgColumn { - length = this.config.length; - enumValues = this.config.enumValues; - getSQLType() { - return this.length === void 0 ? `char` : `char(${this.length})`; - } -}; -_a99 = entityKind; -__publicField(PgChar, _a99, "PgChar"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/columns/uuid.js -var _a100; -var PgUUIDBuilder = class extends PgColumnBuilder { - constructor(name) { - super(name, "string", "PgUUID"); - } - /** - * Adds `default gen_random_uuid()` to the column definition. - */ - defaultRandom() { - return this.default(sql`gen_random_uuid()`); - } - /** @internal */ - build(table) { - return new PgUUID(table, this.config); - } -}; -_a100 = entityKind; -__publicField(PgUUIDBuilder, _a100, "PgUUIDBuilder"); -var _a101; -var PgUUID = class extends PgColumn { - getSQLType() { - return "uuid"; - } -}; -_a101 = entityKind; -__publicField(PgUUID, _a101, "PgUUID"); - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/pg-core/columns/varchar.js -var _a102; -var PgVarcharBuilder = class extends PgColumnBuilder { - constructor(name, config) { - super(name, "string", "PgVarchar"); - this.config.length = config.length; - this.config.enumValues = config.enum; - } - /** @internal */ - build(table) { - return new PgVarchar(table, this.config); - } -}; -_a102 = entityKind; -__publicField(PgVarcharBuilder, _a102, "PgVarcharBuilder"); -var _a103; -var PgVarchar = class extends PgColumn { - length = this.config.length; - enumValues = this.config.enumValues; - getSQLType() { - return this.length === void 0 ? `varchar` : `varchar(${this.length})`; - } -}; -_a103 = entityKind; -__publicField(PgVarchar, _a103, "PgVarchar"); - -// ../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs -var util; -(function (util2) { - util2.assertEqual = (val) => val; - function assertIs(_arg) {} - util2.assertIs = assertIs; - function assertNever(_x) { - throw new Error(); - } - util2.assertNever = assertNever; - util2.arrayToEnum = (items) => { - const obj = {}; - for (const item of items) { - obj[item] = item; - } - return obj; - }; - util2.getValidEnumValues = (obj) => { - const validKeys = util2 - .objectKeys(obj) - .filter((k) => typeof obj[obj[k]] !== "number"); - const filtered = {}; - for (const k of validKeys) { - filtered[k] = obj[k]; - } - return util2.objectValues(filtered); - }; - util2.objectValues = (obj) => { - return util2.objectKeys(obj).map(function (e) { - return obj[e]; - }); - }; - util2.objectKeys = - typeof Object.keys === "function" - ? (obj) => Object.keys(obj) - : (object2) => { - const keys = []; - for (const key in object2) { - if (Object.prototype.hasOwnProperty.call(object2, key)) { - keys.push(key); - } - } - return keys; - }; - util2.find = (arr, checker) => { - for (const item of arr) { - if (checker(item)) return item; - } - return void 0; - }; - util2.isInteger = - typeof Number.isInteger === "function" - ? (val) => Number.isInteger(val) - : (val) => - typeof val === "number" && isFinite(val) && Math.floor(val) === val; - function joinValues(array2, separator = " | ") { - return array2 - .map((val) => (typeof val === "string" ? `'${val}'` : val)) - .join(separator); - } - util2.joinValues = joinValues; - util2.jsonStringifyReplacer = (_, value) => { - if (typeof value === "bigint") { - return value.toString(); - } - return value; - }; -})(util || (util = {})); -var objectUtil; -(function (objectUtil2) { - objectUtil2.mergeShapes = (first, second) => { - return { - ...first, - ...second, - // second overwrites first - }; - }; -})(objectUtil || (objectUtil = {})); -var ZodParsedType = util.arrayToEnum([ - "string", - "nan", - "number", - "integer", - "float", - "boolean", - "date", - "bigint", - "symbol", - "function", - "undefined", - "null", - "array", - "object", - "unknown", - "promise", - "void", - "never", - "map", - "set", -]); -var getParsedType = (data) => { - const t = typeof data; - switch (t) { - case "undefined": - return ZodParsedType.undefined; - case "string": - return ZodParsedType.string; - case "number": - return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number; - case "boolean": - return ZodParsedType.boolean; - case "function": - return ZodParsedType.function; - case "bigint": - return ZodParsedType.bigint; - case "symbol": - return ZodParsedType.symbol; - case "object": - if (Array.isArray(data)) { - return ZodParsedType.array; - } - if (data === null) { - return ZodParsedType.null; - } - if ( - data.then && - typeof data.then === "function" && - data.catch && - typeof data.catch === "function" - ) { - return ZodParsedType.promise; - } - if (typeof Map !== "undefined" && data instanceof Map) { - return ZodParsedType.map; - } - if (typeof Set !== "undefined" && data instanceof Set) { - return ZodParsedType.set; - } - if (typeof Date !== "undefined" && data instanceof Date) { - return ZodParsedType.date; - } - return ZodParsedType.object; - default: - return ZodParsedType.unknown; - } -}; -var ZodIssueCode = util.arrayToEnum([ - "invalid_type", - "invalid_literal", - "custom", - "invalid_union", - "invalid_union_discriminator", - "invalid_enum_value", - "unrecognized_keys", - "invalid_arguments", - "invalid_return_type", - "invalid_date", - "invalid_string", - "too_small", - "too_big", - "invalid_intersection_types", - "not_multiple_of", - "not_finite", -]); -var quotelessJson = (obj) => { - const json = JSON.stringify(obj, null, 2); - return json.replace(/"([^"]+)":/g, "$1:"); -}; -var ZodError = class extends Error { - constructor(issues) { - super(); - this.issues = []; - this.addIssue = (sub) => { - this.issues = [...this.issues, sub]; - }; - this.addIssues = (subs = []) => { - this.issues = [...this.issues, ...subs]; - }; - const actualProto = new.target.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(this, actualProto); - } else { - this.__proto__ = actualProto; - } - this.name = "ZodError"; - this.issues = issues; - } - get errors() { - return this.issues; - } - format(_mapper) { - const mapper = - _mapper || - function (issue) { - return issue.message; - }; - const fieldErrors = { _errors: [] }; - const processError = (error) => { - for (const issue of error.issues) { - if (issue.code === "invalid_union") { - issue.unionErrors.map(processError); - } else if (issue.code === "invalid_return_type") { - processError(issue.returnTypeError); - } else if (issue.code === "invalid_arguments") { - processError(issue.argumentsError); - } else if (issue.path.length === 0) { - fieldErrors._errors.push(mapper(issue)); - } else { - let curr = fieldErrors; - let i = 0; - while (i < issue.path.length) { - const el = issue.path[i]; - const terminal = i === issue.path.length - 1; - if (!terminal) { - curr[el] = curr[el] || { _errors: [] }; - } else { - curr[el] = curr[el] || { _errors: [] }; - curr[el]._errors.push(mapper(issue)); - } - curr = curr[el]; - i++; - } - } - } - }; - processError(this); - return fieldErrors; - } - toString() { - return this.message; - } - get message() { - return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2); - } - get isEmpty() { - return this.issues.length === 0; - } - flatten(mapper = (issue) => issue.message) { - const fieldErrors = {}; - const formErrors = []; - for (const sub of this.issues) { - if (sub.path.length > 0) { - fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; - fieldErrors[sub.path[0]].push(mapper(sub)); - } else { - formErrors.push(mapper(sub)); - } - } - return { formErrors, fieldErrors }; - } - get formErrors() { - return this.flatten(); - } -}; -ZodError.create = (issues) => { - const error = new ZodError(issues); - return error; -}; -var errorMap = (issue, _ctx) => { - let message; - switch (issue.code) { - case ZodIssueCode.invalid_type: - if (issue.received === ZodParsedType.undefined) { - message = "Required"; - } else { - message = `Expected ${issue.expected}, received ${issue.received}`; - } - break; - case ZodIssueCode.invalid_literal: - message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`; - break; - case ZodIssueCode.unrecognized_keys: - message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`; - break; - case ZodIssueCode.invalid_union: - message = `Invalid input`; - break; - case ZodIssueCode.invalid_union_discriminator: - message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`; - break; - case ZodIssueCode.invalid_enum_value: - message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`; - break; - case ZodIssueCode.invalid_arguments: - message = `Invalid function arguments`; - break; - case ZodIssueCode.invalid_return_type: - message = `Invalid function return type`; - break; - case ZodIssueCode.invalid_date: - message = `Invalid date`; - break; - case ZodIssueCode.invalid_string: - if (typeof issue.validation === "object") { - if ("includes" in issue.validation) { - message = `Invalid input: must include "${issue.validation.includes}"`; - if (typeof issue.validation.position === "number") { - message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`; - } - } else if ("startsWith" in issue.validation) { - message = `Invalid input: must start with "${issue.validation.startsWith}"`; - } else if ("endsWith" in issue.validation) { - message = `Invalid input: must end with "${issue.validation.endsWith}"`; - } else { - util.assertNever(issue.validation); - } - } else if (issue.validation !== "regex") { - message = `Invalid ${issue.validation}`; - } else { - message = "Invalid"; - } - break; - case ZodIssueCode.too_small: - if (issue.type === "array") - message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`; - else if (issue.type === "string") - message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`; - else if (issue.type === "number") - message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`; - else if (issue.type === "date") - message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`; - else message = "Invalid input"; - break; - case ZodIssueCode.too_big: - if (issue.type === "array") - message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`; - else if (issue.type === "string") - message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`; - else if (issue.type === "number") - message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`; - else if (issue.type === "bigint") - message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`; - else if (issue.type === "date") - message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`; - else message = "Invalid input"; - break; - case ZodIssueCode.custom: - message = `Invalid input`; - break; - case ZodIssueCode.invalid_intersection_types: - message = `Intersection results could not be merged`; - break; - case ZodIssueCode.not_multiple_of: - message = `Number must be a multiple of ${issue.multipleOf}`; - break; - case ZodIssueCode.not_finite: - message = "Number must be finite"; - break; - default: - message = _ctx.defaultError; - util.assertNever(issue); - } - return { message }; -}; -var overrideErrorMap = errorMap; -function setErrorMap(map) { - overrideErrorMap = map; -} -function getErrorMap() { - return overrideErrorMap; -} -var makeIssue = (params) => { - const { data, path, errorMaps, issueData } = params; - const fullPath = [...path, ...(issueData.path || [])]; - const fullIssue = { - ...issueData, - path: fullPath, - }; - let errorMessage = ""; - const maps = errorMaps - .filter((m2) => !!m2) - .slice() - .reverse(); - for (const map of maps) { - errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message; - } - return { - ...issueData, - path: fullPath, - message: issueData.message || errorMessage, - }; -}; -var EMPTY_PATH = []; -function addIssueToContext(ctx, issueData) { - const issue = makeIssue({ - issueData, - data: ctx.data, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - ctx.schemaErrorMap, - getErrorMap(), - errorMap, - // then global default map - ].filter((x) => !!x), - }); - ctx.common.issues.push(issue); -} -var ParseStatus = class { - constructor() { - this.value = "valid"; - } - dirty() { - if (this.value === "valid") this.value = "dirty"; - } - abort() { - if (this.value !== "aborted") this.value = "aborted"; - } - static mergeArray(status, results) { - const arrayValue = []; - for (const s of results) { - if (s.status === "aborted") return INVALID; - if (s.status === "dirty") status.dirty(); - arrayValue.push(s.value); - } - return { status: status.value, value: arrayValue }; - } - static async mergeObjectAsync(status, pairs) { - const syncPairs = []; - for (const pair of pairs) { - syncPairs.push({ - key: await pair.key, - value: await pair.value, - }); - } - return ParseStatus.mergeObjectSync(status, syncPairs); - } - static mergeObjectSync(status, pairs) { - const finalObject = {}; - for (const pair of pairs) { - const { key, value } = pair; - if (key.status === "aborted") return INVALID; - if (value.status === "aborted") return INVALID; - if (key.status === "dirty") status.dirty(); - if (value.status === "dirty") status.dirty(); - if ( - key.value !== "__proto__" && - (typeof value.value !== "undefined" || pair.alwaysSet) - ) { - finalObject[key.value] = value.value; - } - } - return { status: status.value, value: finalObject }; - } -}; -var INVALID = Object.freeze({ - status: "aborted", -}); -var DIRTY = (value) => ({ status: "dirty", value }); -var OK = (value) => ({ status: "valid", value }); -var isAborted = (x) => x.status === "aborted"; -var isDirty = (x) => x.status === "dirty"; -var isValid = (x) => x.status === "valid"; -var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise; -var errorUtil; -(function (errorUtil2) { - errorUtil2.errToObj = (message) => - typeof message === "string" ? { message } : message || {}; - errorUtil2.toString = (message) => - typeof message === "string" - ? message - : message === null || message === void 0 - ? void 0 - : message.message; -})(errorUtil || (errorUtil = {})); -var ParseInputLazyPath = class { - constructor(parent, value, path, key) { - this._cachedPath = []; - this.parent = parent; - this.data = value; - this._path = path; - this._key = key; - } - get path() { - if (!this._cachedPath.length) { - if (this._key instanceof Array) { - this._cachedPath.push(...this._path, ...this._key); - } else { - this._cachedPath.push(...this._path, this._key); - } - } - return this._cachedPath; - } -}; -var handleResult = (ctx, result) => { - if (isValid(result)) { - return { success: true, data: result.value }; - } else { - if (!ctx.common.issues.length) { - throw new Error("Validation failed but no issues detected."); - } - return { - success: false, - get error() { - if (this._error) return this._error; - const error = new ZodError(ctx.common.issues); - this._error = error; - return this._error; - }, - }; - } -}; -function processCreateParams(params) { - if (!params) return {}; - const { - errorMap: errorMap2, - invalid_type_error, - required_error, - description, - } = params; - if (errorMap2 && (invalid_type_error || required_error)) { - throw new Error( - `Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.` - ); - } - if (errorMap2) return { errorMap: errorMap2, description }; - const customMap = (iss, ctx) => { - if (iss.code !== "invalid_type") return { message: ctx.defaultError }; - if (typeof ctx.data === "undefined") { - return { - message: - required_error !== null && required_error !== void 0 - ? required_error - : ctx.defaultError, - }; - } - return { - message: - invalid_type_error !== null && invalid_type_error !== void 0 - ? invalid_type_error - : ctx.defaultError, - }; - }; - return { errorMap: customMap, description }; -} -var ZodType = class { - constructor(def) { - this.spa = this.safeParseAsync; - this._def = def; - this.parse = this.parse.bind(this); - this.safeParse = this.safeParse.bind(this); - this.parseAsync = this.parseAsync.bind(this); - this.safeParseAsync = this.safeParseAsync.bind(this); - this.spa = this.spa.bind(this); - this.refine = this.refine.bind(this); - this.refinement = this.refinement.bind(this); - this.superRefine = this.superRefine.bind(this); - this.optional = this.optional.bind(this); - this.nullable = this.nullable.bind(this); - this.nullish = this.nullish.bind(this); - this.array = this.array.bind(this); - this.promise = this.promise.bind(this); - this.or = this.or.bind(this); - this.and = this.and.bind(this); - this.transform = this.transform.bind(this); - this.brand = this.brand.bind(this); - this.default = this.default.bind(this); - this.catch = this.catch.bind(this); - this.describe = this.describe.bind(this); - this.pipe = this.pipe.bind(this); - this.readonly = this.readonly.bind(this); - this.isNullable = this.isNullable.bind(this); - this.isOptional = this.isOptional.bind(this); - } - get description() { - return this._def.description; - } - _getType(input) { - return getParsedType(input.data); - } - _getOrReturnCtx(input, ctx) { - return ( - ctx || { - common: input.parent.common, - data: input.data, - parsedType: getParsedType(input.data), - schemaErrorMap: this._def.errorMap, - path: input.path, - parent: input.parent, - } - ); - } - _processInputParams(input) { - return { - status: new ParseStatus(), - ctx: { - common: input.parent.common, - data: input.data, - parsedType: getParsedType(input.data), - schemaErrorMap: this._def.errorMap, - path: input.path, - parent: input.parent, - }, - }; - } - _parseSync(input) { - const result = this._parse(input); - if (isAsync(result)) { - throw new Error("Synchronous parse encountered promise."); - } - return result; - } - _parseAsync(input) { - const result = this._parse(input); - return Promise.resolve(result); - } - parse(data, params) { - const result = this.safeParse(data, params); - if (result.success) return result.data; - throw result.error; - } - safeParse(data, params) { - var _a108; - const ctx = { - common: { - issues: [], - async: - (_a108 = - params === null || params === void 0 ? void 0 : params.async) !== - null && _a108 !== void 0 - ? _a108 - : false, - contextualErrorMap: - params === null || params === void 0 ? void 0 : params.errorMap, - }, - path: (params === null || params === void 0 ? void 0 : params.path) || [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data), - }; - const result = this._parseSync({ data, path: ctx.path, parent: ctx }); - return handleResult(ctx, result); - } - async parseAsync(data, params) { - const result = await this.safeParseAsync(data, params); - if (result.success) return result.data; - throw result.error; - } - async safeParseAsync(data, params) { - const ctx = { - common: { - issues: [], - contextualErrorMap: - params === null || params === void 0 ? void 0 : params.errorMap, - async: true, - }, - path: (params === null || params === void 0 ? void 0 : params.path) || [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data), - }; - const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }); - const result = await (isAsync(maybeAsyncResult) - ? maybeAsyncResult - : Promise.resolve(maybeAsyncResult)); - return handleResult(ctx, result); - } - refine(check, message) { - const getIssueProperties = (val) => { - if (typeof message === "string" || typeof message === "undefined") { - return { message }; - } else if (typeof message === "function") { - return message(val); - } else { - return message; - } - }; - return this._refinement((val, ctx) => { - const result = check(val); - const setError = () => - ctx.addIssue({ - code: ZodIssueCode.custom, - ...getIssueProperties(val), - }); - if (typeof Promise !== "undefined" && result instanceof Promise) { - return result.then((data) => { - if (!data) { - setError(); - return false; - } else { - return true; - } - }); - } - if (!result) { - setError(); - return false; - } else { - return true; - } - }); - } - refinement(check, refinementData) { - return this._refinement((val, ctx) => { - if (!check(val)) { - ctx.addIssue( - typeof refinementData === "function" - ? refinementData(val, ctx) - : refinementData - ); - return false; - } else { - return true; - } - }); - } - _refinement(refinement) { - return new ZodEffects({ - schema: this, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect: { type: "refinement", refinement }, - }); - } - superRefine(refinement) { - return this._refinement(refinement); - } - optional() { - return ZodOptional.create(this, this._def); - } - nullable() { - return ZodNullable.create(this, this._def); - } - nullish() { - return this.nullable().optional(); - } - array() { - return ZodArray.create(this, this._def); - } - promise() { - return ZodPromise.create(this, this._def); - } - or(option) { - return ZodUnion.create([this, option], this._def); - } - and(incoming) { - return ZodIntersection.create(this, incoming, this._def); - } - transform(transform) { - return new ZodEffects({ - ...processCreateParams(this._def), - schema: this, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect: { type: "transform", transform }, - }); - } - default(def) { - const defaultValueFunc = typeof def === "function" ? def : () => def; - return new ZodDefault({ - ...processCreateParams(this._def), - innerType: this, - defaultValue: defaultValueFunc, - typeName: ZodFirstPartyTypeKind.ZodDefault, - }); - } - brand() { - return new ZodBranded({ - typeName: ZodFirstPartyTypeKind.ZodBranded, - type: this, - ...processCreateParams(this._def), - }); - } - catch(def) { - const catchValueFunc = typeof def === "function" ? def : () => def; - return new ZodCatch({ - ...processCreateParams(this._def), - innerType: this, - catchValue: catchValueFunc, - typeName: ZodFirstPartyTypeKind.ZodCatch, - }); - } - describe(description) { - const This = this.constructor; - return new This({ - ...this._def, - description, - }); - } - pipe(target) { - return ZodPipeline.create(this, target); - } - readonly() { - return ZodReadonly.create(this); - } - isOptional() { - return this.safeParse(void 0).success; - } - isNullable() { - return this.safeParse(null).success; - } -}; -var cuidRegex = /^c[^\s-]{8,}$/i; -var cuid2Regex = /^[a-z][a-z0-9]*$/; -var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; -var uuidRegex = - /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i; -var emailRegex = - /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; -var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; -var emojiRegex; -var ipv4Regex = - /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/; -var ipv6Regex = - /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/; -var datetimeRegex = (args) => { - if (args.precision) { - if (args.offset) { - return new RegExp( - `^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$` - ); - } else { - return new RegExp( - `^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$` - ); - } - } else if (args.precision === 0) { - if (args.offset) { - return new RegExp( - `^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$` - ); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`); - } - } else { - if (args.offset) { - return new RegExp( - `^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$` - ); - } else { - return new RegExp( - `^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$` - ); - } - } -}; -function isValidIP(ip, version3) { - if ((version3 === "v4" || !version3) && ipv4Regex.test(ip)) { - return true; - } - if ((version3 === "v6" || !version3) && ipv6Regex.test(ip)) { - return true; - } - return false; -} -var ZodString = class extends ZodType { - _parse(input) { - if (this._def.coerce) { - input.data = String(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.string) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext( - ctx2, - { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.string, - received: ctx2.parsedType, - } - // - ); - return INVALID; - } - const status = new ParseStatus(); - let ctx = void 0; - for (const check of this._def.checks) { - if (check.kind === "min") { - if (input.data.length < check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check.value, - type: "string", - inclusive: true, - exact: false, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "max") { - if (input.data.length > check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check.value, - type: "string", - inclusive: true, - exact: false, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "length") { - const tooBig = input.data.length > check.value; - const tooSmall = input.data.length < check.value; - if (tooBig || tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); - if (tooBig) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check.value, - type: "string", - inclusive: true, - exact: true, - message: check.message, - }); - } else if (tooSmall) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check.value, - type: "string", - inclusive: true, - exact: true, - message: check.message, - }); - } - status.dirty(); - } - } else if (check.kind === "email") { - if (!emailRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "email", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "emoji") { - if (!emojiRegex) { - emojiRegex = new RegExp(_emojiRegex, "u"); - } - if (!emojiRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "emoji", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "uuid") { - if (!uuidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "uuid", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "cuid") { - if (!cuidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "cuid", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "cuid2") { - if (!cuid2Regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "cuid2", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "ulid") { - if (!ulidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "ulid", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "url") { - try { - new URL(input.data); - } catch (_a108) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "url", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "regex") { - check.regex.lastIndex = 0; - const testResult = check.regex.test(input.data); - if (!testResult) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "regex", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "trim") { - input.data = input.data.trim(); - } else if (check.kind === "includes") { - if (!input.data.includes(check.value, check.position)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { includes: check.value, position: check.position }, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "toLowerCase") { - input.data = input.data.toLowerCase(); - } else if (check.kind === "toUpperCase") { - input.data = input.data.toUpperCase(); - } else if (check.kind === "startsWith") { - if (!input.data.startsWith(check.value)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { startsWith: check.value }, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "endsWith") { - if (!input.data.endsWith(check.value)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { endsWith: check.value }, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "datetime") { - const regex = datetimeRegex(check); - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "datetime", - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "ip") { - if (!isValidIP(input.data, check.version)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "ip", - code: ZodIssueCode.invalid_string, - message: check.message, - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { status: status.value, value: input.data }; - } - _regex(regex, validation, message) { - return this.refinement((data) => regex.test(data), { - validation, - code: ZodIssueCode.invalid_string, - ...errorUtil.errToObj(message), - }); - } - _addCheck(check) { - return new ZodString({ - ...this._def, - checks: [...this._def.checks, check], - }); - } - email(message) { - return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) }); - } - url(message) { - return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) }); - } - emoji(message) { - return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); - } - uuid(message) { - return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); - } - cuid(message) { - return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); - } - cuid2(message) { - return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); - } - ulid(message) { - return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); - } - ip(options) { - return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) }); - } - datetime(options) { - var _a108; - if (typeof options === "string") { - return this._addCheck({ - kind: "datetime", - precision: null, - offset: false, - message: options, - }); - } - return this._addCheck({ - kind: "datetime", - precision: - typeof (options === null || options === void 0 - ? void 0 - : options.precision) === "undefined" - ? null - : options === null || options === void 0 - ? void 0 - : options.precision, - offset: - (_a108 = - options === null || options === void 0 ? void 0 : options.offset) !== - null && _a108 !== void 0 - ? _a108 - : false, - ...errorUtil.errToObj( - options === null || options === void 0 ? void 0 : options.message - ), - }); - } - regex(regex, message) { - return this._addCheck({ - kind: "regex", - regex, - ...errorUtil.errToObj(message), - }); - } - includes(value, options) { - return this._addCheck({ - kind: "includes", - value, - position: - options === null || options === void 0 ? void 0 : options.position, - ...errorUtil.errToObj( - options === null || options === void 0 ? void 0 : options.message - ), - }); - } - startsWith(value, message) { - return this._addCheck({ - kind: "startsWith", - value, - ...errorUtil.errToObj(message), - }); - } - endsWith(value, message) { - return this._addCheck({ - kind: "endsWith", - value, - ...errorUtil.errToObj(message), - }); - } - min(minLength, message) { - return this._addCheck({ - kind: "min", - value: minLength, - ...errorUtil.errToObj(message), - }); - } - max(maxLength, message) { - return this._addCheck({ - kind: "max", - value: maxLength, - ...errorUtil.errToObj(message), - }); - } - length(len, message) { - return this._addCheck({ - kind: "length", - value: len, - ...errorUtil.errToObj(message), - }); - } - /** - * @deprecated Use z.string().min(1) instead. - * @see {@link ZodString.min} - */ - nonempty(message) { - return this.min(1, errorUtil.errToObj(message)); - } - trim() { - return new ZodString({ - ...this._def, - checks: [...this._def.checks, { kind: "trim" }], - }); - } - toLowerCase() { - return new ZodString({ - ...this._def, - checks: [...this._def.checks, { kind: "toLowerCase" }], - }); - } - toUpperCase() { - return new ZodString({ - ...this._def, - checks: [...this._def.checks, { kind: "toUpperCase" }], - }); - } - get isDatetime() { - return !!this._def.checks.find((ch) => ch.kind === "datetime"); - } - get isEmail() { - return !!this._def.checks.find((ch) => ch.kind === "email"); - } - get isURL() { - return !!this._def.checks.find((ch) => ch.kind === "url"); - } - get isEmoji() { - return !!this._def.checks.find((ch) => ch.kind === "emoji"); - } - get isUUID() { - return !!this._def.checks.find((ch) => ch.kind === "uuid"); - } - get isCUID() { - return !!this._def.checks.find((ch) => ch.kind === "cuid"); - } - get isCUID2() { - return !!this._def.checks.find((ch) => ch.kind === "cuid2"); - } - get isULID() { - return !!this._def.checks.find((ch) => ch.kind === "ulid"); - } - get isIP() { - return !!this._def.checks.find((ch) => ch.kind === "ip"); - } - get minLength() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) min = ch.value; - } - } - return min; - } - get maxLength() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) max = ch.value; - } - } - return max; - } -}; -ZodString.create = (params) => { - var _a108; - return new ZodString({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodString, - coerce: - (_a108 = - params === null || params === void 0 ? void 0 : params.coerce) !== - null && _a108 !== void 0 - ? _a108 - : false, - ...processCreateParams(params), - }); -}; -function floatSafeRemainder(val, step) { - const valDecCount = (val.toString().split(".")[1] || "").length; - const stepDecCount = (step.toString().split(".")[1] || "").length; - const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount; - const valInt = parseInt(val.toFixed(decCount).replace(".", "")); - const stepInt = parseInt(step.toFixed(decCount).replace(".", "")); - return (valInt % stepInt) / Math.pow(10, decCount); -} -var ZodNumber = class extends ZodType { - constructor() { - super(...arguments); - this.min = this.gte; - this.max = this.lte; - this.step = this.multipleOf; - } - _parse(input) { - if (this._def.coerce) { - input.data = Number(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.number) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.number, - received: ctx2.parsedType, - }); - return INVALID; - } - let ctx = void 0; - const status = new ParseStatus(); - for (const check of this._def.checks) { - if (check.kind === "int") { - if (!util.isInteger(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: "integer", - received: "float", - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "min") { - const tooSmall = check.inclusive - ? input.data < check.value - : input.data <= check.value; - if (tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check.value, - type: "number", - inclusive: check.inclusive, - exact: false, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "max") { - const tooBig = check.inclusive - ? input.data > check.value - : input.data >= check.value; - if (tooBig) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check.value, - type: "number", - inclusive: check.inclusive, - exact: false, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "multipleOf") { - if (floatSafeRemainder(input.data, check.value) !== 0) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_multiple_of, - multipleOf: check.value, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "finite") { - if (!Number.isFinite(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_finite, - message: check.message, - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { status: status.value, value: input.data }; - } - gte(value, message) { - return this.setLimit("min", value, true, errorUtil.toString(message)); - } - gt(value, message) { - return this.setLimit("min", value, false, errorUtil.toString(message)); - } - lte(value, message) { - return this.setLimit("max", value, true, errorUtil.toString(message)); - } - lt(value, message) { - return this.setLimit("max", value, false, errorUtil.toString(message)); - } - setLimit(kind, value, inclusive, message) { - return new ZodNumber({ - ...this._def, - checks: [ - ...this._def.checks, - { - kind, - value, - inclusive, - message: errorUtil.toString(message), - }, - ], - }); - } - _addCheck(check) { - return new ZodNumber({ - ...this._def, - checks: [...this._def.checks, check], - }); - } - int(message) { - return this._addCheck({ - kind: "int", - message: errorUtil.toString(message), - }); - } - positive(message) { - return this._addCheck({ - kind: "min", - value: 0, - inclusive: false, - message: errorUtil.toString(message), - }); - } - negative(message) { - return this._addCheck({ - kind: "max", - value: 0, - inclusive: false, - message: errorUtil.toString(message), - }); - } - nonpositive(message) { - return this._addCheck({ - kind: "max", - value: 0, - inclusive: true, - message: errorUtil.toString(message), - }); - } - nonnegative(message) { - return this._addCheck({ - kind: "min", - value: 0, - inclusive: true, - message: errorUtil.toString(message), - }); - } - multipleOf(value, message) { - return this._addCheck({ - kind: "multipleOf", - value, - message: errorUtil.toString(message), - }); - } - finite(message) { - return this._addCheck({ - kind: "finite", - message: errorUtil.toString(message), - }); - } - safe(message) { - return this._addCheck({ - kind: "min", - inclusive: true, - value: Number.MIN_SAFE_INTEGER, - message: errorUtil.toString(message), - })._addCheck({ - kind: "max", - inclusive: true, - value: Number.MAX_SAFE_INTEGER, - message: errorUtil.toString(message), - }); - } - get minValue() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) min = ch.value; - } - } - return min; - } - get maxValue() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) max = ch.value; - } - } - return max; - } - get isInt() { - return !!this._def.checks.find( - (ch) => - ch.kind === "int" || - (ch.kind === "multipleOf" && util.isInteger(ch.value)) - ); - } - get isFinite() { - let max = null, - min = null; - for (const ch of this._def.checks) { - if ( - ch.kind === "finite" || - ch.kind === "int" || - ch.kind === "multipleOf" - ) { - return true; - } else if (ch.kind === "min") { - if (min === null || ch.value > min) min = ch.value; - } else if (ch.kind === "max") { - if (max === null || ch.value < max) max = ch.value; - } - } - return Number.isFinite(min) && Number.isFinite(max); - } -}; -ZodNumber.create = (params) => { - return new ZodNumber({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodNumber, - coerce: - (params === null || params === void 0 ? void 0 : params.coerce) || false, - ...processCreateParams(params), - }); -}; -var ZodBigInt = class extends ZodType { - constructor() { - super(...arguments); - this.min = this.gte; - this.max = this.lte; - } - _parse(input) { - if (this._def.coerce) { - input.data = BigInt(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.bigint) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.bigint, - received: ctx2.parsedType, - }); - return INVALID; - } - let ctx = void 0; - const status = new ParseStatus(); - for (const check of this._def.checks) { - if (check.kind === "min") { - const tooSmall = check.inclusive - ? input.data < check.value - : input.data <= check.value; - if (tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - type: "bigint", - minimum: check.value, - inclusive: check.inclusive, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "max") { - const tooBig = check.inclusive - ? input.data > check.value - : input.data >= check.value; - if (tooBig) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - type: "bigint", - maximum: check.value, - inclusive: check.inclusive, - message: check.message, - }); - status.dirty(); - } - } else if (check.kind === "multipleOf") { - if (input.data % check.value !== BigInt(0)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_multiple_of, - multipleOf: check.value, - message: check.message, - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { status: status.value, value: input.data }; - } - gte(value, message) { - return this.setLimit("min", value, true, errorUtil.toString(message)); - } - gt(value, message) { - return this.setLimit("min", value, false, errorUtil.toString(message)); - } - lte(value, message) { - return this.setLimit("max", value, true, errorUtil.toString(message)); - } - lt(value, message) { - return this.setLimit("max", value, false, errorUtil.toString(message)); - } - setLimit(kind, value, inclusive, message) { - return new ZodBigInt({ - ...this._def, - checks: [ - ...this._def.checks, - { - kind, - value, - inclusive, - message: errorUtil.toString(message), - }, - ], - }); - } - _addCheck(check) { - return new ZodBigInt({ - ...this._def, - checks: [...this._def.checks, check], - }); - } - positive(message) { - return this._addCheck({ - kind: "min", - value: BigInt(0), - inclusive: false, - message: errorUtil.toString(message), - }); - } - negative(message) { - return this._addCheck({ - kind: "max", - value: BigInt(0), - inclusive: false, - message: errorUtil.toString(message), - }); - } - nonpositive(message) { - return this._addCheck({ - kind: "max", - value: BigInt(0), - inclusive: true, - message: errorUtil.toString(message), - }); - } - nonnegative(message) { - return this._addCheck({ - kind: "min", - value: BigInt(0), - inclusive: true, - message: errorUtil.toString(message), - }); - } - multipleOf(value, message) { - return this._addCheck({ - kind: "multipleOf", - value, - message: errorUtil.toString(message), - }); - } - get minValue() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) min = ch.value; - } - } - return min; - } - get maxValue() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) max = ch.value; - } - } - return max; - } -}; -ZodBigInt.create = (params) => { - var _a108; - return new ZodBigInt({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodBigInt, - coerce: - (_a108 = - params === null || params === void 0 ? void 0 : params.coerce) !== - null && _a108 !== void 0 - ? _a108 - : false, - ...processCreateParams(params), - }); -}; -var ZodBoolean = class extends ZodType { - _parse(input) { - if (this._def.coerce) { - input.data = Boolean(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.boolean) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.boolean, - received: ctx.parsedType, - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodBoolean.create = (params) => { - return new ZodBoolean({ - typeName: ZodFirstPartyTypeKind.ZodBoolean, - coerce: - (params === null || params === void 0 ? void 0 : params.coerce) || false, - ...processCreateParams(params), - }); -}; -var ZodDate = class extends ZodType { - _parse(input) { - if (this._def.coerce) { - input.data = new Date(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.date) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.date, - received: ctx2.parsedType, - }); - return INVALID; - } - if (isNaN(input.data.getTime())) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_date, - }); - return INVALID; - } - const status = new ParseStatus(); - let ctx = void 0; - for (const check of this._def.checks) { - if (check.kind === "min") { - if (input.data.getTime() < check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - message: check.message, - inclusive: true, - exact: false, - minimum: check.value, - type: "date", - }); - status.dirty(); - } - } else if (check.kind === "max") { - if (input.data.getTime() > check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - message: check.message, - inclusive: true, - exact: false, - maximum: check.value, - type: "date", - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { - status: status.value, - value: new Date(input.data.getTime()), - }; - } - _addCheck(check) { - return new ZodDate({ - ...this._def, - checks: [...this._def.checks, check], - }); - } - min(minDate, message) { - return this._addCheck({ - kind: "min", - value: minDate.getTime(), - message: errorUtil.toString(message), - }); - } - max(maxDate, message) { - return this._addCheck({ - kind: "max", - value: maxDate.getTime(), - message: errorUtil.toString(message), - }); - } - get minDate() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) min = ch.value; - } - } - return min != null ? new Date(min) : null; - } - get maxDate() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) max = ch.value; - } - } - return max != null ? new Date(max) : null; - } -}; -ZodDate.create = (params) => { - return new ZodDate({ - checks: [], - coerce: - (params === null || params === void 0 ? void 0 : params.coerce) || false, - typeName: ZodFirstPartyTypeKind.ZodDate, - ...processCreateParams(params), - }); -}; -var ZodSymbol = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.symbol) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.symbol, - received: ctx.parsedType, - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodSymbol.create = (params) => { - return new ZodSymbol({ - typeName: ZodFirstPartyTypeKind.ZodSymbol, - ...processCreateParams(params), - }); -}; -var ZodUndefined = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.undefined, - received: ctx.parsedType, - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodUndefined.create = (params) => { - return new ZodUndefined({ - typeName: ZodFirstPartyTypeKind.ZodUndefined, - ...processCreateParams(params), - }); -}; -var ZodNull = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.null) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.null, - received: ctx.parsedType, - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodNull.create = (params) => { - return new ZodNull({ - typeName: ZodFirstPartyTypeKind.ZodNull, - ...processCreateParams(params), - }); -}; -var ZodAny = class extends ZodType { - constructor() { - super(...arguments); - this._any = true; - } - _parse(input) { - return OK(input.data); - } -}; -ZodAny.create = (params) => { - return new ZodAny({ - typeName: ZodFirstPartyTypeKind.ZodAny, - ...processCreateParams(params), - }); -}; -var ZodUnknown = class extends ZodType { - constructor() { - super(...arguments); - this._unknown = true; - } - _parse(input) { - return OK(input.data); - } -}; -ZodUnknown.create = (params) => { - return new ZodUnknown({ - typeName: ZodFirstPartyTypeKind.ZodUnknown, - ...processCreateParams(params), - }); -}; -var ZodNever = class extends ZodType { - _parse(input) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.never, - received: ctx.parsedType, - }); - return INVALID; - } -}; -ZodNever.create = (params) => { - return new ZodNever({ - typeName: ZodFirstPartyTypeKind.ZodNever, - ...processCreateParams(params), - }); -}; -var ZodVoid = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.void, - received: ctx.parsedType, - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodVoid.create = (params) => { - return new ZodVoid({ - typeName: ZodFirstPartyTypeKind.ZodVoid, - ...processCreateParams(params), - }); -}; -var ZodArray = class extends ZodType { - _parse(input) { - const { ctx, status } = this._processInputParams(input); - const def = this._def; - if (ctx.parsedType !== ZodParsedType.array) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.array, - received: ctx.parsedType, - }); - return INVALID; - } - if (def.exactLength !== null) { - const tooBig = ctx.data.length > def.exactLength.value; - const tooSmall = ctx.data.length < def.exactLength.value; - if (tooBig || tooSmall) { - addIssueToContext(ctx, { - code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small, - minimum: tooSmall ? def.exactLength.value : void 0, - maximum: tooBig ? def.exactLength.value : void 0, - type: "array", - inclusive: true, - exact: true, - message: def.exactLength.message, - }); - status.dirty(); - } - } - if (def.minLength !== null) { - if (ctx.data.length < def.minLength.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: def.minLength.value, - type: "array", - inclusive: true, - exact: false, - message: def.minLength.message, - }); - status.dirty(); - } - } - if (def.maxLength !== null) { - if (ctx.data.length > def.maxLength.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: def.maxLength.value, - type: "array", - inclusive: true, - exact: false, - message: def.maxLength.message, - }); - status.dirty(); - } - } - if (ctx.common.async) { - return Promise.all( - [...ctx.data].map((item, i) => { - return def.type._parseAsync( - new ParseInputLazyPath(ctx, item, ctx.path, i) - ); - }) - ).then((result2) => { - return ParseStatus.mergeArray(status, result2); - }); - } - const result = [...ctx.data].map((item, i) => { - return def.type._parseSync( - new ParseInputLazyPath(ctx, item, ctx.path, i) - ); - }); - return ParseStatus.mergeArray(status, result); - } - get element() { - return this._def.type; - } - min(minLength, message) { - return new ZodArray({ - ...this._def, - minLength: { value: minLength, message: errorUtil.toString(message) }, - }); - } - max(maxLength, message) { - return new ZodArray({ - ...this._def, - maxLength: { value: maxLength, message: errorUtil.toString(message) }, - }); - } - length(len, message) { - return new ZodArray({ - ...this._def, - exactLength: { value: len, message: errorUtil.toString(message) }, - }); - } - nonempty(message) { - return this.min(1, message); - } -}; -ZodArray.create = (schema, params) => { - return new ZodArray({ - type: schema, - minLength: null, - maxLength: null, - exactLength: null, - typeName: ZodFirstPartyTypeKind.ZodArray, - ...processCreateParams(params), - }); -}; -function deepPartialify(schema) { - if (schema instanceof ZodObject) { - const newShape = {}; - for (const key in schema.shape) { - const fieldSchema = schema.shape[key]; - newShape[key] = ZodOptional.create(deepPartialify(fieldSchema)); - } - return new ZodObject({ - ...schema._def, - shape: () => newShape, - }); - } else if (schema instanceof ZodArray) { - return new ZodArray({ - ...schema._def, - type: deepPartialify(schema.element), - }); - } else if (schema instanceof ZodOptional) { - return ZodOptional.create(deepPartialify(schema.unwrap())); - } else if (schema instanceof ZodNullable) { - return ZodNullable.create(deepPartialify(schema.unwrap())); - } else if (schema instanceof ZodTuple) { - return ZodTuple.create(schema.items.map((item) => deepPartialify(item))); - } else { - return schema; - } -} -var ZodObject = class extends ZodType { - constructor() { - super(...arguments); - this._cached = null; - this.nonstrict = this.passthrough; - this.augment = this.extend; - } - _getCached() { - if (this._cached !== null) return this._cached; - const shape = this._def.shape(); - const keys = util.objectKeys(shape); - return (this._cached = { shape, keys }); - } - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.object) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx2.parsedType, - }); - return INVALID; - } - const { status, ctx } = this._processInputParams(input); - const { shape, keys: shapeKeys } = this._getCached(); - const extraKeys = []; - if ( - !( - this._def.catchall instanceof ZodNever && - this._def.unknownKeys === "strip" - ) - ) { - for (const key in ctx.data) { - if (!shapeKeys.includes(key)) { - extraKeys.push(key); - } - } - } - const pairs = []; - for (const key of shapeKeys) { - const keyValidator = shape[key]; - const value = ctx.data[key]; - pairs.push({ - key: { status: "valid", value: key }, - value: keyValidator._parse( - new ParseInputLazyPath(ctx, value, ctx.path, key) - ), - alwaysSet: key in ctx.data, - }); - } - if (this._def.catchall instanceof ZodNever) { - const unknownKeys = this._def.unknownKeys; - if (unknownKeys === "passthrough") { - for (const key of extraKeys) { - pairs.push({ - key: { status: "valid", value: key }, - value: { status: "valid", value: ctx.data[key] }, - }); - } - } else if (unknownKeys === "strict") { - if (extraKeys.length > 0) { - addIssueToContext(ctx, { - code: ZodIssueCode.unrecognized_keys, - keys: extraKeys, - }); - status.dirty(); - } - } else if (unknownKeys === "strip"); - else { - throw new Error(`Internal ZodObject error: invalid unknownKeys value.`); - } - } else { - const catchall = this._def.catchall; - for (const key of extraKeys) { - const value = ctx.data[key]; - pairs.push({ - key: { status: "valid", value: key }, - value: catchall._parse( - new ParseInputLazyPath(ctx, value, ctx.path, key) - //, ctx.child(key), value, getParsedType(value) - ), - alwaysSet: key in ctx.data, - }); - } - } - if (ctx.common.async) { - return Promise.resolve() - .then(async () => { - const syncPairs = []; - for (const pair of pairs) { - const key = await pair.key; - syncPairs.push({ - key, - value: await pair.value, - alwaysSet: pair.alwaysSet, - }); - } - return syncPairs; - }) - .then((syncPairs) => { - return ParseStatus.mergeObjectSync(status, syncPairs); - }); - } else { - return ParseStatus.mergeObjectSync(status, pairs); - } - } - get shape() { - return this._def.shape(); - } - strict(message) { - errorUtil.errToObj; - return new ZodObject({ - ...this._def, - unknownKeys: "strict", - ...(message !== void 0 - ? { - errorMap: (issue, ctx) => { - var _a108, _b, _c, _d; - const defaultError = - (_c = - (_b = (_a108 = this._def).errorMap) === null || _b === void 0 - ? void 0 - : _b.call(_a108, issue, ctx).message) !== null && - _c !== void 0 - ? _c - : ctx.defaultError; - if (issue.code === "unrecognized_keys") - return { - message: - (_d = errorUtil.errToObj(message).message) !== null && - _d !== void 0 - ? _d - : defaultError, - }; - return { - message: defaultError, - }; - }, - } - : {}), - }); - } - strip() { - return new ZodObject({ - ...this._def, - unknownKeys: "strip", - }); - } - passthrough() { - return new ZodObject({ - ...this._def, - unknownKeys: "passthrough", - }); - } - // const AugmentFactory = - // (def: Def) => - // ( - // augmentation: Augmentation - // ): ZodObject< - // extendShape, Augmentation>, - // Def["unknownKeys"], - // Def["catchall"] - // > => { - // return new ZodObject({ - // ...def, - // shape: () => ({ - // ...def.shape(), - // ...augmentation, - // }), - // }) as any; - // }; - extend(augmentation) { - return new ZodObject({ - ...this._def, - shape: () => ({ - ...this._def.shape(), - ...augmentation, - }), - }); - } - /** - * Prior to zod@1.0.12 there was a bug in the - * inferred type of merged objects. Please - * upgrade if you are experiencing issues. - */ - merge(merging) { - const merged = new ZodObject({ - unknownKeys: merging._def.unknownKeys, - catchall: merging._def.catchall, - shape: () => ({ - ...this._def.shape(), - ...merging._def.shape(), - }), - typeName: ZodFirstPartyTypeKind.ZodObject, - }); - return merged; - } - // merge< - // Incoming extends AnyZodObject, - // Augmentation extends Incoming["shape"], - // NewOutput extends { - // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation - // ? Augmentation[k]["_output"] - // : k extends keyof Output - // ? Output[k] - // : never; - // }, - // NewInput extends { - // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation - // ? Augmentation[k]["_input"] - // : k extends keyof Input - // ? Input[k] - // : never; - // } - // >( - // merging: Incoming - // ): ZodObject< - // extendShape>, - // Incoming["_def"]["unknownKeys"], - // Incoming["_def"]["catchall"], - // NewOutput, - // NewInput - // > { - // const merged: any = new ZodObject({ - // unknownKeys: merging._def.unknownKeys, - // catchall: merging._def.catchall, - // shape: () => - // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), - // typeName: ZodFirstPartyTypeKind.ZodObject, - // }) as any; - // return merged; - // } - setKey(key, schema) { - return this.augment({ [key]: schema }); - } - // merge( - // merging: Incoming - // ): //ZodObject = (merging) => { - // ZodObject< - // extendShape>, - // Incoming["_def"]["unknownKeys"], - // Incoming["_def"]["catchall"] - // > { - // // const mergedShape = objectUtil.mergeShapes( - // // this._def.shape(), - // // merging._def.shape() - // // ); - // const merged: any = new ZodObject({ - // unknownKeys: merging._def.unknownKeys, - // catchall: merging._def.catchall, - // shape: () => - // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), - // typeName: ZodFirstPartyTypeKind.ZodObject, - // }) as any; - // return merged; - // } - catchall(index) { - return new ZodObject({ - ...this._def, - catchall: index, - }); - } - pick(mask) { - const shape = {}; - util.objectKeys(mask).forEach((key) => { - if (mask[key] && this.shape[key]) { - shape[key] = this.shape[key]; - } - }); - return new ZodObject({ - ...this._def, - shape: () => shape, - }); - } - omit(mask) { - const shape = {}; - util.objectKeys(this.shape).forEach((key) => { - if (!mask[key]) { - shape[key] = this.shape[key]; - } - }); - return new ZodObject({ - ...this._def, - shape: () => shape, - }); - } - /** - * @deprecated - */ - deepPartial() { - return deepPartialify(this); - } - partial(mask) { - const newShape = {}; - util.objectKeys(this.shape).forEach((key) => { - const fieldSchema = this.shape[key]; - if (mask && !mask[key]) { - newShape[key] = fieldSchema; - } else { - newShape[key] = fieldSchema.optional(); - } - }); - return new ZodObject({ - ...this._def, - shape: () => newShape, - }); - } - required(mask) { - const newShape = {}; - util.objectKeys(this.shape).forEach((key) => { - if (mask && !mask[key]) { - newShape[key] = this.shape[key]; - } else { - const fieldSchema = this.shape[key]; - let newField = fieldSchema; - while (newField instanceof ZodOptional) { - newField = newField._def.innerType; - } - newShape[key] = newField; - } - }); - return new ZodObject({ - ...this._def, - shape: () => newShape, - }); - } - keyof() { - return createZodEnum(util.objectKeys(this.shape)); - } -}; -ZodObject.create = (shape, params) => { - return new ZodObject({ - shape: () => shape, - unknownKeys: "strip", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params), - }); -}; -ZodObject.strictCreate = (shape, params) => { - return new ZodObject({ - shape: () => shape, - unknownKeys: "strict", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params), - }); -}; -ZodObject.lazycreate = (shape, params) => { - return new ZodObject({ - shape, - unknownKeys: "strip", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params), - }); -}; -var ZodUnion = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - const options = this._def.options; - function handleResults(results) { - for (const result of results) { - if (result.result.status === "valid") { - return result.result; - } - } - for (const result of results) { - if (result.result.status === "dirty") { - ctx.common.issues.push(...result.ctx.common.issues); - return result.result; - } - } - const unionErrors = results.map( - (result) => new ZodError(result.ctx.common.issues) - ); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union, - unionErrors, - }); - return INVALID; - } - if (ctx.common.async) { - return Promise.all( - options.map(async (option) => { - const childCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [], - }, - parent: null, - }; - return { - result: await option._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: childCtx, - }), - ctx: childCtx, - }; - }) - ).then(handleResults); - } else { - let dirty = void 0; - const issues = []; - for (const option of options) { - const childCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [], - }, - parent: null, - }; - const result = option._parseSync({ - data: ctx.data, - path: ctx.path, - parent: childCtx, - }); - if (result.status === "valid") { - return result; - } else if (result.status === "dirty" && !dirty) { - dirty = { result, ctx: childCtx }; - } - if (childCtx.common.issues.length) { - issues.push(childCtx.common.issues); - } - } - if (dirty) { - ctx.common.issues.push(...dirty.ctx.common.issues); - return dirty.result; - } - const unionErrors = issues.map((issues2) => new ZodError(issues2)); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union, - unionErrors, - }); - return INVALID; - } - } - get options() { - return this._def.options; - } -}; -ZodUnion.create = (types, params) => { - return new ZodUnion({ - options: types, - typeName: ZodFirstPartyTypeKind.ZodUnion, - ...processCreateParams(params), - }); -}; -var getDiscriminator = (type) => { - if (type instanceof ZodLazy) { - return getDiscriminator(type.schema); - } else if (type instanceof ZodEffects) { - return getDiscriminator(type.innerType()); - } else if (type instanceof ZodLiteral) { - return [type.value]; - } else if (type instanceof ZodEnum) { - return type.options; - } else if (type instanceof ZodNativeEnum) { - return Object.keys(type.enum); - } else if (type instanceof ZodDefault) { - return getDiscriminator(type._def.innerType); - } else if (type instanceof ZodUndefined) { - return [void 0]; - } else if (type instanceof ZodNull) { - return [null]; - } else { - return null; - } -}; -var ZodDiscriminatedUnion = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.object) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx.parsedType, - }); - return INVALID; - } - const discriminator = this.discriminator; - const discriminatorValue = ctx.data[discriminator]; - const option = this.optionsMap.get(discriminatorValue); - if (!option) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union_discriminator, - options: Array.from(this.optionsMap.keys()), - path: [discriminator], - }); - return INVALID; - } - if (ctx.common.async) { - return option._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }); - } else { - return option._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }); - } - } - get discriminator() { - return this._def.discriminator; - } - get options() { - return this._def.options; - } - get optionsMap() { - return this._def.optionsMap; - } - /** - * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. - * However, it only allows a union of objects, all of which need to share a discriminator property. This property must - * have a different value for each object in the union. - * @param discriminator the name of the discriminator property - * @param types an array of object schemas - * @param params - */ - static create(discriminator, options, params) { - const optionsMap = /* @__PURE__ */ new Map(); - for (const type of options) { - const discriminatorValues = getDiscriminator(type.shape[discriminator]); - if (!discriminatorValues) { - throw new Error( - `A discriminator value for key \`${discriminator}\` could not be extracted from all schema options` - ); - } - for (const value of discriminatorValues) { - if (optionsMap.has(value)) { - throw new Error( - `Discriminator property ${String(discriminator)} has duplicate value ${String(value)}` - ); - } - optionsMap.set(value, type); - } - } - return new ZodDiscriminatedUnion({ - typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion, - discriminator, - options, - optionsMap, - ...processCreateParams(params), - }); - } -}; -function mergeValues(a, b) { - const aType = getParsedType(a); - const bType = getParsedType(b); - if (a === b) { - return { valid: true, data: a }; - } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) { - const bKeys = util.objectKeys(b); - const sharedKeys = util - .objectKeys(a) - .filter((key) => bKeys.indexOf(key) !== -1); - const newObj = { ...a, ...b }; - for (const key of sharedKeys) { - const sharedValue = mergeValues(a[key], b[key]); - if (!sharedValue.valid) { - return { valid: false }; - } - newObj[key] = sharedValue.data; - } - return { valid: true, data: newObj }; - } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) { - if (a.length !== b.length) { - return { valid: false }; - } - const newArray = []; - for (let index = 0; index < a.length; index++) { - const itemA = a[index]; - const itemB = b[index]; - const sharedValue = mergeValues(itemA, itemB); - if (!sharedValue.valid) { - return { valid: false }; - } - newArray.push(sharedValue.data); - } - return { valid: true, data: newArray }; - } else if ( - aType === ZodParsedType.date && - bType === ZodParsedType.date && - +a === +b - ) { - return { valid: true, data: a }; - } else { - return { valid: false }; - } -} -var ZodIntersection = class extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - const handleParsed = (parsedLeft, parsedRight) => { - if (isAborted(parsedLeft) || isAborted(parsedRight)) { - return INVALID; - } - const merged = mergeValues(parsedLeft.value, parsedRight.value); - if (!merged.valid) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_intersection_types, - }); - return INVALID; - } - if (isDirty(parsedLeft) || isDirty(parsedRight)) { - status.dirty(); - } - return { status: status.value, value: merged.data }; - }; - if (ctx.common.async) { - return Promise.all([ - this._def.left._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }), - this._def.right._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }), - ]).then(([left, right]) => handleParsed(left, right)); - } else { - return handleParsed( - this._def.left._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }), - this._def.right._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }) - ); - } - } -}; -ZodIntersection.create = (left, right, params) => { - return new ZodIntersection({ - left, - right, - typeName: ZodFirstPartyTypeKind.ZodIntersection, - ...processCreateParams(params), - }); -}; -var ZodTuple = class extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.array) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.array, - received: ctx.parsedType, - }); - return INVALID; - } - if (ctx.data.length < this._def.items.length) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: this._def.items.length, - inclusive: true, - exact: false, - type: "array", - }); - return INVALID; - } - const rest = this._def.rest; - if (!rest && ctx.data.length > this._def.items.length) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: this._def.items.length, - inclusive: true, - exact: false, - type: "array", - }); - status.dirty(); - } - const items = [...ctx.data] - .map((item, itemIndex) => { - const schema = this._def.items[itemIndex] || this._def.rest; - if (!schema) return null; - return schema._parse( - new ParseInputLazyPath(ctx, item, ctx.path, itemIndex) - ); - }) - .filter((x) => !!x); - if (ctx.common.async) { - return Promise.all(items).then((results) => { - return ParseStatus.mergeArray(status, results); - }); - } else { - return ParseStatus.mergeArray(status, items); - } - } - get items() { - return this._def.items; - } - rest(rest) { - return new ZodTuple({ - ...this._def, - rest, - }); - } -}; -ZodTuple.create = (schemas, params) => { - if (!Array.isArray(schemas)) { - throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); - } - return new ZodTuple({ - items: schemas, - typeName: ZodFirstPartyTypeKind.ZodTuple, - rest: null, - ...processCreateParams(params), - }); -}; -var ZodRecord = class extends ZodType { - get keySchema() { - return this._def.keyType; - } - get valueSchema() { - return this._def.valueType; - } - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.object) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx.parsedType, - }); - return INVALID; - } - const pairs = []; - const keyType = this._def.keyType; - const valueType = this._def.valueType; - for (const key in ctx.data) { - pairs.push({ - key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)), - value: valueType._parse( - new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key) - ), - }); - } - if (ctx.common.async) { - return ParseStatus.mergeObjectAsync(status, pairs); - } else { - return ParseStatus.mergeObjectSync(status, pairs); - } - } - get element() { - return this._def.valueType; - } - static create(first, second, third) { - if (second instanceof ZodType) { - return new ZodRecord({ - keyType: first, - valueType: second, - typeName: ZodFirstPartyTypeKind.ZodRecord, - ...processCreateParams(third), - }); - } - return new ZodRecord({ - keyType: ZodString.create(), - valueType: first, - typeName: ZodFirstPartyTypeKind.ZodRecord, - ...processCreateParams(second), - }); - } -}; -var ZodMap = class extends ZodType { - get keySchema() { - return this._def.keyType; - } - get valueSchema() { - return this._def.valueType; - } - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.map) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.map, - received: ctx.parsedType, - }); - return INVALID; - } - const keyType = this._def.keyType; - const valueType = this._def.valueType; - const pairs = [...ctx.data.entries()].map(([key, value], index) => { - return { - key: keyType._parse( - new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"]) - ), - value: valueType._parse( - new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]) - ), - }; - }); - if (ctx.common.async) { - const finalMap = /* @__PURE__ */ new Map(); - return Promise.resolve().then(async () => { - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - if (key.status === "aborted" || value.status === "aborted") { - return INVALID; - } - if (key.status === "dirty" || value.status === "dirty") { - status.dirty(); - } - finalMap.set(key.value, value.value); - } - return { status: status.value, value: finalMap }; - }); - } else { - const finalMap = /* @__PURE__ */ new Map(); - for (const pair of pairs) { - const key = pair.key; - const value = pair.value; - if (key.status === "aborted" || value.status === "aborted") { - return INVALID; - } - if (key.status === "dirty" || value.status === "dirty") { - status.dirty(); - } - finalMap.set(key.value, value.value); - } - return { status: status.value, value: finalMap }; - } - } -}; -ZodMap.create = (keyType, valueType, params) => { - return new ZodMap({ - valueType, - keyType, - typeName: ZodFirstPartyTypeKind.ZodMap, - ...processCreateParams(params), - }); -}; -var ZodSet = class extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.set) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.set, - received: ctx.parsedType, - }); - return INVALID; - } - const def = this._def; - if (def.minSize !== null) { - if (ctx.data.size < def.minSize.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: def.minSize.value, - type: "set", - inclusive: true, - exact: false, - message: def.minSize.message, - }); - status.dirty(); - } - } - if (def.maxSize !== null) { - if (ctx.data.size > def.maxSize.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: def.maxSize.value, - type: "set", - inclusive: true, - exact: false, - message: def.maxSize.message, - }); - status.dirty(); - } - } - const valueType = this._def.valueType; - function finalizeSet(elements2) { - const parsedSet = /* @__PURE__ */ new Set(); - for (const element of elements2) { - if (element.status === "aborted") return INVALID; - if (element.status === "dirty") status.dirty(); - parsedSet.add(element.value); - } - return { status: status.value, value: parsedSet }; - } - const elements = [...ctx.data.values()].map((item, i) => - valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)) - ); - if (ctx.common.async) { - return Promise.all(elements).then((elements2) => finalizeSet(elements2)); - } else { - return finalizeSet(elements); - } - } - min(minSize, message) { - return new ZodSet({ - ...this._def, - minSize: { value: minSize, message: errorUtil.toString(message) }, - }); - } - max(maxSize, message) { - return new ZodSet({ - ...this._def, - maxSize: { value: maxSize, message: errorUtil.toString(message) }, - }); - } - size(size, message) { - return this.min(size, message).max(size, message); - } - nonempty(message) { - return this.min(1, message); - } -}; -ZodSet.create = (valueType, params) => { - return new ZodSet({ - valueType, - minSize: null, - maxSize: null, - typeName: ZodFirstPartyTypeKind.ZodSet, - ...processCreateParams(params), - }); -}; -var ZodFunction = class extends ZodType { - constructor() { - super(...arguments); - this.validate = this.implement; - } - _parse(input) { - const { ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.function) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.function, - received: ctx.parsedType, - }); - return INVALID; - } - function makeArgsIssue(args, error) { - return makeIssue({ - data: args, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - ctx.schemaErrorMap, - getErrorMap(), - errorMap, - ].filter((x) => !!x), - issueData: { - code: ZodIssueCode.invalid_arguments, - argumentsError: error, - }, - }); - } - function makeReturnsIssue(returns, error) { - return makeIssue({ - data: returns, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - ctx.schemaErrorMap, - getErrorMap(), - errorMap, - ].filter((x) => !!x), - issueData: { - code: ZodIssueCode.invalid_return_type, - returnTypeError: error, - }, - }); - } - const params = { errorMap: ctx.common.contextualErrorMap }; - const fn = ctx.data; - if (this._def.returns instanceof ZodPromise) { - const me = this; - return OK(async function (...args) { - const error = new ZodError([]); - const parsedArgs = await me._def.args - .parseAsync(args, params) - .catch((e) => { - error.addIssue(makeArgsIssue(args, e)); - throw error; - }); - const result = await Reflect.apply(fn, this, parsedArgs); - const parsedReturns = await me._def.returns._def.type - .parseAsync(result, params) - .catch((e) => { - error.addIssue(makeReturnsIssue(result, e)); - throw error; - }); - return parsedReturns; - }); - } else { - const me = this; - return OK(function (...args) { - const parsedArgs = me._def.args.safeParse(args, params); - if (!parsedArgs.success) { - throw new ZodError([makeArgsIssue(args, parsedArgs.error)]); - } - const result = Reflect.apply(fn, this, parsedArgs.data); - const parsedReturns = me._def.returns.safeParse(result, params); - if (!parsedReturns.success) { - throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]); - } - return parsedReturns.data; - }); - } - } - parameters() { - return this._def.args; - } - returnType() { - return this._def.returns; - } - args(...items) { - return new ZodFunction({ - ...this._def, - args: ZodTuple.create(items).rest(ZodUnknown.create()), - }); - } - returns(returnType) { - return new ZodFunction({ - ...this._def, - returns: returnType, - }); - } - implement(func) { - const validatedFunc = this.parse(func); - return validatedFunc; - } - strictImplement(func) { - const validatedFunc = this.parse(func); - return validatedFunc; - } - static create(args, returns, params) { - return new ZodFunction({ - args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()), - returns: returns || ZodUnknown.create(), - typeName: ZodFirstPartyTypeKind.ZodFunction, - ...processCreateParams(params), - }); - } -}; -var ZodLazy = class extends ZodType { - get schema() { - return this._def.getter(); - } - _parse(input) { - const { ctx } = this._processInputParams(input); - const lazySchema = this._def.getter(); - return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx }); - } -}; -ZodLazy.create = (getter, params) => { - return new ZodLazy({ - getter, - typeName: ZodFirstPartyTypeKind.ZodLazy, - ...processCreateParams(params), - }); -}; -var ZodLiteral = class extends ZodType { - _parse(input) { - if (input.data !== this._def.value) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_literal, - expected: this._def.value, - }); - return INVALID; - } - return { status: "valid", value: input.data }; - } - get value() { - return this._def.value; - } -}; -ZodLiteral.create = (value, params) => { - return new ZodLiteral({ - value, - typeName: ZodFirstPartyTypeKind.ZodLiteral, - ...processCreateParams(params), - }); -}; -function createZodEnum(values, params) { - return new ZodEnum({ - values, - typeName: ZodFirstPartyTypeKind.ZodEnum, - ...processCreateParams(params), - }); -} -var ZodEnum = class extends ZodType { - _parse(input) { - if (typeof input.data !== "string") { - const ctx = this._getOrReturnCtx(input); - const expectedValues = this._def.values; - addIssueToContext(ctx, { - expected: util.joinValues(expectedValues), - received: ctx.parsedType, - code: ZodIssueCode.invalid_type, - }); - return INVALID; - } - if (this._def.values.indexOf(input.data) === -1) { - const ctx = this._getOrReturnCtx(input); - const expectedValues = this._def.values; - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_enum_value, - options: expectedValues, - }); - return INVALID; - } - return OK(input.data); - } - get options() { - return this._def.values; - } - get enum() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - get Values() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - get Enum() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - extract(values) { - return ZodEnum.create(values); - } - exclude(values) { - return ZodEnum.create(this.options.filter((opt) => !values.includes(opt))); - } -}; -ZodEnum.create = createZodEnum; -var ZodNativeEnum = class extends ZodType { - _parse(input) { - const nativeEnumValues = util.getValidEnumValues(this._def.values); - const ctx = this._getOrReturnCtx(input); - if ( - ctx.parsedType !== ZodParsedType.string && - ctx.parsedType !== ZodParsedType.number - ) { - const expectedValues = util.objectValues(nativeEnumValues); - addIssueToContext(ctx, { - expected: util.joinValues(expectedValues), - received: ctx.parsedType, - code: ZodIssueCode.invalid_type, - }); - return INVALID; - } - if (nativeEnumValues.indexOf(input.data) === -1) { - const expectedValues = util.objectValues(nativeEnumValues); - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_enum_value, - options: expectedValues, - }); - return INVALID; - } - return OK(input.data); - } - get enum() { - return this._def.values; - } -}; -ZodNativeEnum.create = (values, params) => { - return new ZodNativeEnum({ - values, - typeName: ZodFirstPartyTypeKind.ZodNativeEnum, - ...processCreateParams(params), - }); -}; -var ZodPromise = class extends ZodType { - unwrap() { - return this._def.type; - } - _parse(input) { - const { ctx } = this._processInputParams(input); - if ( - ctx.parsedType !== ZodParsedType.promise && - ctx.common.async === false - ) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.promise, - received: ctx.parsedType, - }); - return INVALID; - } - const promisified = - ctx.parsedType === ZodParsedType.promise - ? ctx.data - : Promise.resolve(ctx.data); - return OK( - promisified.then((data) => { - return this._def.type.parseAsync(data, { - path: ctx.path, - errorMap: ctx.common.contextualErrorMap, - }); - }) - ); - } -}; -ZodPromise.create = (schema, params) => { - return new ZodPromise({ - type: schema, - typeName: ZodFirstPartyTypeKind.ZodPromise, - ...processCreateParams(params), - }); -}; -var ZodEffects = class extends ZodType { - innerType() { - return this._def.schema; - } - sourceType() { - return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects - ? this._def.schema.sourceType() - : this._def.schema; - } - _parse(input) { - const { status, ctx } = this._processInputParams(input); - const effect = this._def.effect || null; - const checkCtx = { - addIssue: (arg) => { - addIssueToContext(ctx, arg); - if (arg.fatal) { - status.abort(); - } else { - status.dirty(); - } - }, - get path() { - return ctx.path; - }, - }; - checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx); - if (effect.type === "preprocess") { - const processed = effect.transform(ctx.data, checkCtx); - if (ctx.common.issues.length) { - return { - status: "dirty", - value: ctx.data, - }; - } - if (ctx.common.async) { - return Promise.resolve(processed).then((processed2) => { - return this._def.schema._parseAsync({ - data: processed2, - path: ctx.path, - parent: ctx, - }); - }); - } else { - return this._def.schema._parseSync({ - data: processed, - path: ctx.path, - parent: ctx, - }); - } - } - if (effect.type === "refinement") { - const executeRefinement = (acc) => { - const result = effect.refinement(acc, checkCtx); - if (ctx.common.async) { - return Promise.resolve(result); - } - if (result instanceof Promise) { - throw new Error( - "Async refinement encountered during synchronous parse operation. Use .parseAsync instead." - ); - } - return acc; - }; - if (ctx.common.async === false) { - const inner = this._def.schema._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }); - if (inner.status === "aborted") return INVALID; - if (inner.status === "dirty") status.dirty(); - executeRefinement(inner.value); - return { status: status.value, value: inner.value }; - } else { - return this._def.schema - ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }) - .then((inner) => { - if (inner.status === "aborted") return INVALID; - if (inner.status === "dirty") status.dirty(); - return executeRefinement(inner.value).then(() => { - return { status: status.value, value: inner.value }; - }); - }); - } - } - if (effect.type === "transform") { - if (ctx.common.async === false) { - const base = this._def.schema._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }); - if (!isValid(base)) return base; - const result = effect.transform(base.value, checkCtx); - if (result instanceof Promise) { - throw new Error( - `Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.` - ); - } - return { status: status.value, value: result }; - } else { - return this._def.schema - ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }) - .then((base) => { - if (!isValid(base)) return base; - return Promise.resolve(effect.transform(base.value, checkCtx)).then( - (result) => ({ status: status.value, value: result }) - ); - }); - } - } - util.assertNever(effect); - } -}; -ZodEffects.create = (schema, effect, params) => { - return new ZodEffects({ - schema, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect, - ...processCreateParams(params), - }); -}; -ZodEffects.createWithPreprocess = (preprocess, schema, params) => { - return new ZodEffects({ - schema, - effect: { type: "preprocess", transform: preprocess }, - typeName: ZodFirstPartyTypeKind.ZodEffects, - ...processCreateParams(params), - }); -}; -var ZodOptional = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType === ZodParsedType.undefined) { - return OK(void 0); - } - return this._def.innerType._parse(input); - } - unwrap() { - return this._def.innerType; - } -}; -ZodOptional.create = (type, params) => { - return new ZodOptional({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodOptional, - ...processCreateParams(params), - }); -}; -var ZodNullable = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType === ZodParsedType.null) { - return OK(null); - } - return this._def.innerType._parse(input); - } - unwrap() { - return this._def.innerType; - } -}; -ZodNullable.create = (type, params) => { - return new ZodNullable({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodNullable, - ...processCreateParams(params), - }); -}; -var ZodDefault = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - let data = ctx.data; - if (ctx.parsedType === ZodParsedType.undefined) { - data = this._def.defaultValue(); - } - return this._def.innerType._parse({ - data, - path: ctx.path, - parent: ctx, - }); - } - removeDefault() { - return this._def.innerType; - } -}; -ZodDefault.create = (type, params) => { - return new ZodDefault({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodDefault, - defaultValue: - typeof params.default === "function" - ? params.default - : () => params.default, - ...processCreateParams(params), - }); -}; -var ZodCatch = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - const newCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [], - }, - }; - const result = this._def.innerType._parse({ - data: newCtx.data, - path: newCtx.path, - parent: { - ...newCtx, - }, - }); - if (isAsync(result)) { - return result.then((result2) => { - return { - status: "valid", - value: - result2.status === "valid" - ? result2.value - : this._def.catchValue({ - get error() { - return new ZodError(newCtx.common.issues); - }, - input: newCtx.data, - }), - }; - }); - } else { - return { - status: "valid", - value: - result.status === "valid" - ? result.value - : this._def.catchValue({ - get error() { - return new ZodError(newCtx.common.issues); - }, - input: newCtx.data, - }), - }; - } - } - removeCatch() { - return this._def.innerType; - } -}; -ZodCatch.create = (type, params) => { - return new ZodCatch({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodCatch, - catchValue: - typeof params.catch === "function" ? params.catch : () => params.catch, - ...processCreateParams(params), - }); -}; -var ZodNaN = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.nan) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.nan, - received: ctx.parsedType, - }); - return INVALID; - } - return { status: "valid", value: input.data }; - } -}; -ZodNaN.create = (params) => { - return new ZodNaN({ - typeName: ZodFirstPartyTypeKind.ZodNaN, - ...processCreateParams(params), - }); -}; -var BRAND = Symbol("zod_brand"); -var ZodBranded = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - const data = ctx.data; - return this._def.type._parse({ - data, - path: ctx.path, - parent: ctx, - }); - } - unwrap() { - return this._def.type; - } -}; -var ZodPipeline = class extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.common.async) { - const handleAsync = async () => { - const inResult = await this._def.in._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }); - if (inResult.status === "aborted") return INVALID; - if (inResult.status === "dirty") { - status.dirty(); - return DIRTY(inResult.value); - } else { - return this._def.out._parseAsync({ - data: inResult.value, - path: ctx.path, - parent: ctx, - }); - } - }; - return handleAsync(); - } else { - const inResult = this._def.in._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx, - }); - if (inResult.status === "aborted") return INVALID; - if (inResult.status === "dirty") { - status.dirty(); - return { - status: "dirty", - value: inResult.value, - }; - } else { - return this._def.out._parseSync({ - data: inResult.value, - path: ctx.path, - parent: ctx, - }); - } - } - } - static create(a, b) { - return new ZodPipeline({ - in: a, - out: b, - typeName: ZodFirstPartyTypeKind.ZodPipeline, - }); - } -}; -var ZodReadonly = class extends ZodType { - _parse(input) { - const result = this._def.innerType._parse(input); - if (isValid(result)) { - result.value = Object.freeze(result.value); - } - return result; - } -}; -ZodReadonly.create = (type, params) => { - return new ZodReadonly({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodReadonly, - ...processCreateParams(params), - }); -}; -var custom = (check, params = {}, fatal) => { - if (check) - return ZodAny.create().superRefine((data, ctx) => { - var _a108, _b; - if (!check(data)) { - const p2 = - typeof params === "function" - ? params(data) - : typeof params === "string" - ? { message: params } - : params; - const _fatal = - (_b = - (_a108 = p2.fatal) !== null && _a108 !== void 0 ? _a108 : fatal) !== - null && _b !== void 0 - ? _b - : true; - const p22 = typeof p2 === "string" ? { message: p2 } : p2; - ctx.addIssue({ code: "custom", ...p22, fatal: _fatal }); - } - }); - return ZodAny.create(); -}; -var late = { - object: ZodObject.lazycreate, -}; -var ZodFirstPartyTypeKind; -(function (ZodFirstPartyTypeKind2) { - ZodFirstPartyTypeKind2["ZodString"] = "ZodString"; - ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber"; - ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN"; - ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt"; - ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean"; - ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate"; - ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol"; - ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined"; - ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull"; - ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny"; - ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown"; - ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever"; - ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid"; - ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray"; - ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject"; - ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion"; - ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion"; - ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection"; - ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple"; - ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord"; - ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap"; - ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet"; - ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction"; - ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy"; - ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral"; - ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum"; - ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects"; - ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum"; - ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional"; - ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable"; - ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault"; - ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch"; - ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise"; - ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded"; - ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline"; - ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly"; -})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); -var instanceOfType = ( - cls, - params = { - message: `Input not instance of ${cls.name}`, - } -) => custom((data) => data instanceof cls, params); -var stringType = ZodString.create; -var numberType = ZodNumber.create; -var nanType = ZodNaN.create; -var bigIntType = ZodBigInt.create; -var booleanType = ZodBoolean.create; -var dateType = ZodDate.create; -var symbolType = ZodSymbol.create; -var undefinedType = ZodUndefined.create; -var nullType = ZodNull.create; -var anyType = ZodAny.create; -var unknownType = ZodUnknown.create; -var neverType = ZodNever.create; -var voidType = ZodVoid.create; -var arrayType = ZodArray.create; -var objectType = ZodObject.create; -var strictObjectType = ZodObject.strictCreate; -var unionType = ZodUnion.create; -var discriminatedUnionType = ZodDiscriminatedUnion.create; -var intersectionType = ZodIntersection.create; -var tupleType = ZodTuple.create; -var recordType = ZodRecord.create; -var mapType = ZodMap.create; -var setType = ZodSet.create; -var functionType = ZodFunction.create; -var lazyType = ZodLazy.create; -var literalType = ZodLiteral.create; -var enumType = ZodEnum.create; -var nativeEnumType = ZodNativeEnum.create; -var promiseType = ZodPromise.create; -var effectsType = ZodEffects.create; -var optionalType = ZodOptional.create; -var nullableType = ZodNullable.create; -var preprocessType = ZodEffects.createWithPreprocess; -var pipelineType = ZodPipeline.create; -var ostring = () => stringType().optional(); -var onumber = () => numberType().optional(); -var oboolean = () => booleanType().optional(); -var coerce = { - string: (arg) => ZodString.create({ ...arg, coerce: true }), - number: (arg) => ZodNumber.create({ ...arg, coerce: true }), - boolean: (arg) => - ZodBoolean.create({ - ...arg, - coerce: true, - }), - bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }), - date: (arg) => ZodDate.create({ ...arg, coerce: true }), -}; -var NEVER = INVALID; -var z = /* @__PURE__ */ Object.freeze({ - __proto__: null, - defaultErrorMap: errorMap, - setErrorMap, - getErrorMap, - makeIssue, - EMPTY_PATH, - addIssueToContext, - ParseStatus, - INVALID, - DIRTY, - OK, - isAborted, - isDirty, - isValid, - isAsync, - get util() { - return util; - }, - get objectUtil() { - return objectUtil; - }, - ZodParsedType, - getParsedType, - ZodType, - ZodString, - ZodNumber, - ZodBigInt, - ZodBoolean, - ZodDate, - ZodSymbol, - ZodUndefined, - ZodNull, - ZodAny, - ZodUnknown, - ZodNever, - ZodVoid, - ZodArray, - ZodObject, - ZodUnion, - ZodDiscriminatedUnion, - ZodIntersection, - ZodTuple, - ZodRecord, - ZodMap, - ZodSet, - ZodFunction, - ZodLazy, - ZodLiteral, - ZodEnum, - ZodNativeEnum, - ZodPromise, - ZodEffects, - ZodTransformer: ZodEffects, - ZodOptional, - ZodNullable, - ZodDefault, - ZodCatch, - ZodNaN, - BRAND, - ZodBranded, - ZodPipeline, - ZodReadonly, - custom, - Schema: ZodType, - ZodSchema: ZodType, - late, - get ZodFirstPartyTypeKind() { - return ZodFirstPartyTypeKind; - }, - coerce, - any: anyType, - array: arrayType, - bigint: bigIntType, - boolean: booleanType, - date: dateType, - discriminatedUnion: discriminatedUnionType, - effect: effectsType, - enum: enumType, - function: functionType, - instanceof: instanceOfType, - intersection: intersectionType, - lazy: lazyType, - literal: literalType, - map: mapType, - nan: nanType, - nativeEnum: nativeEnumType, - never: neverType, - null: nullType, - nullable: nullableType, - number: numberType, - object: objectType, - oboolean, - onumber, - optional: optionalType, - ostring, - pipeline: pipelineType, - preprocess: preprocessType, - promise: promiseType, - record: recordType, - set: setType, - strictObject: strictObjectType, - string: stringType, - symbol: symbolType, - transformer: effectsType, - tuple: tupleType, - undefined: undefinedType, - union: unionType, - unknown: unknownType, - void: voidType, - NEVER, - ZodIssueCode, - quotelessJson, - ZodError, -}); - -// ../../node_modules/.pnpm/drizzle-zod@0.5.1_drizzle-orm@0.29.3_zod@3.22.4/node_modules/drizzle-zod/index.mjs -var m = z.union([z.string(), z.number(), z.boolean(), z.null()]); -var f = z.lazy(() => z.union([m, z.array(f), z.record(f)])); -function c(t, n) { - const r = getTableColumns(t), - o = Object.entries(r); - let i = Object.fromEntries(o.map(([e, t2]) => [e, p(t2)])); - n && - (i = Object.assign( - i, - Object.fromEntries( - Object.entries(n).map(([e, t2]) => [ - e, - "function" == typeof t2 ? t2(i) : t2, - ]) - ) - )); - for (const [e, t2] of o) - t2.notNull - ? t2.hasDefault && (i[e] = i[e].optional()) - : (i[e] = i[e].nullable().optional()); - return z.object(i); -} -function p(e) { - let m2; - if ( - ((function (e2) { - return ( - "enumValues" in e2 && - Array.isArray(e2.enumValues) && - e2.enumValues.length > 0 - ); - })(e) && (m2 = e.enumValues.length ? z.enum(e.enumValues) : z.string()), - !m2) - ) { - if (is(e, PgUUID)) m2 = z.string().uuid(); - else if ("custom" === e.dataType) m2 = z.any(); - else if ("json" === e.dataType) m2 = f; - else if ("array" === e.dataType) m2 = z.array(p(e.baseColumn)); - else if ("number" === e.dataType) m2 = z.number(); - else if ("bigint" === e.dataType) m2 = z.bigint(); - else if ("boolean" === e.dataType) m2 = z.boolean(); - else if ("date" === e.dataType) m2 = z.date(); - else if ("string" === e.dataType) { - let i = z.string(); - (is(e, PgChar) || - is(e, PgVarchar) || - is(e, MySqlVarChar) || - is(e, MySqlVarBinary) || - is(e, MySqlChar) || - is(e, SQLiteText)) && - "number" == typeof e.length && - (i = i.max(e.length)), - (m2 = i); - } - } - return m2 || (m2 = z.any()), m2; -} - -// ../../packages/database/schema.ts -var emails = sqliteTable("emails", { - id: text("id").primaryKey(), - messageFrom: text("message_from").notNull(), - messageTo: text("message_to").notNull(), - headers: text("headers", { mode: "json" }).$type().notNull(), - from: text("from", { mode: "json" }).$type().notNull(), - sender: text("sender", { mode: "json" }).$type(), - replyTo: text("reply_to", { mode: "json" }).$type(), - deliveredTo: text("delivered_to"), - returnPath: text("return_path"), - to: text("to", { mode: "json" }).$type(), - cc: text("cc", { mode: "json" }).$type(), - bcc: text("bcc", { mode: "json" }).$type(), - subject: text("subject"), - messageId: text("message_id").notNull(), - inReplyTo: text("in_reply_to"), - references: text("references"), - date: text("date"), - html: text("html"), - text: text("text"), - createdAt: integer("created_at", { mode: "timestamp" }).notNull(), - updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(), -}); -var AddressSchema = objectType({ - address: stringType(), - name: stringType(), -}); -var insertEmailSchema = c(emails, { - headers: arrayType(recordType(stringType())), - from: AddressSchema, - sender: AddressSchema.optional(), - replyTo: arrayType(AddressSchema).optional(), - to: arrayType(AddressSchema).optional(), - cc: arrayType(AddressSchema).optional(), - bcc: arrayType(AddressSchema).optional(), -}); - -// ../../packages/database/dao.ts -async function insertEmail(db, email) { - try { - await db.insert(emails).values(email).execute(); - } catch (e) { - console.error(e); - } -} - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/api.js -var LibsqlError = class extends Error { - /** Machine-readable error code. */ - code; - /** Raw numeric error code */ - rawCode; - constructor(message, code, rawCode, cause) { - if (code !== void 0) { - message = `${code}: ${message}`; - } - super(message, { cause }); - this.code = code; - this.rawCode = rawCode; - this.name = "LibsqlError"; - } -}; - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/uri.js -function parseUri(text2) { - const match = URI_RE.exec(text2); - if (match === null) { - throw new LibsqlError("The URL is not in a valid format", "URL_INVALID"); - } - const groups = match.groups; - const scheme = groups["scheme"]; - const authority = - groups["authority"] !== void 0 - ? parseAuthority(groups["authority"]) - : void 0; - const path = percentDecode(groups["path"]); - const query = - groups["query"] !== void 0 ? parseQuery(groups["query"]) : void 0; - const fragment = - groups["fragment"] !== void 0 ? percentDecode(groups["fragment"]) : void 0; - return { scheme, authority, path, query, fragment }; -} -var URI_RE = (() => { - const SCHEME = "(?[A-Za-z][A-Za-z.+-]*)"; - const AUTHORITY = "(?[^/?#]*)"; - const PATH = "(?[^?#]*)"; - const QUERY = "(?[^#]*)"; - const FRAGMENT = "(?.*)"; - return new RegExp( - `^${SCHEME}:(//${AUTHORITY})?${PATH}(\\?${QUERY})?(#${FRAGMENT})?$`, - "su" - ); -})(); -function parseAuthority(text2) { - const match = AUTHORITY_RE.exec(text2); - if (match === null) { - throw new LibsqlError( - "The authority part of the URL is not in a valid format", - "URL_INVALID" - ); - } - const groups = match.groups; - const host = percentDecode(groups["host_br"] ?? groups["host"]); - const port = groups["port"] ? parseInt(groups["port"], 10) : void 0; - const userinfo = - groups["username"] !== void 0 - ? { - username: percentDecode(groups["username"]), - password: - groups["password"] !== void 0 - ? percentDecode(groups["password"]) - : void 0, - } - : void 0; - return { host, port, userinfo }; -} -var AUTHORITY_RE = (() => { - const USERINFO = "(?[^:]*)(:(?.*))?"; - const HOST = "((?[^:\\[\\]]*)|(\\[(?[^\\[\\]]*)\\]))"; - const PORT = "(?[0-9]*)"; - return new RegExp(`^(${USERINFO}@)?${HOST}(:${PORT})?$`, "su"); -})(); -function parseQuery(text2) { - const sequences = text2.split("&"); - const pairs = []; - for (const sequence of sequences) { - if (sequence === "") { - continue; - } - let key; - let value; - const splitIdx = sequence.indexOf("="); - if (splitIdx < 0) { - key = sequence; - value = ""; - } else { - key = sequence.substring(0, splitIdx); - value = sequence.substring(splitIdx + 1); - } - pairs.push({ - key: percentDecode(key.replaceAll("+", " ")), - value: percentDecode(value.replaceAll("+", " ")), - }); - } - return { pairs }; -} -function percentDecode(text2) { - try { - return decodeURIComponent(text2); - } catch (e) { - if (e instanceof URIError) { - throw new LibsqlError( - `URL component has invalid percent encoding: ${e}`, - "URL_INVALID", - void 0, - e - ); - } - throw e; - } -} -function encodeBaseUrl(scheme, authority, path) { - if (authority === void 0) { - throw new LibsqlError( - `URL with scheme ${JSON.stringify(scheme + ":")} requires authority (the "//" part)`, - "URL_INVALID" - ); - } - const schemeText = `${scheme}:`; - const hostText = encodeHost(authority.host); - const portText = encodePort(authority.port); - const userinfoText = encodeUserinfo(authority.userinfo); - const authorityText = `//${userinfoText}${hostText}${portText}`; - let pathText = path.split("/").map(encodeURIComponent).join("/"); - if (pathText !== "" && !pathText.startsWith("/")) { - pathText = "/" + pathText; - } - return new URL(`${schemeText}${authorityText}${pathText}`); -} -function encodeHost(host) { - return host.includes(":") ? `[${encodeURI(host)}]` : encodeURI(host); -} -function encodePort(port) { - return port !== void 0 ? `:${port}` : ""; -} -function encodeUserinfo(userinfo) { - if (userinfo === void 0) { - return ""; - } - const usernameText = encodeURIComponent(userinfo.username); - const passwordText = - userinfo.password !== void 0 - ? `:${encodeURIComponent(userinfo.password)}` - : ""; - return `${usernameText}${passwordText}@`; -} - -// ../../node_modules/.pnpm/js-base64@3.7.5/node_modules/js-base64/base64.mjs -var version2 = "3.7.5"; -var VERSION = version2; -var _hasatob = typeof atob === "function"; -var _hasbtoa = typeof btoa === "function"; -var _hasBuffer = typeof Buffer === "function"; -var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0; -var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0; -var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; -var b64chs = Array.prototype.slice.call(b64ch); -var b64tab = ((a) => { - let tab = {}; - a.forEach((c2, i) => (tab[c2] = i)); - return tab; -})(b64chs); -var b64re = - /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; -var _fromCC = String.fromCharCode.bind(String); -var _U8Afrom = - typeof Uint8Array.from === "function" - ? Uint8Array.from.bind(Uint8Array) - : (it) => new Uint8Array(Array.prototype.slice.call(it, 0)); -var _mkUriSafe = (src) => - src.replace(/=/g, "").replace(/[+\/]/g, (m0) => (m0 == "+" ? "-" : "_")); -var _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, ""); -var btoaPolyfill = (bin) => { - let u32, - c0, - c1, - c2, - asc2 = ""; - const pad = bin.length % 3; - for (let i = 0; i < bin.length; ) { - if ( - (c0 = bin.charCodeAt(i++)) > 255 || - (c1 = bin.charCodeAt(i++)) > 255 || - (c2 = bin.charCodeAt(i++)) > 255 - ) - throw new TypeError("invalid character found"); - u32 = (c0 << 16) | (c1 << 8) | c2; - asc2 += - b64chs[(u32 >> 18) & 63] + - b64chs[(u32 >> 12) & 63] + - b64chs[(u32 >> 6) & 63] + - b64chs[u32 & 63]; - } - return pad ? asc2.slice(0, pad - 3) + "===".substring(pad) : asc2; -}; -var _btoa = _hasbtoa - ? (bin) => btoa(bin) - : _hasBuffer - ? (bin) => Buffer.from(bin, "binary").toString("base64") - : btoaPolyfill; -var _fromUint8Array = _hasBuffer - ? (u8a) => Buffer.from(u8a).toString("base64") - : (u8a) => { - const maxargs = 4096; - let strs = []; - for (let i = 0, l = u8a.length; i < l; i += maxargs) { - strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); - } - return _btoa(strs.join("")); - }; -var fromUint8Array = (u8a, urlsafe = false) => - urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); -var cb_utob = (c2) => { - if (c2.length < 2) { - var cc = c2.charCodeAt(0); - return cc < 128 - ? c2 - : cc < 2048 - ? _fromCC(192 | (cc >>> 6)) + _fromCC(128 | (cc & 63)) - : _fromCC(224 | ((cc >>> 12) & 15)) + - _fromCC(128 | ((cc >>> 6) & 63)) + - _fromCC(128 | (cc & 63)); - } else { - var cc = - 65536 + (c2.charCodeAt(0) - 55296) * 1024 + (c2.charCodeAt(1) - 56320); - return ( - _fromCC(240 | ((cc >>> 18) & 7)) + - _fromCC(128 | ((cc >>> 12) & 63)) + - _fromCC(128 | ((cc >>> 6) & 63)) + - _fromCC(128 | (cc & 63)) - ); - } -}; -var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; -var utob = (u) => u.replace(re_utob, cb_utob); -var _encode = _hasBuffer - ? (s) => Buffer.from(s, "utf8").toString("base64") - : _TE - ? (s) => _fromUint8Array(_TE.encode(s)) - : (s) => _btoa(utob(s)); -var encode = (src, urlsafe = false) => - urlsafe ? _mkUriSafe(_encode(src)) : _encode(src); -var encodeURI2 = (src) => encode(src, true); -var re_btou = - /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; -var cb_btou = (cccc) => { - switch (cccc.length) { - case 4: - var cp = - ((7 & cccc.charCodeAt(0)) << 18) | - ((63 & cccc.charCodeAt(1)) << 12) | - ((63 & cccc.charCodeAt(2)) << 6) | - (63 & cccc.charCodeAt(3)), - offset = cp - 65536; - return ( - _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320) - ); - case 3: - return _fromCC( - ((15 & cccc.charCodeAt(0)) << 12) | - ((63 & cccc.charCodeAt(1)) << 6) | - (63 & cccc.charCodeAt(2)) - ); - default: - return _fromCC( - ((31 & cccc.charCodeAt(0)) << 6) | (63 & cccc.charCodeAt(1)) - ); - } -}; -var btou = (b) => b.replace(re_btou, cb_btou); -var atobPolyfill = (asc2) => { - asc2 = asc2.replace(/\s+/g, ""); - if (!b64re.test(asc2)) throw new TypeError("malformed base64."); - asc2 += "==".slice(2 - (asc2.length & 3)); - let u24, - bin = "", - r1, - r2; - for (let i = 0; i < asc2.length; ) { - u24 = - (b64tab[asc2.charAt(i++)] << 18) | - (b64tab[asc2.charAt(i++)] << 12) | - ((r1 = b64tab[asc2.charAt(i++)]) << 6) | - (r2 = b64tab[asc2.charAt(i++)]); - bin += - r1 === 64 - ? _fromCC((u24 >> 16) & 255) - : r2 === 64 - ? _fromCC((u24 >> 16) & 255, (u24 >> 8) & 255) - : _fromCC((u24 >> 16) & 255, (u24 >> 8) & 255, u24 & 255); - } - return bin; -}; -var _atob = _hasatob - ? (asc2) => atob(_tidyB64(asc2)) - : _hasBuffer - ? (asc2) => Buffer.from(asc2, "base64").toString("binary") - : atobPolyfill; -var _toUint8Array = _hasBuffer - ? (a) => _U8Afrom(Buffer.from(a, "base64")) - : (a) => - _U8Afrom( - _atob(a) - .split("") - .map((c2) => c2.charCodeAt(0)) - ); -var toUint8Array = (a) => _toUint8Array(_unURI(a)); -var _decode = _hasBuffer - ? (a) => Buffer.from(a, "base64").toString("utf8") - : _TD - ? (a) => _TD.decode(_toUint8Array(a)) - : (a) => btou(_atob(a)); -var _unURI = (a) => - _tidyB64(a.replace(/[-_]/g, (m0) => (m0 == "-" ? "+" : "/"))); -var decode = (src) => _decode(_unURI(src)); -var isValid2 = (src) => { - if (typeof src !== "string") return false; - const s = src.replace(/\s+/g, "").replace(/={0,2}$/, ""); - return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s); -}; -var _noEnum = (v) => { - return { - value: v, - enumerable: false, - writable: true, - configurable: true, - }; -}; -var extendString = function () { - const _add = (name, body) => - Object.defineProperty(String.prototype, name, _noEnum(body)); - _add("fromBase64", function () { - return decode(this); - }); - _add("toBase64", function (urlsafe) { - return encode(this, urlsafe); - }); - _add("toBase64URI", function () { - return encode(this, true); - }); - _add("toBase64URL", function () { - return encode(this, true); - }); - _add("toUint8Array", function () { - return toUint8Array(this); - }); -}; -var extendUint8Array = function () { - const _add = (name, body) => - Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); - _add("toBase64", function (urlsafe) { - return fromUint8Array(this, urlsafe); - }); - _add("toBase64URI", function () { - return fromUint8Array(this, true); - }); - _add("toBase64URL", function () { - return fromUint8Array(this, true); - }); -}; -var extendBuiltins = () => { - extendString(); - extendUint8Array(); -}; -var gBase64 = { - version: version2, - VERSION, - atob: _atob, - atobPolyfill, - btoa: _btoa, - btoaPolyfill, - fromBase64: decode, - toBase64: encode, - encode, - encodeURI: encodeURI2, - encodeURL: encodeURI2, - utob, - btou, - decode, - isValid: isValid2, - fromUint8Array, - toUint8Array, - extendString, - extendUint8Array, - extendBuiltins, -}; - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/util.js -var supportedUrlLink = - "https://github.com/libsql/libsql-client-ts#supported-urls"; -function transactionModeToBegin(mode) { - if (mode === "write") { - return "BEGIN IMMEDIATE"; - } else if (mode === "read") { - return "BEGIN TRANSACTION READONLY"; - } else if (mode === "deferred") { - return "BEGIN DEFERRED"; - } else { - throw RangeError( - 'Unknown transaction mode, supported values are "write", "read" and "deferred"' - ); - } -} -var ResultSetImpl = class { - columns; - columnTypes; - rows; - rowsAffected; - lastInsertRowid; - constructor(columns, columnTypes, rows, rowsAffected, lastInsertRowid) { - this.columns = columns; - this.columnTypes = columnTypes; - this.rows = rows; - this.rowsAffected = rowsAffected; - this.lastInsertRowid = lastInsertRowid; - } - toJSON() { - return { - columns: this.columns, - columnTypes: this.columnTypes, - rows: this.rows.map(rowToJson), - rowsAffected: this.rowsAffected, - lastInsertRowid: - this.lastInsertRowid !== void 0 ? "" + this.lastInsertRowid : null, - }; - } -}; -function rowToJson(row) { - return Array.prototype.map.call(row, valueToJson); -} -function valueToJson(value) { - if (typeof value === "bigint") { - return "" + value; - } else if (value instanceof ArrayBuffer) { - return gBase64.fromUint8Array(new Uint8Array(value)); - } else { - return value; - } -} - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/config.js -function expandConfig(config, preferHttp) { - if (typeof config !== "object") { - throw new TypeError( - `Expected client configuration as object, got ${typeof config}` - ); - } - let tls = config.tls; - let authToken = config.authToken; - let syncUrl = config.syncUrl; - const intMode = "" + (config.intMode ?? "number"); - if (intMode !== "number" && intMode !== "bigint" && intMode !== "string") { - throw new TypeError( - `Invalid value for intMode, expected "number", "bigint" or "string", got ${JSON.stringify(intMode)}` - ); - } - if (config.url === ":memory:") { - return { - path: ":memory:", - scheme: "file", - syncUrl, - intMode, - fetch: config.fetch, - tls: false, - authToken: void 0, - authority: void 0, - }; - } - const uri = parseUri(config.url); - for (const { key, value } of uri.query?.pairs ?? []) { - if (key === "authToken") { - authToken = value ? value : void 0; - } else if (key === "tls") { - if (value === "0") { - tls = false; - } else if (value === "1") { - tls = true; - } else { - throw new LibsqlError( - `Unknown value for the "tls" query argument: ${JSON.stringify(value)}. Supported values are "0" and "1"`, - "URL_INVALID" - ); - } - } else { - throw new LibsqlError( - `Unknown URL query parameter ${JSON.stringify(key)}`, - "URL_PARAM_NOT_SUPPORTED" - ); - } - } - const uriScheme = uri.scheme.toLowerCase(); - let scheme; - if (uriScheme === "libsql") { - if (tls === false) { - if (uri.authority?.port === void 0) { - throw new LibsqlError( - 'A "libsql:" URL with ?tls=0 must specify an explicit port', - "URL_INVALID" - ); - } - scheme = preferHttp ? "http" : "ws"; - } else { - scheme = preferHttp ? "https" : "wss"; - } - } else if (uriScheme === "http" || uriScheme === "ws") { - scheme = uriScheme; - tls ??= false; - } else if ( - uriScheme === "https" || - uriScheme === "wss" || - uriScheme === "file" - ) { - scheme = uriScheme; - } else { - throw new LibsqlError( - `The client supports only "libsql:", "wss:", "ws:", "https:", "http:" and "file:" URLs, got ${JSON.stringify(uri.scheme + ":")}. For more information, please read ${supportedUrlLink}`, - "URL_SCHEME_NOT_SUPPORTED" - ); - } - if (uri.fragment !== void 0) { - throw new LibsqlError( - `URL fragments are not supported: ${JSON.stringify("#" + uri.fragment)}`, - "URL_INVALID" - ); - } - return { - scheme, - tls: tls ?? true, - authority: uri.authority, - path: uri.path, - authToken, - syncUrl, - intMode, - fetch: config.fetch, - }; -} - -// ../../node_modules/.pnpm/@libsql+isomorphic-ws@0.1.5/node_modules/@libsql/isomorphic-ws/web.mjs -var _WebSocket; -if (typeof WebSocket !== "undefined") { - _WebSocket = WebSocket; -} else if (typeof global !== "undefined") { - _WebSocket = global.WebSocket; -} else if (typeof window !== "undefined") { - _WebSocket = window.WebSocket; -} else if (typeof self !== "undefined") { - _WebSocket = self.WebSocket; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/client.js -var Client = class { - /** @private */ - constructor() { - this.intMode = "number"; - } - /** Representation of integers returned from the database. See {@link IntMode}. - * - * This value is inherited by {@link Stream} objects created with {@link openStream}, but you can - * override the integer mode for every stream by setting {@link Stream.intMode} on the stream. - */ - intMode; -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/errors.js -var ClientError = class extends Error { - /** @private */ - constructor(message) { - super(message); - this.name = "ClientError"; - } -}; -var ProtoError = class extends ClientError { - /** @private */ - constructor(message) { - super(message); - this.name = "ProtoError"; - } -}; -var ResponseError = class extends ClientError { - code; - /** @internal */ - proto; - /** @private */ - constructor(message, protoError) { - super(message); - this.name = "ResponseError"; - this.code = protoError.code; - this.proto = protoError; - this.stack = void 0; - } -}; -var ClosedError = class extends ClientError { - /** @private */ - constructor(message, cause) { - if (cause !== void 0) { - super(`${message}: ${cause}`); - this.cause = cause; - } else { - super(message); - } - this.name = "ClosedError"; - } -}; -var WebSocketUnsupportedError = class extends ClientError { - /** @private */ - constructor(message) { - super(message); - this.name = "WebSocketUnsupportedError"; - } -}; -var WebSocketError = class extends ClientError { - /** @private */ - constructor(message) { - super(message); - this.name = "WebSocketError"; - } -}; -var HttpServerError = class extends ClientError { - status; - /** @private */ - constructor(message, status) { - super(message); - this.status = status; - this.name = "HttpServerError"; - } -}; -var ProtocolVersionError = class extends ClientError { - /** @private */ - constructor(message) { - super(message); - this.name = "ProtocolVersionError"; - } -}; -var InternalError = class extends ClientError { - /** @private */ - constructor(message) { - super(message); - this.name = "InternalError"; - } -}; -var MisuseError = class extends ClientError { - /** @private */ - constructor(message) { - super(message); - this.name = "MisuseError"; - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/encoding/json/decode.js -function string(value) { - if (typeof value === "string") { - return value; - } - throw typeError(value, "string"); -} -function stringOpt(value) { - if (value === null || value === void 0) { - return void 0; - } else if (typeof value === "string") { - return value; - } - throw typeError(value, "string or null"); -} -function number(value) { - if (typeof value === "number") { - return value; - } - throw typeError(value, "number"); -} -function boolean(value) { - if (typeof value === "boolean") { - return value; - } - throw typeError(value, "boolean"); -} -function array(value) { - if (Array.isArray(value)) { - return value; - } - throw typeError(value, "array"); -} -function object(value) { - if (value !== null && typeof value === "object" && !Array.isArray(value)) { - return value; - } - throw typeError(value, "object"); -} -function arrayObjectsMap(value, fun) { - return array(value).map((elemValue) => fun(object(elemValue))); -} -function typeError(value, expected) { - if (value === void 0) { - return new ProtoError(`Expected ${expected}, but the property was missing`); - } - let received = typeof value; - if (value === null) { - received = "null"; - } else if (Array.isArray(value)) { - received = "array"; - } - return new ProtoError(`Expected ${expected}, received ${received}`); -} -function readJsonObject(value, fun) { - return fun(object(value)); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/encoding/json/encode.js -var ObjectWriter = class { - #output; - #isFirst; - constructor(output) { - this.#output = output; - this.#isFirst = false; - } - begin() { - this.#output.push("{"); - this.#isFirst = true; - } - end() { - this.#output.push("}"); - this.#isFirst = false; - } - #key(name) { - if (this.#isFirst) { - this.#output.push('"'); - this.#isFirst = false; - } else { - this.#output.push(',"'); - } - this.#output.push(name); - this.#output.push('":'); - } - string(name, value) { - this.#key(name); - this.#output.push(JSON.stringify(value)); - } - stringRaw(name, value) { - this.#key(name); - this.#output.push('"'); - this.#output.push(value); - this.#output.push('"'); - } - number(name, value) { - this.#key(name); - this.#output.push("" + value); - } - boolean(name, value) { - this.#key(name); - this.#output.push(value ? "true" : "false"); - } - object(name, value, valueFun) { - this.#key(name); - this.begin(); - valueFun(this, value); - this.end(); - } - arrayObjects(name, values, valueFun) { - this.#key(name); - this.#output.push("["); - for (let i = 0; i < values.length; ++i) { - if (i !== 0) { - this.#output.push(","); - } - this.begin(); - valueFun(this, values[i]); - this.end(); - } - this.#output.push("]"); - } -}; -function writeJsonObject(value, fun) { - const output = []; - const writer = new ObjectWriter(output); - writer.begin(); - fun(writer, value); - writer.end(); - return output.join(""); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/util.js -var VARINT = 0; -var FIXED_64 = 1; -var LENGTH_DELIMITED = 2; -var FIXED_32 = 5; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/decode.js -var MessageReader = class { - #array; - #view; - #pos; - constructor(array2) { - this.#array = array2; - this.#view = new DataView( - array2.buffer, - array2.byteOffset, - array2.byteLength - ); - this.#pos = 0; - } - varint() { - let value = 0; - for (let shift = 0; ; shift += 7) { - const byte = this.#array[this.#pos++]; - value |= (byte & 127) << shift; - if (!(byte & 128)) { - break; - } - } - return value; - } - varintBig() { - let value = 0n; - for (let shift = 0n; ; shift += 7n) { - const byte = this.#array[this.#pos++]; - value |= BigInt(byte & 127) << shift; - if (!(byte & 128)) { - break; - } - } - return value; - } - bytes(length) { - const array2 = new Uint8Array( - this.#array.buffer, - this.#array.byteOffset + this.#pos, - length - ); - this.#pos += length; - return array2; - } - double() { - const value = this.#view.getFloat64(this.#pos, true); - this.#pos += 8; - return value; - } - skipVarint() { - for (;;) { - const byte = this.#array[this.#pos++]; - if (!(byte & 128)) { - break; - } - } - } - skip(count) { - this.#pos += count; - } - eof() { - return this.#pos >= this.#array.byteLength; - } -}; -var FieldReader = class { - #reader; - #wireType; - constructor(reader) { - this.#reader = reader; - this.#wireType = -1; - } - setup(wireType) { - this.#wireType = wireType; - } - #expect(expectedWireType) { - if (this.#wireType !== expectedWireType) { - throw new ProtoError( - `Expected wire type ${expectedWireType}, got ${this.#wireType}` - ); - } - this.#wireType = -1; - } - bytes() { - this.#expect(LENGTH_DELIMITED); - const length = this.#reader.varint(); - return this.#reader.bytes(length); - } - string() { - return new TextDecoder().decode(this.bytes()); - } - message(def) { - return readProtobufMessage(this.bytes(), def); - } - int32() { - this.#expect(VARINT); - return this.#reader.varint(); - } - uint32() { - return this.int32(); - } - bool() { - return this.int32() !== 0; - } - uint64() { - this.#expect(VARINT); - return this.#reader.varintBig(); - } - sint64() { - const value = this.uint64(); - return (value >> 1n) ^ -(value & 1n); - } - double() { - this.#expect(FIXED_64); - return this.#reader.double(); - } - maybeSkip() { - if (this.#wireType < 0) { - return; - } else if (this.#wireType === VARINT) { - this.#reader.skipVarint(); - } else if (this.#wireType === FIXED_64) { - this.#reader.skip(8); - } else if (this.#wireType === LENGTH_DELIMITED) { - const length = this.#reader.varint(); - this.#reader.skip(length); - } else if (this.#wireType === FIXED_32) { - this.#reader.skip(4); - } else { - throw new ProtoError(`Unexpected wire type ${this.#wireType}`); - } - this.#wireType = -1; - } -}; -function readProtobufMessage(data, def) { - const msgReader = new MessageReader(data); - const fieldReader = new FieldReader(msgReader); - let value = def.default(); - while (!msgReader.eof()) { - const key = msgReader.varint(); - const tag = key >> 3; - const wireType = key & 7; - fieldReader.setup(wireType); - const tagFun = def[tag]; - if (tagFun !== void 0) { - const returnedValue = tagFun(fieldReader, value); - if (returnedValue !== void 0) { - value = returnedValue; - } - } - fieldReader.maybeSkip(); - } - return value; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/encode.js -var MessageWriter = class { - #buf; - #array; - #view; - #pos; - constructor() { - this.#buf = new ArrayBuffer(256); - this.#array = new Uint8Array(this.#buf); - this.#view = new DataView(this.#buf); - this.#pos = 0; - } - #ensure(extra) { - if (this.#pos + extra <= this.#buf.byteLength) { - return; - } - let newCap = this.#buf.byteLength; - while (newCap < this.#pos + extra) { - newCap *= 2; - } - const newBuf = new ArrayBuffer(newCap); - const newArray = new Uint8Array(newBuf); - const newView = new DataView(newBuf); - newArray.set(new Uint8Array(this.#buf, 0, this.#pos)); - this.#buf = newBuf; - this.#array = newArray; - this.#view = newView; - } - #varint(value) { - this.#ensure(5); - value = 0 | value; - do { - let byte = value & 127; - value >>>= 7; - byte |= value ? 128 : 0; - this.#array[this.#pos++] = byte; - } while (value); - } - #varintBig(value) { - this.#ensure(10); - value = value & 0xffffffffffffffffn; - do { - let byte = Number(value & 0x7fn); - value >>= 7n; - byte |= value ? 128 : 0; - this.#array[this.#pos++] = byte; - } while (value); - } - #tag(tag, wireType) { - this.#varint((tag << 3) | wireType); - } - bytes(tag, value) { - this.#tag(tag, LENGTH_DELIMITED); - this.#varint(value.byteLength); - this.#ensure(value.byteLength); - this.#array.set(value, this.#pos); - this.#pos += value.byteLength; - } - string(tag, value) { - this.bytes(tag, new TextEncoder().encode(value)); - } - message(tag, value, fun) { - const writer = new MessageWriter(); - fun(writer, value); - this.bytes(tag, writer.data()); - } - int32(tag, value) { - this.#tag(tag, VARINT); - this.#varint(value); - } - uint32(tag, value) { - this.int32(tag, value); - } - bool(tag, value) { - this.int32(tag, value ? 1 : 0); - } - sint64(tag, value) { - this.#tag(tag, VARINT); - this.#varintBig((value << 1n) ^ (value >> 63n)); - } - double(tag, value) { - this.#tag(tag, FIXED_64); - this.#ensure(8); - this.#view.setFloat64(this.#pos, value, true); - this.#pos += 8; - } - data() { - return new Uint8Array(this.#buf, 0, this.#pos); - } -}; -function writeProtobufMessage(value, fun) { - const w = new MessageWriter(); - fun(w, value); - return w.data(); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/id_alloc.js -var IdAlloc = class { - // Set of all allocated ids - #usedIds; - // Set of all free ids lower than `#usedIds.size` - #freeIds; - constructor() { - this.#usedIds = /* @__PURE__ */ new Set(); - this.#freeIds = /* @__PURE__ */ new Set(); - } - // Returns an id that was free, and marks it as used. - alloc() { - for (const freeId2 of this.#freeIds) { - this.#freeIds.delete(freeId2); - this.#usedIds.add(freeId2); - if (!this.#usedIds.has(this.#usedIds.size - 1)) { - this.#freeIds.add(this.#usedIds.size - 1); - } - return freeId2; - } - const freeId = this.#usedIds.size; - this.#usedIds.add(freeId); - return freeId; - } - free(id) { - if (!this.#usedIds.delete(id)) { - throw new InternalError("Freeing an id that is not allocated"); - } - this.#freeIds.delete(this.#usedIds.size); - if (id < this.#usedIds.size) { - this.#freeIds.add(id); - } - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/util.js -function impossible(value, message) { - throw new InternalError(message); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/value.js -function valueToProto(value) { - if (value === null) { - return null; - } else if (typeof value === "string") { - return value; - } else if (typeof value === "number") { - if (!Number.isFinite(value)) { - throw new RangeError( - "Only finite numbers (not Infinity or NaN) can be passed as arguments" - ); - } - return value; - } else if (typeof value === "bigint") { - if (value < minInteger || value > maxInteger) { - throw new RangeError( - "This bigint value is too large to be represented as a 64-bit integer and passed as argument" - ); - } - return value; - } else if (typeof value === "boolean") { - return value ? 1n : 0n; - } else if (value instanceof ArrayBuffer) { - return new Uint8Array(value); - } else if (value instanceof Uint8Array) { - return value; - } else if (value instanceof Date) { - return +value.valueOf(); - } else if (typeof value === "object") { - return "" + value.toString(); - } else { - throw new TypeError("Unsupported type of value"); - } -} -var minInteger = -9223372036854775808n; -var maxInteger = 9223372036854775807n; -function valueFromProto(value, intMode) { - if (value === null) { - return null; - } else if (typeof value === "number") { - return value; - } else if (typeof value === "string") { - return value; - } else if (typeof value === "bigint") { - if (intMode === "number") { - const num = Number(value); - if (!Number.isSafeInteger(num)) { - throw new RangeError( - "Received integer which is too large to be safely represented as a JavaScript number" - ); - } - return num; - } else if (intMode === "bigint") { - return value; - } else if (intMode === "string") { - return "" + value; - } else { - throw new MisuseError("Invalid value for IntMode"); - } - } else if (value instanceof Uint8Array) { - return value.slice().buffer; - } else if (value === void 0) { - throw new ProtoError("Received unrecognized type of Value"); - } else { - throw impossible(value, "Impossible type of Value"); - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/result.js -function stmtResultFromProto(result) { - return { - affectedRowCount: result.affectedRowCount, - lastInsertRowid: result.lastInsertRowid, - columnNames: result.cols.map((col) => col.name), - columnDecltypes: result.cols.map((col) => col.decltype), - }; -} -function rowsResultFromProto(result, intMode) { - const stmtResult = stmtResultFromProto(result); - const rows = result.rows.map((row) => - rowFromProto(stmtResult.columnNames, row, intMode) - ); - return { ...stmtResult, rows }; -} -function rowResultFromProto(result, intMode) { - const stmtResult = stmtResultFromProto(result); - let row; - if (result.rows.length > 0) { - row = rowFromProto(stmtResult.columnNames, result.rows[0], intMode); - } - return { ...stmtResult, row }; -} -function valueResultFromProto(result, intMode) { - const stmtResult = stmtResultFromProto(result); - let value; - if (result.rows.length > 0 && stmtResult.columnNames.length > 0) { - value = valueFromProto(result.rows[0][0], intMode); - } - return { ...stmtResult, value }; -} -function rowFromProto(colNames, values, intMode) { - const row = {}; - Object.defineProperty(row, "length", { value: values.length }); - for (let i = 0; i < values.length; ++i) { - const value = valueFromProto(values[i], intMode); - Object.defineProperty(row, i, { value }); - const colName = colNames[i]; - if (colName !== void 0 && !Object.hasOwn(row, colName)) { - Object.defineProperty(row, colName, { value, enumerable: true }); - } - } - return row; -} -function errorFromProto(error) { - return new ResponseError(error.message, error); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/sql.js -var Sql = class { - #owner; - #sqlId; - #closed; - /** @private */ - constructor(owner, sqlId) { - this.#owner = owner; - this.#sqlId = sqlId; - this.#closed = void 0; - } - /** @private */ - _getSqlId(owner) { - if (this.#owner !== owner) { - throw new MisuseError( - "Attempted to use SQL text opened with other object" - ); - } else if (this.#closed !== void 0) { - throw new ClosedError("SQL text is closed", this.#closed); - } - return this.#sqlId; - } - /** Remove the SQL text from the server, releasing resouces. */ - close() { - this._setClosed(new ClientError("SQL text was manually closed")); - } - /** @private */ - _setClosed(error) { - if (this.#closed === void 0) { - this.#closed = error; - this.#owner._closeSql(this.#sqlId); - } - } - /** True if the SQL text is closed (removed from the server). */ - get closed() { - return this.#closed !== void 0; - } -}; -function sqlToProto(owner, sql2) { - if (sql2 instanceof Sql) { - return { sqlId: sql2._getSqlId(owner) }; - } else { - return { sql: "" + sql2 }; - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/queue.js -var Queue = class { - #pushStack; - #shiftStack; - constructor() { - this.#pushStack = []; - this.#shiftStack = []; - } - get length() { - return this.#pushStack.length + this.#shiftStack.length; - } - push(elem) { - this.#pushStack.push(elem); - } - shift() { - if (this.#shiftStack.length === 0 && this.#pushStack.length > 0) { - this.#shiftStack = this.#pushStack.reverse(); - this.#pushStack = []; - } - return this.#shiftStack.pop(); - } - first() { - return this.#shiftStack.length !== 0 - ? this.#shiftStack[this.#shiftStack.length - 1] - : this.#pushStack[0]; - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/stmt.js -var Stmt = class { - /** The SQL statement text. */ - sql; - /** @private */ - _args; - /** @private */ - _namedArgs; - /** Initialize the statement with given SQL text. */ - constructor(sql2) { - this.sql = sql2; - this._args = []; - this._namedArgs = /* @__PURE__ */ new Map(); - } - /** Binds positional parameters from the given `values`. All previous positional bindings are cleared. */ - bindIndexes(values) { - this._args.length = 0; - for (const value of values) { - this._args.push(valueToProto(value)); - } - return this; - } - /** Binds a parameter by a 1-based index. */ - bindIndex(index, value) { - if (index !== (index | 0) || index <= 0) { - throw new RangeError( - "Index of a positional argument must be positive integer" - ); - } - while (this._args.length < index) { - this._args.push(null); - } - this._args[index - 1] = valueToProto(value); - return this; - } - /** Binds a parameter by name. */ - bindName(name, value) { - this._namedArgs.set(name, valueToProto(value)); - return this; - } - /** Clears all bindings. */ - unbindAll() { - this._args.length = 0; - this._namedArgs.clear(); - return this; - } -}; -function stmtToProto(sqlOwner, stmt, wantRows) { - let inSql; - let args = []; - let namedArgs = []; - if (stmt instanceof Stmt) { - inSql = stmt.sql; - args = stmt._args; - for (const [name, value] of stmt._namedArgs.entries()) { - namedArgs.push({ name, value }); - } - } else if (Array.isArray(stmt)) { - inSql = stmt[0]; - if (Array.isArray(stmt[1])) { - args = stmt[1].map((arg) => valueToProto(arg)); - } else { - namedArgs = Object.entries(stmt[1]).map(([name, value]) => { - return { name, value: valueToProto(value) }; - }); - } - } else { - inSql = stmt; - } - const { sql: sql2, sqlId } = sqlToProto(sqlOwner, inSql); - return { sql: sql2, sqlId, args, namedArgs, wantRows }; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/batch.js -var Batch = class { - /** @private */ - _stream; - #useCursor; - /** @private */ - _steps; - #executed; - /** @private */ - constructor(stream, useCursor) { - this._stream = stream; - this.#useCursor = useCursor; - this._steps = []; - this.#executed = false; - } - /** Return a builder for adding a step to the batch. */ - step() { - return new BatchStep(this); - } - /** Execute the batch. */ - execute() { - if (this.#executed) { - throw new MisuseError("This batch has already been executed"); - } - this.#executed = true; - const batch = { - steps: this._steps.map((step) => step.proto), - }; - if (this.#useCursor) { - return executeCursor(this._stream, this._steps, batch); - } else { - return executeRegular(this._stream, this._steps, batch); - } - } -}; -function executeRegular(stream, steps, batch) { - return stream._batch(batch).then((result) => { - for (let step = 0; step < steps.length; ++step) { - const stepResult = result.stepResults.get(step); - const stepError = result.stepErrors.get(step); - steps[step].callback(stepResult, stepError); - } - }); -} -async function executeCursor(stream, steps, batch) { - const cursor = await stream._openCursor(batch); - try { - let nextStep = 0; - let beginEntry = void 0; - let rows = []; - for (;;) { - const entry = await cursor.next(); - if (entry === void 0) { - break; - } - if (entry.type === "step_begin") { - if (entry.step < nextStep || entry.step >= steps.length) { - throw new ProtoError( - "Server produced StepBeginEntry for unexpected step" - ); - } else if (beginEntry !== void 0) { - throw new ProtoError( - "Server produced StepBeginEntry before terminating previous step" - ); - } - for (let step = nextStep; step < entry.step; ++step) { - steps[step].callback(void 0, void 0); - } - nextStep = entry.step + 1; - beginEntry = entry; - rows = []; - } else if (entry.type === "step_end") { - if (beginEntry === void 0) { - throw new ProtoError( - "Server produced StepEndEntry but no step is active" - ); - } - const stmtResult = { - cols: beginEntry.cols, - rows, - affectedRowCount: entry.affectedRowCount, - lastInsertRowid: entry.lastInsertRowid, - }; - steps[beginEntry.step].callback(stmtResult, void 0); - beginEntry = void 0; - rows = []; - } else if (entry.type === "step_error") { - if (beginEntry === void 0) { - if (entry.step >= steps.length) { - throw new ProtoError( - "Server produced StepErrorEntry for unexpected step" - ); - } - for (let step = nextStep; step < entry.step; ++step) { - steps[step].callback(void 0, void 0); - } - } else { - if (entry.step !== beginEntry.step) { - throw new ProtoError( - "Server produced StepErrorEntry for unexpected step" - ); - } - beginEntry = void 0; - rows = []; - } - steps[entry.step].callback(void 0, entry.error); - nextStep = entry.step + 1; - } else if (entry.type === "row") { - if (beginEntry === void 0) { - throw new ProtoError( - "Server produced RowEntry but no step is active" - ); - } - rows.push(entry.row); - } else if (entry.type === "error") { - throw errorFromProto(entry.error); - } else if (entry.type === "none") { - throw new ProtoError("Server produced unrecognized CursorEntry"); - } else { - throw impossible(entry, "Impossible CursorEntry"); - } - } - if (beginEntry !== void 0) { - throw new ProtoError( - "Server closed Cursor before terminating active step" - ); - } - for (let step = nextStep; step < steps.length; ++step) { - steps[step].callback(void 0, void 0); - } - } finally { - cursor.close(); - } -} -var BatchStep = class { - /** @private */ - _batch; - #conds; - /** @private */ - _index; - /** @private */ - constructor(batch) { - this._batch = batch; - this.#conds = []; - this._index = void 0; - } - /** Add the condition that needs to be satisfied to execute the statement. If you use this method multiple - * times, we join the conditions with a logical AND. */ - condition(cond) { - this.#conds.push(cond._proto); - return this; - } - /** Add a statement that returns rows. */ - query(stmt) { - return this.#add(stmt, true, rowsResultFromProto); - } - /** Add a statement that returns at most a single row. */ - queryRow(stmt) { - return this.#add(stmt, true, rowResultFromProto); - } - /** Add a statement that returns at most a single value. */ - queryValue(stmt) { - return this.#add(stmt, true, valueResultFromProto); - } - /** Add a statement without returning rows. */ - run(stmt) { - return this.#add(stmt, false, stmtResultFromProto); - } - #add(inStmt, wantRows, fromProto) { - if (this._index !== void 0) { - throw new MisuseError( - "This BatchStep has already been added to the batch" - ); - } - const stmt = stmtToProto(this._batch._stream._sqlOwner(), inStmt, wantRows); - let condition; - if (this.#conds.length === 0) { - condition = void 0; - } else if (this.#conds.length === 1) { - condition = this.#conds[0]; - } else { - condition = { type: "and", conds: this.#conds.slice() }; - } - const proto = { stmt, condition }; - return new Promise((outputCallback, errorCallback) => { - const callback = (stepResult, stepError) => { - if (stepResult !== void 0 && stepError !== void 0) { - errorCallback( - new ProtoError("Server returned both result and error") - ); - } else if (stepError !== void 0) { - errorCallback(errorFromProto(stepError)); - } else if (stepResult !== void 0) { - outputCallback(fromProto(stepResult, this._batch._stream.intMode)); - } else { - outputCallback(void 0); - } - }; - this._index = this._batch._steps.length; - this._batch._steps.push({ proto, callback }); - }); - } -}; -var BatchCond = class { - /** @private */ - _batch; - /** @private */ - _proto; - /** @private */ - constructor(batch, proto) { - this._batch = batch; - this._proto = proto; - } - /** Create a condition that evaluates to true when the given step executes successfully. - * - * If the given step fails error or is skipped because its condition evaluated to false, this - * condition evaluates to false. - */ - static ok(step) { - return new BatchCond(step._batch, { type: "ok", step: stepIndex(step) }); - } - /** Create a condition that evaluates to true when the given step fails. - * - * If the given step succeeds or is skipped because its condition evaluated to false, this condition - * evaluates to false. - */ - static error(step) { - return new BatchCond(step._batch, { type: "error", step: stepIndex(step) }); - } - /** Create a condition that is a logical negation of another condition. - */ - static not(cond) { - return new BatchCond(cond._batch, { type: "not", cond: cond._proto }); - } - /** Create a condition that is a logical AND of other conditions. - */ - static and(batch, conds) { - for (const cond of conds) { - checkCondBatch(batch, cond); - } - return new BatchCond(batch, { - type: "and", - conds: conds.map((e) => e._proto), - }); - } - /** Create a condition that is a logical OR of other conditions. - */ - static or(batch, conds) { - for (const cond of conds) { - checkCondBatch(batch, cond); - } - return new BatchCond(batch, { - type: "or", - conds: conds.map((e) => e._proto), - }); - } - /** Create a condition that evaluates to true when the SQL connection is in autocommit mode (not inside an - * explicit transaction). This requires protocol version 3 or higher. - */ - static isAutocommit(batch) { - batch._stream.client()._ensureVersion(3, "BatchCond.isAutocommit()"); - return new BatchCond(batch, { type: "is_autocommit" }); - } -}; -function stepIndex(step) { - if (step._index === void 0) { - throw new MisuseError( - "Cannot add a condition referencing a step that has not been added to the batch" - ); - } - return step._index; -} -function checkCondBatch(expectedBatch, cond) { - if (cond._batch !== expectedBatch) { - throw new MisuseError( - "Cannot mix BatchCond objects for different Batch objects" - ); - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/describe.js -function describeResultFromProto(result) { - return { - paramNames: result.params.map((p2) => p2.name), - columns: result.cols, - isExplain: result.isExplain, - isReadonly: result.isReadonly, - }; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/stream.js -var Stream = class { - /** @private */ - constructor(intMode) { - this.intMode = intMode; - } - /** Execute a statement and return rows. */ - query(stmt) { - return this.#execute(stmt, true, rowsResultFromProto); - } - /** Execute a statement and return at most a single row. */ - queryRow(stmt) { - return this.#execute(stmt, true, rowResultFromProto); - } - /** Execute a statement and return at most a single value. */ - queryValue(stmt) { - return this.#execute(stmt, true, valueResultFromProto); - } - /** Execute a statement without returning rows. */ - run(stmt) { - return this.#execute(stmt, false, stmtResultFromProto); - } - #execute(inStmt, wantRows, fromProto) { - const stmt = stmtToProto(this._sqlOwner(), inStmt, wantRows); - return this._execute(stmt).then((r) => fromProto(r, this.intMode)); - } - /** Return a builder for creating and executing a batch. - * - * If `useCursor` is true, the batch will be executed using a Hrana cursor, which will stream results from - * the server to the client, which consumes less memory on the server. This requires protocol version 3 or - * higher. - */ - batch(useCursor = false) { - return new Batch(this, useCursor); - } - /** Parse and analyze a statement. This requires protocol version 2 or higher. */ - describe(inSql) { - const protoSql = sqlToProto(this._sqlOwner(), inSql); - return this._describe(protoSql).then(describeResultFromProto); - } - /** Execute a sequence of statements separated by semicolons. This requires protocol version 2 or higher. - * */ - sequence(inSql) { - const protoSql = sqlToProto(this._sqlOwner(), inSql); - return this._sequence(protoSql); - } - /** Representation of integers returned from the database. See {@link IntMode}. - * - * This value affects the results of all operations on this stream. - */ - intMode; -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/cursor.js -var Cursor = class {}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/cursor.js -var fetchChunkSize = 1e3; -var fetchQueueSize = 10; -var WsCursor = class extends Cursor { - #client; - #stream; - #cursorId; - #entryQueue; - #fetchQueue; - #closed; - #done; - /** @private */ - constructor(client, stream, cursorId) { - super(); - this.#client = client; - this.#stream = stream; - this.#cursorId = cursorId; - this.#entryQueue = new Queue(); - this.#fetchQueue = new Queue(); - this.#closed = void 0; - this.#done = false; - } - /** Fetch the next entry from the cursor. */ - async next() { - for (;;) { - if (this.#closed !== void 0) { - throw new ClosedError("Cursor is closed", this.#closed); - } - while (!this.#done && this.#fetchQueue.length < fetchQueueSize) { - this.#fetchQueue.push(this.#fetch()); - } - const entry = this.#entryQueue.shift(); - if (this.#done || entry !== void 0) { - return entry; - } - await this.#fetchQueue.shift().then((response) => { - if (response === void 0) { - return; - } - for (const entry2 of response.entries) { - this.#entryQueue.push(entry2); - } - this.#done ||= response.done; - }); - } - } - #fetch() { - return this.#stream - ._sendCursorRequest(this, { - type: "fetch_cursor", - cursorId: this.#cursorId, - maxCount: fetchChunkSize, - }) - .then( - (resp) => resp, - (error) => { - this._setClosed(error); - return void 0; - } - ); - } - /** @private */ - _setClosed(error) { - if (this.#closed !== void 0) { - return; - } - this.#closed = error; - this.#stream - ._sendCursorRequest(this, { - type: "close_cursor", - cursorId: this.#cursorId, - }) - .catch(() => void 0); - this.#stream._cursorClosed(this); - } - /** Close the cursor. */ - close() { - this._setClosed(new ClientError("Cursor was manually closed")); - } - /** True if the cursor is closed. */ - get closed() { - return this.#closed !== void 0; - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/stream.js -var WsStream = class extends Stream { - #client; - #streamId; - #queue; - #cursor; - #closing; - #closed; - /** @private */ - static open(client) { - const streamId = client._streamIdAlloc.alloc(); - const stream = new WsStream(client, streamId); - const responseCallback = () => void 0; - const errorCallback = (e) => stream.#setClosed(e); - const request = { type: "open_stream", streamId }; - client._sendRequest(request, { responseCallback, errorCallback }); - return stream; - } - /** @private */ - constructor(client, streamId) { - super(client.intMode); - this.#client = client; - this.#streamId = streamId; - this.#queue = new Queue(); - this.#cursor = void 0; - this.#closing = false; - this.#closed = void 0; - } - /** Get the {@link WsClient} object that this stream belongs to. */ - client() { - return this.#client; - } - /** @private */ - _sqlOwner() { - return this.#client; - } - /** @private */ - _execute(stmt) { - return this.#sendStreamRequest({ - type: "execute", - streamId: this.#streamId, - stmt, - }).then((response) => { - return response.result; - }); - } - /** @private */ - _batch(batch) { - return this.#sendStreamRequest({ - type: "batch", - streamId: this.#streamId, - batch, - }).then((response) => { - return response.result; - }); - } - /** @private */ - _describe(protoSql) { - this.#client._ensureVersion(2, "describe()"); - return this.#sendStreamRequest({ - type: "describe", - streamId: this.#streamId, - sql: protoSql.sql, - sqlId: protoSql.sqlId, - }).then((response) => { - return response.result; - }); - } - /** @private */ - _sequence(protoSql) { - this.#client._ensureVersion(2, "sequence()"); - return this.#sendStreamRequest({ - type: "sequence", - streamId: this.#streamId, - sql: protoSql.sql, - sqlId: protoSql.sqlId, - }).then((_response) => { - return void 0; - }); - } - /** Check whether the SQL connection underlying this stream is in autocommit state (i.e., outside of an - * explicit transaction). This requires protocol version 3 or higher. - */ - getAutocommit() { - this.#client._ensureVersion(3, "getAutocommit()"); - return this.#sendStreamRequest({ - type: "get_autocommit", - streamId: this.#streamId, - }).then((response) => { - return response.isAutocommit; - }); - } - #sendStreamRequest(request) { - return new Promise((responseCallback, errorCallback) => { - this.#pushToQueue({ - type: "request", - request, - responseCallback, - errorCallback, - }); - }); - } - /** @private */ - _openCursor(batch) { - this.#client._ensureVersion(3, "cursor"); - return new Promise((cursorCallback, errorCallback) => { - this.#pushToQueue({ - type: "cursor", - batch, - cursorCallback, - errorCallback, - }); - }); - } - /** @private */ - _sendCursorRequest(cursor, request) { - if (cursor !== this.#cursor) { - throw new InternalError( - "Cursor not associated with the stream attempted to execute a request" - ); - } - return new Promise((responseCallback, errorCallback) => { - if (this.#closed !== void 0) { - errorCallback(new ClosedError("Stream is closed", this.#closed)); - } else { - this.#client._sendRequest(request, { responseCallback, errorCallback }); - } - }); - } - /** @private */ - _cursorClosed(cursor) { - if (cursor !== this.#cursor) { - throw new InternalError( - "Cursor was closed, but it was not associated with the stream" - ); - } - this.#cursor = void 0; - this.#flushQueue(); - } - #pushToQueue(entry) { - if (this.#closed !== void 0) { - entry.errorCallback(new ClosedError("Stream is closed", this.#closed)); - } else if (this.#closing) { - entry.errorCallback(new ClosedError("Stream is closing", void 0)); - } else { - this.#queue.push(entry); - this.#flushQueue(); - } - } - #flushQueue() { - for (;;) { - const entry = this.#queue.first(); - if (entry === void 0 && this.#cursor === void 0 && this.#closing) { - this.#setClosed(new ClientError("Stream was gracefully closed")); - break; - } else if (entry?.type === "request" && this.#cursor === void 0) { - const { request, responseCallback, errorCallback } = entry; - this.#queue.shift(); - this.#client._sendRequest(request, { responseCallback, errorCallback }); - } else if (entry?.type === "cursor" && this.#cursor === void 0) { - const { batch, cursorCallback } = entry; - this.#queue.shift(); - const cursorId = this.#client._cursorIdAlloc.alloc(); - const cursor = new WsCursor(this.#client, this, cursorId); - const request = { - type: "open_cursor", - streamId: this.#streamId, - cursorId, - batch, - }; - const responseCallback = () => void 0; - const errorCallback = (e) => cursor._setClosed(e); - this.#client._sendRequest(request, { responseCallback, errorCallback }); - this.#cursor = cursor; - cursorCallback(cursor); - } else { - break; - } - } - } - #setClosed(error) { - if (this.#closed !== void 0) { - return; - } - this.#closed = error; - if (this.#cursor !== void 0) { - this.#cursor._setClosed(error); - } - for (;;) { - const entry = this.#queue.shift(); - if (entry !== void 0) { - entry.errorCallback(error); - } else { - break; - } - } - const request = { type: "close_stream", streamId: this.#streamId }; - const responseCallback = () => - this.#client._streamIdAlloc.free(this.#streamId); - const errorCallback = () => void 0; - this.#client._sendRequest(request, { responseCallback, errorCallback }); - } - /** Immediately close the stream. */ - close() { - this.#setClosed(new ClientError("Stream was manually closed")); - } - /** Gracefully close the stream. */ - closeGracefully() { - this.#closing = true; - this.#flushQueue(); - } - /** True if the stream is closed or closing. */ - get closed() { - return this.#closed !== void 0 || this.#closing; - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/shared/json_encode.js -function Stmt2(w, msg) { - if (msg.sql !== void 0) { - w.string("sql", msg.sql); - } - if (msg.sqlId !== void 0) { - w.number("sql_id", msg.sqlId); - } - w.arrayObjects("args", msg.args, Value); - w.arrayObjects("named_args", msg.namedArgs, NamedArg); - w.boolean("want_rows", msg.wantRows); -} -function NamedArg(w, msg) { - w.string("name", msg.name); - w.object("value", msg.value, Value); -} -function Batch2(w, msg) { - w.arrayObjects("steps", msg.steps, BatchStep2); -} -function BatchStep2(w, msg) { - if (msg.condition !== void 0) { - w.object("condition", msg.condition, BatchCond2); - } - w.object("stmt", msg.stmt, Stmt2); -} -function BatchCond2(w, msg) { - w.stringRaw("type", msg.type); - if (msg.type === "ok" || msg.type === "error") { - w.number("step", msg.step); - } else if (msg.type === "not") { - w.object("cond", msg.cond, BatchCond2); - } else if (msg.type === "and" || msg.type === "or") { - w.arrayObjects("conds", msg.conds, BatchCond2); - } else if (msg.type === "is_autocommit") { - } else { - throw impossible(msg, "Impossible type of BatchCond"); - } -} -function Value(w, msg) { - if (msg === null) { - w.stringRaw("type", "null"); - } else if (typeof msg === "bigint") { - w.stringRaw("type", "integer"); - w.stringRaw("value", "" + msg); - } else if (typeof msg === "number") { - w.stringRaw("type", "float"); - w.number("value", msg); - } else if (typeof msg === "string") { - w.stringRaw("type", "text"); - w.string("value", msg); - } else if (msg instanceof Uint8Array) { - w.stringRaw("type", "blob"); - w.stringRaw("base64", gBase64.fromUint8Array(msg)); - } else if (msg === void 0) { - } else { - throw impossible(msg, "Impossible type of Value"); - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/json_encode.js -function ClientMsg(w, msg) { - w.stringRaw("type", msg.type); - if (msg.type === "hello") { - if (msg.jwt !== void 0) { - w.string("jwt", msg.jwt); - } - } else if (msg.type === "request") { - w.number("request_id", msg.requestId); - w.object("request", msg.request, Request2); - } else { - throw impossible(msg, "Impossible type of ClientMsg"); - } -} -function Request2(w, msg) { - w.stringRaw("type", msg.type); - if (msg.type === "open_stream") { - w.number("stream_id", msg.streamId); - } else if (msg.type === "close_stream") { - w.number("stream_id", msg.streamId); - } else if (msg.type === "execute") { - w.number("stream_id", msg.streamId); - w.object("stmt", msg.stmt, Stmt2); - } else if (msg.type === "batch") { - w.number("stream_id", msg.streamId); - w.object("batch", msg.batch, Batch2); - } else if (msg.type === "open_cursor") { - w.number("stream_id", msg.streamId); - w.number("cursor_id", msg.cursorId); - w.object("batch", msg.batch, Batch2); - } else if (msg.type === "close_cursor") { - w.number("cursor_id", msg.cursorId); - } else if (msg.type === "fetch_cursor") { - w.number("cursor_id", msg.cursorId); - w.number("max_count", msg.maxCount); - } else if (msg.type === "sequence") { - w.number("stream_id", msg.streamId); - if (msg.sql !== void 0) { - w.string("sql", msg.sql); - } - if (msg.sqlId !== void 0) { - w.number("sql_id", msg.sqlId); - } - } else if (msg.type === "describe") { - w.number("stream_id", msg.streamId); - if (msg.sql !== void 0) { - w.string("sql", msg.sql); - } - if (msg.sqlId !== void 0) { - w.number("sql_id", msg.sqlId); - } - } else if (msg.type === "store_sql") { - w.number("sql_id", msg.sqlId); - w.string("sql", msg.sql); - } else if (msg.type === "close_sql") { - w.number("sql_id", msg.sqlId); - } else if (msg.type === "get_autocommit") { - w.number("stream_id", msg.streamId); - } else { - throw impossible(msg, "Impossible type of Request"); - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_encode.js -function Stmt3(w, msg) { - if (msg.sql !== void 0) { - w.string(1, msg.sql); - } - if (msg.sqlId !== void 0) { - w.int32(2, msg.sqlId); - } - for (const arg of msg.args) { - w.message(3, arg, Value2); - } - for (const arg of msg.namedArgs) { - w.message(4, arg, NamedArg2); - } - w.bool(5, msg.wantRows); -} -function NamedArg2(w, msg) { - w.string(1, msg.name); - w.message(2, msg.value, Value2); -} -function Batch3(w, msg) { - for (const step of msg.steps) { - w.message(1, step, BatchStep3); - } -} -function BatchStep3(w, msg) { - if (msg.condition !== void 0) { - w.message(1, msg.condition, BatchCond3); - } - w.message(2, msg.stmt, Stmt3); -} -function BatchCond3(w, msg) { - if (msg.type === "ok") { - w.uint32(1, msg.step); - } else if (msg.type === "error") { - w.uint32(2, msg.step); - } else if (msg.type === "not") { - w.message(3, msg.cond, BatchCond3); - } else if (msg.type === "and") { - w.message(4, msg.conds, BatchCondList); - } else if (msg.type === "or") { - w.message(5, msg.conds, BatchCondList); - } else if (msg.type === "is_autocommit") { - w.message(6, void 0, Empty); - } else { - throw impossible(msg, "Impossible type of BatchCond"); - } -} -function BatchCondList(w, msg) { - for (const cond of msg) { - w.message(1, cond, BatchCond3); - } -} -function Value2(w, msg) { - if (msg === null) { - w.message(1, void 0, Empty); - } else if (typeof msg === "bigint") { - w.sint64(2, msg); - } else if (typeof msg === "number") { - w.double(3, msg); - } else if (typeof msg === "string") { - w.string(4, msg); - } else if (msg instanceof Uint8Array) { - w.bytes(5, msg); - } else if (msg === void 0) { - } else { - throw impossible(msg, "Impossible type of Value"); - } -} -function Empty(_w, _msg) {} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_encode.js -function ClientMsg2(w, msg) { - if (msg.type === "hello") { - w.message(1, msg, HelloMsg); - } else if (msg.type === "request") { - w.message(2, msg, RequestMsg); - } else { - throw impossible(msg, "Impossible type of ClientMsg"); - } -} -function HelloMsg(w, msg) { - if (msg.jwt !== void 0) { - w.string(1, msg.jwt); - } -} -function RequestMsg(w, msg) { - w.int32(1, msg.requestId); - const request = msg.request; - if (request.type === "open_stream") { - w.message(2, request, OpenStreamReq); - } else if (request.type === "close_stream") { - w.message(3, request, CloseStreamReq); - } else if (request.type === "execute") { - w.message(4, request, ExecuteReq); - } else if (request.type === "batch") { - w.message(5, request, BatchReq); - } else if (request.type === "open_cursor") { - w.message(6, request, OpenCursorReq); - } else if (request.type === "close_cursor") { - w.message(7, request, CloseCursorReq); - } else if (request.type === "fetch_cursor") { - w.message(8, request, FetchCursorReq); - } else if (request.type === "sequence") { - w.message(9, request, SequenceReq); - } else if (request.type === "describe") { - w.message(10, request, DescribeReq); - } else if (request.type === "store_sql") { - w.message(11, request, StoreSqlReq); - } else if (request.type === "close_sql") { - w.message(12, request, CloseSqlReq); - } else if (request.type === "get_autocommit") { - w.message(13, request, GetAutocommitReq); - } else { - throw impossible(request, "Impossible type of Request"); - } -} -function OpenStreamReq(w, msg) { - w.int32(1, msg.streamId); -} -function CloseStreamReq(w, msg) { - w.int32(1, msg.streamId); -} -function ExecuteReq(w, msg) { - w.int32(1, msg.streamId); - w.message(2, msg.stmt, Stmt3); -} -function BatchReq(w, msg) { - w.int32(1, msg.streamId); - w.message(2, msg.batch, Batch3); -} -function OpenCursorReq(w, msg) { - w.int32(1, msg.streamId); - w.int32(2, msg.cursorId); - w.message(3, msg.batch, Batch3); -} -function CloseCursorReq(w, msg) { - w.int32(1, msg.cursorId); -} -function FetchCursorReq(w, msg) { - w.int32(1, msg.cursorId); - w.uint32(2, msg.maxCount); -} -function SequenceReq(w, msg) { - w.int32(1, msg.streamId); - if (msg.sql !== void 0) { - w.string(2, msg.sql); - } - if (msg.sqlId !== void 0) { - w.int32(3, msg.sqlId); - } -} -function DescribeReq(w, msg) { - w.int32(1, msg.streamId); - if (msg.sql !== void 0) { - w.string(2, msg.sql); - } - if (msg.sqlId !== void 0) { - w.int32(3, msg.sqlId); - } -} -function StoreSqlReq(w, msg) { - w.int32(1, msg.sqlId); - w.string(2, msg.sql); -} -function CloseSqlReq(w, msg) { - w.int32(1, msg.sqlId); -} -function GetAutocommitReq(w, msg) { - w.int32(1, msg.streamId); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/shared/json_decode.js -function Error2(obj) { - const message = string(obj["message"]); - const code = stringOpt(obj["code"]); - return { message, code }; -} -function StmtResult(obj) { - const cols = arrayObjectsMap(obj["cols"], Col); - const rows = array(obj["rows"]).map((rowObj) => - arrayObjectsMap(rowObj, Value3) - ); - const affectedRowCount = number(obj["affected_row_count"]); - const lastInsertRowidStr = stringOpt(obj["last_insert_rowid"]); - const lastInsertRowid = - lastInsertRowidStr !== void 0 ? BigInt(lastInsertRowidStr) : void 0; - return { cols, rows, affectedRowCount, lastInsertRowid }; -} -function Col(obj) { - const name = stringOpt(obj["name"]); - const decltype = stringOpt(obj["decltype"]); - return { name, decltype }; -} -function BatchResult(obj) { - const stepResults = /* @__PURE__ */ new Map(); - array(obj["step_results"]).forEach((value, i) => { - if (value !== null) { - stepResults.set(i, StmtResult(object(value))); - } - }); - const stepErrors = /* @__PURE__ */ new Map(); - array(obj["step_errors"]).forEach((value, i) => { - if (value !== null) { - stepErrors.set(i, Error2(object(value))); - } - }); - return { stepResults, stepErrors }; -} -function CursorEntry(obj) { - const type = string(obj["type"]); - if (type === "step_begin") { - const step = number(obj["step"]); - const cols = arrayObjectsMap(obj["cols"], Col); - return { type: "step_begin", step, cols }; - } else if (type === "step_end") { - const affectedRowCount = number(obj["affected_row_count"]); - const lastInsertRowidStr = stringOpt(obj["last_insert_rowid"]); - const lastInsertRowid = - lastInsertRowidStr !== void 0 ? BigInt(lastInsertRowidStr) : void 0; - return { type: "step_end", affectedRowCount, lastInsertRowid }; - } else if (type === "step_error") { - const step = number(obj["step"]); - const error = Error2(object(obj["error"])); - return { type: "step_error", step, error }; - } else if (type === "row") { - const row = arrayObjectsMap(obj["row"], Value3); - return { type: "row", row }; - } else if (type === "error") { - const error = Error2(object(obj["error"])); - return { type: "error", error }; - } else { - throw new ProtoError("Unexpected type of CursorEntry"); - } -} -function DescribeResult(obj) { - const params = arrayObjectsMap(obj["params"], DescribeParam); - const cols = arrayObjectsMap(obj["cols"], DescribeCol); - const isExplain = boolean(obj["is_explain"]); - const isReadonly = boolean(obj["is_readonly"]); - return { params, cols, isExplain, isReadonly }; -} -function DescribeParam(obj) { - const name = stringOpt(obj["name"]); - return { name }; -} -function DescribeCol(obj) { - const name = string(obj["name"]); - const decltype = stringOpt(obj["decltype"]); - return { name, decltype }; -} -function Value3(obj) { - const type = string(obj["type"]); - if (type === "null") { - return null; - } else if (type === "integer") { - const value = string(obj["value"]); - return BigInt(value); - } else if (type === "float") { - return number(obj["value"]); - } else if (type === "text") { - return string(obj["value"]); - } else if (type === "blob") { - return gBase64.toUint8Array(string(obj["base64"])); - } else { - throw new ProtoError("Unexpected type of Value"); - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/json_decode.js -function ServerMsg(obj) { - const type = string(obj["type"]); - if (type === "hello_ok") { - return { type: "hello_ok" }; - } else if (type === "hello_error") { - const error = Error2(object(obj["error"])); - return { type: "hello_error", error }; - } else if (type === "response_ok") { - const requestId = number(obj["request_id"]); - const response = Response2(object(obj["response"])); - return { type: "response_ok", requestId, response }; - } else if (type === "response_error") { - const requestId = number(obj["request_id"]); - const error = Error2(object(obj["error"])); - return { type: "response_error", requestId, error }; - } else { - throw new ProtoError("Unexpected type of ServerMsg"); - } -} -function Response2(obj) { - const type = string(obj["type"]); - if (type === "open_stream") { - return { type: "open_stream" }; - } else if (type === "close_stream") { - return { type: "close_stream" }; - } else if (type === "execute") { - const result = StmtResult(object(obj["result"])); - return { type: "execute", result }; - } else if (type === "batch") { - const result = BatchResult(object(obj["result"])); - return { type: "batch", result }; - } else if (type === "open_cursor") { - return { type: "open_cursor" }; - } else if (type === "close_cursor") { - return { type: "close_cursor" }; - } else if (type === "fetch_cursor") { - const entries = arrayObjectsMap(obj["entries"], CursorEntry); - const done = boolean(obj["done"]); - return { type: "fetch_cursor", entries, done }; - } else if (type === "sequence") { - return { type: "sequence" }; - } else if (type === "describe") { - const result = DescribeResult(object(obj["result"])); - return { type: "describe", result }; - } else if (type === "store_sql") { - return { type: "store_sql" }; - } else if (type === "close_sql") { - return { type: "close_sql" }; - } else if (type === "get_autocommit") { - const isAutocommit = boolean(obj["is_autocommit"]); - return { type: "get_autocommit", isAutocommit }; - } else { - throw new ProtoError("Unexpected type of Response"); - } -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_decode.js -var Error3 = { - default() { - return { message: "", code: void 0 }; - }, - 1(r, msg) { - msg.message = r.string(); - }, - 2(r, msg) { - msg.code = r.string(); - }, -}; -var StmtResult2 = { - default() { - return { - cols: [], - rows: [], - affectedRowCount: 0, - lastInsertRowid: void 0, - }; - }, - 1(r, msg) { - msg.cols.push(r.message(Col2)); - }, - 2(r, msg) { - msg.rows.push(r.message(Row)); - }, - 3(r, msg) { - msg.affectedRowCount = Number(r.uint64()); - }, - 4(r, msg) { - msg.lastInsertRowid = r.sint64(); - }, -}; -var Col2 = { - default() { - return { name: void 0, decltype: void 0 }; - }, - 1(r, msg) { - msg.name = r.string(); - }, - 2(r, msg) { - msg.decltype = r.string(); - }, -}; -var Row = { - default() { - return []; - }, - 1(r, msg) { - msg.push(r.message(Value4)); - }, -}; -var BatchResult2 = { - default() { - return { - stepResults: /* @__PURE__ */ new Map(), - stepErrors: /* @__PURE__ */ new Map(), - }; - }, - 1(r, msg) { - const [key, value] = r.message(BatchResultStepResult); - msg.stepResults.set(key, value); - }, - 2(r, msg) { - const [key, value] = r.message(BatchResultStepError); - msg.stepErrors.set(key, value); - }, -}; -var BatchResultStepResult = { - default() { - return [0, StmtResult2.default()]; - }, - 1(r, msg) { - msg[0] = r.uint32(); - }, - 2(r, msg) { - msg[1] = r.message(StmtResult2); - }, -}; -var BatchResultStepError = { - default() { - return [0, Error3.default()]; - }, - 1(r, msg) { - msg[0] = r.uint32(); - }, - 2(r, msg) { - msg[1] = r.message(Error3); - }, -}; -var CursorEntry2 = { - default() { - return { type: "none" }; - }, - 1(r) { - return r.message(StepBeginEntry); - }, - 2(r) { - return r.message(StepEndEntry); - }, - 3(r) { - return r.message(StepErrorEntry); - }, - 4(r) { - return { type: "row", row: r.message(Row) }; - }, - 5(r) { - return { type: "error", error: r.message(Error3) }; - }, -}; -var StepBeginEntry = { - default() { - return { type: "step_begin", step: 0, cols: [] }; - }, - 1(r, msg) { - msg.step = r.uint32(); - }, - 2(r, msg) { - msg.cols.push(r.message(Col2)); - }, -}; -var StepEndEntry = { - default() { - return { - type: "step_end", - affectedRowCount: 0, - lastInsertRowid: void 0, - }; - }, - 1(r, msg) { - msg.affectedRowCount = r.uint32(); - }, - 2(r, msg) { - msg.lastInsertRowid = r.uint64(); - }, -}; -var StepErrorEntry = { - default() { - return { - type: "step_error", - step: 0, - error: Error3.default(), - }; - }, - 1(r, msg) { - msg.step = r.uint32(); - }, - 2(r, msg) { - msg.error = r.message(Error3); - }, -}; -var DescribeResult2 = { - default() { - return { - params: [], - cols: [], - isExplain: false, - isReadonly: false, - }; - }, - 1(r, msg) { - msg.params.push(r.message(DescribeParam2)); - }, - 2(r, msg) { - msg.cols.push(r.message(DescribeCol2)); - }, - 3(r, msg) { - msg.isExplain = r.bool(); - }, - 4(r, msg) { - msg.isReadonly = r.bool(); - }, -}; -var DescribeParam2 = { - default() { - return { name: void 0 }; - }, - 1(r, msg) { - msg.name = r.string(); - }, -}; -var DescribeCol2 = { - default() { - return { name: "", decltype: void 0 }; - }, - 1(r, msg) { - msg.name = r.string(); - }, - 2(r, msg) { - msg.decltype = r.string(); - }, -}; -var Value4 = { - default() { - return void 0; - }, - 1(r) { - return null; - }, - 2(r) { - return r.sint64(); - }, - 3(r) { - return r.double(); - }, - 4(r) { - return r.string(); - }, - 5(r) { - return r.bytes(); - }, -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_decode.js -var ServerMsg2 = { - default() { - return { type: "none" }; - }, - 1(r) { - return { type: "hello_ok" }; - }, - 2(r) { - return r.message(HelloErrorMsg); - }, - 3(r) { - return r.message(ResponseOkMsg); - }, - 4(r) { - return r.message(ResponseErrorMsg); - }, -}; -var HelloErrorMsg = { - default() { - return { type: "hello_error", error: Error3.default() }; - }, - 1(r, msg) { - msg.error = r.message(Error3); - }, -}; -var ResponseErrorMsg = { - default() { - return { type: "response_error", requestId: 0, error: Error3.default() }; - }, - 1(r, msg) { - msg.requestId = r.int32(); - }, - 2(r, msg) { - msg.error = r.message(Error3); - }, -}; -var ResponseOkMsg = { - default() { - return { - type: "response_ok", - requestId: 0, - response: { type: "none" }, - }; - }, - 1(r, msg) { - msg.requestId = r.int32(); - }, - 2(r, msg) { - msg.response = { type: "open_stream" }; - }, - 3(r, msg) { - msg.response = { type: "close_stream" }; - }, - 4(r, msg) { - msg.response = r.message(ExecuteResp); - }, - 5(r, msg) { - msg.response = r.message(BatchResp); - }, - 6(r, msg) { - msg.response = { type: "open_cursor" }; - }, - 7(r, msg) { - msg.response = { type: "close_cursor" }; - }, - 8(r, msg) { - msg.response = r.message(FetchCursorResp); - }, - 9(r, msg) { - msg.response = { type: "sequence" }; - }, - 10(r, msg) { - msg.response = r.message(DescribeResp); - }, - 11(r, msg) { - msg.response = { type: "store_sql" }; - }, - 12(r, msg) { - msg.response = { type: "close_sql" }; - }, - 13(r, msg) { - msg.response = r.message(GetAutocommitResp); - }, -}; -var ExecuteResp = { - default() { - return { type: "execute", result: StmtResult2.default() }; - }, - 1(r, msg) { - msg.result = r.message(StmtResult2); - }, -}; -var BatchResp = { - default() { - return { type: "batch", result: BatchResult2.default() }; - }, - 1(r, msg) { - msg.result = r.message(BatchResult2); - }, -}; -var FetchCursorResp = { - default() { - return { type: "fetch_cursor", entries: [], done: false }; - }, - 1(r, msg) { - msg.entries.push(r.message(CursorEntry2)); - }, - 2(r, msg) { - msg.done = r.bool(); - }, -}; -var DescribeResp = { - default() { - return { type: "describe", result: DescribeResult2.default() }; - }, - 1(r, msg) { - msg.result = r.message(DescribeResult2); - }, -}; -var GetAutocommitResp = { - default() { - return { type: "get_autocommit", isAutocommit: false }; - }, - 1(r, msg) { - msg.isAutocommit = r.bool(); - }, -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/ws/client.js -var subprotocolsV2 = /* @__PURE__ */ new Map([ - ["hrana2", { version: 2, encoding: "json" }], - ["hrana1", { version: 1, encoding: "json" }], -]); -var subprotocolsV3 = /* @__PURE__ */ new Map([ - ["hrana3-protobuf", { version: 3, encoding: "protobuf" }], - ["hrana3", { version: 3, encoding: "json" }], - ["hrana2", { version: 2, encoding: "json" }], - ["hrana1", { version: 1, encoding: "json" }], -]); -var WsClient = class extends Client { - #socket; - // List of callbacks that we queue until the socket transitions from the CONNECTING to the OPEN state. - #openCallbacks; - // Have we already transitioned from CONNECTING to OPEN and fired the callbacks in #openCallbacks? - #opened; - // Stores the error that caused us to close the client (and the socket). If we are not closed, this is - // `undefined`. - #closed; - // Have we received a response to our "hello" from the server? - #recvdHello; - // Subprotocol negotiated with the server. It is only available after the socket transitions to the OPEN - // state. - #subprotocol; - // Has the `getVersion()` function been called? This is only used to validate that the API is used - // correctly. - #getVersionCalled; - // A map from request id to the responses that we expect to receive from the server. - #responseMap; - // An allocator of request ids. - #requestIdAlloc; - // An allocator of stream ids. - /** @private */ - _streamIdAlloc; - // An allocator of cursor ids. - /** @private */ - _cursorIdAlloc; - // An allocator of SQL text ids. - #sqlIdAlloc; - /** @private */ - constructor(socket, jwt) { - super(); - this.#socket = socket; - this.#openCallbacks = []; - this.#opened = false; - this.#closed = void 0; - this.#recvdHello = false; - this.#subprotocol = void 0; - this.#getVersionCalled = false; - this.#responseMap = /* @__PURE__ */ new Map(); - this.#requestIdAlloc = new IdAlloc(); - this._streamIdAlloc = new IdAlloc(); - this._cursorIdAlloc = new IdAlloc(); - this.#sqlIdAlloc = new IdAlloc(); - this.#socket.binaryType = "arraybuffer"; - this.#socket.addEventListener("open", () => this.#onSocketOpen()); - this.#socket.addEventListener("close", (event) => - this.#onSocketClose(event) - ); - this.#socket.addEventListener("error", (event) => - this.#onSocketError(event) - ); - this.#socket.addEventListener("message", (event) => - this.#onSocketMessage(event) - ); - this.#send({ type: "hello", jwt }); - } - // Send (or enqueue to send) a message to the server. - #send(msg) { - if (this.#closed !== void 0) { - throw new InternalError("Trying to send a message on a closed client"); - } - if (this.#opened) { - this.#sendToSocket(msg); - } else { - const openCallback = () => this.#sendToSocket(msg); - const errorCallback = () => void 0; - this.#openCallbacks.push({ openCallback, errorCallback }); - } - } - // The socket transitioned from CONNECTING to OPEN - #onSocketOpen() { - const protocol = this.#socket.protocol; - if (protocol === void 0) { - this.#setClosed( - new ClientError( - "The `WebSocket.protocol` property is undefined. This most likely means that the WebSocket implementation provided by the environment is broken. If you are using Miniflare 2, please update to Miniflare 3, which fixes this problem." - ) - ); - return; - } else if (protocol === "") { - this.#subprotocol = { version: 1, encoding: "json" }; - } else { - this.#subprotocol = subprotocolsV3.get(protocol); - if (this.#subprotocol === void 0) { - this.#setClosed( - new ProtoError( - `Unrecognized WebSocket subprotocol: ${JSON.stringify(protocol)}` - ) - ); - return; - } - } - for (const callbacks of this.#openCallbacks) { - callbacks.openCallback(); - } - this.#openCallbacks.length = 0; - this.#opened = true; - } - #sendToSocket(msg) { - const encoding = this.#subprotocol.encoding; - if (encoding === "json") { - const jsonMsg = writeJsonObject(msg, ClientMsg); - this.#socket.send(jsonMsg); - } else if (encoding === "protobuf") { - const protobufMsg = writeProtobufMessage(msg, ClientMsg2); - this.#socket.send(protobufMsg); - } else { - throw impossible(encoding, "Impossible encoding"); - } - } - /** Get the protocol version negotiated with the server, possibly waiting until the socket is open. */ - getVersion() { - return new Promise((versionCallback, errorCallback) => { - this.#getVersionCalled = true; - if (this.#closed !== void 0) { - errorCallback(this.#closed); - } else if (!this.#opened) { - const openCallback = () => versionCallback(this.#subprotocol.version); - this.#openCallbacks.push({ openCallback, errorCallback }); - } else { - versionCallback(this.#subprotocol.version); - } - }); - } - // Make sure that the negotiated version is at least `minVersion`. - /** @private */ - _ensureVersion(minVersion, feature) { - if (this.#subprotocol === void 0 || !this.#getVersionCalled) { - throw new ProtocolVersionError( - `${feature} is supported only on protocol version ${minVersion} and higher, but the version supported by the WebSocket server is not yet known. Use Client.getVersion() to wait until the version is available.` - ); - } else if (this.#subprotocol.version < minVersion) { - throw new ProtocolVersionError( - `${feature} is supported on protocol version ${minVersion} and higher, but the WebSocket server only supports version ${this.#subprotocol.version}` - ); - } - } - // Send a request to the server and invoke a callback when we get the response. - /** @private */ - _sendRequest(request, callbacks) { - if (this.#closed !== void 0) { - callbacks.errorCallback( - new ClosedError("Client is closed", this.#closed) - ); - return; - } - const requestId = this.#requestIdAlloc.alloc(); - this.#responseMap.set(requestId, { ...callbacks, type: request.type }); - this.#send({ type: "request", requestId, request }); - } - // The socket encountered an error. - #onSocketError(event) { - const eventMessage = event.message; - const message = eventMessage ?? "WebSocket was closed due to an error"; - this.#setClosed(new WebSocketError(message)); - } - // The socket was closed. - #onSocketClose(event) { - let message = `WebSocket was closed with code ${event.code}`; - if (event.reason) { - message += `: ${event.reason}`; - } - this.#setClosed(new WebSocketError(message)); - } - // Close the client with the given error. - #setClosed(error) { - if (this.#closed !== void 0) { - return; - } - this.#closed = error; - for (const callbacks of this.#openCallbacks) { - callbacks.errorCallback(error); - } - this.#openCallbacks.length = 0; - for (const [requestId, responseState] of this.#responseMap.entries()) { - responseState.errorCallback(error); - this.#requestIdAlloc.free(requestId); - } - this.#responseMap.clear(); - this.#socket.close(); - } - // We received a message from the socket. - #onSocketMessage(event) { - if (this.#closed !== void 0) { - return; - } - try { - let msg; - const encoding = this.#subprotocol.encoding; - if (encoding === "json") { - if (typeof event.data !== "string") { - this.#socket.close( - 3003, - "Only text messages are accepted with JSON encoding" - ); - this.#setClosed( - new ProtoError( - "Received non-text message from server with JSON encoding" - ) - ); - return; - } - msg = readJsonObject(JSON.parse(event.data), ServerMsg); - } else if (encoding === "protobuf") { - if (!(event.data instanceof ArrayBuffer)) { - this.#socket.close( - 3003, - "Only binary messages are accepted with Protobuf encoding" - ); - this.#setClosed( - new ProtoError( - "Received non-binary message from server with Protobuf encoding" - ) - ); - return; - } - msg = readProtobufMessage(new Uint8Array(event.data), ServerMsg2); - } else { - throw impossible(encoding, "Impossible encoding"); - } - this.#handleMsg(msg); - } catch (e) { - this.#socket.close(3007, "Could not handle message"); - this.#setClosed(e); - } - } - // Handle a message from the server. - #handleMsg(msg) { - if (msg.type === "none") { - throw new ProtoError("Received an unrecognized ServerMsg"); - } else if (msg.type === "hello_ok" || msg.type === "hello_error") { - if (this.#recvdHello) { - throw new ProtoError("Received a duplicated hello response"); - } - this.#recvdHello = true; - if (msg.type === "hello_error") { - throw errorFromProto(msg.error); - } - return; - } else if (!this.#recvdHello) { - throw new ProtoError( - "Received a non-hello message before a hello response" - ); - } - if (msg.type === "response_ok") { - const requestId = msg.requestId; - const responseState = this.#responseMap.get(requestId); - this.#responseMap.delete(requestId); - if (responseState === void 0) { - throw new ProtoError("Received unexpected OK response"); - } - this.#requestIdAlloc.free(requestId); - try { - if (responseState.type !== msg.response.type) { - console.dir({ responseState, msg }); - throw new ProtoError("Received unexpected type of response"); - } - responseState.responseCallback(msg.response); - } catch (e) { - responseState.errorCallback(e); - throw e; - } - } else if (msg.type === "response_error") { - const requestId = msg.requestId; - const responseState = this.#responseMap.get(requestId); - this.#responseMap.delete(requestId); - if (responseState === void 0) { - throw new ProtoError("Received unexpected error response"); - } - this.#requestIdAlloc.free(requestId); - responseState.errorCallback(errorFromProto(msg.error)); - } else { - throw impossible(msg, "Impossible ServerMsg type"); - } - } - /** Open a {@link WsStream}, a stream for executing SQL statements. */ - openStream() { - return WsStream.open(this); - } - /** Cache a SQL text on the server. This requires protocol version 2 or higher. */ - storeSql(sql2) { - this._ensureVersion(2, "storeSql()"); - const sqlId = this.#sqlIdAlloc.alloc(); - const sqlObj = new Sql(this, sqlId); - const responseCallback = () => void 0; - const errorCallback = (e) => sqlObj._setClosed(e); - const request = { type: "store_sql", sqlId, sql: sql2 }; - this._sendRequest(request, { responseCallback, errorCallback }); - return sqlObj; - } - /** @private */ - _closeSql(sqlId) { - if (this.#closed !== void 0) { - return; - } - const responseCallback = () => this.#sqlIdAlloc.free(sqlId); - const errorCallback = (e) => this.#setClosed(e); - const request = { type: "close_sql", sqlId }; - this._sendRequest(request, { responseCallback, errorCallback }); - } - /** Close the client and the WebSocket. */ - close() { - this.#setClosed(new ClientError("Client was manually closed")); - } - /** True if the client is closed. */ - get closed() { - return this.#closed !== void 0; - } -}; - -// ../../node_modules/.pnpm/@libsql+isomorphic-fetch@0.1.10/node_modules/@libsql/isomorphic-fetch/web.js -var _fetch = fetch; -var _Request = Request; -var _Headers = Headers; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/queue_microtask.js -var _queueMicrotask; -if (typeof queueMicrotask !== "undefined") { - _queueMicrotask = queueMicrotask; -} else { - const resolved = Promise.resolve(); - _queueMicrotask = (callback) => { - resolved.then(callback); - }; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/byte_queue.js -var ByteQueue = class { - #array; - #shiftPos; - #pushPos; - constructor(initialCap) { - this.#array = new Uint8Array(new ArrayBuffer(initialCap)); - this.#shiftPos = 0; - this.#pushPos = 0; - } - get length() { - return this.#pushPos - this.#shiftPos; - } - data() { - return this.#array.slice(this.#shiftPos, this.#pushPos); - } - push(chunk) { - this.#ensurePush(chunk.byteLength); - this.#array.set(chunk, this.#pushPos); - this.#pushPos += chunk.byteLength; - } - #ensurePush(pushLength) { - if (this.#pushPos + pushLength <= this.#array.byteLength) { - return; - } - const filledLength = this.#pushPos - this.#shiftPos; - if ( - filledLength + pushLength <= this.#array.byteLength && - 2 * this.#pushPos >= this.#array.byteLength - ) { - this.#array.copyWithin(0, this.#shiftPos, this.#pushPos); - } else { - let newCap = this.#array.byteLength; - do { - newCap *= 2; - } while (filledLength + pushLength > newCap); - const newArray = new Uint8Array(new ArrayBuffer(newCap)); - newArray.set(this.#array.slice(this.#shiftPos, this.#pushPos), 0); - this.#array = newArray; - } - this.#pushPos = filledLength; - this.#shiftPos = 0; - } - shift(length) { - this.#shiftPos += length; - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/json_decode.js -function PipelineRespBody(obj) { - const baton = stringOpt(obj["baton"]); - const baseUrl = stringOpt(obj["base_url"]); - const results = arrayObjectsMap(obj["results"], StreamResult); - return { baton, baseUrl, results }; -} -function StreamResult(obj) { - const type = string(obj["type"]); - if (type === "ok") { - const response = StreamResponse(object(obj["response"])); - return { type: "ok", response }; - } else if (type === "error") { - const error = Error2(object(obj["error"])); - return { type: "error", error }; - } else { - throw new ProtoError("Unexpected type of StreamResult"); - } -} -function StreamResponse(obj) { - const type = string(obj["type"]); - if (type === "close") { - return { type: "close" }; - } else if (type === "execute") { - const result = StmtResult(object(obj["result"])); - return { type: "execute", result }; - } else if (type === "batch") { - const result = BatchResult(object(obj["result"])); - return { type: "batch", result }; - } else if (type === "sequence") { - return { type: "sequence" }; - } else if (type === "describe") { - const result = DescribeResult(object(obj["result"])); - return { type: "describe", result }; - } else if (type === "store_sql") { - return { type: "store_sql" }; - } else if (type === "close_sql") { - return { type: "close_sql" }; - } else if (type === "get_autocommit") { - const isAutocommit = boolean(obj["is_autocommit"]); - return { type: "get_autocommit", isAutocommit }; - } else { - throw new ProtoError("Unexpected type of StreamResponse"); - } -} -function CursorRespBody(obj) { - const baton = stringOpt(obj["baton"]); - const baseUrl = stringOpt(obj["base_url"]); - return { baton, baseUrl }; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/protobuf_decode.js -var PipelineRespBody2 = { - default() { - return { baton: void 0, baseUrl: void 0, results: [] }; - }, - 1(r, msg) { - msg.baton = r.string(); - }, - 2(r, msg) { - msg.baseUrl = r.string(); - }, - 3(r, msg) { - msg.results.push(r.message(StreamResult2)); - }, -}; -var StreamResult2 = { - default() { - return { type: "none" }; - }, - 1(r) { - return { type: "ok", response: r.message(StreamResponse2) }; - }, - 2(r) { - return { type: "error", error: r.message(Error3) }; - }, -}; -var StreamResponse2 = { - default() { - return { type: "none" }; - }, - 1(r) { - return { type: "close" }; - }, - 2(r) { - return r.message(ExecuteStreamResp); - }, - 3(r) { - return r.message(BatchStreamResp); - }, - 4(r) { - return { type: "sequence" }; - }, - 5(r) { - return r.message(DescribeStreamResp); - }, - 6(r) { - return { type: "store_sql" }; - }, - 7(r) { - return { type: "close_sql" }; - }, - 8(r) { - return r.message(GetAutocommitStreamResp); - }, -}; -var ExecuteStreamResp = { - default() { - return { type: "execute", result: StmtResult2.default() }; - }, - 1(r, msg) { - msg.result = r.message(StmtResult2); - }, -}; -var BatchStreamResp = { - default() { - return { type: "batch", result: BatchResult2.default() }; - }, - 1(r, msg) { - msg.result = r.message(BatchResult2); - }, -}; -var DescribeStreamResp = { - default() { - return { type: "describe", result: DescribeResult2.default() }; - }, - 1(r, msg) { - msg.result = r.message(DescribeResult2); - }, -}; -var GetAutocommitStreamResp = { - default() { - return { type: "get_autocommit", isAutocommit: false }; - }, - 1(r, msg) { - msg.isAutocommit = r.bool(); - }, -}; -var CursorRespBody2 = { - default() { - return { baton: void 0, baseUrl: void 0 }; - }, - 1(r, msg) { - msg.baton = r.string(); - }, - 2(r, msg) { - msg.baseUrl = r.string(); - }, -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/cursor.js -var HttpCursor = class extends Cursor { - #stream; - #encoding; - #reader; - #queue; - #closed; - #done; - /** @private */ - constructor(stream, encoding) { - super(); - this.#stream = stream; - this.#encoding = encoding; - this.#reader = void 0; - this.#queue = new ByteQueue(16 * 1024); - this.#closed = void 0; - this.#done = false; - } - async open(response) { - if (response.body === null) { - throw new ProtoError("No response body for cursor request"); - } - this.#reader = response.body.getReader(); - const respBody = await this.#nextItem(CursorRespBody, CursorRespBody2); - if (respBody === void 0) { - throw new ProtoError("Empty response to cursor request"); - } - return respBody; - } - /** Fetch the next entry from the cursor. */ - next() { - return this.#nextItem(CursorEntry, CursorEntry2); - } - /** Close the cursor. */ - close() { - this._setClosed(new ClientError("Cursor was manually closed")); - } - /** @private */ - _setClosed(error) { - if (this.#closed !== void 0) { - return; - } - this.#closed = error; - this.#stream._cursorClosed(this); - if (this.#reader !== void 0) { - this.#reader.cancel(); - } - } - /** True if the cursor is closed. */ - get closed() { - return this.#closed !== void 0; - } - async #nextItem(jsonFun, protobufDef) { - for (;;) { - if (this.#done) { - return void 0; - } else if (this.#closed !== void 0) { - throw new ClosedError("Cursor is closed", this.#closed); - } - if (this.#encoding === "json") { - const jsonData = this.#parseItemJson(); - if (jsonData !== void 0) { - const jsonText = new TextDecoder().decode(jsonData); - const jsonValue = JSON.parse(jsonText); - return readJsonObject(jsonValue, jsonFun); - } - } else if (this.#encoding === "protobuf") { - const protobufData = this.#parseItemProtobuf(); - if (protobufData !== void 0) { - return readProtobufMessage(protobufData, protobufDef); - } - } else { - throw impossible(this.#encoding, "Impossible encoding"); - } - if (this.#reader === void 0) { - throw new InternalError( - "Attempted to read from HTTP cursor before it was opened" - ); - } - const { value, done } = await this.#reader.read(); - if (done && this.#queue.length === 0) { - this.#done = true; - } else if (done) { - throw new ProtoError("Unexpected end of cursor stream"); - } else { - this.#queue.push(value); - } - } - } - #parseItemJson() { - const data = this.#queue.data(); - const newlineByte = 10; - const newlinePos = data.indexOf(newlineByte); - if (newlinePos < 0) { - return void 0; - } - const jsonData = data.slice(0, newlinePos); - this.#queue.shift(newlinePos + 1); - return jsonData; - } - #parseItemProtobuf() { - const data = this.#queue.data(); - let varintValue = 0; - let varintLength = 0; - for (;;) { - if (varintLength >= data.byteLength) { - return void 0; - } - const byte = data[varintLength]; - varintValue |= (byte & 127) << (7 * varintLength); - varintLength += 1; - if (!(byte & 128)) { - break; - } - } - if (data.byteLength < varintLength + varintValue) { - return void 0; - } - const protobufData = data.slice(varintLength, varintLength + varintValue); - this.#queue.shift(varintLength + varintValue); - return protobufData; - } -}; - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/json_encode.js -function PipelineReqBody(w, msg) { - if (msg.baton !== void 0) { - w.string("baton", msg.baton); - } - w.arrayObjects("requests", msg.requests, StreamRequest); -} -function StreamRequest(w, msg) { - w.stringRaw("type", msg.type); - if (msg.type === "close") { - } else if (msg.type === "execute") { - w.object("stmt", msg.stmt, Stmt2); - } else if (msg.type === "batch") { - w.object("batch", msg.batch, Batch2); - } else if (msg.type === "sequence") { - if (msg.sql !== void 0) { - w.string("sql", msg.sql); - } - if (msg.sqlId !== void 0) { - w.number("sql_id", msg.sqlId); - } - } else if (msg.type === "describe") { - if (msg.sql !== void 0) { - w.string("sql", msg.sql); - } - if (msg.sqlId !== void 0) { - w.number("sql_id", msg.sqlId); - } - } else if (msg.type === "store_sql") { - w.number("sql_id", msg.sqlId); - w.string("sql", msg.sql); - } else if (msg.type === "close_sql") { - w.number("sql_id", msg.sqlId); - } else if (msg.type === "get_autocommit") { - } else { - throw impossible(msg, "Impossible type of StreamRequest"); - } -} -function CursorReqBody(w, msg) { - if (msg.baton !== void 0) { - w.string("baton", msg.baton); - } - w.object("batch", msg.batch, Batch2); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/protobuf_encode.js -function PipelineReqBody2(w, msg) { - if (msg.baton !== void 0) { - w.string(1, msg.baton); - } - for (const req of msg.requests) { - w.message(2, req, StreamRequest2); - } -} -function StreamRequest2(w, msg) { - if (msg.type === "close") { - w.message(1, msg, CloseStreamReq2); - } else if (msg.type === "execute") { - w.message(2, msg, ExecuteStreamReq); - } else if (msg.type === "batch") { - w.message(3, msg, BatchStreamReq); - } else if (msg.type === "sequence") { - w.message(4, msg, SequenceStreamReq); - } else if (msg.type === "describe") { - w.message(5, msg, DescribeStreamReq); - } else if (msg.type === "store_sql") { - w.message(6, msg, StoreSqlStreamReq); - } else if (msg.type === "close_sql") { - w.message(7, msg, CloseSqlStreamReq); - } else if (msg.type === "get_autocommit") { - w.message(8, msg, GetAutocommitStreamReq); - } else { - throw impossible(msg, "Impossible type of StreamRequest"); - } -} -function CloseStreamReq2(_w, _msg) {} -function ExecuteStreamReq(w, msg) { - w.message(1, msg.stmt, Stmt3); -} -function BatchStreamReq(w, msg) { - w.message(1, msg.batch, Batch3); -} -function SequenceStreamReq(w, msg) { - if (msg.sql !== void 0) { - w.string(1, msg.sql); - } - if (msg.sqlId !== void 0) { - w.int32(2, msg.sqlId); - } -} -function DescribeStreamReq(w, msg) { - if (msg.sql !== void 0) { - w.string(1, msg.sql); - } - if (msg.sqlId !== void 0) { - w.int32(2, msg.sqlId); - } -} -function StoreSqlStreamReq(w, msg) { - w.int32(1, msg.sqlId); - w.string(2, msg.sql); -} -function CloseSqlStreamReq(w, msg) { - w.int32(1, msg.sqlId); -} -function GetAutocommitStreamReq(_w, _msg) {} -function CursorReqBody2(w, msg) { - if (msg.baton !== void 0) { - w.string(1, msg.baton); - } - w.message(2, msg.batch, Batch3); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/stream.js -var HttpStream = class extends Stream { - #client; - #baseUrl; - #jwt; - #fetch; - #baton; - #queue; - #flushing; - #cursor; - #closing; - #closeQueued; - #closed; - #sqlIdAlloc; - /** @private */ - constructor(client, baseUrl, jwt, customFetch) { - super(client.intMode); - this.#client = client; - this.#baseUrl = baseUrl.toString(); - this.#jwt = jwt; - this.#fetch = customFetch; - this.#baton = void 0; - this.#queue = new Queue(); - this.#flushing = false; - this.#closing = false; - this.#closeQueued = false; - this.#closed = void 0; - this.#sqlIdAlloc = new IdAlloc(); - } - /** Get the {@link HttpClient} object that this stream belongs to. */ - client() { - return this.#client; - } - /** @private */ - _sqlOwner() { - return this; - } - /** Cache a SQL text on the server. */ - storeSql(sql2) { - const sqlId = this.#sqlIdAlloc.alloc(); - this.#sendStreamRequest({ type: "store_sql", sqlId, sql: sql2 }).then( - () => void 0, - (error) => this._setClosed(error) - ); - return new Sql(this, sqlId); - } - /** @private */ - _closeSql(sqlId) { - if (this.#closed !== void 0) { - return; - } - this.#sendStreamRequest({ type: "close_sql", sqlId }).then( - () => this.#sqlIdAlloc.free(sqlId), - (error) => this._setClosed(error) - ); - } - /** @private */ - _execute(stmt) { - return this.#sendStreamRequest({ type: "execute", stmt }).then( - (response) => { - return response.result; - } - ); - } - /** @private */ - _batch(batch) { - return this.#sendStreamRequest({ type: "batch", batch }).then( - (response) => { - return response.result; - } - ); - } - /** @private */ - _describe(protoSql) { - return this.#sendStreamRequest({ - type: "describe", - sql: protoSql.sql, - sqlId: protoSql.sqlId, - }).then((response) => { - return response.result; - }); - } - /** @private */ - _sequence(protoSql) { - return this.#sendStreamRequest({ - type: "sequence", - sql: protoSql.sql, - sqlId: protoSql.sqlId, - }).then((_response) => { - return void 0; - }); - } - /** Check whether the SQL connection underlying this stream is in autocommit state (i.e., outside of an - * explicit transaction). This requires protocol version 3 or higher. - */ - getAutocommit() { - this.#client._ensureVersion(3, "getAutocommit()"); - return this.#sendStreamRequest({ - type: "get_autocommit", - }).then((response) => { - return response.isAutocommit; - }); - } - #sendStreamRequest(request) { - return new Promise((responseCallback, errorCallback) => { - this.#pushToQueue({ - type: "pipeline", - request, - responseCallback, - errorCallback, - }); - }); - } - /** @private */ - _openCursor(batch) { - return new Promise((cursorCallback, errorCallback) => { - this.#pushToQueue({ - type: "cursor", - batch, - cursorCallback, - errorCallback, - }); - }); - } - /** @private */ - _cursorClosed(cursor) { - if (cursor !== this.#cursor) { - throw new InternalError( - "Cursor was closed, but it was not associated with the stream" - ); - } - this.#cursor = void 0; - _queueMicrotask(() => this.#flushQueue()); - } - /** Immediately close the stream. */ - close() { - this._setClosed(new ClientError("Stream was manually closed")); - } - /** Gracefully close the stream. */ - closeGracefully() { - this.#closing = true; - _queueMicrotask(() => this.#flushQueue()); - } - /** True if the stream is closed. */ - get closed() { - return this.#closed !== void 0 || this.#closing; - } - /** @private */ - _setClosed(error) { - if (this.#closed !== void 0) { - return; - } - this.#closed = error; - if (this.#cursor !== void 0) { - this.#cursor._setClosed(error); - } - this.#client._streamClosed(this); - for (;;) { - const entry = this.#queue.shift(); - if (entry !== void 0) { - entry.errorCallback(error); - } else { - break; - } - } - if ((this.#baton !== void 0 || this.#flushing) && !this.#closeQueued) { - this.#queue.push({ - type: "pipeline", - request: { type: "close" }, - responseCallback: () => void 0, - errorCallback: () => void 0, - }); - this.#closeQueued = true; - _queueMicrotask(() => this.#flushQueue()); - } - } - #pushToQueue(entry) { - if (this.#closed !== void 0) { - throw new ClosedError("Stream is closed", this.#closed); - } else if (this.#closing) { - throw new ClosedError("Stream is closing", void 0); - } else { - this.#queue.push(entry); - _queueMicrotask(() => this.#flushQueue()); - } - } - #flushQueue() { - if (this.#flushing || this.#cursor !== void 0) { - return; - } - if (this.#closing && this.#queue.length === 0) { - this._setClosed(new ClientError("Stream was gracefully closed")); - return; - } - const endpoint = this.#client._endpoint; - if (endpoint === void 0) { - this.#client._endpointPromise.then( - () => this.#flushQueue(), - (error) => this._setClosed(error) - ); - return; - } - const firstEntry = this.#queue.shift(); - if (firstEntry === void 0) { - return; - } else if (firstEntry.type === "pipeline") { - const pipeline = [firstEntry]; - for (;;) { - const entry = this.#queue.first(); - if (entry !== void 0 && entry.type === "pipeline") { - pipeline.push(entry); - this.#queue.shift(); - } else if (entry === void 0 && this.#closing && !this.#closeQueued) { - pipeline.push({ - type: "pipeline", - request: { type: "close" }, - responseCallback: () => void 0, - errorCallback: () => void 0, - }); - this.#closeQueued = true; - break; - } else { - break; - } - } - this.#flushPipeline(endpoint, pipeline); - } else if (firstEntry.type === "cursor") { - this.#flushCursor(endpoint, firstEntry); - } else { - throw impossible(firstEntry, "Impossible type of QueueEntry"); - } - } - #flushPipeline(endpoint, pipeline) { - this.#flush( - () => this.#createPipelineRequest(pipeline, endpoint), - (resp) => decodePipelineResponse(resp, endpoint.encoding), - (respBody) => respBody.baton, - (respBody) => respBody.baseUrl, - (respBody) => handlePipelineResponse(pipeline, respBody), - (error) => pipeline.forEach((entry) => entry.errorCallback(error)) - ); - } - #flushCursor(endpoint, entry) { - const cursor = new HttpCursor(this, endpoint.encoding); - this.#cursor = cursor; - this.#flush( - () => this.#createCursorRequest(entry, endpoint), - (resp) => cursor.open(resp), - (respBody) => respBody.baton, - (respBody) => respBody.baseUrl, - (_respBody) => entry.cursorCallback(cursor), - (error) => entry.errorCallback(error) - ); - } - #flush( - createRequest, - decodeResponse, - getBaton, - getBaseUrl, - handleResponse, - handleError - ) { - let promise; - try { - const request = createRequest(); - const fetch2 = this.#fetch; - promise = fetch2(request); - } catch (error) { - promise = Promise.reject(error); - } - this.#flushing = true; - promise - .then((resp) => { - if (!resp.ok) { - return errorFromResponse(resp).then((error) => { - throw error; - }); - } - return decodeResponse(resp); - }) - .then((r) => { - this.#baton = getBaton(r); - this.#baseUrl = getBaseUrl(r) ?? this.#baseUrl; - handleResponse(r); - }) - .catch((error) => { - this._setClosed(error); - handleError(error); - }) - .finally(() => { - this.#flushing = false; - this.#flushQueue(); - }); - } - #createPipelineRequest(pipeline, endpoint) { - return this.#createRequest( - new URL(endpoint.pipelinePath, this.#baseUrl), - { - baton: this.#baton, - requests: pipeline.map((entry) => entry.request), - }, - endpoint.encoding, - PipelineReqBody, - PipelineReqBody2 - ); - } - #createCursorRequest(entry, endpoint) { - if (endpoint.cursorPath === void 0) { - throw new ProtocolVersionError( - `Cursors are supported only on protocol version 3 and higher, but the HTTP server only supports version ${endpoint.version}.` - ); - } - return this.#createRequest( - new URL(endpoint.cursorPath, this.#baseUrl), - { - baton: this.#baton, - batch: entry.batch, - }, - endpoint.encoding, - CursorReqBody, - CursorReqBody2 - ); - } - #createRequest(url, reqBody, encoding, jsonFun, protobufFun) { - let bodyData; - let contentType; - if (encoding === "json") { - bodyData = writeJsonObject(reqBody, jsonFun); - contentType = "application/json"; - } else if (encoding === "protobuf") { - bodyData = writeProtobufMessage(reqBody, protobufFun); - contentType = "application/x-protobuf"; - } else { - throw impossible(encoding, "Impossible encoding"); - } - const headers = new _Headers(); - headers.set("content-type", contentType); - if (this.#jwt !== void 0) { - headers.set("authorization", `Bearer ${this.#jwt}`); - } - return new _Request(url.toString(), { - method: "POST", - headers, - body: bodyData, - }); - } -}; -function handlePipelineResponse(pipeline, respBody) { - if (respBody.results.length !== pipeline.length) { - throw new ProtoError( - "Server returned unexpected number of pipeline results" - ); - } - for (let i = 0; i < pipeline.length; ++i) { - const result = respBody.results[i]; - const entry = pipeline[i]; - if (result.type === "ok") { - if (result.response.type !== entry.request.type) { - throw new ProtoError("Received unexpected type of response"); - } - entry.responseCallback(result.response); - } else if (result.type === "error") { - entry.errorCallback(errorFromProto(result.error)); - } else if (result.type === "none") { - throw new ProtoError("Received unrecognized type of StreamResult"); - } else { - throw impossible(result, "Received impossible type of StreamResult"); - } - } -} -async function decodePipelineResponse(resp, encoding) { - if (encoding === "json") { - const respJson = await resp.json(); - return readJsonObject(respJson, PipelineRespBody); - } else if (encoding === "protobuf") { - const respData = await resp.arrayBuffer(); - return readProtobufMessage(new Uint8Array(respData), PipelineRespBody2); - } else { - throw impossible(encoding, "Impossible encoding"); - } -} -async function errorFromResponse(resp) { - const respType = resp.headers.get("content-type") ?? "text/plain"; - if (respType === "application/json") { - const respBody = await resp.json(); - if ("message" in respBody) { - return errorFromProto(respBody); - } - } - let message = `Server returned HTTP status ${resp.status}`; - if (respType === "text/plain") { - const respBody = (await resp.text()).trim(); - if (respBody !== "") { - message += `: ${respBody}`; - } - } - if (resp.status === 404) { - message += - ". It seems that the libsql server is outdated, please try updating the database."; - } - return new HttpServerError(message, resp.status); -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/http/client.js -var checkEndpoints = [ - { - versionPath: "v3-protobuf", - pipelinePath: "v3-protobuf/pipeline", - cursorPath: "v3-protobuf/cursor", - version: 3, - encoding: "protobuf", - }, - /* - { - versionPath: "v3", - pipelinePath: "v3/pipeline", - cursorPath: "v3/cursor", - version: 3, - encoding: "json", - }, - */ -]; -var fallbackEndpoint = { - versionPath: "v2", - pipelinePath: "v2/pipeline", - cursorPath: void 0, - version: 2, - encoding: "json", -}; -var HttpClient = class extends Client { - #url; - #jwt; - #fetch; - #closed; - #streams; - /** @private */ - _endpointPromise; - /** @private */ - _endpoint; - /** @private */ - constructor(url, jwt, customFetch, protocolVersion = 2) { - super(); - this.#url = url; - this.#jwt = jwt; - this.#fetch = customFetch ?? _fetch; - this.#closed = void 0; - this.#streams = /* @__PURE__ */ new Set(); - if (protocolVersion == 3) { - this._endpointPromise = findEndpoint(this.#fetch, this.#url); - this._endpointPromise.then( - (endpoint) => (this._endpoint = endpoint), - (error) => this.#setClosed(error) - ); - } else { - this._endpointPromise = Promise.resolve(fallbackEndpoint); - this._endpointPromise.then( - (endpoint) => (this._endpoint = endpoint), - (error) => this.#setClosed(error) - ); - } - } - /** Get the protocol version supported by the server. */ - async getVersion() { - if (this._endpoint !== void 0) { - return this._endpoint.version; - } - return (await this._endpointPromise).version; - } - // Make sure that the negotiated version is at least `minVersion`. - /** @private */ - _ensureVersion(minVersion, feature) { - if (minVersion <= fallbackEndpoint.version) { - return; - } else if (this._endpoint === void 0) { - throw new ProtocolVersionError( - `${feature} is supported only on protocol version ${minVersion} and higher, but the version supported by the HTTP server is not yet known. Use Client.getVersion() to wait until the version is available.` - ); - } else if (this._endpoint.version < minVersion) { - throw new ProtocolVersionError( - `${feature} is supported only on protocol version ${minVersion} and higher, but the HTTP server only supports version ${this._endpoint.version}.` - ); - } - } - /** Open a {@link HttpStream}, a stream for executing SQL statements. */ - openStream() { - if (this.#closed !== void 0) { - throw new ClosedError("Client is closed", this.#closed); - } - const stream = new HttpStream(this, this.#url, this.#jwt, this.#fetch); - this.#streams.add(stream); - return stream; - } - /** @private */ - _streamClosed(stream) { - this.#streams.delete(stream); - } - /** Close the client and all its streams. */ - close() { - this.#setClosed(new ClientError("Client was manually closed")); - } - /** True if the client is closed. */ - get closed() { - return this.#closed !== void 0; - } - #setClosed(error) { - if (this.#closed !== void 0) { - return; - } - this.#closed = error; - for (const stream of Array.from(this.#streams)) { - stream._setClosed(new ClosedError("Client was closed", error)); - } - } -}; -async function findEndpoint(customFetch, clientUrl) { - const fetch2 = customFetch; - for (const endpoint of checkEndpoints) { - const url = new URL(endpoint.versionPath, clientUrl); - const request = new _Request(url.toString(), { method: "GET" }); - const response = await fetch2(request); - await response.arrayBuffer(); - if (response.ok) { - return endpoint; - } - } - return fallbackEndpoint; -} - -// ../../node_modules/.pnpm/@libsql+hrana-client@0.5.5/node_modules/@libsql/hrana-client/lib-esm/index.js -function openWs(url, jwt, protocolVersion = 2) { - if (typeof _WebSocket === "undefined") { - throw new WebSocketUnsupportedError( - "WebSockets are not supported in this environment" - ); - } - var subprotocols = void 0; - if (protocolVersion == 3) { - subprotocols = Array.from(subprotocolsV3.keys()); - } else { - subprotocols = Array.from(subprotocolsV2.keys()); - } - const socket = new _WebSocket(url, subprotocols); - return new WsClient(socket, jwt); -} -function openHttp(url, jwt, customFetch, protocolVersion = 2) { - return new HttpClient( - url instanceof URL ? url : new URL(url), - jwt, - customFetch, - protocolVersion - ); -} - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/hrana.js -var HranaTransaction = class { - #mode; - #version; - // Promise that is resolved when the BEGIN statement completes, or `undefined` if we haven't executed the - // BEGIN statement yet. - #started; - /** @private */ - constructor(mode, version3) { - this.#mode = mode; - this.#version = version3; - this.#started = void 0; - } - execute(stmt) { - return this.batch([stmt]).then((results) => results[0]); - } - async batch(stmts) { - const stream = this._getStream(); - if (stream.closed) { - throw new LibsqlError( - "Cannot execute statements because the transaction is closed", - "TRANSACTION_CLOSED" - ); - } - try { - const hranaStmts = stmts.map(stmtToHrana); - let rowsPromises; - if (this.#started === void 0) { - this._getSqlCache().apply(hranaStmts); - const batch = stream.batch(this.#version >= 3); - const beginStep = batch.step(); - const beginPromise = beginStep.run(transactionModeToBegin(this.#mode)); - let lastStep = beginStep; - rowsPromises = hranaStmts.map((hranaStmt) => { - const stmtStep = batch.step().condition(BatchCond.ok(lastStep)); - if (this.#version >= 3) { - stmtStep.condition(BatchCond.not(BatchCond.isAutocommit(batch))); - } - const rowsPromise = stmtStep.query(hranaStmt); - rowsPromise.catch(() => void 0); - lastStep = stmtStep; - return rowsPromise; - }); - this.#started = batch - .execute() - .then(() => beginPromise) - .then(() => void 0); - try { - await this.#started; - } catch (e) { - this.close(); - throw e; - } - } else { - if (this.#version < 3) { - await this.#started; - } else { - } - this._getSqlCache().apply(hranaStmts); - const batch = stream.batch(this.#version >= 3); - let lastStep = void 0; - rowsPromises = hranaStmts.map((hranaStmt) => { - const stmtStep = batch.step(); - if (lastStep !== void 0) { - stmtStep.condition(BatchCond.ok(lastStep)); - } - if (this.#version >= 3) { - stmtStep.condition(BatchCond.not(BatchCond.isAutocommit(batch))); - } - const rowsPromise = stmtStep.query(hranaStmt); - rowsPromise.catch(() => void 0); - lastStep = stmtStep; - return rowsPromise; - }); - await batch.execute(); - } - const resultSets = []; - for (const rowsPromise of rowsPromises) { - const rows = await rowsPromise; - if (rows === void 0) { - throw new LibsqlError( - "Statement in a transaction was not executed, probably because the transaction has been rolled back", - "TRANSACTION_CLOSED" - ); - } - resultSets.push(resultSetFromHrana(rows)); - } - return resultSets; - } catch (e) { - throw mapHranaError(e); - } - } - async executeMultiple(sql2) { - const stream = this._getStream(); - if (stream.closed) { - throw new LibsqlError( - "Cannot execute statements because the transaction is closed", - "TRANSACTION_CLOSED" - ); - } - try { - if (this.#started === void 0) { - this.#started = stream - .run(transactionModeToBegin(this.#mode)) - .then(() => void 0); - try { - await this.#started; - } catch (e) { - this.close(); - throw e; - } - } else { - await this.#started; - } - await stream.sequence(sql2); - } catch (e) { - throw mapHranaError(e); - } - } - async rollback() { - try { - const stream = this._getStream(); - if (stream.closed) { - return; - } - if (this.#started !== void 0) { - } else { - return; - } - const promise = stream.run("ROLLBACK").catch((e) => { - throw mapHranaError(e); - }); - stream.closeGracefully(); - await promise; - } catch (e) { - throw mapHranaError(e); - } finally { - this.close(); - } - } - async commit() { - try { - const stream = this._getStream(); - if (stream.closed) { - throw new LibsqlError( - "Cannot commit the transaction because it is already closed", - "TRANSACTION_CLOSED" - ); - } - if (this.#started !== void 0) { - await this.#started; - } else { - return; - } - const promise = stream.run("COMMIT").catch((e) => { - throw mapHranaError(e); - }); - stream.closeGracefully(); - await promise; - } catch (e) { - throw mapHranaError(e); - } finally { - this.close(); - } - } -}; -async function executeHranaBatch(mode, version3, batch, hranaStmts) { - const beginStep = batch.step(); - const beginPromise = beginStep.run(transactionModeToBegin(mode)); - let lastStep = beginStep; - const stmtPromises = hranaStmts.map((hranaStmt) => { - const stmtStep = batch.step().condition(BatchCond.ok(lastStep)); - if (version3 >= 3) { - stmtStep.condition(BatchCond.not(BatchCond.isAutocommit(batch))); - } - const stmtPromise = stmtStep.query(hranaStmt); - lastStep = stmtStep; - return stmtPromise; - }); - const commitStep = batch.step().condition(BatchCond.ok(lastStep)); - if (version3 >= 3) { - commitStep.condition(BatchCond.not(BatchCond.isAutocommit(batch))); - } - const commitPromise = commitStep.run("COMMIT"); - const rollbackStep = batch - .step() - .condition(BatchCond.not(BatchCond.ok(commitStep))); - rollbackStep.run("ROLLBACK").catch((_) => void 0); - await batch.execute(); - const resultSets = []; - await beginPromise; - for (const stmtPromise of stmtPromises) { - const hranaRows = await stmtPromise; - if (hranaRows === void 0) { - throw new LibsqlError( - "Statement in a batch was not executed, probably because the transaction has been rolled back", - "TRANSACTION_CLOSED" - ); - } - resultSets.push(resultSetFromHrana(hranaRows)); - } - await commitPromise; - return resultSets; -} -function stmtToHrana(stmt) { - if (typeof stmt === "string") { - return new Stmt(stmt); - } - const hranaStmt = new Stmt(stmt.sql); - if (Array.isArray(stmt.args)) { - hranaStmt.bindIndexes(stmt.args); - } else { - for (const [key, value] of Object.entries(stmt.args)) { - hranaStmt.bindName(key, value); - } - } - return hranaStmt; -} -function resultSetFromHrana(hranaRows) { - const columns = hranaRows.columnNames.map((c2) => c2 ?? ""); - const columnTypes = hranaRows.columnDecltypes.map((c2) => c2 ?? ""); - const rows = hranaRows.rows; - const rowsAffected = hranaRows.affectedRowCount; - const lastInsertRowid = - hranaRows.lastInsertRowid !== void 0 ? hranaRows.lastInsertRowid : void 0; - return new ResultSetImpl( - columns, - columnTypes, - rows, - rowsAffected, - lastInsertRowid - ); -} -function mapHranaError(e) { - if (e instanceof ClientError) { - const code = mapHranaErrorCode(e); - return new LibsqlError(e.message, code, void 0, e); - } - return e; -} -function mapHranaErrorCode(e) { - if (e instanceof ResponseError && e.code !== void 0) { - return e.code; - } else if (e instanceof ProtoError) { - return "HRANA_PROTO_ERROR"; - } else if (e instanceof ClosedError) { - return e.cause instanceof ClientError - ? mapHranaErrorCode(e.cause) - : "HRANA_CLOSED_ERROR"; - } else if (e instanceof WebSocketError) { - return "HRANA_WEBSOCKET_ERROR"; - } else if (e instanceof HttpServerError) { - return "SERVER_ERROR"; - } else if (e instanceof ProtocolVersionError) { - return "PROTOCOL_VERSION_ERROR"; - } else if (e instanceof InternalError) { - return "INTERNAL_ERROR"; - } else { - return "UNKNOWN"; - } -} - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/sql_cache.js -var SqlCache = class { - #owner; - #sqls; - capacity; - constructor(owner, capacity) { - this.#owner = owner; - this.#sqls = new Lru(); - this.capacity = capacity; - } - // Replaces SQL strings with cached `hrana.Sql` objects in the statements in `hranaStmts`. After this - // function returns, we guarantee that all `hranaStmts` refer to valid (not closed) `hrana.Sql` objects, - // but _we may invalidate any other `hrana.Sql` objects_ (by closing them, thus removing them from the - // server). - // - // In practice, this means that after calling this function, you can use the statements only up to the - // first `await`, because concurrent code may also use the cache and invalidate those statements. - apply(hranaStmts) { - if (this.capacity <= 0) { - return; - } - const usedSqlObjs = /* @__PURE__ */ new Set(); - for (const hranaStmt of hranaStmts) { - if (typeof hranaStmt.sql !== "string") { - continue; - } - const sqlText = hranaStmt.sql; - let sqlObj = this.#sqls.get(sqlText); - if (sqlObj === void 0) { - while (this.#sqls.size + 1 > this.capacity) { - const [evictSqlText, evictSqlObj] = this.#sqls.peekLru(); - if (usedSqlObjs.has(evictSqlObj)) { - break; - } - evictSqlObj.close(); - this.#sqls.delete(evictSqlText); - } - if (this.#sqls.size + 1 <= this.capacity) { - sqlObj = this.#owner.storeSql(sqlText); - this.#sqls.set(sqlText, sqlObj); - } - } - if (sqlObj !== void 0) { - hranaStmt.sql = sqlObj; - usedSqlObjs.add(sqlObj); - } - } - } -}; -var Lru = class { - // This maps keys to the cache values. The entries are ordered by their last use (entires that were used - // most recently are at the end). - #cache; - constructor() { - this.#cache = /* @__PURE__ */ new Map(); - } - get(key) { - const value = this.#cache.get(key); - if (value !== void 0) { - this.#cache.delete(key); - this.#cache.set(key, value); - } - return value; - } - set(key, value) { - this.#cache.set(key, value); - } - peekLru() { - for (const entry of this.#cache.entries()) { - return entry; - } - return void 0; - } - delete(key) { - this.#cache.delete(key); - } - get size() { - return this.#cache.size; - } -}; - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/ws.js -function _createClient(config) { - if (config.scheme !== "wss" && config.scheme !== "ws") { - throw new LibsqlError( - `The WebSocket client supports only "libsql:", "wss:" and "ws:" URLs, got ${JSON.stringify(config.scheme + ":")}. For more information, please read ${supportedUrlLink}`, - "URL_SCHEME_NOT_SUPPORTED" - ); - } - if (config.scheme === "ws" && config.tls) { - throw new LibsqlError( - `A "ws:" URL cannot opt into TLS by using ?tls=1`, - "URL_INVALID" - ); - } else if (config.scheme === "wss" && !config.tls) { - throw new LibsqlError( - `A "wss:" URL cannot opt out of TLS by using ?tls=0`, - "URL_INVALID" - ); - } - const url = encodeBaseUrl(config.scheme, config.authority, config.path); - let client; - try { - client = openWs(url, config.authToken); - } catch (e) { - if (e instanceof WebSocketUnsupportedError) { - const suggestedScheme = config.scheme === "wss" ? "https" : "http"; - const suggestedUrl = encodeBaseUrl( - suggestedScheme, - config.authority, - config.path - ); - throw new LibsqlError( - `This environment does not support WebSockets, please switch to the HTTP client by using a "${suggestedScheme}:" URL (${JSON.stringify(suggestedUrl)}). For more information, please read ${supportedUrlLink}`, - "WEBSOCKETS_NOT_SUPPORTED" - ); - } - throw mapHranaError(e); - } - return new WsClient2(client, url, config.authToken, config.intMode); -} -var maxConnAgeMillis = 60 * 1e3; -var sqlCacheCapacity = 100; -var WsClient2 = class { - #url; - #authToken; - #intMode; - // State of the current connection. The `hrana.WsClient` inside may be closed at any moment due to an - // asynchronous error. - #connState; - // If defined, this is a connection that will be used in the future, once it is ready. - #futureConnState; - closed; - protocol; - /** @private */ - constructor(client, url, authToken, intMode) { - this.#url = url; - this.#authToken = authToken; - this.#intMode = intMode; - this.#connState = this.#openConn(client); - this.#futureConnState = void 0; - this.closed = false; - this.protocol = "ws"; - } - async execute(stmt) { - const streamState = await this.#openStream(); - try { - const hranaStmt = stmtToHrana(stmt); - streamState.conn.sqlCache.apply([hranaStmt]); - const hranaRowsPromise = streamState.stream.query(hranaStmt); - streamState.stream.closeGracefully(); - return resultSetFromHrana(await hranaRowsPromise); - } catch (e) { - throw mapHranaError(e); - } finally { - this._closeStream(streamState); - } - } - async batch(stmts, mode = "deferred") { - const streamState = await this.#openStream(); - try { - const hranaStmts = stmts.map(stmtToHrana); - const version3 = await streamState.conn.client.getVersion(); - streamState.conn.sqlCache.apply(hranaStmts); - const batch = streamState.stream.batch(version3 >= 3); - const resultsPromise = executeHranaBatch( - mode, - version3, - batch, - hranaStmts - ); - return await resultsPromise; - } catch (e) { - throw mapHranaError(e); - } finally { - this._closeStream(streamState); - } - } - async transaction(mode = "write") { - const streamState = await this.#openStream(); - try { - const version3 = await streamState.conn.client.getVersion(); - return new WsTransaction(this, streamState, mode, version3); - } catch (e) { - this._closeStream(streamState); - throw mapHranaError(e); - } - } - async executeMultiple(sql2) { - const streamState = await this.#openStream(); - try { - const promise = streamState.stream.sequence(sql2); - streamState.stream.closeGracefully(); - await promise; - } catch (e) { - throw mapHranaError(e); - } finally { - this._closeStream(streamState); - } - } - sync() { - return Promise.resolve(); - } - async #openStream() { - if (this.closed) { - throw new LibsqlError("The client is closed", "CLIENT_CLOSED"); - } - const now = /* @__PURE__ */ new Date(); - const ageMillis = now.valueOf() - this.#connState.openTime.valueOf(); - if (ageMillis > maxConnAgeMillis && this.#futureConnState === void 0) { - const futureConnState = this.#openConn(); - this.#futureConnState = futureConnState; - futureConnState.client.getVersion().then( - (_version) => { - if (this.#connState !== futureConnState) { - if (this.#connState.streamStates.size === 0) { - this.#connState.client.close(); - } else { - } - } - this.#connState = futureConnState; - this.#futureConnState = void 0; - }, - (_e) => { - this.#futureConnState = void 0; - } - ); - } - if (this.#connState.client.closed) { - try { - if (this.#futureConnState !== void 0) { - this.#connState = this.#futureConnState; - } else { - this.#connState = this.#openConn(); - } - } catch (e) { - throw mapHranaError(e); - } - } - const connState = this.#connState; - try { - if (connState.useSqlCache === void 0) { - connState.useSqlCache = (await connState.client.getVersion()) >= 2; - if (connState.useSqlCache) { - connState.sqlCache.capacity = sqlCacheCapacity; - } - } - const stream = connState.client.openStream(); - stream.intMode = this.#intMode; - const streamState = { conn: connState, stream }; - connState.streamStates.add(streamState); - return streamState; - } catch (e) { - throw mapHranaError(e); - } - } - #openConn(client) { - try { - client ??= openWs(this.#url, this.#authToken); - return { - client, - useSqlCache: void 0, - sqlCache: new SqlCache(client, 0), - openTime: /* @__PURE__ */ new Date(), - streamStates: /* @__PURE__ */ new Set(), - }; - } catch (e) { - throw mapHranaError(e); - } - } - _closeStream(streamState) { - streamState.stream.close(); - const connState = streamState.conn; - connState.streamStates.delete(streamState); - if (connState.streamStates.size === 0 && connState !== this.#connState) { - connState.client.close(); - } - } - close() { - this.#connState.client.close(); - this.closed = true; - } -}; -var WsTransaction = class extends HranaTransaction { - #client; - #streamState; - /** @private */ - constructor(client, state, mode, version3) { - super(mode, version3); - this.#client = client; - this.#streamState = state; - } - /** @private */ - _getStream() { - return this.#streamState.stream; - } - /** @private */ - _getSqlCache() { - return this.#streamState.conn.sqlCache; - } - close() { - this.#client._closeStream(this.#streamState); - } - get closed() { - return this.#streamState.stream.closed; - } -}; - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/http.js -function _createClient2(config) { - if (config.scheme !== "https" && config.scheme !== "http") { - throw new LibsqlError( - `The HTTP client supports only "libsql:", "https:" and "http:" URLs, got ${JSON.stringify(config.scheme + ":")}. For more information, please read ${supportedUrlLink}`, - "URL_SCHEME_NOT_SUPPORTED" - ); - } - if (config.scheme === "http" && config.tls) { - throw new LibsqlError( - `A "http:" URL cannot opt into TLS by using ?tls=1`, - "URL_INVALID" - ); - } else if (config.scheme === "https" && !config.tls) { - throw new LibsqlError( - `A "https:" URL cannot opt out of TLS by using ?tls=0`, - "URL_INVALID" - ); - } - const url = encodeBaseUrl(config.scheme, config.authority, config.path); - return new HttpClient2(url, config.authToken, config.intMode, config.fetch); -} -var sqlCacheCapacity2 = 30; -var HttpClient2 = class { - #client; - protocol; - /** @private */ - constructor(url, authToken, intMode, customFetch) { - this.#client = openHttp(url, authToken, customFetch); - this.#client.intMode = intMode; - this.protocol = "http"; - } - async execute(stmt) { - try { - const hranaStmt = stmtToHrana(stmt); - let rowsPromise; - const stream = this.#client.openStream(); - try { - rowsPromise = stream.query(hranaStmt); - } finally { - stream.closeGracefully(); - } - return resultSetFromHrana(await rowsPromise); - } catch (e) { - throw mapHranaError(e); - } - } - async batch(stmts, mode = "deferred") { - try { - const hranaStmts = stmts.map(stmtToHrana); - const version3 = await this.#client.getVersion(); - let resultsPromise; - const stream = this.#client.openStream(); - try { - const sqlCache = new SqlCache(stream, sqlCacheCapacity2); - sqlCache.apply(hranaStmts); - const batch = stream.batch(false); - resultsPromise = executeHranaBatch(mode, version3, batch, hranaStmts); - } finally { - stream.closeGracefully(); - } - return await resultsPromise; - } catch (e) { - throw mapHranaError(e); - } - } - async transaction(mode = "write") { - try { - const version3 = await this.#client.getVersion(); - return new HttpTransaction(this.#client.openStream(), mode, version3); - } catch (e) { - throw mapHranaError(e); - } - } - async executeMultiple(sql2) { - try { - let promise; - const stream = this.#client.openStream(); - try { - promise = stream.sequence(sql2); - } finally { - stream.closeGracefully(); - } - await promise; - } catch (e) { - throw mapHranaError(e); - } - } - sync() { - throw new LibsqlError( - "sync not supported in http mode", - "SYNC_NOT_SUPPORTED" - ); - } - close() { - this.#client.close(); - } - get closed() { - return this.#client.closed; - } -}; -var HttpTransaction = class extends HranaTransaction { - #stream; - #sqlCache; - /** @private */ - constructor(stream, mode, version3) { - super(mode, version3); - this.#stream = stream; - this.#sqlCache = new SqlCache(stream, sqlCacheCapacity2); - } - /** @private */ - _getStream() { - return this.#stream; - } - /** @private */ - _getSqlCache() { - return this.#sqlCache; - } - close() { - this.#stream.close(); - } - get closed() { - return this.#stream.closed; - } -}; - -// ../../node_modules/.pnpm/@libsql+client@0.4.0-pre.7/node_modules/@libsql/client/lib-esm/web.js -function createClient(config) { - return _createClient3(expandConfig(config, true)); -} -function _createClient3(config) { - if (config.scheme === "ws" || config.scheme === "wss") { - return _createClient(config); - } else if (config.scheme === "http" || config.scheme === "https") { - return _createClient2(config); - } else { - throw new LibsqlError( - `The client that uses Web standard APIs supports only "libsql:", "wss:", "ws:", "https:" and "http:" URLs, got ${JSON.stringify(config.scheme + ":")}. For more information, please read ${supportedUrlLink}`, - "URL_SCHEME_NOT_SUPPORTED" - ); - } -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/libsql/session.js -var _a104; -var _LibSQLSession = class extends SQLiteSession { - constructor(client, dialect, schema, options, tx) { - super(dialect); - this.client = client; - this.schema = schema; - this.options = options; - this.tx = tx; - this.logger = options.logger ?? new NoopLogger(); - } - logger; - prepareQuery(query, fields, executeMethod, customResultMapper) { - return new LibSQLPreparedQuery( - this.client, - query, - this.logger, - fields, - this.tx, - executeMethod, - customResultMapper - ); - } - async batch(queries) { - const preparedQueries = []; - const builtQueries = []; - for (const query of queries) { - const preparedQuery = query.prepare(); - const builtQuery = preparedQuery.getQuery(); - preparedQueries.push(preparedQuery); - builtQueries.push({ sql: builtQuery.sql, args: builtQuery.params }); - } - const batchResults = await this.client.batch(builtQueries); - return batchResults.map((result, i) => - preparedQueries[i].mapResult(result, true) - ); - } - async transaction(transaction, _config) { - const libsqlTx = await this.client.transaction(); - const session = new _LibSQLSession( - this.client, - this.dialect, - this.schema, - this.options, - libsqlTx - ); - const tx = new LibSQLTransaction( - "async", - this.dialect, - session, - this.schema - ); - try { - const result = await transaction(tx); - await libsqlTx.commit(); - return result; - } catch (err) { - await libsqlTx.rollback(); - throw err; - } - } - extractRawAllValueFromBatchResult(result) { - return result.rows; - } - extractRawGetValueFromBatchResult(result) { - return result.rows[0]; - } - extractRawValuesValueFromBatchResult(result) { - return result.rows; - } -}; -var LibSQLSession = _LibSQLSession; -_a104 = entityKind; -__publicField(LibSQLSession, _a104, "LibSQLSession"); -var _a105; -var _LibSQLTransaction = class extends SQLiteTransaction { - async transaction(transaction) { - const savepointName = `sp${this.nestedIndex}`; - const tx = new _LibSQLTransaction( - "async", - this.dialect, - this.session, - this.schema, - this.nestedIndex + 1 - ); - await this.session.run(sql.raw(`savepoint ${savepointName}`)); - try { - const result = await transaction(tx); - await this.session.run(sql.raw(`release savepoint ${savepointName}`)); - return result; - } catch (err) { - await this.session.run(sql.raw(`rollback to savepoint ${savepointName}`)); - throw err; - } - } -}; -var LibSQLTransaction = _LibSQLTransaction; -_a105 = entityKind; -__publicField(LibSQLTransaction, _a105, "LibSQLTransaction"); -var _a106; -var LibSQLPreparedQuery = class extends SQLitePreparedQuery { - constructor( - client, - query, - logger, - fields, - tx, - executeMethod, - customResultMapper - ) { - super("async", executeMethod, query); - this.client = client; - this.logger = logger; - this.fields = fields; - this.tx = tx; - this.customResultMapper = customResultMapper; - this.customResultMapper = customResultMapper; - this.fields = fields; - } - run(placeholderValues) { - const params = fillPlaceholders(this.query.params, placeholderValues ?? {}); - this.logger.logQuery(this.query.sql, params); - const stmt = { sql: this.query.sql, args: params }; - return this.tx ? this.tx.execute(stmt) : this.client.execute(stmt); - } - async all(placeholderValues) { - const { fields, logger, query, tx, client, customResultMapper } = this; - if (!fields && !customResultMapper) { - const params = fillPlaceholders(query.params, placeholderValues ?? {}); - logger.logQuery(query.sql, params); - const stmt = { sql: query.sql, args: params }; - return (tx ? tx.execute(stmt) : client.execute(stmt)).then( - ({ rows: rows2 }) => this.mapAllResult(rows2) - ); - } - const rows = await this.values(placeholderValues); - return this.mapAllResult(rows); - } - mapAllResult(rows, isFromBatch) { - if (isFromBatch) { - rows = rows.rows; - } - if (!this.fields && !this.customResultMapper) { - return rows.map((row) => normalizeRow(row)); - } - if (this.customResultMapper) { - return this.customResultMapper(rows, normalizeFieldValue); - } - return rows.map((row) => { - return mapResultRow( - this.fields, - Array.prototype.slice.call(row).map((v) => normalizeFieldValue(v)), - this.joinsNotNullableMap - ); - }); - } - async get(placeholderValues) { - const { fields, logger, query, tx, client, customResultMapper } = this; - if (!fields && !customResultMapper) { - const params = fillPlaceholders(query.params, placeholderValues ?? {}); - logger.logQuery(query.sql, params); - const stmt = { sql: query.sql, args: params }; - return (tx ? tx.execute(stmt) : client.execute(stmt)).then( - ({ rows: rows2 }) => this.mapGetResult(rows2) - ); - } - const rows = await this.values(placeholderValues); - return this.mapGetResult(rows); - } - mapGetResult(rows, isFromBatch) { - if (isFromBatch) { - rows = rows.rows; - } - const row = rows[0]; - if (!this.fields && !this.customResultMapper) { - return normalizeRow(row); - } - if (!row) { - return void 0; - } - if (this.customResultMapper) { - return this.customResultMapper(rows, normalizeFieldValue); - } - return mapResultRow( - this.fields, - Array.prototype.slice.call(row).map((v) => normalizeFieldValue(v)), - this.joinsNotNullableMap - ); - } - values(placeholderValues) { - const params = fillPlaceholders(this.query.params, placeholderValues ?? {}); - this.logger.logQuery(this.query.sql, params); - const stmt = { sql: this.query.sql, args: params }; - return (this.tx ? this.tx.execute(stmt) : this.client.execute(stmt)).then( - ({ rows }) => rows - ); - } -}; -_a106 = entityKind; -__publicField(LibSQLPreparedQuery, _a106, "LibSQLPreparedQuery"); -function normalizeRow(obj) { - return Object.keys(obj).reduce((acc, key) => { - if (Object.prototype.propertyIsEnumerable.call(obj, key)) { - acc[key] = obj[key]; - } - return acc; - }, {}); -} -function normalizeFieldValue(value) { - if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) { - if (typeof Buffer !== "undefined") { - if (!(value instanceof Buffer)) { - return Buffer.from(value); - } - return value; - } - if (typeof TextDecoder !== "undefined") { - return new TextDecoder().decode(value); - } - throw new Error( - "TextDecoder is not available. Please provide either Buffer or TextDecoder polyfill." - ); - } - return value; -} - -// ../../node_modules/.pnpm/drizzle-orm@0.29.3_@libsql+client@0.4.0-pre.7_react@18.2.0/node_modules/drizzle-orm/libsql/driver.js -var _a107; -var LibSQLDatabase = class extends BaseSQLiteDatabase { - async batch(batch) { - return this.session.batch(batch); - } -}; -_a107 = entityKind; -__publicField(LibSQLDatabase, _a107, "LibSQLDatabase"); -function drizzle(client, config = {}) { - const dialect = new SQLiteAsyncDialect(); - let logger; - if (config.logger === true) { - logger = new DefaultLogger(); - } else if (config.logger !== false) { - logger = config.logger; - } - let schema; - if (config.schema) { - const tablesConfig = extractTablesRelationalConfig( - config.schema, - createTableRelationsHelpers - ); - schema = { - fullSchema: config.schema, - schema: tablesConfig.tables, - tableNamesMap: tablesConfig.tableNamesMap, - }; - } - const session = new LibSQLSession( - client, - dialect, - schema, - { logger }, - void 0 - ); - return new LibSQLDatabase("async", dialect, session, schema); -} - -// ../../packages/database/db.ts -function getWebTursoDB(url, authToken) { - return drizzle(createClient({ url, authToken })); -} - -// ../../node_modules/.pnpm/nanoid@5.0.4/node_modules/nanoid/non-secure/index.js -var urlAlphabet = - "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; -var nanoid = (size = 21) => { - let id = ""; - let i = size; - while (i--) { - id += urlAlphabet[(Math.random() * 64) | 0]; - } - return id; -}; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/decode-strings.js -var textEncoder = new TextEncoder(); -var decoders = /* @__PURE__ */ new Map(); -var base64Chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var base64Lookup = new Uint8Array(256); -for (i = 0; i < base64Chars.length; i++) { - base64Lookup[base64Chars.charCodeAt(i)] = i; -} -var i; -function decodeBase64(base64) { - let bufferLength = Math.ceil(base64.length / 4) * 3; - const len = base64.length; - let p2 = 0; - if (base64.length % 4 === 3) { - bufferLength--; - } else if (base64.length % 4 === 2) { - bufferLength -= 2; - } else if (base64[base64.length - 1] === "=") { - bufferLength--; - if (base64[base64.length - 2] === "=") { - bufferLength--; - } - } - const arrayBuffer = new ArrayBuffer(bufferLength); - const bytes = new Uint8Array(arrayBuffer); - for (let i = 0; i < len; i += 4) { - let encoded1 = base64Lookup[base64.charCodeAt(i)]; - let encoded2 = base64Lookup[base64.charCodeAt(i + 1)]; - let encoded3 = base64Lookup[base64.charCodeAt(i + 2)]; - let encoded4 = base64Lookup[base64.charCodeAt(i + 3)]; - bytes[p2++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p2++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p2++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - return arrayBuffer; -} -function getDecoder(charset) { - charset = charset || "utf8"; - if (decoders.has(charset)) { - return decoders.get(charset); - } - let decoder; - try { - decoder = new TextDecoder(charset); - } catch (err) { - if (charset === "utf8") { - throw err; - } - return getDecoder(); - } - decoders.set(charset, decoder); - return decoder; -} -async function blobToArrayBuffer(blob) { - if ("arrayBuffer" in blob) { - return await blob.arrayBuffer(); - } - const fr = new FileReader(); - return new Promise((resolve, reject) => { - fr.onload = function (e) { - resolve(e.target.result); - }; - fr.onerror = function (e) { - reject(fr.error); - }; - fr.readAsArrayBuffer(blob); - }); -} -function getHex(c2) { - if ( - (c2 >= 48 && c2 <= 57) || - (c2 >= 97 && c2 <= 102) || - (c2 >= 65 && c2 <= 70) - ) { - return String.fromCharCode(c2); - } - return false; -} -function decodeWord(charset, encoding, str) { - let splitPos = charset.indexOf("*"); - if (splitPos >= 0) { - charset = charset.substr(0, splitPos); - } - encoding = encoding.toUpperCase(); - let byteStr; - if (encoding === "Q") { - str = str.replace(/=\s+([0-9a-fA-F])/g, "=$1").replace(/[_\s]/g, " "); - let buf = textEncoder.encode(str); - let encodedBytes = []; - for (let i = 0, len = buf.length; i < len; i++) { - let c2 = buf[i]; - if (i <= len - 2 && c2 === 61) { - let c1 = getHex(buf[i + 1]); - let c22 = getHex(buf[i + 2]); - if (c1 && c22) { - let c3 = parseInt(c1 + c22, 16); - encodedBytes.push(c3); - i += 2; - continue; - } - } - encodedBytes.push(c2); - } - byteStr = new ArrayBuffer(encodedBytes.length); - let dataView = new DataView(byteStr); - for (let i = 0, len = encodedBytes.length; i < len; i++) { - dataView.setUint8(i, encodedBytes[i]); - } - } else if (encoding === "B") { - byteStr = decodeBase64(str.replace(/[^a-zA-Z0-9\+\/=]+/g, "")); - } else { - byteStr = textEncoder.encode(str); - } - return getDecoder(charset).decode(byteStr); -} -function decodeWords(str) { - return (str || "") - .toString() - .replace( - /(=\?([^?]+)\?[Bb]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g, - (match, left, chLeft, chRight) => { - if (chLeft === chRight) { - return left + "__\0JOIN\0__"; - } - return match; - } - ) - .replace( - /(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g, - (match, left, chLeft, chRight) => { - if (chLeft === chRight) { - return left + "__\0JOIN\0__"; - } - return match; - } - ) - .replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g, "") - .replace( - /(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g, - "$1" - ) - .replace( - /=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g, - (m2, charset, encoding, text2) => decodeWord(charset, encoding, text2) - ); -} -function decodeURIComponentWithCharset(encodedStr, charset) { - charset = charset || "utf-8"; - let encodedBytes = []; - for (let i = 0; i < encodedStr.length; i++) { - let c2 = encodedStr.charAt(i); - if (c2 === "%" && /^[a-f0-9]{2}/i.test(encodedStr.substr(i + 1, 2))) { - let byte = encodedStr.substr(i + 1, 2); - i += 2; - encodedBytes.push(parseInt(byte, 16)); - } else if (c2.charCodeAt(0) > 126) { - c2 = textEncoder.encode(c2); - for (let j = 0; j < c2.length; j++) { - encodedBytes.push(c2[j]); - } - } else { - encodedBytes.push(c2.charCodeAt(0)); - } - } - const byteStr = new ArrayBuffer(encodedBytes.length); - const dataView = new DataView(byteStr); - for (let i = 0, len = encodedBytes.length; i < len; i++) { - dataView.setUint8(i, encodedBytes[i]); - } - return getDecoder(charset).decode(byteStr); -} -function decodeParameterValueContinuations(header) { - let paramKeys = /* @__PURE__ */ new Map(); - Object.keys(header.params).forEach((key) => { - let match = key.match(/\*((\d+)\*?)?$/); - if (!match) { - return; - } - let actualKey = key.substr(0, match.index).toLowerCase(); - let nr = Number(match[2]) || 0; - let paramVal; - if (!paramKeys.has(actualKey)) { - paramVal = { - charset: false, - values: [], - }; - paramKeys.set(actualKey, paramVal); - } else { - paramVal = paramKeys.get(actualKey); - } - let value = header.params[key]; - if ( - nr === 0 && - match[0].charAt(match[0].length - 1) === "*" && - (match = value.match(/^([^']*)'[^']*'(.*)$/)) - ) { - paramVal.charset = match[1] || "utf-8"; - value = match[2]; - } - paramVal.values.push({ nr, value }); - delete header.params[key]; - }); - paramKeys.forEach((paramVal, key) => { - header.params[key] = decodeURIComponentWithCharset( - paramVal.values - .sort((a, b) => a.nr - b.nr) - .map((a) => a.value) - .join(""), - paramVal.charset - ); - }); -} - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/pass-through-decoder.js -var PassThroughDecoder = class { - constructor() { - this.chunks = []; - } - update(line) { - this.chunks.push(line); - this.chunks.push("\n"); - } - finalize() { - return blobToArrayBuffer( - new Blob(this.chunks, { type: "application/octet-stream" }) - ); - } -}; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/base64-decoder.js -var Base64Decoder = class { - constructor(opts) { - opts = opts || {}; - this.decoder = opts.decoder || new TextDecoder(); - this.maxChunkSize = 100 * 1024; - this.chunks = []; - this.remainder = ""; - } - update(buffer) { - let str = this.decoder.decode(buffer); - if (/[^a-zA-Z0-9+\/]/.test(str)) { - str = str.replace(/[^a-zA-Z0-9+\/]+/g, ""); - } - this.remainder += str; - if (this.remainder.length >= this.maxChunkSize) { - let allowedBytes = Math.floor(this.remainder.length / 4) * 4; - let base64Str; - if (allowedBytes === this.remainder.length) { - base64Str = this.remainder; - this.remainder = ""; - } else { - base64Str = this.remainder.substr(0, allowedBytes); - this.remainder = this.remainder.substr(allowedBytes); - } - if (base64Str.length) { - this.chunks.push(decodeBase64(base64Str)); - } - } - } - finalize() { - if (this.remainder && !/^=+$/.test(this.remainder)) { - this.chunks.push(decodeBase64(this.remainder)); - } - return blobToArrayBuffer( - new Blob(this.chunks, { type: "application/octet-stream" }) - ); - } -}; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/qp-decoder.js -var QPDecoder = class { - constructor(opts) { - opts = opts || {}; - this.decoder = opts.decoder || new TextDecoder(); - this.maxChunkSize = 100 * 1024; - this.remainder = ""; - this.chunks = []; - } - decodeQPBytes(encodedBytes) { - let buf = new ArrayBuffer(encodedBytes.length); - let dataView = new DataView(buf); - for (let i = 0, len = encodedBytes.length; i < len; i++) { - dataView.setUint8(i, parseInt(encodedBytes[i], 16)); - } - return buf; - } - decodeChunks(str) { - str = str.replace(/=\r?\n/g, ""); - let list = str.split(/(?==)/); - let encodedBytes = []; - for (let part of list) { - if (part.charAt(0) !== "=") { - if (encodedBytes.length) { - this.chunks.push(this.decodeQPBytes(encodedBytes)); - encodedBytes = []; - } - this.chunks.push(part); - continue; - } - if (part.length === 3) { - encodedBytes.push(part.substr(1)); - continue; - } - if (part.length > 3) { - encodedBytes.push(part.substr(1, 2)); - this.chunks.push(this.decodeQPBytes(encodedBytes)); - encodedBytes = []; - part = part.substr(3); - this.chunks.push(part); - } - } - if (encodedBytes.length) { - this.chunks.push(this.decodeQPBytes(encodedBytes)); - encodedBytes = []; - } - } - update(buffer) { - let str = this.decoder.decode(buffer) + "\n"; - str = this.remainder + str; - if (str.length < this.maxChunkSize) { - this.remainder = str; - return; - } - this.remainder = ""; - let partialEnding = str.match(/=[a-fA-F0-9]?$/); - if (partialEnding) { - if (partialEnding.index === 0) { - this.remainder = str; - return; - } - this.remainder = str.substr(partialEnding.index); - str = str.substr(0, partialEnding.index); - } - this.decodeChunks(str); - } - finalize() { - if (this.remainder.length) { - this.decodeChunks(this.remainder); - this.remainder = ""; - } - return blobToArrayBuffer( - new Blob(this.chunks, { type: "application/octet-stream" }) - ); - } -}; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/mime-node.js -var MimeNode = class { - constructor(opts) { - opts = opts || {}; - this.postalMime = opts.postalMime; - this.root = !!opts.parentNode; - this.childNodes = []; - if (opts.parentNode) { - opts.parentNode.childNodes.push(this); - } - this.state = "header"; - this.headerLines = []; - this.decoders = /* @__PURE__ */ new Map(); - this.contentType = { - value: "text/plain", - default: true, - }; - this.contentTransferEncoding = { - value: "8bit", - }; - this.contentDisposition = { - value: "", - }; - this.headers = []; - this.contentDecoder = false; - } - setupContentDecoder(transferEncoding) { - if (/base64/i.test(transferEncoding)) { - this.contentDecoder = new Base64Decoder(); - } else if (/quoted-printable/i.test(transferEncoding)) { - this.contentDecoder = new QPDecoder({ - decoder: getDecoder(this.contentType.parsed.params.charset), - }); - } else { - this.contentDecoder = new PassThroughDecoder(); - } - } - async finalize() { - if (this.state === "finished") { - return; - } - if (this.state === "header") { - this.processHeaders(); - } - let boundaries = this.postalMime.boundaries; - for (let i = boundaries.length - 1; i >= 0; i--) { - let boundary = boundaries[i]; - if (boundary.node === this) { - boundaries.splice(i, 1); - break; - } - } - await this.finalizeChildNodes(); - this.content = this.contentDecoder - ? await this.contentDecoder.finalize() - : null; - this.state = "finished"; - } - async finalizeChildNodes() { - for (let childNode of this.childNodes) { - await childNode.finalize(); - } - } - parseStructuredHeader(str) { - let response = { - value: false, - params: {}, - }; - let key = false; - let value = ""; - let stage = "value"; - let quote = false; - let escaped = false; - let chr; - for (let i = 0, len = str.length; i < len; i++) { - chr = str.charAt(i); - switch (stage) { - case "key": - if (chr === "=") { - key = value.trim().toLowerCase(); - stage = "value"; - value = ""; - break; - } - value += chr; - break; - case "value": - if (escaped) { - value += chr; - } else if (chr === "\\") { - escaped = true; - continue; - } else if (quote && chr === quote) { - quote = false; - } else if (!quote && chr === '"') { - quote = chr; - } else if (!quote && chr === ";") { - if (key === false) { - response.value = value.trim(); - } else { - response.params[key] = value.trim(); - } - stage = "key"; - value = ""; - } else { - value += chr; - } - escaped = false; - break; - } - } - value = value.trim(); - if (stage === "value") { - if (key === false) { - response.value = value; - } else { - response.params[key] = value; - } - } else if (value) { - response.params[value.toLowerCase()] = ""; - } - if (response.value) { - response.value = response.value.toLowerCase(); - } - decodeParameterValueContinuations(response); - return response; - } - decodeFlowedText(str, delSp) { - return str - .split(/\r?\n/) - .reduce((previousValue, currentValue) => { - if (/ $/.test(previousValue) && !/(^|\n)-- $/.test(previousValue)) { - if (delSp) { - return previousValue.slice(0, -1) + currentValue; - } else { - return previousValue + currentValue; - } - } else { - return previousValue + "\n" + currentValue; - } - }) - .replace(/^ /gm, ""); - } - getTextContent() { - if (!this.content) { - return ""; - } - let str = getDecoder(this.contentType.parsed.params.charset).decode( - this.content - ); - if (/^flowed$/i.test(this.contentType.parsed.params.format)) { - str = this.decodeFlowedText( - str, - /^yes$/i.test(this.contentType.parsed.params.delsp) - ); - } - return str; - } - processHeaders() { - for (let i = this.headerLines.length - 1; i >= 0; i--) { - let line = this.headerLines[i]; - if (i && /^\s/.test(line)) { - this.headerLines[i - 1] += "\n" + line; - this.headerLines.splice(i, 1); - } else { - line = line.replace(/\s+/g, " "); - let sep = line.indexOf(":"); - let key = sep < 0 ? line.trim() : line.substr(0, sep).trim(); - let value = sep < 0 ? "" : line.substr(sep + 1).trim(); - this.headers.push({ key: key.toLowerCase(), originalKey: key, value }); - switch (key.toLowerCase()) { - case "content-type": - if (this.contentType.default) { - this.contentType = { value, parsed: {} }; - } - break; - case "content-transfer-encoding": - this.contentTransferEncoding = { value, parsed: {} }; - break; - case "content-disposition": - this.contentDisposition = { value, parsed: {} }; - break; - case "content-id": - this.contentId = value; - break; - } - } - } - this.contentType.parsed = this.parseStructuredHeader( - this.contentType.value - ); - this.contentType.multipart = /^multipart\//i.test( - this.contentType.parsed.value - ) - ? this.contentType.parsed.value.substr( - this.contentType.parsed.value.indexOf("/") + 1 - ) - : false; - if (this.contentType.multipart && this.contentType.parsed.params.boundary) { - this.postalMime.boundaries.push({ - value: textEncoder.encode(this.contentType.parsed.params.boundary), - node: this, - }); - } - this.contentDisposition.parsed = this.parseStructuredHeader( - this.contentDisposition.value - ); - this.contentTransferEncoding.encoding = this.contentTransferEncoding.value - .toLowerCase() - .split(/[^\w-]/) - .shift(); - this.setupContentDecoder(this.contentTransferEncoding.encoding); - } - feed(line) { - switch (this.state) { - case "header": - if (!line.length) { - this.state = "body"; - return this.processHeaders(); - } - this.headerLines.push(getDecoder().decode(line)); - break; - case "body": { - this.contentDecoder.update(line); - } - } - } -}; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/html-entities.js -var htmlEntities = { - "Æ": "\xC6", - "Æ": "\xC6", - "&": "&", - "&": "&", - "Á": "\xC1", - "Á": "\xC1", - "Ă": "\u0102", - "Â": "\xC2", - "Â": "\xC2", - "А": "\u0410", - "𝔄": "\u{1D504}", - "À": "\xC0", - "À": "\xC0", - "Α": "\u0391", - "Ā": "\u0100", - "⩓": "\u2A53", - "Ą": "\u0104", - "𝔸": "\u{1D538}", - "⁡": "\u2061", - "Å": "\xC5", - "Å": "\xC5", - "𝒜": "\u{1D49C}", - "≔": "\u2254", - "Ã": "\xC3", - "Ã": "\xC3", - "Ä": "\xC4", - "Ä": "\xC4", - "∖": "\u2216", - "⫧": "\u2AE7", - "⌆": "\u2306", - "Б": "\u0411", - "∵": "\u2235", - "ℬ": "\u212C", - "Β": "\u0392", - "𝔅": "\u{1D505}", - "𝔹": "\u{1D539}", - "˘": "\u02D8", - "ℬ": "\u212C", - "≎": "\u224E", - "Ч": "\u0427", - "©": "\xA9", - "©": "\xA9", - "Ć": "\u0106", - "⋒": "\u22D2", - "ⅅ": "\u2145", - "ℭ": "\u212D", - "Č": "\u010C", - "Ç": "\xC7", - "Ç": "\xC7", - "Ĉ": "\u0108", - "∰": "\u2230", - "Ċ": "\u010A", - "¸": "\xB8", - "·": "\xB7", - "ℭ": "\u212D", - "Χ": "\u03A7", - "⊙": "\u2299", - "⊖": "\u2296", - "⊕": "\u2295", - "⊗": "\u2297", - "∲": "\u2232", - "”": "\u201D", - "’": "\u2019", - "∷": "\u2237", - "⩴": "\u2A74", - "≡": "\u2261", - "∯": "\u222F", - "∮": "\u222E", - "ℂ": "\u2102", - "∐": "\u2210", - "∳": "\u2233", - "⨯": "\u2A2F", - "𝒞": "\u{1D49E}", - "⋓": "\u22D3", - "≍": "\u224D", - "ⅅ": "\u2145", - "⤑": "\u2911", - "Ђ": "\u0402", - "Ѕ": "\u0405", - "Џ": "\u040F", - "‡": "\u2021", - "↡": "\u21A1", - "⫤": "\u2AE4", - "Ď": "\u010E", - "Д": "\u0414", - "∇": "\u2207", - "Δ": "\u0394", - "𝔇": "\u{1D507}", - "´": "\xB4", - "˙": "\u02D9", - "˝": "\u02DD", - "`": "`", - "˜": "\u02DC", - "⋄": "\u22C4", - "ⅆ": "\u2146", - "𝔻": "\u{1D53B}", - "¨": "\xA8", - "⃜": "\u20DC", - "≐": "\u2250", - "∯": "\u222F", - "¨": "\xA8", - "⇓": "\u21D3", - "⇐": "\u21D0", - "⇔": "\u21D4", - "⫤": "\u2AE4", - "⟸": "\u27F8", - "⟺": "\u27FA", - "⟹": "\u27F9", - "⇒": "\u21D2", - "⊨": "\u22A8", - "⇑": "\u21D1", - "⇕": "\u21D5", - "∥": "\u2225", - "↓": "\u2193", - "⤓": "\u2913", - "⇵": "\u21F5", - "̑": "\u0311", - "⥐": "\u2950", - "⥞": "\u295E", - "↽": "\u21BD", - "⥖": "\u2956", - "⥟": "\u295F", - "⇁": "\u21C1", - "⥗": "\u2957", - "⊤": "\u22A4", - "↧": "\u21A7", - "⇓": "\u21D3", - "𝒟": "\u{1D49F}", - "Đ": "\u0110", - "Ŋ": "\u014A", - "Ð": "\xD0", - "Ð": "\xD0", - "É": "\xC9", - "É": "\xC9", - "Ě": "\u011A", - "Ê": "\xCA", - "Ê": "\xCA", - "Э": "\u042D", - "Ė": "\u0116", - "𝔈": "\u{1D508}", - "È": "\xC8", - "È": "\xC8", - "∈": "\u2208", - "Ē": "\u0112", - "◻": "\u25FB", - "▫": "\u25AB", - "Ę": "\u0118", - "𝔼": "\u{1D53C}", - "Ε": "\u0395", - "⩵": "\u2A75", - "≂": "\u2242", - "⇌": "\u21CC", - "ℰ": "\u2130", - "⩳": "\u2A73", - "Η": "\u0397", - "Ë": "\xCB", - "Ë": "\xCB", - "∃": "\u2203", - "ⅇ": "\u2147", - "Ф": "\u0424", - "𝔉": "\u{1D509}", - "◼": "\u25FC", - "▪": "\u25AA", - "𝔽": "\u{1D53D}", - "∀": "\u2200", - "ℱ": "\u2131", - "ℱ": "\u2131", - "Ѓ": "\u0403", - ">": ">", - ">": ">", - "Γ": "\u0393", - "Ϝ": "\u03DC", - "Ğ": "\u011E", - "Ģ": "\u0122", - "Ĝ": "\u011C", - "Г": "\u0413", - "Ġ": "\u0120", - "𝔊": "\u{1D50A}", - "⋙": "\u22D9", - "𝔾": "\u{1D53E}", - "≥": "\u2265", - "⋛": "\u22DB", - "≧": "\u2267", - "⪢": "\u2AA2", - "≷": "\u2277", - "⩾": "\u2A7E", - "≳": "\u2273", - "𝒢": "\u{1D4A2}", - "≫": "\u226B", - "Ъ": "\u042A", - "ˇ": "\u02C7", - "^": "^", - "Ĥ": "\u0124", - "ℌ": "\u210C", - "ℋ": "\u210B", - "ℍ": "\u210D", - "─": "\u2500", - "ℋ": "\u210B", - "Ħ": "\u0126", - "≎": "\u224E", - "≏": "\u224F", - "Е": "\u0415", - "IJ": "\u0132", - "Ё": "\u0401", - "Í": "\xCD", - "Í": "\xCD", - "Î": "\xCE", - "Î": "\xCE", - "И": "\u0418", - "İ": "\u0130", - "ℑ": "\u2111", - "Ì": "\xCC", - "Ì": "\xCC", - "ℑ": "\u2111", - "Ī": "\u012A", - "ⅈ": "\u2148", - "⇒": "\u21D2", - "∬": "\u222C", - "∫": "\u222B", - "⋂": "\u22C2", - "⁣": "\u2063", - "⁢": "\u2062", - "Į": "\u012E", - "𝕀": "\u{1D540}", - "Ι": "\u0399", - "ℐ": "\u2110", - "Ĩ": "\u0128", - "І": "\u0406", - "Ï": "\xCF", - "Ï": "\xCF", - "Ĵ": "\u0134", - "Й": "\u0419", - "𝔍": "\u{1D50D}", - "𝕁": "\u{1D541}", - "𝒥": "\u{1D4A5}", - "Ј": "\u0408", - "Є": "\u0404", - "Х": "\u0425", - "Ќ": "\u040C", - "Κ": "\u039A", - "Ķ": "\u0136", - "К": "\u041A", - "𝔎": "\u{1D50E}", - "𝕂": "\u{1D542}", - "𝒦": "\u{1D4A6}", - "Љ": "\u0409", - "<": "<", - "<": "<", - "Ĺ": "\u0139", - "Λ": "\u039B", - "⟪": "\u27EA", - "ℒ": "\u2112", - "↞": "\u219E", - "Ľ": "\u013D", - "Ļ": "\u013B", - "Л": "\u041B", - "⟨": "\u27E8", - "←": "\u2190", - "⇤": "\u21E4", - "⇆": "\u21C6", - "⌈": "\u2308", - "⟦": "\u27E6", - "⥡": "\u2961", - "⇃": "\u21C3", - "⥙": "\u2959", - "⌊": "\u230A", - "↔": "\u2194", - "⥎": "\u294E", - "⊣": "\u22A3", - "↤": "\u21A4", - "⥚": "\u295A", - "⊲": "\u22B2", - "⧏": "\u29CF", - "⊴": "\u22B4", - "⥑": "\u2951", - "⥠": "\u2960", - "↿": "\u21BF", - "⥘": "\u2958", - "↼": "\u21BC", - "⥒": "\u2952", - "⇐": "\u21D0", - "⇔": "\u21D4", - "⋚": "\u22DA", - "≦": "\u2266", - "≶": "\u2276", - "⪡": "\u2AA1", - "⩽": "\u2A7D", - "≲": "\u2272", - "𝔏": "\u{1D50F}", - "⋘": "\u22D8", - "⇚": "\u21DA", - "Ŀ": "\u013F", - "⟵": "\u27F5", - "⟷": "\u27F7", - "⟶": "\u27F6", - "⟸": "\u27F8", - "⟺": "\u27FA", - "⟹": "\u27F9", - "𝕃": "\u{1D543}", - "↙": "\u2199", - "↘": "\u2198", - "ℒ": "\u2112", - "↰": "\u21B0", - "Ł": "\u0141", - "≪": "\u226A", - "⤅": "\u2905", - "М": "\u041C", - " ": "\u205F", - "ℳ": "\u2133", - "𝔐": "\u{1D510}", - "∓": "\u2213", - "𝕄": "\u{1D544}", - "ℳ": "\u2133", - "Μ": "\u039C", - "Њ": "\u040A", - "Ń": "\u0143", - "Ň": "\u0147", - "Ņ": "\u0145", - "Н": "\u041D", - "​": "\u200B", - "​": "\u200B", - "​": "\u200B", - "​": "\u200B", - "≫": "\u226B", - "≪": "\u226A", - " ": "\n", - "𝔑": "\u{1D511}", - "⁠": "\u2060", - " ": "\xA0", - "ℕ": "\u2115", - "⫬": "\u2AEC", - "≢": "\u2262", - "≭": "\u226D", - "∦": "\u2226", - "∉": "\u2209", - "≠": "\u2260", - "≂̸": "\u2242\u0338", - "∄": "\u2204", - "≯": "\u226F", - "≱": "\u2271", - "≧̸": "\u2267\u0338", - "≫̸": "\u226B\u0338", - "≹": "\u2279", - "⩾̸": "\u2A7E\u0338", - "≵": "\u2275", - "≎̸": "\u224E\u0338", - "≏̸": "\u224F\u0338", - "⋪": "\u22EA", - "⧏̸": "\u29CF\u0338", - "⋬": "\u22EC", - "≮": "\u226E", - "≰": "\u2270", - "≸": "\u2278", - "≪̸": "\u226A\u0338", - "⩽̸": "\u2A7D\u0338", - "≴": "\u2274", - "⪢̸": "\u2AA2\u0338", - "⪡̸": "\u2AA1\u0338", - "⊀": "\u2280", - "⪯̸": "\u2AAF\u0338", - "⋠": "\u22E0", - "∌": "\u220C", - "⋫": "\u22EB", - "⧐̸": "\u29D0\u0338", - "⋭": "\u22ED", - "⊏̸": "\u228F\u0338", - "⋢": "\u22E2", - "⊐̸": "\u2290\u0338", - "⋣": "\u22E3", - "⊂⃒": "\u2282\u20D2", - "⊈": "\u2288", - "⊁": "\u2281", - "⪰̸": "\u2AB0\u0338", - "⋡": "\u22E1", - "≿̸": "\u227F\u0338", - "⊃⃒": "\u2283\u20D2", - "⊉": "\u2289", - "≁": "\u2241", - "≄": "\u2244", - "≇": "\u2247", - "≉": "\u2249", - "∤": "\u2224", - "𝒩": "\u{1D4A9}", - "Ñ": "\xD1", - "Ñ": "\xD1", - "Ν": "\u039D", - "Œ": "\u0152", - "Ó": "\xD3", - "Ó": "\xD3", - "Ô": "\xD4", - "Ô": "\xD4", - "О": "\u041E", - "Ő": "\u0150", - "𝔒": "\u{1D512}", - "Ò": "\xD2", - "Ò": "\xD2", - "Ō": "\u014C", - "Ω": "\u03A9", - "Ο": "\u039F", - "𝕆": "\u{1D546}", - "“": "\u201C", - "‘": "\u2018", - "⩔": "\u2A54", - "𝒪": "\u{1D4AA}", - "Ø": "\xD8", - "Ø": "\xD8", - "Õ": "\xD5", - "Õ": "\xD5", - "⨷": "\u2A37", - "Ö": "\xD6", - "Ö": "\xD6", - "‾": "\u203E", - "⏞": "\u23DE", - "⎴": "\u23B4", - "⏜": "\u23DC", - "∂": "\u2202", - "П": "\u041F", - "𝔓": "\u{1D513}", - "Φ": "\u03A6", - "Π": "\u03A0", - "±": "\xB1", - "ℌ": "\u210C", - "ℙ": "\u2119", - "⪻": "\u2ABB", - "≺": "\u227A", - "⪯": "\u2AAF", - "≼": "\u227C", - "≾": "\u227E", - "″": "\u2033", - "∏": "\u220F", - "∷": "\u2237", - "∝": "\u221D", - "𝒫": "\u{1D4AB}", - "Ψ": "\u03A8", - """: '"', - """: '"', - "𝔔": "\u{1D514}", - "ℚ": "\u211A", - "𝒬": "\u{1D4AC}", - "⤐": "\u2910", - "®": "\xAE", - "®": "\xAE", - "Ŕ": "\u0154", - "⟫": "\u27EB", - "↠": "\u21A0", - "⤖": "\u2916", - "Ř": "\u0158", - "Ŗ": "\u0156", - "Р": "\u0420", - "ℜ": "\u211C", - "∋": "\u220B", - "⇋": "\u21CB", - "⥯": "\u296F", - "ℜ": "\u211C", - "Ρ": "\u03A1", - "⟩": "\u27E9", - "→": "\u2192", - "⇥": "\u21E5", - "⇄": "\u21C4", - "⌉": "\u2309", - "⟧": "\u27E7", - "⥝": "\u295D", - "⇂": "\u21C2", - "⥕": "\u2955", - "⌋": "\u230B", - "⊢": "\u22A2", - "↦": "\u21A6", - "⥛": "\u295B", - "⊳": "\u22B3", - "⧐": "\u29D0", - "⊵": "\u22B5", - "⥏": "\u294F", - "⥜": "\u295C", - "↾": "\u21BE", - "⥔": "\u2954", - "⇀": "\u21C0", - "⥓": "\u2953", - "⇒": "\u21D2", - "ℝ": "\u211D", - "⥰": "\u2970", - "⇛": "\u21DB", - "ℛ": "\u211B", - "↱": "\u21B1", - "⧴": "\u29F4", - "Щ": "\u0429", - "Ш": "\u0428", - "Ь": "\u042C", - "Ś": "\u015A", - "⪼": "\u2ABC", - "Š": "\u0160", - "Ş": "\u015E", - "Ŝ": "\u015C", - "С": "\u0421", - "𝔖": "\u{1D516}", - "↓": "\u2193", - "←": "\u2190", - "→": "\u2192", - "↑": "\u2191", - "Σ": "\u03A3", - "∘": "\u2218", - "𝕊": "\u{1D54A}", - "√": "\u221A", - "□": "\u25A1", - "⊓": "\u2293", - "⊏": "\u228F", - "⊑": "\u2291", - "⊐": "\u2290", - "⊒": "\u2292", - "⊔": "\u2294", - "𝒮": "\u{1D4AE}", - "⋆": "\u22C6", - "⋐": "\u22D0", - "⋐": "\u22D0", - "⊆": "\u2286", - "≻": "\u227B", - "⪰": "\u2AB0", - "≽": "\u227D", - "≿": "\u227F", - "∋": "\u220B", - "∑": "\u2211", - "⋑": "\u22D1", - "⊃": "\u2283", - "⊇": "\u2287", - "⋑": "\u22D1", - "Þ": "\xDE", - "Þ": "\xDE", - "™": "\u2122", - "Ћ": "\u040B", - "Ц": "\u0426", - " ": " ", - "Τ": "\u03A4", - "Ť": "\u0164", - "Ţ": "\u0162", - "Т": "\u0422", - "𝔗": "\u{1D517}", - "∴": "\u2234", - "Θ": "\u0398", - "  ": "\u205F\u200A", - " ": "\u2009", - "∼": "\u223C", - "≃": "\u2243", - "≅": "\u2245", - "≈": "\u2248", - "𝕋": "\u{1D54B}", - "⃛": "\u20DB", - "𝒯": "\u{1D4AF}", - "Ŧ": "\u0166", - "Ú": "\xDA", - "Ú": "\xDA", - "↟": "\u219F", - "⥉": "\u2949", - "Ў": "\u040E", - "Ŭ": "\u016C", - "Û": "\xDB", - "Û": "\xDB", - "У": "\u0423", - "Ű": "\u0170", - "𝔘": "\u{1D518}", - "Ù": "\xD9", - "Ù": "\xD9", - "Ū": "\u016A", - "_": "_", - "⏟": "\u23DF", - "⎵": "\u23B5", - "⏝": "\u23DD", - "⋃": "\u22C3", - "⊎": "\u228E", - "Ų": "\u0172", - "𝕌": "\u{1D54C}", - "↑": "\u2191", - "⤒": "\u2912", - "⇅": "\u21C5", - "↕": "\u2195", - "⥮": "\u296E", - "⊥": "\u22A5", - "↥": "\u21A5", - "⇑": "\u21D1", - "⇕": "\u21D5", - "↖": "\u2196", - "↗": "\u2197", - "ϒ": "\u03D2", - "Υ": "\u03A5", - "Ů": "\u016E", - "𝒰": "\u{1D4B0}", - "Ũ": "\u0168", - "Ü": "\xDC", - "Ü": "\xDC", - "⊫": "\u22AB", - "⫫": "\u2AEB", - "В": "\u0412", - "⊩": "\u22A9", - "⫦": "\u2AE6", - "⋁": "\u22C1", - "‖": "\u2016", - "‖": "\u2016", - "∣": "\u2223", - "|": "|", - "❘": "\u2758", - "≀": "\u2240", - " ": "\u200A", - "𝔙": "\u{1D519}", - "𝕍": "\u{1D54D}", - "𝒱": "\u{1D4B1}", - "⊪": "\u22AA", - "Ŵ": "\u0174", - "⋀": "\u22C0", - "𝔚": "\u{1D51A}", - "𝕎": "\u{1D54E}", - "𝒲": "\u{1D4B2}", - "𝔛": "\u{1D51B}", - "Ξ": "\u039E", - "𝕏": "\u{1D54F}", - "𝒳": "\u{1D4B3}", - "Я": "\u042F", - "Ї": "\u0407", - "Ю": "\u042E", - "Ý": "\xDD", - "Ý": "\xDD", - "Ŷ": "\u0176", - "Ы": "\u042B", - "𝔜": "\u{1D51C}", - "𝕐": "\u{1D550}", - "𝒴": "\u{1D4B4}", - "Ÿ": "\u0178", - "Ж": "\u0416", - "Ź": "\u0179", - "Ž": "\u017D", - "З": "\u0417", - "Ż": "\u017B", - "​": "\u200B", - "Ζ": "\u0396", - "ℨ": "\u2128", - "ℤ": "\u2124", - "𝒵": "\u{1D4B5}", - "á": "\xE1", - "á": "\xE1", - "ă": "\u0103", - "∾": "\u223E", - "∾̳": "\u223E\u0333", - "∿": "\u223F", - "â": "\xE2", - "â": "\xE2", - "´": "\xB4", - "´": "\xB4", - "а": "\u0430", - "æ": "\xE6", - "æ": "\xE6", - "⁡": "\u2061", - "𝔞": "\u{1D51E}", - "à": "\xE0", - "à": "\xE0", - "ℵ": "\u2135", - "ℵ": "\u2135", - "α": "\u03B1", - "ā": "\u0101", - "⨿": "\u2A3F", - "&": "&", - "&": "&", - "∧": "\u2227", - "⩕": "\u2A55", - "⩜": "\u2A5C", - "⩘": "\u2A58", - "⩚": "\u2A5A", - "∠": "\u2220", - "⦤": "\u29A4", - "∠": "\u2220", - "∡": "\u2221", - "⦨": "\u29A8", - "⦩": "\u29A9", - "⦪": "\u29AA", - "⦫": "\u29AB", - "⦬": "\u29AC", - "⦭": "\u29AD", - "⦮": "\u29AE", - "⦯": "\u29AF", - "∟": "\u221F", - "⊾": "\u22BE", - "⦝": "\u299D", - "∢": "\u2222", - "Å": "\xC5", - "⍼": "\u237C", - "ą": "\u0105", - "𝕒": "\u{1D552}", - "≈": "\u2248", - "⩰": "\u2A70", - "⩯": "\u2A6F", - "≊": "\u224A", - "≋": "\u224B", - "'": "'", - "≈": "\u2248", - "≊": "\u224A", - "å": "\xE5", - "å": "\xE5", - "𝒶": "\u{1D4B6}", - "*": "*", - "≈": "\u2248", - "≍": "\u224D", - "ã": "\xE3", - "ã": "\xE3", - "ä": "\xE4", - "ä": "\xE4", - "∳": "\u2233", - "⨑": "\u2A11", - "⫭": "\u2AED", - "≌": "\u224C", - "϶": "\u03F6", - "‵": "\u2035", - "∽": "\u223D", - "⋍": "\u22CD", - "⊽": "\u22BD", - "⌅": "\u2305", - "⌅": "\u2305", - "⎵": "\u23B5", - "⎶": "\u23B6", - "≌": "\u224C", - "б": "\u0431", - "„": "\u201E", - "∵": "\u2235", - "∵": "\u2235", - "⦰": "\u29B0", - "϶": "\u03F6", - "ℬ": "\u212C", - "β": "\u03B2", - "ℶ": "\u2136", - "≬": "\u226C", - "𝔟": "\u{1D51F}", - "⋂": "\u22C2", - "◯": "\u25EF", - "⋃": "\u22C3", - "⨀": "\u2A00", - "⨁": "\u2A01", - "⨂": "\u2A02", - "⨆": "\u2A06", - "★": "\u2605", - "▽": "\u25BD", - "△": "\u25B3", - "⨄": "\u2A04", - "⋁": "\u22C1", - "⋀": "\u22C0", - "⤍": "\u290D", - "⧫": "\u29EB", - "▪": "\u25AA", - "▴": "\u25B4", - "▾": "\u25BE", - "◂": "\u25C2", - "▸": "\u25B8", - "␣": "\u2423", - "▒": "\u2592", - "░": "\u2591", - "▓": "\u2593", - "█": "\u2588", - "=⃥": "=\u20E5", - "≡⃥": "\u2261\u20E5", - "⌐": "\u2310", - "𝕓": "\u{1D553}", - "⊥": "\u22A5", - "⊥": "\u22A5", - "⋈": "\u22C8", - "╗": "\u2557", - "╔": "\u2554", - "╖": "\u2556", - "╓": "\u2553", - "═": "\u2550", - "╦": "\u2566", - "╩": "\u2569", - "╤": "\u2564", - "╧": "\u2567", - "╝": "\u255D", - "╚": "\u255A", - "╜": "\u255C", - "╙": "\u2559", - "║": "\u2551", - "╬": "\u256C", - "╣": "\u2563", - "╠": "\u2560", - "╫": "\u256B", - "╢": "\u2562", - "╟": "\u255F", - "⧉": "\u29C9", - "╕": "\u2555", - "╒": "\u2552", - "┐": "\u2510", - "┌": "\u250C", - "─": "\u2500", - "╥": "\u2565", - "╨": "\u2568", - "┬": "\u252C", - "┴": "\u2534", - "⊟": "\u229F", - "⊞": "\u229E", - "⊠": "\u22A0", - "╛": "\u255B", - "╘": "\u2558", - "┘": "\u2518", - "└": "\u2514", - "│": "\u2502", - "╪": "\u256A", - "╡": "\u2561", - "╞": "\u255E", - "┼": "\u253C", - "┤": "\u2524", - "├": "\u251C", - "‵": "\u2035", - "˘": "\u02D8", - "¦": "\xA6", - "¦": "\xA6", - "𝒷": "\u{1D4B7}", - "⁏": "\u204F", - "∽": "\u223D", - "⋍": "\u22CD", - "\": "\\", - "⧅": "\u29C5", - "⟈": "\u27C8", - "•": "\u2022", - "•": "\u2022", - "≎": "\u224E", - "⪮": "\u2AAE", - "≏": "\u224F", - "≏": "\u224F", - "ć": "\u0107", - "∩": "\u2229", - "⩄": "\u2A44", - "⩉": "\u2A49", - "⩋": "\u2A4B", - "⩇": "\u2A47", - "⩀": "\u2A40", - "∩︀": "\u2229\uFE00", - "⁁": "\u2041", - "ˇ": "\u02C7", - "⩍": "\u2A4D", - "č": "\u010D", - "ç": "\xE7", - "ç": "\xE7", - "ĉ": "\u0109", - "⩌": "\u2A4C", - "⩐": "\u2A50", - "ċ": "\u010B", - "¸": "\xB8", - "¸": "\xB8", - "⦲": "\u29B2", - "¢": "\xA2", - "¢": "\xA2", - "·": "\xB7", - "𝔠": "\u{1D520}", - "ч": "\u0447", - "✓": "\u2713", - "✓": "\u2713", - "χ": "\u03C7", - "○": "\u25CB", - "⧃": "\u29C3", - "ˆ": "\u02C6", - "≗": "\u2257", - "↺": "\u21BA", - "↻": "\u21BB", - "®": "\xAE", - "Ⓢ": "\u24C8", - "⊛": "\u229B", - "⊚": "\u229A", - "⊝": "\u229D", - "≗": "\u2257", - "⨐": "\u2A10", - "⫯": "\u2AEF", - "⧂": "\u29C2", - "♣": "\u2663", - "♣": "\u2663", - ":": ":", - "≔": "\u2254", - "≔": "\u2254", - ",": ",", - "@": "@", - "∁": "\u2201", - "∘": "\u2218", - "∁": "\u2201", - "ℂ": "\u2102", - "≅": "\u2245", - "⩭": "\u2A6D", - "∮": "\u222E", - "𝕔": "\u{1D554}", - "∐": "\u2210", - "©": "\xA9", - "©": "\xA9", - "℗": "\u2117", - "↵": "\u21B5", - "✗": "\u2717", - "𝒸": "\u{1D4B8}", - "⫏": "\u2ACF", - "⫑": "\u2AD1", - "⫐": "\u2AD0", - "⫒": "\u2AD2", - "⋯": "\u22EF", - "⤸": "\u2938", - "⤵": "\u2935", - "⋞": "\u22DE", - "⋟": "\u22DF", - "↶": "\u21B6", - "⤽": "\u293D", - "∪": "\u222A", - "⩈": "\u2A48", - "⩆": "\u2A46", - "⩊": "\u2A4A", - "⊍": "\u228D", - "⩅": "\u2A45", - "∪︀": "\u222A\uFE00", - "↷": "\u21B7", - "⤼": "\u293C", - "⋞": "\u22DE", - "⋟": "\u22DF", - "⋎": "\u22CE", - "⋏": "\u22CF", - "¤": "\xA4", - "¤": "\xA4", - "↶": "\u21B6", - "↷": "\u21B7", - "⋎": "\u22CE", - "⋏": "\u22CF", - "∲": "\u2232", - "∱": "\u2231", - "⌭": "\u232D", - "⇓": "\u21D3", - "⥥": "\u2965", - "†": "\u2020", - "ℸ": "\u2138", - "↓": "\u2193", - "‐": "\u2010", - "⊣": "\u22A3", - "⤏": "\u290F", - "˝": "\u02DD", - "ď": "\u010F", - "д": "\u0434", - "ⅆ": "\u2146", - "‡": "\u2021", - "⇊": "\u21CA", - "⩷": "\u2A77", - "°": "\xB0", - "°": "\xB0", - "δ": "\u03B4", - "⦱": "\u29B1", - "⥿": "\u297F", - "𝔡": "\u{1D521}", - "⇃": "\u21C3", - "⇂": "\u21C2", - "⋄": "\u22C4", - "⋄": "\u22C4", - "♦": "\u2666", - "♦": "\u2666", - "¨": "\xA8", - "ϝ": "\u03DD", - "⋲": "\u22F2", - "÷": "\xF7", - "÷": "\xF7", - "÷": "\xF7", - "⋇": "\u22C7", - "⋇": "\u22C7", - "ђ": "\u0452", - "⌞": "\u231E", - "⌍": "\u230D", - "$": "$", - "𝕕": "\u{1D555}", - "˙": "\u02D9", - "≐": "\u2250", - "≑": "\u2251", - "∸": "\u2238", - "∔": "\u2214", - "⊡": "\u22A1", - "⌆": "\u2306", - "↓": "\u2193", - "⇊": "\u21CA", - "⇃": "\u21C3", - "⇂": "\u21C2", - "⤐": "\u2910", - "⌟": "\u231F", - "⌌": "\u230C", - "𝒹": "\u{1D4B9}", - "ѕ": "\u0455", - "⧶": "\u29F6", - "đ": "\u0111", - "⋱": "\u22F1", - "▿": "\u25BF", - "▾": "\u25BE", - "⇵": "\u21F5", - "⥯": "\u296F", - "⦦": "\u29A6", - "џ": "\u045F", - "⟿": "\u27FF", - "⩷": "\u2A77", - "≑": "\u2251", - "é": "\xE9", - "é": "\xE9", - "⩮": "\u2A6E", - "ě": "\u011B", - "≖": "\u2256", - "ê": "\xEA", - "ê": "\xEA", - "≕": "\u2255", - "э": "\u044D", - "ė": "\u0117", - "ⅇ": "\u2147", - "≒": "\u2252", - "𝔢": "\u{1D522}", - "⪚": "\u2A9A", - "è": "\xE8", - "è": "\xE8", - "⪖": "\u2A96", - "⪘": "\u2A98", - "⪙": "\u2A99", - "⏧": "\u23E7", - "ℓ": "\u2113", - "⪕": "\u2A95", - "⪗": "\u2A97", - "ē": "\u0113", - "∅": "\u2205", - "∅": "\u2205", - "∅": "\u2205", - " ": "\u2004", - " ": "\u2005", - " ": "\u2003", - "ŋ": "\u014B", - " ": "\u2002", - "ę": "\u0119", - "𝕖": "\u{1D556}", - "⋕": "\u22D5", - "⧣": "\u29E3", - "⩱": "\u2A71", - "ε": "\u03B5", - "ε": "\u03B5", - "ϵ": "\u03F5", - "≖": "\u2256", - "≕": "\u2255", - "≂": "\u2242", - "⪖": "\u2A96", - "⪕": "\u2A95", - "=": "=", - "≟": "\u225F", - "≡": "\u2261", - "⩸": "\u2A78", - "⧥": "\u29E5", - "≓": "\u2253", - "⥱": "\u2971", - "ℯ": "\u212F", - "≐": "\u2250", - "≂": "\u2242", - "η": "\u03B7", - "ð": "\xF0", - "ð": "\xF0", - "ë": "\xEB", - "ë": "\xEB", - "€": "\u20AC", - "!": "!", - "∃": "\u2203", - "ℰ": "\u2130", - "ⅇ": "\u2147", - "≒": "\u2252", - "ф": "\u0444", - "♀": "\u2640", - "ffi": "\uFB03", - "ff": "\uFB00", - "ffl": "\uFB04", - "𝔣": "\u{1D523}", - "fi": "\uFB01", - "fj": "fj", - "♭": "\u266D", - "fl": "\uFB02", - "▱": "\u25B1", - "ƒ": "\u0192", - "𝕗": "\u{1D557}", - "∀": "\u2200", - "⋔": "\u22D4", - "⫙": "\u2AD9", - "⨍": "\u2A0D", - "½": "\xBD", - "½": "\xBD", - "⅓": "\u2153", - "¼": "\xBC", - "¼": "\xBC", - "⅕": "\u2155", - "⅙": "\u2159", - "⅛": "\u215B", - "⅔": "\u2154", - "⅖": "\u2156", - "¾": "\xBE", - "¾": "\xBE", - "⅗": "\u2157", - "⅜": "\u215C", - "⅘": "\u2158", - "⅚": "\u215A", - "⅝": "\u215D", - "⅞": "\u215E", - "⁄": "\u2044", - "⌢": "\u2322", - "𝒻": "\u{1D4BB}", - "≧": "\u2267", - "⪌": "\u2A8C", - "ǵ": "\u01F5", - "γ": "\u03B3", - "ϝ": "\u03DD", - "⪆": "\u2A86", - "ğ": "\u011F", - "ĝ": "\u011D", - "г": "\u0433", - "ġ": "\u0121", - "≥": "\u2265", - "⋛": "\u22DB", - "≥": "\u2265", - "≧": "\u2267", - "⩾": "\u2A7E", - "⩾": "\u2A7E", - "⪩": "\u2AA9", - "⪀": "\u2A80", - "⪂": "\u2A82", - "⪄": "\u2A84", - "⋛︀": "\u22DB\uFE00", - "⪔": "\u2A94", - "𝔤": "\u{1D524}", - "≫": "\u226B", - "⋙": "\u22D9", - "ℷ": "\u2137", - "ѓ": "\u0453", - "≷": "\u2277", - "⪒": "\u2A92", - "⪥": "\u2AA5", - "⪤": "\u2AA4", - "≩": "\u2269", - "⪊": "\u2A8A", - "⪊": "\u2A8A", - "⪈": "\u2A88", - "⪈": "\u2A88", - "≩": "\u2269", - "⋧": "\u22E7", - "𝕘": "\u{1D558}", - "`": "`", - "ℊ": "\u210A", - "≳": "\u2273", - "⪎": "\u2A8E", - "⪐": "\u2A90", - ">": ">", - ">": ">", - "⪧": "\u2AA7", - "⩺": "\u2A7A", - "⋗": "\u22D7", - "⦕": "\u2995", - "⩼": "\u2A7C", - "⪆": "\u2A86", - "⥸": "\u2978", - "⋗": "\u22D7", - "⋛": "\u22DB", - "⪌": "\u2A8C", - "≷": "\u2277", - "≳": "\u2273", - "≩︀": "\u2269\uFE00", - "≩︀": "\u2269\uFE00", - "⇔": "\u21D4", - " ": "\u200A", - "½": "\xBD", - "ℋ": "\u210B", - "ъ": "\u044A", - "↔": "\u2194", - "⥈": "\u2948", - "↭": "\u21AD", - "ℏ": "\u210F", - "ĥ": "\u0125", - "♥": "\u2665", - "♥": "\u2665", - "…": "\u2026", - "⊹": "\u22B9", - "𝔥": "\u{1D525}", - "⤥": "\u2925", - "⤦": "\u2926", - "⇿": "\u21FF", - "∻": "\u223B", - "↩": "\u21A9", - "↪": "\u21AA", - "𝕙": "\u{1D559}", - "―": "\u2015", - "𝒽": "\u{1D4BD}", - "ℏ": "\u210F", - "ħ": "\u0127", - "⁃": "\u2043", - "‐": "\u2010", - "í": "\xED", - "í": "\xED", - "⁣": "\u2063", - "î": "\xEE", - "î": "\xEE", - "и": "\u0438", - "е": "\u0435", - "¡": "\xA1", - "¡": "\xA1", - "⇔": "\u21D4", - "𝔦": "\u{1D526}", - "ì": "\xEC", - "ì": "\xEC", - "ⅈ": "\u2148", - "⨌": "\u2A0C", - "∭": "\u222D", - "⧜": "\u29DC", - "℩": "\u2129", - "ij": "\u0133", - "ī": "\u012B", - "ℑ": "\u2111", - "ℐ": "\u2110", - "ℑ": "\u2111", - "ı": "\u0131", - "⊷": "\u22B7", - "Ƶ": "\u01B5", - "∈": "\u2208", - "℅": "\u2105", - "∞": "\u221E", - "⧝": "\u29DD", - "ı": "\u0131", - "∫": "\u222B", - "⊺": "\u22BA", - "ℤ": "\u2124", - "⊺": "\u22BA", - "⨗": "\u2A17", - "⨼": "\u2A3C", - "ё": "\u0451", - "į": "\u012F", - "𝕚": "\u{1D55A}", - "ι": "\u03B9", - "⨼": "\u2A3C", - "¿": "\xBF", - "¿": "\xBF", - "𝒾": "\u{1D4BE}", - "∈": "\u2208", - "⋹": "\u22F9", - "⋵": "\u22F5", - "⋴": "\u22F4", - "⋳": "\u22F3", - "∈": "\u2208", - "⁢": "\u2062", - "ĩ": "\u0129", - "і": "\u0456", - "ï": "\xEF", - "ï": "\xEF", - "ĵ": "\u0135", - "й": "\u0439", - "𝔧": "\u{1D527}", - "ȷ": "\u0237", - "𝕛": "\u{1D55B}", - "𝒿": "\u{1D4BF}", - "ј": "\u0458", - "є": "\u0454", - "κ": "\u03BA", - "ϰ": "\u03F0", - "ķ": "\u0137", - "к": "\u043A", - "𝔨": "\u{1D528}", - "ĸ": "\u0138", - "х": "\u0445", - "ќ": "\u045C", - "𝕜": "\u{1D55C}", - "𝓀": "\u{1D4C0}", - "⇚": "\u21DA", - "⇐": "\u21D0", - "⤛": "\u291B", - "⤎": "\u290E", - "≦": "\u2266", - "⪋": "\u2A8B", - "⥢": "\u2962", - "ĺ": "\u013A", - "⦴": "\u29B4", - "ℒ": "\u2112", - "λ": "\u03BB", - "⟨": "\u27E8", - "⦑": "\u2991", - "⟨": "\u27E8", - "⪅": "\u2A85", - "«": "\xAB", - "«": "\xAB", - "←": "\u2190", - "⇤": "\u21E4", - "⤟": "\u291F", - "⤝": "\u291D", - "↩": "\u21A9", - "↫": "\u21AB", - "⤹": "\u2939", - "⥳": "\u2973", - "↢": "\u21A2", - "⪫": "\u2AAB", - "⤙": "\u2919", - "⪭": "\u2AAD", - "⪭︀": "\u2AAD\uFE00", - "⤌": "\u290C", - "❲": "\u2772", - "{": "{", - "[": "[", - "⦋": "\u298B", - "⦏": "\u298F", - "⦍": "\u298D", - "ľ": "\u013E", - "ļ": "\u013C", - "⌈": "\u2308", - "{": "{", - "л": "\u043B", - "⤶": "\u2936", - "“": "\u201C", - "„": "\u201E", - "⥧": "\u2967", - "⥋": "\u294B", - "↲": "\u21B2", - "≤": "\u2264", - "←": "\u2190", - "↢": "\u21A2", - "↽": "\u21BD", - "↼": "\u21BC", - "⇇": "\u21C7", - "↔": "\u2194", - "⇆": "\u21C6", - "⇋": "\u21CB", - "↭": "\u21AD", - "⋋": "\u22CB", - "⋚": "\u22DA", - "≤": "\u2264", - "≦": "\u2266", - "⩽": "\u2A7D", - "⩽": "\u2A7D", - "⪨": "\u2AA8", - "⩿": "\u2A7F", - "⪁": "\u2A81", - "⪃": "\u2A83", - "⋚︀": "\u22DA\uFE00", - "⪓": "\u2A93", - "⪅": "\u2A85", - "⋖": "\u22D6", - "⋚": "\u22DA", - "⪋": "\u2A8B", - "≶": "\u2276", - "≲": "\u2272", - "⥼": "\u297C", - "⌊": "\u230A", - "𝔩": "\u{1D529}", - "≶": "\u2276", - "⪑": "\u2A91", - "↽": "\u21BD", - "↼": "\u21BC", - "⥪": "\u296A", - "▄": "\u2584", - "љ": "\u0459", - "≪": "\u226A", - "⇇": "\u21C7", - "⌞": "\u231E", - "⥫": "\u296B", - "◺": "\u25FA", - "ŀ": "\u0140", - "⎰": "\u23B0", - "⎰": "\u23B0", - "≨": "\u2268", - "⪉": "\u2A89", - "⪉": "\u2A89", - "⪇": "\u2A87", - "⪇": "\u2A87", - "≨": "\u2268", - "⋦": "\u22E6", - "⟬": "\u27EC", - "⇽": "\u21FD", - "⟦": "\u27E6", - "⟵": "\u27F5", - "⟷": "\u27F7", - "⟼": "\u27FC", - "⟶": "\u27F6", - "↫": "\u21AB", - "↬": "\u21AC", - "⦅": "\u2985", - "𝕝": "\u{1D55D}", - "⨭": "\u2A2D", - "⨴": "\u2A34", - "∗": "\u2217", - "_": "_", - "◊": "\u25CA", - "◊": "\u25CA", - "⧫": "\u29EB", - "(": "(", - "⦓": "\u2993", - "⇆": "\u21C6", - "⌟": "\u231F", - "⇋": "\u21CB", - "⥭": "\u296D", - "‎": "\u200E", - "⊿": "\u22BF", - "‹": "\u2039", - "𝓁": "\u{1D4C1}", - "↰": "\u21B0", - "≲": "\u2272", - "⪍": "\u2A8D", - "⪏": "\u2A8F", - "[": "[", - "‘": "\u2018", - "‚": "\u201A", - "ł": "\u0142", - "<": "<", - "<": "<", - "⪦": "\u2AA6", - "⩹": "\u2A79", - "⋖": "\u22D6", - "⋋": "\u22CB", - "⋉": "\u22C9", - "⥶": "\u2976", - "⩻": "\u2A7B", - "⦖": "\u2996", - "◃": "\u25C3", - "⊴": "\u22B4", - "◂": "\u25C2", - "⥊": "\u294A", - "⥦": "\u2966", - "≨︀": "\u2268\uFE00", - "≨︀": "\u2268\uFE00", - "∺": "\u223A", - "¯": "\xAF", - "¯": "\xAF", - "♂": "\u2642", - "✠": "\u2720", - "✠": "\u2720", - "↦": "\u21A6", - "↦": "\u21A6", - "↧": "\u21A7", - "↤": "\u21A4", - "↥": "\u21A5", - "▮": "\u25AE", - "⨩": "\u2A29", - "м": "\u043C", - "—": "\u2014", - "∡": "\u2221", - "𝔪": "\u{1D52A}", - "℧": "\u2127", - "µ": "\xB5", - "µ": "\xB5", - "∣": "\u2223", - "*": "*", - "⫰": "\u2AF0", - "·": "\xB7", - "·": "\xB7", - "−": "\u2212", - "⊟": "\u229F", - "∸": "\u2238", - "⨪": "\u2A2A", - "⫛": "\u2ADB", - "…": "\u2026", - "∓": "\u2213", - "⊧": "\u22A7", - "𝕞": "\u{1D55E}", - "∓": "\u2213", - "𝓂": "\u{1D4C2}", - "∾": "\u223E", - "μ": "\u03BC", - "⊸": "\u22B8", - "⊸": "\u22B8", - "⋙̸": "\u22D9\u0338", - "≫⃒": "\u226B\u20D2", - "≫̸": "\u226B\u0338", - "⇍": "\u21CD", - "⇎": "\u21CE", - "⋘̸": "\u22D8\u0338", - "≪⃒": "\u226A\u20D2", - "≪̸": "\u226A\u0338", - "⇏": "\u21CF", - "⊯": "\u22AF", - "⊮": "\u22AE", - "∇": "\u2207", - "ń": "\u0144", - "∠⃒": "\u2220\u20D2", - "≉": "\u2249", - "⩰̸": "\u2A70\u0338", - "≋̸": "\u224B\u0338", - "ʼn": "\u0149", - "≉": "\u2249", - "♮": "\u266E", - "♮": "\u266E", - "ℕ": "\u2115", - " ": "\xA0", - " ": "\xA0", - "≎̸": "\u224E\u0338", - "≏̸": "\u224F\u0338", - "⩃": "\u2A43", - "ň": "\u0148", - "ņ": "\u0146", - "≇": "\u2247", - "⩭̸": "\u2A6D\u0338", - "⩂": "\u2A42", - "н": "\u043D", - "–": "\u2013", - "≠": "\u2260", - "⇗": "\u21D7", - "⤤": "\u2924", - "↗": "\u2197", - "↗": "\u2197", - "≐̸": "\u2250\u0338", - "≢": "\u2262", - "⤨": "\u2928", - "≂̸": "\u2242\u0338", - "∄": "\u2204", - "∄": "\u2204", - "𝔫": "\u{1D52B}", - "≧̸": "\u2267\u0338", - "≱": "\u2271", - "≱": "\u2271", - "≧̸": "\u2267\u0338", - "⩾̸": "\u2A7E\u0338", - "⩾̸": "\u2A7E\u0338", - "≵": "\u2275", - "≯": "\u226F", - "≯": "\u226F", - "⇎": "\u21CE", - "↮": "\u21AE", - "⫲": "\u2AF2", - "∋": "\u220B", - "⋼": "\u22FC", - "⋺": "\u22FA", - "∋": "\u220B", - "њ": "\u045A", - "⇍": "\u21CD", - "≦̸": "\u2266\u0338", - "↚": "\u219A", - "‥": "\u2025", - "≰": "\u2270", - "↚": "\u219A", - "↮": "\u21AE", - "≰": "\u2270", - "≦̸": "\u2266\u0338", - "⩽̸": "\u2A7D\u0338", - "⩽̸": "\u2A7D\u0338", - "≮": "\u226E", - "≴": "\u2274", - "≮": "\u226E", - "⋪": "\u22EA", - "⋬": "\u22EC", - "∤": "\u2224", - "𝕟": "\u{1D55F}", - "¬": "\xAC", - "¬": "\xAC", - "∉": "\u2209", - "⋹̸": "\u22F9\u0338", - "⋵̸": "\u22F5\u0338", - "∉": "\u2209", - "⋷": "\u22F7", - "⋶": "\u22F6", - "∌": "\u220C", - "∌": "\u220C", - "⋾": "\u22FE", - "⋽": "\u22FD", - "∦": "\u2226", - "∦": "\u2226", - "⫽⃥": "\u2AFD\u20E5", - "∂̸": "\u2202\u0338", - "⨔": "\u2A14", - "⊀": "\u2280", - "⋠": "\u22E0", - "⪯̸": "\u2AAF\u0338", - "⊀": "\u2280", - "⪯̸": "\u2AAF\u0338", - "⇏": "\u21CF", - "↛": "\u219B", - "⤳̸": "\u2933\u0338", - "↝̸": "\u219D\u0338", - "↛": "\u219B", - "⋫": "\u22EB", - "⋭": "\u22ED", - "⊁": "\u2281", - "⋡": "\u22E1", - "⪰̸": "\u2AB0\u0338", - "𝓃": "\u{1D4C3}", - "∤": "\u2224", - "∦": "\u2226", - "≁": "\u2241", - "≄": "\u2244", - "≄": "\u2244", - "∤": "\u2224", - "∦": "\u2226", - "⋢": "\u22E2", - "⋣": "\u22E3", - "⊄": "\u2284", - "⫅̸": "\u2AC5\u0338", - "⊈": "\u2288", - "⊂⃒": "\u2282\u20D2", - "⊈": "\u2288", - "⫅̸": "\u2AC5\u0338", - "⊁": "\u2281", - "⪰̸": "\u2AB0\u0338", - "⊅": "\u2285", - "⫆̸": "\u2AC6\u0338", - "⊉": "\u2289", - "⊃⃒": "\u2283\u20D2", - "⊉": "\u2289", - "⫆̸": "\u2AC6\u0338", - "≹": "\u2279", - "ñ": "\xF1", - "ñ": "\xF1", - "≸": "\u2278", - "⋪": "\u22EA", - "⋬": "\u22EC", - "⋫": "\u22EB", - "⋭": "\u22ED", - "ν": "\u03BD", - "#": "#", - "№": "\u2116", - " ": "\u2007", - "⊭": "\u22AD", - "⤄": "\u2904", - "≍⃒": "\u224D\u20D2", - "⊬": "\u22AC", - "≥⃒": "\u2265\u20D2", - ">⃒": ">\u20D2", - "⧞": "\u29DE", - "⤂": "\u2902", - "≤⃒": "\u2264\u20D2", - "<⃒": "<\u20D2", - "⊴⃒": "\u22B4\u20D2", - "⤃": "\u2903", - "⊵⃒": "\u22B5\u20D2", - "∼⃒": "\u223C\u20D2", - "⇖": "\u21D6", - "⤣": "\u2923", - "↖": "\u2196", - "↖": "\u2196", - "⤧": "\u2927", - "Ⓢ": "\u24C8", - "ó": "\xF3", - "ó": "\xF3", - "⊛": "\u229B", - "⊚": "\u229A", - "ô": "\xF4", - "ô": "\xF4", - "о": "\u043E", - "⊝": "\u229D", - "ő": "\u0151", - "⨸": "\u2A38", - "⊙": "\u2299", - "⦼": "\u29BC", - "œ": "\u0153", - "⦿": "\u29BF", - "𝔬": "\u{1D52C}", - "˛": "\u02DB", - "ò": "\xF2", - "ò": "\xF2", - "⧁": "\u29C1", - "⦵": "\u29B5", - "Ω": "\u03A9", - "∮": "\u222E", - "↺": "\u21BA", - "⦾": "\u29BE", - "⦻": "\u29BB", - "‾": "\u203E", - "⧀": "\u29C0", - "ō": "\u014D", - "ω": "\u03C9", - "ο": "\u03BF", - "⦶": "\u29B6", - "⊖": "\u2296", - "𝕠": "\u{1D560}", - "⦷": "\u29B7", - "⦹": "\u29B9", - "⊕": "\u2295", - "∨": "\u2228", - "↻": "\u21BB", - "⩝": "\u2A5D", - "ℴ": "\u2134", - "ℴ": "\u2134", - "ª": "\xAA", - "ª": "\xAA", - "º": "\xBA", - "º": "\xBA", - "⊶": "\u22B6", - "⩖": "\u2A56", - "⩗": "\u2A57", - "⩛": "\u2A5B", - "ℴ": "\u2134", - "ø": "\xF8", - "ø": "\xF8", - "⊘": "\u2298", - "õ": "\xF5", - "õ": "\xF5", - "⊗": "\u2297", - "⨶": "\u2A36", - "ö": "\xF6", - "ö": "\xF6", - "⌽": "\u233D", - "∥": "\u2225", - "¶": "\xB6", - "¶": "\xB6", - "∥": "\u2225", - "⫳": "\u2AF3", - "⫽": "\u2AFD", - "∂": "\u2202", - "п": "\u043F", - "%": "%", - ".": ".", - "‰": "\u2030", - "⊥": "\u22A5", - "‱": "\u2031", - "𝔭": "\u{1D52D}", - "φ": "\u03C6", - "ϕ": "\u03D5", - "ℳ": "\u2133", - "☎": "\u260E", - "π": "\u03C0", - "⋔": "\u22D4", - "ϖ": "\u03D6", - "ℏ": "\u210F", - "ℎ": "\u210E", - "ℏ": "\u210F", - "+": "+", - "⨣": "\u2A23", - "⊞": "\u229E", - "⨢": "\u2A22", - "∔": "\u2214", - "⨥": "\u2A25", - "⩲": "\u2A72", - "±": "\xB1", - "±": "\xB1", - "⨦": "\u2A26", - "⨧": "\u2A27", - "±": "\xB1", - "⨕": "\u2A15", - "𝕡": "\u{1D561}", - "£": "\xA3", - "£": "\xA3", - "≺": "\u227A", - "⪳": "\u2AB3", - "⪷": "\u2AB7", - "≼": "\u227C", - "⪯": "\u2AAF", - "≺": "\u227A", - "⪷": "\u2AB7", - "≼": "\u227C", - "⪯": "\u2AAF", - "⪹": "\u2AB9", - "⪵": "\u2AB5", - "⋨": "\u22E8", - "≾": "\u227E", - "′": "\u2032", - "ℙ": "\u2119", - "⪵": "\u2AB5", - "⪹": "\u2AB9", - "⋨": "\u22E8", - "∏": "\u220F", - "⌮": "\u232E", - "⌒": "\u2312", - "⌓": "\u2313", - "∝": "\u221D", - "∝": "\u221D", - "≾": "\u227E", - "⊰": "\u22B0", - "𝓅": "\u{1D4C5}", - "ψ": "\u03C8", - " ": "\u2008", - "𝔮": "\u{1D52E}", - "⨌": "\u2A0C", - "𝕢": "\u{1D562}", - "⁗": "\u2057", - "𝓆": "\u{1D4C6}", - "ℍ": "\u210D", - "⨖": "\u2A16", - "?": "?", - "≟": "\u225F", - """: '"', - """: '"', - "⇛": "\u21DB", - "⇒": "\u21D2", - "⤜": "\u291C", - "⤏": "\u290F", - "⥤": "\u2964", - "∽̱": "\u223D\u0331", - "ŕ": "\u0155", - "√": "\u221A", - "⦳": "\u29B3", - "⟩": "\u27E9", - "⦒": "\u2992", - "⦥": "\u29A5", - "⟩": "\u27E9", - "»": "\xBB", - "»": "\xBB", - "→": "\u2192", - "⥵": "\u2975", - "⇥": "\u21E5", - "⤠": "\u2920", - "⤳": "\u2933", - "⤞": "\u291E", - "↪": "\u21AA", - "↬": "\u21AC", - "⥅": "\u2945", - "⥴": "\u2974", - "↣": "\u21A3", - "↝": "\u219D", - "⤚": "\u291A", - "∶": "\u2236", - "ℚ": "\u211A", - "⤍": "\u290D", - "❳": "\u2773", - "}": "}", - "]": "]", - "⦌": "\u298C", - "⦎": "\u298E", - "⦐": "\u2990", - "ř": "\u0159", - "ŗ": "\u0157", - "⌉": "\u2309", - "}": "}", - "р": "\u0440", - "⤷": "\u2937", - "⥩": "\u2969", - "”": "\u201D", - "”": "\u201D", - "↳": "\u21B3", - "ℜ": "\u211C", - "ℛ": "\u211B", - "ℜ": "\u211C", - "ℝ": "\u211D", - "▭": "\u25AD", - "®": "\xAE", - "®": "\xAE", - "⥽": "\u297D", - "⌋": "\u230B", - "𝔯": "\u{1D52F}", - "⇁": "\u21C1", - "⇀": "\u21C0", - "⥬": "\u296C", - "ρ": "\u03C1", - "ϱ": "\u03F1", - "→": "\u2192", - "↣": "\u21A3", - "⇁": "\u21C1", - "⇀": "\u21C0", - "⇄": "\u21C4", - "⇌": "\u21CC", - "⇉": "\u21C9", - "↝": "\u219D", - "⋌": "\u22CC", - "˚": "\u02DA", - "≓": "\u2253", - "⇄": "\u21C4", - "⇌": "\u21CC", - "‏": "\u200F", - "⎱": "\u23B1", - "⎱": "\u23B1", - "⫮": "\u2AEE", - "⟭": "\u27ED", - "⇾": "\u21FE", - "⟧": "\u27E7", - "⦆": "\u2986", - "𝕣": "\u{1D563}", - "⨮": "\u2A2E", - "⨵": "\u2A35", - ")": ")", - "⦔": "\u2994", - "⨒": "\u2A12", - "⇉": "\u21C9", - "›": "\u203A", - "𝓇": "\u{1D4C7}", - "↱": "\u21B1", - "]": "]", - "’": "\u2019", - "’": "\u2019", - "⋌": "\u22CC", - "⋊": "\u22CA", - "▹": "\u25B9", - "⊵": "\u22B5", - "▸": "\u25B8", - "⧎": "\u29CE", - "⥨": "\u2968", - "℞": "\u211E", - "ś": "\u015B", - "‚": "\u201A", - "≻": "\u227B", - "⪴": "\u2AB4", - "⪸": "\u2AB8", - "š": "\u0161", - "≽": "\u227D", - "⪰": "\u2AB0", - "ş": "\u015F", - "ŝ": "\u015D", - "⪶": "\u2AB6", - "⪺": "\u2ABA", - "⋩": "\u22E9", - "⨓": "\u2A13", - "≿": "\u227F", - "с": "\u0441", - "⋅": "\u22C5", - "⊡": "\u22A1", - "⩦": "\u2A66", - "⇘": "\u21D8", - "⤥": "\u2925", - "↘": "\u2198", - "↘": "\u2198", - "§": "\xA7", - "§": "\xA7", - ";": ";", - "⤩": "\u2929", - "∖": "\u2216", - "∖": "\u2216", - "✶": "\u2736", - "𝔰": "\u{1D530}", - "⌢": "\u2322", - "♯": "\u266F", - "щ": "\u0449", - "ш": "\u0448", - "∣": "\u2223", - "∥": "\u2225", - "­": "\xAD", - "­": "\xAD", - "σ": "\u03C3", - "ς": "\u03C2", - "ς": "\u03C2", - "∼": "\u223C", - "⩪": "\u2A6A", - "≃": "\u2243", - "≃": "\u2243", - "⪞": "\u2A9E", - "⪠": "\u2AA0", - "⪝": "\u2A9D", - "⪟": "\u2A9F", - "≆": "\u2246", - "⨤": "\u2A24", - "⥲": "\u2972", - "←": "\u2190", - "∖": "\u2216", - "⨳": "\u2A33", - "⧤": "\u29E4", - "∣": "\u2223", - "⌣": "\u2323", - "⪪": "\u2AAA", - "⪬": "\u2AAC", - "⪬︀": "\u2AAC\uFE00", - "ь": "\u044C", - "/": "/", - "⧄": "\u29C4", - "⌿": "\u233F", - "𝕤": "\u{1D564}", - "♠": "\u2660", - "♠": "\u2660", - "∥": "\u2225", - "⊓": "\u2293", - "⊓︀": "\u2293\uFE00", - "⊔": "\u2294", - "⊔︀": "\u2294\uFE00", - "⊏": "\u228F", - "⊑": "\u2291", - "⊏": "\u228F", - "⊑": "\u2291", - "⊐": "\u2290", - "⊒": "\u2292", - "⊐": "\u2290", - "⊒": "\u2292", - "□": "\u25A1", - "□": "\u25A1", - "▪": "\u25AA", - "▪": "\u25AA", - "→": "\u2192", - "𝓈": "\u{1D4C8}", - "∖": "\u2216", - "⌣": "\u2323", - "⋆": "\u22C6", - "☆": "\u2606", - "★": "\u2605", - "ϵ": "\u03F5", - "ϕ": "\u03D5", - "¯": "\xAF", - "⊂": "\u2282", - "⫅": "\u2AC5", - "⪽": "\u2ABD", - "⊆": "\u2286", - "⫃": "\u2AC3", - "⫁": "\u2AC1", - "⫋": "\u2ACB", - "⊊": "\u228A", - "⪿": "\u2ABF", - "⥹": "\u2979", - "⊂": "\u2282", - "⊆": "\u2286", - "⫅": "\u2AC5", - "⊊": "\u228A", - "⫋": "\u2ACB", - "⫇": "\u2AC7", - "⫕": "\u2AD5", - "⫓": "\u2AD3", - "≻": "\u227B", - "⪸": "\u2AB8", - "≽": "\u227D", - "⪰": "\u2AB0", - "⪺": "\u2ABA", - "⪶": "\u2AB6", - "⋩": "\u22E9", - "≿": "\u227F", - "∑": "\u2211", - "♪": "\u266A", - "¹": "\xB9", - "¹": "\xB9", - "²": "\xB2", - "²": "\xB2", - "³": "\xB3", - "³": "\xB3", - "⊃": "\u2283", - "⫆": "\u2AC6", - "⪾": "\u2ABE", - "⫘": "\u2AD8", - "⊇": "\u2287", - "⫄": "\u2AC4", - "⟉": "\u27C9", - "⫗": "\u2AD7", - "⥻": "\u297B", - "⫂": "\u2AC2", - "⫌": "\u2ACC", - "⊋": "\u228B", - "⫀": "\u2AC0", - "⊃": "\u2283", - "⊇": "\u2287", - "⫆": "\u2AC6", - "⊋": "\u228B", - "⫌": "\u2ACC", - "⫈": "\u2AC8", - "⫔": "\u2AD4", - "⫖": "\u2AD6", - "⇙": "\u21D9", - "⤦": "\u2926", - "↙": "\u2199", - "↙": "\u2199", - "⤪": "\u292A", - "ß": "\xDF", - "ß": "\xDF", - "⌖": "\u2316", - "τ": "\u03C4", - "⎴": "\u23B4", - "ť": "\u0165", - "ţ": "\u0163", - "т": "\u0442", - "⃛": "\u20DB", - "⌕": "\u2315", - "𝔱": "\u{1D531}", - "∴": "\u2234", - "∴": "\u2234", - "θ": "\u03B8", - "ϑ": "\u03D1", - "ϑ": "\u03D1", - "≈": "\u2248", - "∼": "\u223C", - " ": "\u2009", - "≈": "\u2248", - "∼": "\u223C", - "þ": "\xFE", - "þ": "\xFE", - "˜": "\u02DC", - "×": "\xD7", - "×": "\xD7", - "⊠": "\u22A0", - "⨱": "\u2A31", - "⨰": "\u2A30", - "∭": "\u222D", - "⤨": "\u2928", - "⊤": "\u22A4", - "⌶": "\u2336", - "⫱": "\u2AF1", - "𝕥": "\u{1D565}", - "⫚": "\u2ADA", - "⤩": "\u2929", - "‴": "\u2034", - "™": "\u2122", - "▵": "\u25B5", - "▿": "\u25BF", - "◃": "\u25C3", - "⊴": "\u22B4", - "≜": "\u225C", - "▹": "\u25B9", - "⊵": "\u22B5", - "◬": "\u25EC", - "≜": "\u225C", - "⨺": "\u2A3A", - "⨹": "\u2A39", - "⧍": "\u29CD", - "⨻": "\u2A3B", - "⏢": "\u23E2", - "𝓉": "\u{1D4C9}", - "ц": "\u0446", - "ћ": "\u045B", - "ŧ": "\u0167", - "≬": "\u226C", - "↞": "\u219E", - "↠": "\u21A0", - "⇑": "\u21D1", - "⥣": "\u2963", - "ú": "\xFA", - "ú": "\xFA", - "↑": "\u2191", - "ў": "\u045E", - "ŭ": "\u016D", - "û": "\xFB", - "û": "\xFB", - "у": "\u0443", - "⇅": "\u21C5", - "ű": "\u0171", - "⥮": "\u296E", - "⥾": "\u297E", - "𝔲": "\u{1D532}", - "ù": "\xF9", - "ù": "\xF9", - "↿": "\u21BF", - "↾": "\u21BE", - "▀": "\u2580", - "⌜": "\u231C", - "⌜": "\u231C", - "⌏": "\u230F", - "◸": "\u25F8", - "ū": "\u016B", - "¨": "\xA8", - "¨": "\xA8", - "ų": "\u0173", - "𝕦": "\u{1D566}", - "↑": "\u2191", - "↕": "\u2195", - "↿": "\u21BF", - "↾": "\u21BE", - "⊎": "\u228E", - "υ": "\u03C5", - "ϒ": "\u03D2", - "υ": "\u03C5", - "⇈": "\u21C8", - "⌝": "\u231D", - "⌝": "\u231D", - "⌎": "\u230E", - "ů": "\u016F", - "◹": "\u25F9", - "𝓊": "\u{1D4CA}", - "⋰": "\u22F0", - "ũ": "\u0169", - "▵": "\u25B5", - "▴": "\u25B4", - "⇈": "\u21C8", - "ü": "\xFC", - "ü": "\xFC", - "⦧": "\u29A7", - "⇕": "\u21D5", - "⫨": "\u2AE8", - "⫩": "\u2AE9", - "⊨": "\u22A8", - "⦜": "\u299C", - "ϵ": "\u03F5", - "ϰ": "\u03F0", - "∅": "\u2205", - "ϕ": "\u03D5", - "ϖ": "\u03D6", - "∝": "\u221D", - "↕": "\u2195", - "ϱ": "\u03F1", - "ς": "\u03C2", - "⊊︀": "\u228A\uFE00", - "⫋︀": "\u2ACB\uFE00", - "⊋︀": "\u228B\uFE00", - "⫌︀": "\u2ACC\uFE00", - "ϑ": "\u03D1", - "⊲": "\u22B2", - "⊳": "\u22B3", - "в": "\u0432", - "⊢": "\u22A2", - "∨": "\u2228", - "⊻": "\u22BB", - "≚": "\u225A", - "⋮": "\u22EE", - "|": "|", - "|": "|", - "𝔳": "\u{1D533}", - "⊲": "\u22B2", - "⊂⃒": "\u2282\u20D2", - "⊃⃒": "\u2283\u20D2", - "𝕧": "\u{1D567}", - "∝": "\u221D", - "⊳": "\u22B3", - "𝓋": "\u{1D4CB}", - "⫋︀": "\u2ACB\uFE00", - "⊊︀": "\u228A\uFE00", - "⫌︀": "\u2ACC\uFE00", - "⊋︀": "\u228B\uFE00", - "⦚": "\u299A", - "ŵ": "\u0175", - "⩟": "\u2A5F", - "∧": "\u2227", - "≙": "\u2259", - "℘": "\u2118", - "𝔴": "\u{1D534}", - "𝕨": "\u{1D568}", - "℘": "\u2118", - "≀": "\u2240", - "≀": "\u2240", - "𝓌": "\u{1D4CC}", - "⋂": "\u22C2", - "◯": "\u25EF", - "⋃": "\u22C3", - "▽": "\u25BD", - "𝔵": "\u{1D535}", - "⟺": "\u27FA", - "⟷": "\u27F7", - "ξ": "\u03BE", - "⟸": "\u27F8", - "⟵": "\u27F5", - "⟼": "\u27FC", - "⋻": "\u22FB", - "⨀": "\u2A00", - "𝕩": "\u{1D569}", - "⨁": "\u2A01", - "⨂": "\u2A02", - "⟹": "\u27F9", - "⟶": "\u27F6", - "𝓍": "\u{1D4CD}", - "⨆": "\u2A06", - "⨄": "\u2A04", - "△": "\u25B3", - "⋁": "\u22C1", - "⋀": "\u22C0", - "ý": "\xFD", - "ý": "\xFD", - "я": "\u044F", - "ŷ": "\u0177", - "ы": "\u044B", - "¥": "\xA5", - "¥": "\xA5", - "𝔶": "\u{1D536}", - "ї": "\u0457", - "𝕪": "\u{1D56A}", - "𝓎": "\u{1D4CE}", - "ю": "\u044E", - "ÿ": "\xFF", - "ÿ": "\xFF", - "ź": "\u017A", - "ž": "\u017E", - "з": "\u0437", - "ż": "\u017C", - "ℨ": "\u2128", - "ζ": "\u03B6", - "𝔷": "\u{1D537}", - "ж": "\u0436", - "⇝": "\u21DD", - "𝕫": "\u{1D56B}", - "𝓏": "\u{1D4CF}", - "‍": "\u200D", - "‌": "\u200C", -}; -var html_entities_default = htmlEntities; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/text-format.js -function decodeHTMLEntities(str) { - return str.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi, (match, entity) => { - if (typeof html_entities_default[match] === "string") { - return html_entities_default[match]; - } - if (entity.charAt(0) !== "#" || match.charAt(match.length - 1) !== ";") { - return match; - } - let codePoint; - if (entity.charAt(1) === "x") { - codePoint = parseInt(entity.substr(2), 16); - } else { - codePoint = parseInt(entity.substr(1), 10); - } - var output = ""; - if ((codePoint >= 55296 && codePoint <= 57343) || codePoint > 1114111) { - return "\uFFFD"; - } - if (codePoint > 65535) { - codePoint -= 65536; - output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296); - codePoint = 56320 | (codePoint & 1023); - } - output += String.fromCharCode(codePoint); - return output; - }); -} -function escapeHtml(str) { - return str.trim().replace(/[<>"'?&]/g, (c2) => { - let hex = c2.charCodeAt(0).toString(16); - if (hex.length < 2) { - hex = "0" + hex; - } - return "&#x" + hex.toUpperCase() + ";"; - }); -} -function textToHtml(str) { - let html = escapeHtml(str).replace(/\n/g, "
"); - return "
" + html + "
"; -} -function htmlToText(str) { - str = str - .replace(/\r?\n/g, "") - .replace(/<\!\-\-.*?\-\->/gi, " ") - .replace(/]*>/gi, "\n") - .replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi, "\n\n") - .replace(/]*>.*?<\/script\b[^>]*>/gi, " ") - .replace(/^.*]*>/i, "") - .replace(/^.*<\/head\b[^>]*>/i, "") - .replace(/^.*<\!doctype\b[^>]*>/i, "") - .replace(/<\/body\b[^>]*>.*$/i, "") - .replace(/<\/html\b[^>]*>.*$/i, "") - .replace(/]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi, " ($1) ") - .replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi, "") - .replace(/]*>[\n\u0001\s]*/gi, "* ") - .replace(/]*>/g, "\n-------------\n") - .replace(/<[^>]*>/g, " ") - .replace(/\u0001/g, "\n") - .replace(/[ \t]+/g, " ") - .replace(/^\s+$/gm, "") - .replace(/\n\n+/g, "\n\n") - .replace(/^\n+/, "\n") - .replace(/\n+$/, "\n"); - str = decodeHTMLEntities(str); - return str; -} -function formatTextAddress(address) { - return [] - .concat(address.name || []) - .concat(address.name ? `<${address.address}>` : address.address) - .join(" "); -} -function formatTextAddresses(addresses) { - let parts = []; - let processAddress = (address, partCounter) => { - if (partCounter) { - parts.push(", "); - } - if (address.group) { - let groupStart = `${address.name}:`; - let groupEnd = `;`; - parts.push(groupStart); - address.group.forEach(processAddress); - parts.push(groupEnd); - } else { - parts.push(formatTextAddress(address)); - } - }; - addresses.forEach(processAddress); - return parts.join(""); -} -function formatHtmlAddress(address) { - return ``; -} -function formatHtmlAddresses(addresses) { - let parts = []; - let processAddress = (address, partCounter) => { - if (partCounter) { - parts.push(''); - } - if (address.group) { - let groupStart = ``; - let groupEnd = ``; - parts.push(groupStart); - address.group.forEach(processAddress); - parts.push(groupEnd); - } else { - parts.push(formatHtmlAddress(address)); - } - }; - addresses.forEach(processAddress); - return parts.join(" "); -} -function foldLines(str, lineLength, afterSpace) { - str = (str || "").toString(); - lineLength = lineLength || 76; - let pos = 0, - len = str.length, - result = "", - line, - match; - while (pos < len) { - line = str.substr(pos, lineLength); - if (line.length < lineLength) { - result += line; - break; - } - if ((match = line.match(/^[^\n\r]*(\r?\n|\r)/))) { - line = match[0]; - result += line; - pos += line.length; - continue; - } else if ( - (match = line.match(/(\s+)[^\s]*$/)) && - match[0].length - (afterSpace ? (match[1] || "").length : 0) < line.length - ) { - line = line.substr( - 0, - line.length - - (match[0].length - (afterSpace ? (match[1] || "").length : 0)) - ); - } else if ((match = str.substr(pos + line.length).match(/^[^\s]+(\s*)/))) { - line = - line + - match[0].substr( - 0, - match[0].length - (!afterSpace ? (match[1] || "").length : 0) - ); - } - result += line; - pos += line.length; - if (pos < len) { - result += "\r\n"; - } - } - return result; -} -function formatTextHeader(message) { - let rows = []; - if (message.from) { - rows.push({ key: "From", val: formatTextAddress(message.from) }); - } - if (message.subject) { - rows.push({ key: "Subject", val: message.subject }); - } - if (message.date) { - let dateOptions = { - year: "numeric", - month: "numeric", - day: "numeric", - hour: "numeric", - minute: "numeric", - second: "numeric", - hour12: false, - }; - let dateStr = - typeof Intl === "undefined" - ? message.date - : new Intl.DateTimeFormat("default", dateOptions).format( - new Date(message.date) - ); - rows.push({ key: "Date", val: dateStr }); - } - if (message.to && message.to.length) { - rows.push({ key: "To", val: formatTextAddresses(message.to) }); - } - if (message.cc && message.cc.length) { - rows.push({ key: "Cc", val: formatTextAddresses(message.cc) }); - } - if (message.bcc && message.bcc.length) { - rows.push({ key: "Bcc", val: formatTextAddresses(message.bcc) }); - } - let maxKeyLength = rows - .map((r) => r.key.length) - .reduce((acc, cur) => { - return cur > acc ? cur : acc; - }, 0); - rows = rows.flatMap((row) => { - let sepLen = maxKeyLength - row.key.length; - let prefix = `${row.key}: ${" ".repeat(sepLen)}`; - let emptyPrefix = `${" ".repeat(row.key.length + 1)} ${" ".repeat(sepLen)}`; - let foldedLines = foldLines(row.val, 80, true) - .split(/\r?\n/) - .map((line) => line.trim()); - return foldedLines.map((line, i) => `${i ? emptyPrefix : prefix}${line}`); - }); - let maxLineLength = rows - .map((r) => r.length) - .reduce((acc, cur) => { - return cur > acc ? cur : acc; - }, 0); - let lineMarker = "-".repeat(maxLineLength); - let template = ` -${lineMarker} -${rows.join("\n")} -${lineMarker} -`; - return template; -} -function formatHtmlHeader(message) { - let rows = []; - if (message.from) { - rows.push( - `` - ); - } - if (message.subject) { - rows.push( - `` - ); - } - if (message.date) { - let dateOptions = { - year: "numeric", - month: "numeric", - day: "numeric", - hour: "numeric", - minute: "numeric", - second: "numeric", - hour12: false, - }; - let dateStr = - typeof Intl === "undefined" - ? message.date - : new Intl.DateTimeFormat("default", dateOptions).format( - new Date(message.date) - ); - rows.push( - `` - ); - } - if (message.to && message.to.length) { - rows.push( - `` - ); - } - if (message.cc && message.cc.length) { - rows.push( - `` - ); - } - if (message.bcc && message.bcc.length) { - rows.push( - `` - ); - } - let template = ``; - return template; -} - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/address-parser.js -function _handleAddress(tokens) { - let token; - let isGroup = false; - let state = "text"; - let address; - let addresses = []; - let data = { - address: [], - comment: [], - group: [], - text: [], - }; - let i; - let len; - for (i = 0, len = tokens.length; i < len; i++) { - token = tokens[i]; - if (token.type === "operator") { - switch (token.value) { - case "<": - state = "address"; - break; - case "(": - state = "comment"; - break; - case ":": - state = "group"; - isGroup = true; - break; - default: - state = "text"; - } - } else if (token.value) { - if (state === "address") { - token.value = token.value.replace(/^[^<]*<\s*/, ""); - } - data[state].push(token.value); - } - } - if (!data.text.length && data.comment.length) { - data.text = data.comment; - data.comment = []; - } - if (isGroup) { - data.text = data.text.join(" "); - addresses.push({ - name: decodeWords(data.text || (address && address.name)), - group: data.group.length ? addressParser(data.group.join(",")) : [], - }); - } else { - if (!data.address.length && data.text.length) { - for (i = data.text.length - 1; i >= 0; i--) { - if (data.text[i].match(/^[^@\s]+@[^@\s]+$/)) { - data.address = data.text.splice(i, 1); - break; - } - } - let _regexHandler = function (address2) { - if (!data.address.length) { - data.address = [address2.trim()]; - return " "; - } else { - return address2; - } - }; - if (!data.address.length) { - for (i = data.text.length - 1; i >= 0; i--) { - data.text[i] = data.text[i] - .replace(/\s*\b[^@\s]+@[^\s]+\b\s*/, _regexHandler) - .trim(); - if (data.address.length) { - break; - } - } - } - } - if (!data.text.length && data.comment.length) { - data.text = data.comment; - data.comment = []; - } - if (data.address.length > 1) { - data.text = data.text.concat(data.address.splice(1)); - } - data.text = data.text.join(" "); - data.address = data.address.join(" "); - if (!data.address && /^=\?[^=]+?=$/.test(data.text.trim())) { - const parsedSubAddresses = addressParser(decodeWords(data.text)); - if (parsedSubAddresses && parsedSubAddresses.length) { - return parsedSubAddresses; - } - } - if (!data.address && isGroup) { - return []; - } else { - address = { - address: data.address || data.text || "", - name: decodeWords(data.text || data.address || ""), - }; - if (address.address === address.name) { - if ((address.address || "").match(/@/)) { - address.name = ""; - } else { - address.address = ""; - } - } - addresses.push(address); - } - } - return addresses; -} -var Tokenizer = class { - constructor(str) { - this.str = (str || "").toString(); - this.operatorCurrent = ""; - this.operatorExpecting = ""; - this.node = null; - this.escaped = false; - this.list = []; - this.operators = { - '"': '"', - "(": ")", - "<": ">", - ",": "", - ":": ";", - // Semicolons are not a legal delimiter per the RFC2822 grammar other - // than for terminating a group, but they are also not valid for any - // other use in this context. Given that some mail clients have - // historically allowed the semicolon as a delimiter equivalent to the - // comma in their UI, it makes sense to treat them the same as a comma - // when used outside of a group. - ";": "", - }; - } - /** - * Tokenizes the original input string - * - * @return {Array} An array of operator|text tokens - */ - tokenize() { - let chr, - list = []; - for (let i = 0, len = this.str.length; i < len; i++) { - chr = this.str.charAt(i); - this.checkChar(chr); - } - this.list.forEach((node) => { - node.value = (node.value || "").toString().trim(); - if (node.value) { - list.push(node); - } - }); - return list; - } - /** - * Checks if a character is an operator or text and acts accordingly - * - * @param {String} chr Character from the address field - */ - checkChar(chr) { - if (this.escaped) { - } else if (chr === this.operatorExpecting) { - this.node = { - type: "operator", - value: chr, - }; - this.list.push(this.node); - this.node = null; - this.operatorExpecting = ""; - this.escaped = false; - return; - } else if (!this.operatorExpecting && chr in this.operators) { - this.node = { - type: "operator", - value: chr, - }; - this.list.push(this.node); - this.node = null; - this.operatorExpecting = this.operators[chr]; - this.escaped = false; - return; - } else if (['"', "'"].includes(this.operatorExpecting) && chr === "\\") { - this.escaped = true; - return; - } - if (!this.node) { - this.node = { - type: "text", - value: "", - }; - this.list.push(this.node); - } - if (chr === "\n") { - chr = " "; - } - if (chr.charCodeAt(0) >= 33 || [" ", " "].includes(chr)) { - this.node.value += chr; - } - this.escaped = false; - } -}; -function addressParser(str, options) { - options = options || {}; - let tokenizer = new Tokenizer(str); - let tokens = tokenizer.tokenize(); - let addresses = []; - let address = []; - let parsedAddresses = []; - tokens.forEach((token) => { - if ( - token.type === "operator" && - (token.value === "," || token.value === ";") - ) { - if (address.length) { - addresses.push(address); - } - address = []; - } else { - address.push(token); - } - }); - if (address.length) { - addresses.push(address); - } - addresses.forEach((address2) => { - address2 = _handleAddress(address2); - if (address2.length) { - parsedAddresses = parsedAddresses.concat(address2); - } - }); - if (options.flatten) { - let addresses2 = []; - let walkAddressList = (list) => { - list.forEach((address2) => { - if (address2.group) { - return walkAddressList(address2.group); - } else { - addresses2.push(address2); - } - }); - }; - walkAddressList(parsedAddresses); - return addresses2; - } - return parsedAddresses; -} -var address_parser_default = addressParser; - -// ../../node_modules/.pnpm/postal-mime@2.0.2/node_modules/postal-mime/src/postal-mime.js -var PostalMime = class { - constructor() { - this.root = this.currentNode = new MimeNode({ - postalMime: this, - }); - this.boundaries = []; - this.textContent = {}; - this.attachments = []; - this.started = false; - } - async finalize() { - await this.root.finalize(); - } - async processLine(line, isFinal) { - let boundaries = this.boundaries; - if ( - boundaries.length && - line.length > 2 && - line[0] === 45 && - line[1] === 45 - ) { - for (let i = boundaries.length - 1; i >= 0; i--) { - let boundary = boundaries[i]; - if ( - line.length !== boundary.value.length + 2 && - line.length !== boundary.value.length + 4 - ) { - continue; - } - let isTerminator = line.length === boundary.value.length + 4; - if ( - isTerminator && - (line[line.length - 2] !== 45 || line[line.length - 1] !== 45) - ) { - continue; - } - let boudaryMatches = true; - for (let i2 = 0; i2 < boundary.value.length; i2++) { - if (line[i2 + 2] !== boundary.value[i2]) { - boudaryMatches = false; - break; - } - } - if (!boudaryMatches) { - continue; - } - if (isTerminator) { - await boundary.node.finalize(); - this.currentNode = boundary.node.parentNode || this.root; - } else { - await boundary.node.finalizeChildNodes(); - this.currentNode = new MimeNode({ - postalMime: this, - parentNode: boundary.node, - }); - } - if (isFinal) { - return this.finalize(); - } - return; - } - } - this.currentNode.feed(line); - if (isFinal) { - return this.finalize(); - } - } - readLine() { - let startPos = this.readPos; - let endPos = this.readPos; - let res = () => { - return { - bytes: new Uint8Array(this.buf, startPos, endPos - startPos), - done: this.readPos >= this.av.length, - }; - }; - while (this.readPos < this.av.length) { - const c2 = this.av[this.readPos++]; - if (c2 !== 13 && c2 !== 10) { - endPos = this.readPos; - } - if (c2 === 10) { - return res(); - } - } - return res(); - } - async processNodeTree() { - let textContent = {}; - let textTypes = /* @__PURE__ */ new Set(); - let textMap = (this.textMap = /* @__PURE__ */ new Map()); - let walk = async (node, alternative, related) => { - alternative = alternative || false; - related = related || false; - if (!node.contentType.multipart) { - if ( - node.contentType.parsed.value === "message/rfc822" && - node.contentDisposition.parsed.value !== "attachment" - ) { - const subParser = new PostalMime(); - node.subMessage = await subParser.parse(node.content); - if (!textMap.has(node)) { - textMap.set(node, {}); - } - let textEntry = textMap.get(node); - if (node.subMessage.text || !node.subMessage.html) { - textEntry.plain = textEntry.plain || []; - textEntry.plain.push({ - type: "subMessage", - value: node.subMessage, - }); - textTypes.add("plain"); - } - if (node.subMessage.html) { - textEntry.html = textEntry.html || []; - textEntry.html.push({ type: "subMessage", value: node.subMessage }); - textTypes.add("html"); - } - if (subParser.textMap) { - subParser.textMap.forEach((subTextEntry, subTextNode) => { - textMap.set(subTextNode, subTextEntry); - }); - } - for (let attachment of node.subMessage.attachments || []) { - this.attachments.push(attachment); - } - } else if ( - (/^text\//i.test(node.contentType.parsed.value) || - node.contentType.parsed.value === "message/delivery-status") && - node.contentDisposition.parsed.value !== "attachment" - ) { - let textType = node.contentType.parsed.value.substr( - node.contentType.parsed.value.indexOf("/") + 1 - ); - if (node.contentType.parsed.value === "message/delivery-status") { - textType = "plain"; - } - let selectorNode = alternative || node; - if (!textMap.has(selectorNode)) { - textMap.set(selectorNode, {}); - } - let textEntry = textMap.get(selectorNode); - textEntry[textType] = textEntry[textType] || []; - textEntry[textType].push({ - type: "text", - value: node.getTextContent(), - }); - textTypes.add(textType); - } else if (node.content) { - let filename = - node.contentDisposition.parsed.params.filename || - node.contentType.parsed.params.name || - null; - let attachment = { - filename: decodeWords(filename), - mimeType: node.contentType.parsed.value, - disposition: node.contentDisposition.parsed.value || null, - }; - if (related && node.contentId) { - attachment.related = true; - } - if (node.contentId) { - attachment.contentId = node.contentId; - } - attachment.content = node.content; - this.attachments.push(attachment); - } - } else if (node.contentType.multipart === "alternative") { - alternative = node; - } else if (node.contentType.multipart === "related") { - related = node; - } - for (let childNode of node.childNodes) { - await walk(childNode, alternative, related); - } - }; - await walk(this.root, false, []); - textMap.forEach((mapEntry) => { - textTypes.forEach((textType) => { - if (!textContent[textType]) { - textContent[textType] = []; - } - if (mapEntry[textType]) { - mapEntry[textType].forEach((textEntry) => { - switch (textEntry.type) { - case "text": - textContent[textType].push(textEntry.value); - break; - case "subMessage": - { - switch (textType) { - case "html": - textContent[textType].push( - formatHtmlHeader(textEntry.value) - ); - break; - case "plain": - textContent[textType].push( - formatTextHeader(textEntry.value) - ); - break; - } - } - break; - } - }); - } else { - let alternativeType; - switch (textType) { - case "html": - alternativeType = "plain"; - break; - case "plain": - alternativeType = "html"; - break; - } - (mapEntry[alternativeType] || []).forEach((textEntry) => { - switch (textEntry.type) { - case "text": - switch (textType) { - case "html": - textContent[textType].push(textToHtml(textEntry.value)); - break; - case "plain": - textContent[textType].push(htmlToText(textEntry.value)); - break; - } - break; - case "subMessage": - { - switch (textType) { - case "html": - textContent[textType].push( - formatHtmlHeader(textEntry.value) - ); - break; - case "plain": - textContent[textType].push( - formatTextHeader(textEntry.value) - ); - break; - } - } - break; - } - }); - } - }); - }); - Object.keys(textContent).forEach((textType) => { - textContent[textType] = textContent[textType].join("\n"); - }); - this.textContent = textContent; - } - async parse(buf) { - if (this.started) { - throw new Error("Can not reuse parser, create a new PostalMime object"); - } - this.started = true; - buf = buf || ArrayBuffer(0); - if (typeof buf === "string") { - buf = textEncoder.encode(buf); - } - if ( - buf instanceof Blob || - Object.prototype.toString.call(buf) === "[object Blob]" - ) { - buf = await blobToArrayBuffer(buf); - } - if (buf.buffer instanceof ArrayBuffer) { - buf = new Uint8Array(buf).buffer; - } - this.buf = buf; - this.av = new Uint8Array(buf); - this.readPos = 0; - while (this.readPos < this.av.length) { - const line = this.readLine(); - await this.processLine(line.bytes, line.done); - } - await this.processNodeTree(); - let message = { - headers: this.root.headers - .map((entry) => ({ key: entry.key, value: entry.value })) - .reverse(), - }; - for (let key of ["from", "sender", "reply-to"]) { - let addressHeader = this.root.headers.find((line) => line.key === key); - if (addressHeader && addressHeader.value) { - let addresses = address_parser_default(addressHeader.value); - if (addresses && addresses.length) { - message[key.replace(/\-(.)/g, (o, c2) => c2.toUpperCase())] = - addresses[0]; - } - } - } - for (let key of ["delivered-to", "return-path"]) { - let addressHeader = this.root.headers.find((line) => line.key === key); - if (addressHeader && addressHeader.value) { - let addresses = address_parser_default(addressHeader.value); - if (addresses && addresses.length && addresses[0].address) { - message[key.replace(/\-(.)/g, (o, c2) => c2.toUpperCase())] = - addresses[0].address; - } - } - } - for (let key of ["to", "cc", "bcc"]) { - let addressHeaders = this.root.headers.filter((line) => line.key === key); - let addresses = []; - addressHeaders - .filter((entry) => entry && entry.value) - .map((entry) => address_parser_default(entry.value)) - .forEach((parsed) => (addresses = addresses.concat(parsed || []))); - if (addresses && addresses.length) { - message[key] = addresses; - } - } - for (let key of ["subject", "message-id", "in-reply-to", "references"]) { - let header = this.root.headers.find((line) => line.key === key); - if (header && header.value) { - message[key.replace(/\-(.)/g, (o, c2) => c2.toUpperCase())] = - decodeWords(header.value); - } - } - let dateHeader = this.root.headers.find((line) => line.key === "date"); - if (dateHeader) { - let date = new Date(dateHeader.value); - if (!date || date.toString() === "Invalid Date") { - date = dateHeader.value; - } else { - date = date.toISOString(); - } - message.date = date; - } - if (this.textContent && this.textContent.html) { - message.html = this.textContent.html; - } - if (this.textContent && this.textContent.plain) { - message.text = this.textContent.plain; - } - message.attachments = this.attachments; - return message; - } -}; - -// src/index.ts -var src_default = { - async email(message, env, ctx) { - try { - const messageFrom = message.from; - const messageTo = message.to; - const rawText = await new Response(message.raw).text(); - const mail = await new PostalMime().parse(rawText); - const now = /* @__PURE__ */ new Date(); - const db = getWebTursoDB(env.TURSO_DB_URL, env.TURSO_DB_AUTH_TOKEN); - const newEmail = { - id: nanoid(), - messageFrom, - messageTo, - ...mail, - createdAt: now, - updatedAt: now, - }; - const email = insertEmailSchema.parse(newEmail); - await insertEmail(db, email); - } catch (e) { - console.log(e); - } - }, -}; -export { src_default as default }; -//# sourceMappingURL=index.js.map diff --git a/docs/receive-tutorial-en.md b/docs/receive-tutorial-en.md deleted file mode 100644 index 68b2723..0000000 --- a/docs/receive-tutorial-en.md +++ /dev/null @@ -1,116 +0,0 @@ -## Email receiving tutorial - -**1.Register a [turso](https://turso.tech) account, create a database, and create an emails table** - -After registration, you will be prompted to create a database. I named it `vmail` here, - -![](https://imgv2.wr.do/file/3773b481c78c9087140b1.png) - -Select your database, you will see the "Edit Table" button, click and enter, continue to click the "SQL Runner" button in the upper left corner, and insert the [SQL Script](https://github.com/oiov/vmail/blob/main/packages/database/drizzle/0000_sturdy_arclight.sql) Copy to Terminal Run: - -```bash -# Copy sql script to run on the terminal (packages/database/drizzle/0000_sturdy_arclight.sql) -CREATE TABLE `emails` ( - `id` text PRIMARY KEY NOT NULL, - `message_from` text NOT NULL, - `message_to` text NOT NULL, - `headers` text NOT NULL, - `from` text NOT NULL, - `sender` text, - `reply_to` text, - `delivered_to` text, - `return_path` text, - `to` text, - `cc` text, - `bcc` text, - `subject` text, - `message_id` text NOT NULL, - `in_reply_to` text, - `references` text, - `date` text, - `html` text, - `text` text, - `created_at` integer NOT NULL, - `updated_at` integer NOT NULL -); -``` - -**2.Deploy email workers** - -```bash -git clone https://github.com/oiov/vmail - -cd vmail - -# Install dependencies -pnpm install -``` - -Fill in the necessary environment variables in `vmail/apps/email-worker/wrangler.toml` file. - -- TURSO_DB_AUTH_TOKEN (turso table info from step 1,click `Generate Token`) -- TURSO_DB_URL (e.g. libsql://db-name.turso.io) -- EMAIL_DOMAIN (e.g. vmail.dev) - -> If you don't do this step, you can add environment variables in the worker settings of Cloudflare - -Then run cmds: - -```bash -cd apps/email-worker - -# Node environment required, and your need to install wrangler cli and login first, see https://developers.cloudflare.com/workers/wrangler/install-and-update -pnpm run deploy -``` - -**3.Configure email routing rules** - -Set `Catch-all` action to Send to Worker - -![](https://imgv2.wr.do/file/fa39163411cd35fad0a7f.png) - -**4.Deploy Remix app on Vercel or fly.io** - -Ensure that the following environment variables (`.env.example`) are prepared and filled in during deployment: - -| Variable | Description | example | -| ---------------------- | ------------------------------------------------------------------ | -------------------------------------- | -| COOKIES_SECRET | The encryption secret of the cookie, a random string is sufficient | `s3cr3t` | -| TURSO_DB_RO_AUTH_TOKEN | Obtain database credentials from turso | `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9` | -| TURSO_DB_URL | Obtain database credentials from turso | `libsql://db-name.turso.io` | -| EMAIL_DOMAIN | email domains | `vmail.dev,meetu.dev` | -| EXPIRY_TIME | Optional. default `86400` | `86400` | -| TURNSTILE_KEY | Optional. Obtained from Cloudflare for website verification | `1234567890` | -| TURNSTILE_SECRET | Optional. Obtained from Cloudflare for website verification | `s3cr3t` | - -Get `TURNSTILE_KEY`、`TURNSTILE_SECRET` from https://dash.cloudflare.com/?to=/:account/turnstile - -**For Vercel:** - -Deploy your own version of email to Vercel with one click: - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Foiov%2Fvmail&env=COOKIES_SECRET&env=TURNSTILE_KEY&env=TURNSTILE_SECRET&env=TURSO_DB_RO_AUTH_TOKEN&env=TURSO_DB_URL&env=EMAIL_DOMAIN&project-name=vmail&repository-name=vmail) - -Or push the code to your Github repository and create a new project in Vercel. Choose `New project`, then import the corresponding Github repository, fill in the environment variables, select the `Remix` framework, and click `Deploy`. Wait for the deployment to complete. - -Click Couninue to Dashboard -> Settings -> General: - -![](https://imgv2.wr.do/file/573f842ccbefdf8daf319.png) -![](https://imgv2.wr.do/file/36c1566d8c27735bb097d.png) - -**For fly.io:** - -```bash -cd vmail/apps/remix -fly launch -``` - -**5.Add DNS records (A record) to the corresponding platform in Cloudflare** - -e.g. vercel: - -![](https://imgv2.wr.do/file/245b71636cd16afcf93c7.png) - -![](https://imgv2.wr.do/file/e10af19334fd6a13b7d2e.png) - -Done! diff --git a/docs/receive-tutorial.md b/docs/receive-tutorial.md deleted file mode 100644 index 48234ee..0000000 --- a/docs/receive-tutorial.md +++ /dev/null @@ -1,150 +0,0 @@ -## 接收邮件部署教程 - -**1.注册一个 [turso](https://turso.tech) 账户,创建数据库,并创建一个`emails`表** - -注册后,系统会提示您创建一个数据库。在这里我将其命名为 `vmail`, - -![](https://imgv2.wr.do/file/3773b481c78c9087140b1.png) - -然后,创建一个名为 `emails` 的表。 - -选择您的数据库,您会看到“编辑表”按钮,点击并进入,继续点击左上角的 `SQL runner` 按钮,将[sql脚本](https://github.com/oiov/vmail/blob/main/packages/database/drizzle/0000_sturdy_arclight.sql)复制到终端运行: - -
-查看脚本内容 -
CREATE TABLE `emails` (
- `id` text PRIMARY KEY NOT NULL,
- `message_from` text NOT NULL,
- `message_to` text NOT NULL,
- `headers` text NOT NULL,
- `from` text NOT NULL,
- `sender` text,
- `reply_to` text,
- `delivered_to` text,
- `return_path` text,
- `to` text,
- `cc` text,
- `bcc` text,
- `subject` text,
- `message_id` text NOT NULL,
- `in_reply_to` text,
- `references` text,
- `date` text,
- `html` text,
- `text` text,
- `created_at` integer NOT NULL,
- `updated_at` integer NOT NULL
-);
-
-
- -
-手动创建表(旧版方法) -Cli 文档:https://docs.turso.tech/cli/introduction - -Linux (或 mac/windows) 终端执行: - -# 安装(安装后记得重启终端生效) -curl -sSfL https://get.tur.so/install.sh | bash -# 登录账户 -turso auth login -# 连接到您的Turso数据库 -turso db shell -
- -**2.部署 email worker** - -需要准备 Node 环境(推荐 18.x 及以上),并且需要安装 wrangler cli 并在本地登录,参考 https://developers.cloudflare.com/workers/wrangler/install-and-update (登录时建议开启VPN) - -```bash -# 安装 pnpm -npm install -g pnpm -``` - -```bash -git clone https://github.com/oiov/vmail - -cd vmail - -# 安装依赖 -pnpm install -``` - -在 `vmail/apps/email-worker/wrangler.toml` 文件中填写必要的环境变量。 - -- TURSO_DB_AUTH_TOKEN(第1步中的turso表信息,点击“Generate Token”) -- TURSO_DB_URL(例如 libsql://db-name.turso.io) -- EMAIL_DOMAIN (域名,如 vmail.dev) - -> 如果您不执行此步骤,可以在Cloudflare的 worker settings 中添加环境变量 - -然后运行命令: - -```bash -cd apps/email-worker - -pnpm run deploy -``` - -**3.配置电子邮件路由规则** - -设置“Catch-all”操作为发送到 email worker: - -![](https://imgv2.wr.do/file/fa39163411cd35fad0a7f.png) - -**4.在 Vercel 或 fly.io 上部署 Remix 应用程序** - -确保在部署时准备并填写以下环境变量(`.env.example`): - -| 变量名 | 说明 | 示例 | -| ---------------------- | ------------------------------------- | --------------------------- | -| COOKIES_SECRET | 必填,cookie加密密钥,随机字符串 | `12345abcde` | -| TURSO_DB_RO_AUTH_TOKEN | 必填,turso数据库只读凭据 | `my-turso-db-ro-auth-token` | -| TURSO_DB_URL | 必填,turso数据库URL | `libsql://db-name.turso.io` | -| EMAIL_DOMAIN | 必填,域名后缀,支持多个 | `vmail.dev,meetu.dev` | -| EXPIRY_TIME | 可选,邮箱过期时间,单位秒,默认86400 | `86400` | -| TURNSTILE_KEY | 可选,网站验证所需的 Turnstile Key | `my-turnstile-key` | -| TURNSTILE_SECRET | 可选,网站验证所需的 Turnstile Secret | `my-turnstile-secret` | - -获取 `TURNSTILE_KEY`、`TURNSTILE_SECRET` 请前往 cloudflare 控制台 https://dash.cloudflare.com/?to=/:account/turnstile - -**Vercel:** - -推荐使用一键部署按钮(此操作会在你的github账户中自动创建vmail仓库并关联部署到vercel): - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Foiov%2Fvmail&env=COOKIES_SECRET&env=TURNSTILE_KEY&env=TURNSTILE_SECRET&env=TURSO_DB_RO_AUTH_TOKEN&env=TURSO_DB_URL&env=EMAIL_DOMAIN&project-name=vmail&repository-name=vmail) - -或手动将代码推送到你的 Github 仓库,并在 Vercel 面板中创建项目。选择 `New project`,然后导入对应的 Github 仓库,填写环境变量,选择 `Remix` 框架,点击 `Deploy`,等待部署完成。 - -部署完后继续点击 Countinu to Dashboard,进入 Settings -> General,修改下面设置: - -![](https://imgv2.wr.do/file/573f842ccbefdf8daf319.png) - -注意一定要修改目录为 `apps/remix`,否则部署后访问网站会出现`404`错误: - -![](https://imgv2.wr.do/file/36c1566d8c27735bb097d.png) - -**然后进入 Deployments 重新部署一次,或向 github 推送代码重新触发部署**。 - -**fly.io:** - -```bash -cd vmail/apps/remix -fly launch -``` - -**5.部署成功后在 cloudflare 添加域名解析(A记录)到对应平台** - -vercel 演示如何解析: - -![](https://imgv2.wr.do/file/245b71636cd16afcf93c7.png) - -![](https://imgv2.wr.do/file/e10af19334fd6a13b7d2e.png) - -**6.在CF域名控制台修改加密模式为完全(或严格)** - -> 若不修改,访问网站会出现`重定向次数过多`错误 - -![](https://img.wr.do/api/img/KK8Qwp) - -以上,完成! diff --git a/docs/send-tutorial-en.md b/docs/send-tutorial-en.md deleted file mode 100644 index a96fd76..0000000 --- a/docs/send-tutorial-en.md +++ /dev/null @@ -1,119 +0,0 @@ -## Email Sending Tutorial - -### Preparation Work - -- Continue to use the domain hosted on cf from the email receiving tutorial. -- DKIM (optional) - -### 1. Create a Sending Worker - -Here we will manually create it: - -- Go to the Cloudflare dashboard at `https://dash.cloudflare.com/`, click on `Workers and Pages` in the sidebar. -- Click `Create an app` -> `Create a worker` -> Name it as you wish, for example, `sender` -> Click `Deploy`. -- Enter the worker and click `Edit code`. Paste the following [code](/docs/send-worker.js) -- In the worker's `Settings` -> `Variables`, add the following variables: - -| Variable Name | Description | Example | -| ---------------- | ------------------------------------ | --------------------- | -| DKIM_DOMAIN | Optional, domain suffix | `vmail.dev` | -| DKIM_PRIVATE_KEY | Optional, DKIM private key | `MIIEpQIBAAKCAQEA...` | -| DKIM_SELECTOR | Optional, fixed value `mailchannels` | `mailchannels` | - -The `DKIM_PRIVATE_KEY` will be explained later on how to obtain it. - -Remember the address assigned to the worker, i.e., `https://..workers.dev`, which will be used later. - -### 2. Prepare DKIM Private Key (optional) - -> DKIM is an email authentication technology that can verify the identity of the email sender. - -Execute the following command in the terminal to generate a DKIM private key, refer to [Adding a DKIM Signature](https://support.mailchannels.com/hc/en-us/articles/7122849237389-Adding-a-DKIM-Signature): - -```bash -openssl genrsa 2048 | tee private_key.pem | openssl rsa -outform der | openssl base64 -A > private_key.txt - -echo -n "v=DKIM1;p=" > dkim_record.txt && openssl rsa -in private_key.pem -pubout -outform der | openssl base64 -A >> dkim_record.txt -``` - -These two commands will generate 3 files: - -- `private_key.pem`: Private key file. -- `private_key.txt`: Private key file in base64 encoding. -- `dkim_record.txt`: DKIM record. - -The content of the `private_key.txt` file is the value for the `DKIM_PRIVATE_KEY` variable in the previous step. - -### 3. Configure DNS - -Enter the Cloudflare domain control console, select your domain -> Click `DNS`, next, you need to **add 3 TXT records** and **modify 1 TXT record**. - -The new ones are as follows: - -| Type | Name | Value | Remarks | -| ---- | ------------------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------ | -| TXT | `_dmarc` | `v=DMARC1; p=reject; adkim=s; aspf=s; rua=mailto:YYY; ruf=mailto:YYY pct=100; fo=1;` | Fixed value | -| TXT | `mailchannels._domainkey` | `v=DKIM1;p=MIIEpQIBAAKCAQEA...` | The value is the content of the `dkim_record.txt` file | -| TXT | `_mailchannels` | `v=mc1 cfid=yesmore.workers.dev` | Replace yesmore with your account name | - -The one that needs modification (the TXT record value is `example.com`, i.e., your domain name): - -| Type | Name | Value | Remarks | -| ---- | ------------- | --------------------------------------------------------------------------- | ----------------------------------------------------- | -| TXT | `example.com` | `v=spf1 include:_spf.mx.cloudflare.net include:relay.mailchannels.net ~all` | Replace the value with this, leave the rest unchanged | - -In the end, there will be a total of 4 TXT records: - -![](https://img.inke.app/file/b7422917c667de620ae95.png) - -Verify if the DKIM record is configured successfully at [dkim-record-checker](https://dmarcly.com/tools/dkim-record-checker). - -### 4. Verify Sending - -Method one: Open the webpage `https://..workers.dev/submit` to verify if sending is normal. - -Method two: Send via API - -- Request URL `https://..workers.dev` -- Request Method `POST` -- Request Body: - -```json -{ - "from": { - "email": "sender@vmail.dev", - "name": "Sender" - }, - "personalizations": [ - { - "to": [ - { - "email": "example@gmail.com", - "name": "Recipient" - } - ] - } - ], - "subject": "Email Subject", - "content": [ - { - "type": "text/plain", - "value": "Email Content" - } - ] -} -``` - -Example: - -![](https://img.inke.app/file/1f6f3ab53aff9a1855475.png) - -### 5. Add Environment Variables - -This project uses the method two from step four to send emails via API. - -In the Vercel project console, go to `Settings` -> `Environment Variables`, and add the following variable: - -- SEND_WORKER_URL: The value should be `https://..workers.dev` - -After adding, trigger a redeployment. \ No newline at end of file diff --git a/docs/send-tutorial.md b/docs/send-tutorial.md deleted file mode 100644 index 7e2945a..0000000 --- a/docs/send-tutorial.md +++ /dev/null @@ -1,120 +0,0 @@ -## 发送邮件部署教程 - -### 准备工作 - -- 继续使用收件教程中托管到 cf 的域名 -- DKIM(可选) - -### 1. 创建发件 worker - -这里使用手动创建的方式: - -- 进入 Cloudflare 控制台 `https://dash.cloudflare.com/`,点击侧边栏 `Workers 和 Pages` -- 点击`创建应用程序` -> `创建 worker` -> 名称随意,比如 `sender` -> 点击 `部署` -- 进入到该 worker,点击 `编辑代码`,将代码 [send-worker.js](/docs/send-worker.js) 粘贴进去并保存部署 -- 在 worker 的 `设置` -> `变量` 中添加以下变量: - -| 变量名 | 说明 | 示例 | -| ---------------- | --------------------------- | --------------------- | -| DKIM_DOMAIN | 可选,域名后缀 | `vmail.dev` | -| DKIM_PRIVATE_KEY | 可选,DKIM 私钥 | `MIIEpQIBAAKCAQEA...` | -| DKIM_SELECTOR | 可选,固定值 `mailchannels` | `mailchannels` | - -`DKIM_PRIVATE_KEY` 后续会提到如何获取。 - -记住 worker 分配的地址,即 `https://..workers.dev`,后面会用到。 - -### 2. 准备 DKIM 私钥(可选) - -> DKIM 是一种电子邮件认证技术,可以验证邮件的发送者身份。 - -在终端执行下面的命令,生成 DKIM 私钥,参考 [Adding-a-DKIM-Signature](https://support.mailchannels.com/hc/en-us/articles/7122849237389-Adding-a-DKIM-Signature): - -```bash -openssl genrsa 2048 | tee private_key.pem | openssl rsa -outform der | openssl base64 -A > private_key.txt - -echo -n "v=DKIM1;p=" > dkim_record.txt && openssl rsa -in private_key.pem -pubout -outform der | openssl base64 -A >> dkim_record.txt -``` - -这两条命令会生成3个文件: - -- `private_key.pem`:私钥文件 -- `private_key.txt`:私钥文件,base64 编码 -- `dkim_record.txt`:DKIM 记录 - -其中 `private_key.txt` 文件中的内容就是上一步 `DKIM_PRIVATE_KEY` 变量的值。 - -### 3. 配置 DNS - -进入 Cloudflare 托管域名控制台,选择你的域名 -> 点击 `DNS`,接下来,需要**添加3条TXT记录**并**修改1条TXT记录**。 - -新增的如下: - -| 类型 | 名称 | 值 | 备注 | -| ---- | ------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------- | -| TXT | `_dmarc` | `v=DMARC1; p=reject; adkim=s; aspf=s; rua=mailto:YYY; ruf=mailto:YYY pct=100; fo=1;` | 固定值 | -| TXT | `mailchannels._domainkey` | `v=DKIM1;p=MIIEpQIBAAKCAQEA...` | 值为 `dkim_record.txt` 文件的内容 | -| TXT | `_mailchannels` | `v=mc1 cfid=yesmore.workers.dev` | 将其中的 yesmore 修改为你的账号名称 | - -需要修改的如下(TXT记录值为 `example.com` 即你的域名的那条): - -| 类型 | 名称 | 值 | 备注 | -| ---- | ------------- | --------------------------------------------------------------------------- | ------------------------ | -| TXT | `example.com` | `v=spf1 include:_spf.mx.cloudflare.net include:relay.mailchannels.net ~all` | 把值替换为这个,其他不动 | - -最后一共4条TXT记录: - -![](https://img.inke.app/file/b7422917c667de620ae95.png) - -在 [dkim-record-checker](https://dmarcly.com/tools/dkim-record-checker) 验证 DKIM 记录是否配置成功。 - -### 4. 验证发送 - -方法一:打开网页 `https://..workers.dev/submit` 验证是否可以正常发送 - -方法二:使用 API 发送 - -- 请求地址 `https://..workers.dev` -- 请求方法 `POST` -- 请求体: - -```json -{ - "from": { - "email": "sender@vmail.dev", - "name": "发送者" - }, - "personalizations": [ - { - "to": [ - { - "email": "example@gmail.com", - "name": "接收者" - } - ] - } - ], - "subject": "邮件标题", - "content": [ - { - "type": "text/plain", - "value": "邮件内容" - } - ] -} -``` - -示例: - -![](https://img.inke.app/file/1f6f3ab53aff9a1855475.png) - - -### 5. 添加环境变量 - -此项目使用第4步中的方法二通过 API 发送邮件。 - -在 Vercel 项目控制台中,进入 `Settings` -> `Environment Variables`,添加以下变量: - -- SEND_WORKER_URL:值为 `https://..workers.dev` - -添加后重新触发部署一次即可。 \ No newline at end of file diff --git a/docs/send-worker.js b/docs/send-worker.js deleted file mode 100644 index cc3169d..0000000 --- a/docs/send-worker.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Welcome to Cloudflare Workers! This is your first worker. - * - * - Run "npm run dev" in your terminal to start a development server - * - Open a browser tab at http://localhost:8787/ to see your worker in action - * - Run "npm run deploy" to publish your worker - * - * Learn more at https://developers.cloudflare.com/workers/ - */ - -async function readRequestBody(request, env) { - const { headers } = request; - const contentType = headers.get("content-type") || ""; - if (contentType.includes("application/json")) { - return JSON.stringify(await request.json()); - } else if (contentType.includes("form")) { - const formData = await request.formData(); - const body = {}; - for (const entry of formData.entries()) { - body[entry[0]] = entry[1]; - } - let data = JSON.parse(JSON.stringify(body)); - let combine = `{"personalizations":[{"to":[{"email":"${data.to}","name":"${data.ton}"}],"dkim_domain":"${env.DKIM_DOMAIN}","dkim_selector":"${env.DKIM_SELECTOR}","dkim_private_key":"${env.DKIM_PRIVATE_KEY}"}],"from":{"email":"${data.from}","name":"${data.fromn}"},"reply_to":{"email":"${data.rep}","name":"${data.repn}"},"subject":"${data.sbj}","content":[{"type":"${data.type}","value":"${data.body}"}]}`; - return combine; - } else { - return '{"success":false}'; - } -} - -async function handleRequest(request, env) { - let start = Date.now(); - let reqBody = await readRequestBody(request, env); - let send_request = new Request("https://api.mailchannels.net/tx/v1/send", { - method: "POST", - headers: { - "content-type": "application/json", - }, - body: reqBody, - }); - let resp = await fetch(send_request); - let respText = await resp.text(); - let end = Date.now(); - let total = end - start; - return new Response(respText, { - headers: { - "X-MC-Status": resp.status, - "X-Response-Time": total, - }, - }); -} - -const htmlForm = ` - - - -Submit your email - -(*) is required -
-
-
-
-
-
-
- -
- -
-
- -
- -`; - -export default { - async fetch(request, env, ctx) { - const { url } = request; - if (url.includes("submit")) { - return new Response(htmlForm, { - headers: { "Content-Type": "text/html" }, - }); - } - if (request.method === "POST") { - return handleRequest(request, env); - } else if (request.method === "GET") { - return new Response(`The request was a GET`); - } - }, -}; diff --git a/frontend/build/client/assets/main-B3RYd5Io.css b/frontend/build/client/assets/main-B3RYd5Io.css deleted file mode 100644 index dad9fca..0000000 --- a/frontend/build/client/assets/main-B3RYd5Io.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.right-4{right:1rem}.top-0{top:0}.top-4{top:1rem}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-1{margin-bottom:-.25rem}.-mr-1{margin-right:-.25rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-\[1px\]{margin-bottom:1px}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.size-6{width:1.5rem;height:1.5rem}.h-1{height:.25rem}.h-20{height:5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-\[32px\]{height:32px}.h-\[488px\]{height:488px}.h-\[60vh\]{height:60vh}.h-\[65px\]{height:65px}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[80vh\]{max-height:80vh}.min-h-0{min-height:0px}.min-h-24{min-height:6rem}.min-h-screen{min-height:100vh}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-\[85px\]{width:85px}.w-full{width:100%}.w-screen{width:100vw}.max-w-\[1400px\]{max-width:1400px}.max-w-\[300px\]{max-width:300px}.max-w-lg{max-width:32rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.origin-left{transform-origin:left}.scale-\[1\.2\]{--tw-scale-x: 1.2;--tw-scale-y: 1.2;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-cyan-50\/20{border-color:#ecfeff33}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-neutral-300{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.border-zinc-600{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity))}.bg-\[\#1f2023\]{--tw-bg-opacity: 1;background-color:rgb(31 32 35 / var(--tw-bg-opacity))}.bg-\[\#ffffffd6\]{background-color:#ffffffd6}.bg-cyan-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-gray-50\/5{background-color:#f9fafb0d}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.bg-neutral-100{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.bg-neutral-800\/95{background-color:#262626f2}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/5{background-color:#ffffff0d}.bg-white\/95{background-color:#fffffff2}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity))}.bg-opacity-10{--tw-bg-opacity: .1}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-2{padding-bottom:.5rem}.pb-5{padding-bottom:1.25rem}.pt-16{padding-top:4rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity))}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-50{--tw-text-opacity: 1;color:rgb(249 250 251 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity))}.text-zinc-100{--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.text-zinc-200{--tw-text-opacity: 1;color:rgb(228 228 231 / var(--tw-text-opacity))}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-500{transition-duration:.5s}*::-webkit-scrollbar{width:0px;height:10px}*::-webkit-scrollbar-thumb{background:#bec3ca00;border-radius:4px}*::-webkit-scrollbar-thumb:hover{background:#96969686}.grids{background-image:linear-gradient(0deg,rgba(122,122,122,.05) 1px,transparent 0),linear-gradient(90deg,rgba(122,122,122,.05) 1px,transparent 0);background-position:50%;background-size:24px 24px}.cool-btn{--btn-default-bg: rgb(41, 41, 41);--btn-padding: 15px 20px;--btn-hover-bg: rgb(51, 51, 51);--btn-transition: .3s;--btn-letter-spacing: .1rem;--btn-animation-duration: 1.2s;--btn-shadow-color: rgba(0, 0, 0, .137);--btn-shadow: 0 2px 10px 0 var(--btn-shadow-color);--hover-btn-color: #0a9ec4;--default-btn-color: #fff;--font-size: 18px;--font-weight: 800;--font-family: Menlo, Roboto Mono, monospace}.cool-btn{box-sizing:border-box;padding:var(--btn-padding);padding-left:0;display:flex;align-items:center;justify-content:center;color:var(--default-btn-color);font:var(--font-weight) var(--font-size);border:none;cursor:pointer;transition:var(--btn-transition);overflow:hidden}.cool-btn span{letter-spacing:var(--btn-letter-spacing);transition:var(--btn-transition);box-sizing:border-box;position:relative;background:inherit}.cool-btn span:before{box-sizing:border-box;position:absolute;content:"";background:inherit}.cool-btn:hover span,.cool-btn:focus span{color:var(--hover-btn-color)}.cool-btn:hover span:before,.cool-btn:focus span:before{animation:chitchat linear both var(--btn-animation-duration)}@keyframes chitchat{0%{content:"#"}5%{content:"."}10%{content:"^{"}15%{content:"-!"}20%{content:"#$_"}25%{content:"№:0"}30%{content:"#{+."}35%{content:"@}-?"}40%{content:"?{4@%"}45%{content:"=.,^!"}50%{content:"?2@%"}55%{content:";1}]"}60%{content:"?{%:%";right:0}65%{content:"|{f[4";right:0}70%{content:"{4%0%";right:0}75%{content:"'1_0<";right:0}80%{content:"{0%";right:0}85%{content:"]>'";right:0}90%{content:"4";right:0}95%{content:"2";right:0}to{content:"";right:0}}.loader{scale:3;height:50px;width:40px}.box{position:relative;opacity:0;left:10px}.side-left{position:absolute;background-color:#0891b2;width:19px;height:5px;transform:skew(0,-25deg);top:14px;left:10px}.side-right{position:absolute;background-color:#0b9fc4;width:19px;height:5px;transform:skew(0,25deg);top:14px;left:-9px}.side-top{position:absolute;background-color:#19b6dd;width:20px;height:20px;rotate:45deg;transform:skew(-20deg,-20deg)}.box-1{animation:from-left 4s infinite}.box-2{animation:from-right 4s infinite;animation-delay:1s}.box-3{animation:from-left 4s infinite;animation-delay:2s}.box-4{animation:from-right 4s infinite;animation-delay:3s}@keyframes from-left{0%{z-index:20;opacity:0;translate:-20px -6px}20%{z-index:10;opacity:1;translate:0px 0px}40%{z-index:9;translate:0px 4px}60%{z-index:8;translate:0px 8px}80%{z-index:7;opacity:1;translate:0px 12px}to{z-index:5;translate:0px 30px;opacity:0}}@keyframes from-right{0%{z-index:20;opacity:0;translate:20px -6px}20%{z-index:10;opacity:1;translate:0px 0px}40%{z-index:9;translate:0px 4px}60%{z-index:8;translate:0px 8px}80%{z-index:7;opacity:1;translate:0px 12px}to{z-index:5;translate:0px 30px;opacity:0}}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:right-1:before{content:var(--tw-content);right:.25rem}.before\:top-1:before{content:var(--tw-content);top:.25rem}.before\:z-10:before{content:var(--tw-content);z-index:10}.before\:h-12:before{content:var(--tw-content);height:3rem}.before\:w-12:before{content:var(--tw-content);width:3rem}.before\:rounded-full:before{content:var(--tw-content);border-radius:9999px}.before\:bg-violet-500:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity))}.before\:blur-lg:before{content:var(--tw-content);--tw-blur: blur(16px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.before\:duration-500:before{content:var(--tw-content);transition-duration:.5s}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:right-8:after{content:var(--tw-content);right:2rem}.after\:top-3:after{content:var(--tw-content);top:.75rem}.after\:z-10:after{content:var(--tw-content);z-index:10}.after\:h-20:after{content:var(--tw-content);height:5rem}.after\:w-20:after{content:var(--tw-content);width:5rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:bg-rose-300:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(253 164 175 / var(--tw-bg-opacity))}.after\:blur-lg:after{content:var(--tw-content);--tw-blur: blur(16px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.after\:duration-500:after{content:var(--tw-content);transition-duration:.5s}.after\:content-\[\'_↗\'\]:after{--tw-content: " ↗";content:var(--tw-content)}.hover\:border-cyan-600:hover{--tw-border-opacity: 1;border-color:rgb(8 145 178 / var(--tw-border-opacity))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity))}.hover\:text-gray-500:hover{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:decoration-2:hover{text-decoration-thickness:2px}.hover\:opacity-50:hover{opacity:.5}.hover\:opacity-90:hover{opacity:.9}.hover\:duration-500:hover{transition-duration:.5s}.hover\:before\:-bottom-8:hover:before{content:var(--tw-content);bottom:-2rem}.hover\:before\:right-12:hover:before{content:var(--tw-content);right:3rem}.hover\:before\:blur:hover:before{content:var(--tw-content);--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:before\:\[box-shadow\:_20px_20px_20px_30px_\#a21caf\]:hover:before{content:var(--tw-content);box-shadow:20px 20px 20px 30px #a21caf}.hover\:after\:-right-8:hover:after{content:var(--tw-content);right:-2rem}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-cyan-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(6 182 212 / var(--tw-ring-opacity))}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-zinc-500:disabled{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity))}.disabled\:text-gray-500:disabled{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity))}.group:hover .group-hover\:before\:duration-500:before{content:var(--tw-content);transition-duration:.5s}.group:hover .group-hover\:after\:duration-500:after{content:var(--tw-content);transition-duration:.5s}.group:active .group-active\:-rotate-12{--tw-rotate: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:active .group-active\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-neutral-900[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(23 23 23 / var(--tw-border-opacity))}.data-\[state\=checked\]\:bg-neutral-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(82 82 82 / var(--tw-bg-opacity))}.data-\[state\=checked\]\:text-neutral-100[data-state=checked]{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:ml-4{margin-left:1rem}.sm\:ml-auto{margin-left:auto}.sm\:mt-0{margin-top:0}.sm\:hidden{display:none}.sm\:flex-row{flex-direction:row}.sm\:justify-start{justify-content:flex-start}.sm\:border-l{border-left-width:1px}.sm\:border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.sm\:pl-4{padding-left:1rem}}@media (min-width: 768px){.md\:mx-10{margin-left:2.5rem;margin-right:2.5rem}.md\:ml-8{margin-left:2rem}.md\:block{display:block}.md\:w-\[350px\]{width:350px}.md\:max-w-3xl{max-width:48rem}.md\:max-w-\[350px\]{max-width:350px}.md\:flex-row{flex-direction:row}.md\:rounded-2xl{border-radius:1rem}.md\:border{border-width:1px}.md\:border-cyan-50\/20{border-color:#ecfeff33}.md\:border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.md\:px-10{padding-left:2.5rem;padding-right:2.5rem}.md\:px-16{padding-left:4rem;padding-right:4rem}.md\:text-base{font-size:1rem;line-height:1.5rem}}@media (prefers-color-scheme: dark){.dark\:border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity))}.dark\:bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[state\=checked\]\:border-neutral-300[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}.dark\:data-\[state\=checked\]\:bg-neutral-300[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(212 212 212 / var(--tw-bg-opacity))}}.\[\&_iframe\]\:\!w-full iframe{width:100%!important} diff --git a/frontend/build/client/assets/main-Cj20Dz1y.js b/frontend/build/client/assets/main-Cj20Dz1y.js deleted file mode 100644 index 35875cf..0000000 --- a/frontend/build/client/assets/main-Cj20Dz1y.js +++ /dev/null @@ -1,264 +0,0 @@ -var Yx=Object.defineProperty;var Rh=e=>{throw TypeError(e)};var Gx=(e,t,n)=>t in e?Yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var jh=(e,t,n)=>Gx(e,typeof t!="symbol"?t+"":t,n),ru=(e,t,n)=>t.has(e)||Rh("Cannot "+n);var P=(e,t,n)=>(ru(e,t,"read from private field"),n?n.call(e):t.get(e)),z=(e,t,n)=>t.has(e)?Rh("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),I=(e,t,n,r)=>(ru(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Q=(e,t,n)=>(ru(e,t,"access private method"),n);var Ao=(e,t,n,r)=>({set _(i){I(e,t,i,n)},get _(){return P(e,t,r)}});function Ty(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ry={exports:{}},bl={},jy={exports:{}},G={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var wo=Symbol.for("react.element"),Xx=Symbol.for("react.portal"),Jx=Symbol.for("react.fragment"),Zx=Symbol.for("react.strict_mode"),e2=Symbol.for("react.profiler"),t2=Symbol.for("react.provider"),n2=Symbol.for("react.context"),r2=Symbol.for("react.forward_ref"),i2=Symbol.for("react.suspense"),s2=Symbol.for("react.memo"),o2=Symbol.for("react.lazy"),Nh=Symbol.iterator;function a2(e){return e===null||typeof e!="object"?null:(e=Nh&&e[Nh]||e["@@iterator"],typeof e=="function"?e:null)}var Ny={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ly=Object.assign,Dy={};function Ki(e,t,n){this.props=e,this.context=t,this.refs=Dy,this.updater=n||Ny}Ki.prototype.isReactComponent={};Ki.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ki.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function My(){}My.prototype=Ki.prototype;function Uf(e,t,n){this.props=e,this.context=t,this.refs=Dy,this.updater=n||Ny}var Bf=Uf.prototype=new My;Bf.constructor=Uf;Ly(Bf,Ki.prototype);Bf.isPureReactComponent=!0;var Lh=Array.isArray,Ay=Object.prototype.hasOwnProperty,zf={current:null},Fy={key:!0,ref:!0,__self:!0,__source:!0};function Iy(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)Ay.call(t,r)&&!Fy.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,U=j[A];if(0>>1;Ai(pt,D))Wi(Ne,pt)?(j[A]=Ne,j[W]=D,A=W):(j[A]=pt,j[ve]=D,A=ve);else if(Wi(Ne,D))j[A]=Ne,j[W]=D,A=W;else break e}}return M}function i(j,M){var D=j.sortIndex-M.sortIndex;return D!==0?D:j.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,d=3,h=!1,m=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(j){for(var M=n(u);M!==null;){if(M.callback===null)r(u);else if(M.startTime<=j)r(u),M.sortIndex=M.expirationTime,t(l,M);else break;M=n(u)}}function b(j){if(w=!1,v(j),!m)if(n(l)!==null)m=!0,N(C);else{var M=n(u);M!==null&&_(b,M.startTime-j)}}function C(j,M){m=!1,w&&(w=!1,y(O),O=-1),h=!0;var D=d;try{for(v(M),f=n(l);f!==null&&(!(f.expirationTime>M)||j&&!B());){var A=f.callback;if(typeof A=="function"){f.callback=null,d=f.priorityLevel;var U=A(f.expirationTime<=M);M=e.unstable_now(),typeof U=="function"?f.callback=U:f===n(l)&&r(l),v(M)}else r(l);f=n(l)}if(f!==null)var K=!0;else{var ve=n(u);ve!==null&&_(b,ve.startTime-M),K=!1}return K}finally{f=null,d=D,h=!1}}var T=!1,k=null,O=-1,F=5,$=-1;function B(){return!(e.unstable_now()-$j||125A?(j.sortIndex=D,t(u,j),n(l)===null&&j===n(u)&&(w?(y(O),O=-1):w=!0,_(b,D-A))):(j.sortIndex=U,t(l,j),m||h||(m=!0,N(C))),j},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(j){var M=d;return function(){var D=d;d=M;try{return j.apply(this,arguments)}finally{d=D}}}})(Uy);$y.exports=Uy;var w2=$y.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var By=S,ct=w2;function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ec=Object.prototype.hasOwnProperty,x2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Mh={},Ah={};function S2(e){return ec.call(Ah,e)?!0:ec.call(Mh,e)?!1:x2.test(e)?Ah[e]=!0:(Mh[e]=!0,!1)}function b2(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function P2(e,t,n,r){if(t===null||typeof t>"u"||b2(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ye(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Ae={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ae[e]=new Ye(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ae[t]=new Ye(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ae[e]=new Ye(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ae[e]=new Ye(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ae[e]=new Ye(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ae[e]=new Ye(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ae[e]=new Ye(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ae[e]=new Ye(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ae[e]=new Ye(e,5,!1,e.toLowerCase(),null,!1,!1)});var Hf=/[\-:]([a-z])/g;function Kf(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Hf,Kf);Ae[t]=new Ye(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Hf,Kf);Ae[t]=new Ye(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Hf,Kf);Ae[t]=new Ye(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ae[e]=new Ye(e,1,!1,e.toLowerCase(),null,!1,!1)});Ae.xlinkHref=new Ye("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ae[e]=new Ye(e,1,!1,e.toLowerCase(),null,!0,!0)});function qf(e,t,n,r){var i=Ae.hasOwnProperty(t)?Ae[t]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{ou=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ps(e):""}function C2(e){switch(e.tag){case 5:return ps(e.type);case 16:return ps("Lazy");case 13:return ps("Suspense");case 19:return ps("SuspenseList");case 0:case 2:case 15:return e=au(e.type,!1),e;case 11:return e=au(e.type.render,!1),e;case 1:return e=au(e.type,!0),e;default:return""}}function ic(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Gr:return"Fragment";case Yr:return"Portal";case tc:return"Profiler";case Qf:return"StrictMode";case nc:return"Suspense";case rc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hy:return(e.displayName||"Context")+".Consumer";case Wy:return(e._context.displayName||"Context")+".Provider";case Yf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Gf:return t=e.displayName||null,t!==null?t:ic(e.type)||"Memo";case Cn:t=e._payload,e=e._init;try{return ic(e(t))}catch{}}return null}function E2(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ic(t);case 8:return t===Qf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Yn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function k2(e){var t=qy(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _o(e){e._valueTracker||(e._valueTracker=k2(e))}function Qy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=qy(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function La(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function sc(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ih(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Yn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Yy(e,t){t=t.checked,t!=null&&qf(e,"checked",t,!1)}function oc(e,t){Yy(e,t);var n=Yn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ac(e,t.type,n):t.hasOwnProperty("defaultValue")&&ac(e,t.type,Yn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _h(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ac(e,t,n){(t!=="number"||La(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ms=Array.isArray;function di(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Vo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ps={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},T2=["Webkit","ms","Moz","O"];Object.keys(Ps).forEach(function(e){T2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ps[t]=Ps[e]})});function Zy(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ps.hasOwnProperty(e)&&Ps[e]?(""+t).trim():t+"px"}function e0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Zy(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var O2=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function cc(e,t){if(t){if(O2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function fc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var dc=null;function Xf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hc=null,hi=null,pi=null;function Uh(e){if(e=bo(e)){if(typeof hc!="function")throw Error(L(280));var t=e.stateNode;t&&(t=Tl(t),hc(e.stateNode,e.type,t))}}function t0(e){hi?pi?pi.push(e):pi=[e]:hi=e}function n0(){if(hi){var e=hi,t=pi;if(pi=hi=null,Uh(e),t)for(e=0;e>>=0,e===0?32:31-(V2(e)/$2|0)|0}var $o=64,Uo=4194304;function gs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fa(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=gs(a):(s&=o,s!==0&&(r=gs(s)))}else o=n&~i,o!==0?r=gs(o):s!==0&&(r=gs(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function xo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Lt(t),e[t]=n}function W2(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Es),Gh=" ",Xh=!1;function b0(e,t){switch(e){case"keyup":return vS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function P0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xr=!1;function xS(e,t){switch(e){case"compositionend":return P0(t);case"keypress":return t.which!==32?null:(Xh=!0,Gh);case"textInput":return e=t.data,e===Gh&&Xh?null:e;default:return null}}function SS(e,t){if(Xr)return e==="compositionend"||!sd&&b0(e,t)?(e=x0(),da=nd=In=null,Xr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=tp(n)}}function T0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?T0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function O0(){for(var e=window,t=La();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=La(e.document)}return t}function od(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function jS(e){var t=O0(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&T0(n.ownerDocument.documentElement,n)){if(r!==null&&od(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=np(n,s);var o=np(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jr=null,wc=null,Ts=null,xc=!1;function rp(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xc||Jr==null||Jr!==La(r)||(r=Jr,"selectionStart"in r&&od(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ts&&Hs(Ts,r)||(Ts=r,r=Va(wc,"onSelect"),0ti||(e.current=kc[ti],kc[ti]=null,ti--)}function ie(e,t){ti++,kc[ti]=e.current,e.current=t}var Gn={},Be=tr(Gn),Ze=tr(!1),jr=Gn;function Mi(e,t){var n=e.type.contextTypes;if(!n)return Gn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function et(e){return e=e.childContextTypes,e!=null}function Ua(){le(Ze),le(Be)}function cp(e,t,n){if(Be.current!==Gn)throw Error(L(168));ie(Be,t),ie(Ze,n)}function I0(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(L(108,E2(e)||"Unknown",i));return pe({},n,r)}function Ba(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gn,jr=Be.current,ie(Be,e),ie(Ze,Ze.current),!0}function fp(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=I0(e,t,jr),r.__reactInternalMemoizedMergedChildContext=e,le(Ze),le(Be),ie(Be,e)):le(Ze),ie(Ze,n)}var rn=null,Ol=!1,Su=!1;function _0(e){rn===null?rn=[e]:rn.push(e)}function BS(e){Ol=!0,_0(e)}function nr(){if(!Su&&rn!==null){Su=!0;var e=0,t=re;try{var n=rn;for(re=1;e>=o,i-=o,an=1<<32-Lt(t)+i|n<O?(F=k,k=null):F=k.sibling;var $=d(y,k,v[O],b);if($===null){k===null&&(k=F);break}e&&k&&$.alternate===null&&t(y,k),g=s($,g,O),T===null?C=$:T.sibling=$,T=$,k=F}if(O===v.length)return n(y,k),ce&&lr(y,O),C;if(k===null){for(;OO?(F=k,k=null):F=k.sibling;var B=d(y,k,$.value,b);if(B===null){k===null&&(k=F);break}e&&k&&B.alternate===null&&t(y,k),g=s(B,g,O),T===null?C=B:T.sibling=B,T=B,k=F}if($.done)return n(y,k),ce&&lr(y,O),C;if(k===null){for(;!$.done;O++,$=v.next())$=f(y,$.value,b),$!==null&&(g=s($,g,O),T===null?C=$:T.sibling=$,T=$);return ce&&lr(y,O),C}for(k=r(y,k);!$.done;O++,$=v.next())$=h(k,y,O,$.value,b),$!==null&&(e&&$.alternate!==null&&k.delete($.key===null?O:$.key),g=s($,g,O),T===null?C=$:T.sibling=$,T=$);return e&&k.forEach(function(X){return t(y,X)}),ce&&lr(y,O),C}function x(y,g,v,b){if(typeof v=="object"&&v!==null&&v.type===Gr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Io:e:{for(var C=v.key,T=g;T!==null;){if(T.key===C){if(C=v.type,C===Gr){if(T.tag===7){n(y,T.sibling),g=i(T,v.props.children),g.return=y,y=g;break e}}else if(T.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Cn&&vp(C)===T.type){n(y,T.sibling),g=i(T,v.props),g.ref=os(y,T,v),g.return=y,y=g;break e}n(y,T);break}else t(y,T);T=T.sibling}v.type===Gr?(g=kr(v.props.children,y.mode,b,v.key),g.return=y,y=g):(b=xa(v.type,v.key,v.props,null,y.mode,b),b.ref=os(y,g,v),b.return=y,y=b)}return o(y);case Yr:e:{for(T=v.key;g!==null;){if(g.key===T)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(y,g.sibling),g=i(g,v.children||[]),g.return=y,y=g;break e}else{n(y,g);break}else t(y,g);g=g.sibling}g=Ru(v,y.mode,b),g.return=y,y=g}return o(y);case Cn:return T=v._init,x(y,g,T(v._payload),b)}if(ms(v))return m(y,g,v,b);if(ts(v))return w(y,g,v,b);Qo(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(y,g.sibling),g=i(g,v),g.return=y,y=g):(n(y,g),g=Ou(v,y.mode,b),g.return=y,y=g),o(y)):n(y,g)}return x}var Fi=K0(!0),q0=K0(!1),Po={},Xt=tr(Po),Ys=tr(Po),Gs=tr(Po);function mr(e){if(e===Po)throw Error(L(174));return e}function md(e,t){switch(ie(Gs,t),ie(Ys,e),ie(Xt,Po),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:uc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=uc(t,e)}le(Xt),ie(Xt,t)}function Ii(){le(Xt),le(Ys),le(Gs)}function Q0(e){mr(Gs.current);var t=mr(Xt.current),n=uc(t,e.type);t!==n&&(ie(Ys,e),ie(Xt,n))}function gd(e){Ys.current===e&&(le(Xt),le(Ys))}var fe=tr(0);function Qa(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var bu=[];function yd(){for(var e=0;en?n:4,e(!0);var r=Pu.transition;Pu.transition={};try{e(!1),t()}finally{re=n,Pu.transition=r}}function cv(){return kt().memoizedState}function KS(e,t,n){var r=Kn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},fv(e))dv(t,n);else if(n=B0(e,t,n,r),n!==null){var i=qe();Dt(n,e,r,i),hv(n,t,r)}}function qS(e,t,n){var r=Kn(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(fv(e))dv(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Mt(a,o)){var l=t.interleaved;l===null?(i.next=i,hd(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=B0(e,t,i,r),n!==null&&(i=qe(),Dt(n,e,r,i),hv(n,t,r))}}function fv(e){var t=e.alternate;return e===he||t!==null&&t===he}function dv(e,t){Os=Ya=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hv(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zf(e,n)}}var Ga={readContext:Et,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useInsertionEffect:Fe,useLayoutEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useMutableSource:Fe,useSyncExternalStore:Fe,useId:Fe,unstable_isNewReconciler:!1},QS={readContext:Et,useCallback:function(e,t){return $t().memoizedState=[e,t===void 0?null:t],e},useContext:Et,useEffect:xp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ga(4194308,4,sv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ga(4194308,4,e,t)},useInsertionEffect:function(e,t){return ga(4,2,e,t)},useMemo:function(e,t){var n=$t();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=$t();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=KS.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=$t();return e={current:e},t.memoizedState=e},useState:wp,useDebugValue:bd,useDeferredValue:function(e){return $t().memoizedState=e},useTransition:function(){var e=wp(!1),t=e[0];return e=HS.bind(null,e[1]),$t().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=he,i=$t();if(ce){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),je===null)throw Error(L(349));Lr&30||X0(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,xp(Z0.bind(null,r,s,e),[e]),r.flags|=2048,Zs(9,J0.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=$t(),t=je.identifierPrefix;if(ce){var n=ln,r=an;n=(r&~(1<<32-Lt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ht]=t,e[Qs]=r,bv(e,t,!1,!1),t.stateNode=e;e:{switch(o=fc(n,r),n){case"dialog":oe("cancel",e),oe("close",e),i=r;break;case"iframe":case"object":case"embed":oe("load",e),i=r;break;case"video":case"audio":for(i=0;iVi&&(t.flags|=128,r=!0,as(s,!1),t.lanes=4194304)}else{if(!r)if(e=Qa(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),as(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ce)return Ie(t),null}else 2*xe()-s.renderingStartTime>Vi&&n!==1073741824&&(t.flags|=128,r=!0,as(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=xe(),t.sibling=null,n=fe.current,ie(fe,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Od(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ot&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function nb(e,t){switch(ld(t),t.tag){case 1:return et(t.type)&&Ua(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ii(),le(Ze),le(Be),yd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gd(t),null;case 13:if(le(fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(fe),null;case 4:return Ii(),null;case 10:return dd(t.type._context),null;case 22:case 23:return Od(),null;case 24:return null;default:return null}}var Go=!1,Ve=!1,rb=typeof WeakSet=="function"?WeakSet:Set,V=null;function si(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function _c(e,t,n){try{n()}catch(r){ye(e,t,r)}}var Rp=!1;function ib(e,t){if(Sc=Ia,e=O0(),od(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=e,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(a=o+i),f!==s||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===i&&(a=o),d===s&&++c===r&&(l=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(bc={focusedElem:e,selectionRange:n},Ia=!1,V=t;V!==null;)if(t=V,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,V=e;else for(;V!==null;){t=V;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var w=m.memoizedProps,x=m.memoizedState,y=t.stateNode,g=y.getSnapshotBeforeUpdate(t.elementType===t.type?w:Rt(t.type,w),x);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(b){ye(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return m=Rp,Rp=!1,m}function Rs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&_c(t,n,s)}i=i.next}while(i!==r)}}function Nl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Vc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ev(e){var t=e.alternate;t!==null&&(e.alternate=null,Ev(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ht],delete t[Qs],delete t[Ec],delete t[$S],delete t[US])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function kv(e){return e.tag===5||e.tag===3||e.tag===4}function jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$a));else if(r!==4&&(e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function Uc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Uc(e,t,n),e=e.sibling;e!==null;)Uc(e,t,n),e=e.sibling}var Le=null,jt=!1;function xn(e,t,n){for(n=n.child;n!==null;)Tv(e,t,n),n=n.sibling}function Tv(e,t,n){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(Pl,n)}catch{}switch(n.tag){case 5:Ve||si(n,t);case 6:var r=Le,i=jt;Le=null,xn(e,t,n),Le=r,jt=i,Le!==null&&(jt?(e=Le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Le.removeChild(n.stateNode));break;case 18:Le!==null&&(jt?(e=Le,n=n.stateNode,e.nodeType===8?xu(e.parentNode,n):e.nodeType===1&&xu(e,n),zs(e)):xu(Le,n.stateNode));break;case 4:r=Le,i=jt,Le=n.stateNode.containerInfo,jt=!0,xn(e,t,n),Le=r,jt=i;break;case 0:case 11:case 14:case 15:if(!Ve&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&_c(n,t,o),i=i.next}while(i!==r)}xn(e,t,n);break;case 1:if(!Ve&&(si(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ye(n,t,a)}xn(e,t,n);break;case 21:xn(e,t,n);break;case 22:n.mode&1?(Ve=(r=Ve)||n.memoizedState!==null,xn(e,t,n),Ve=r):xn(e,t,n);break;default:xn(e,t,n)}}function Np(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rb),t.forEach(function(r){var i=hb.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Tt(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ob(r/1960))-r,10e?16:e,_n===null)var r=!1;else{if(e=_n,_n=null,Za=0,ee&6)throw Error(L(331));var i=ee;for(ee|=4,V=e.current;V!==null;){var s=V,o=s.child;if(V.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lxe()-kd?Er(e,0):Ed|=n),tt(e,t)}function Av(e,t){t===0&&(e.mode&1?(t=Uo,Uo<<=1,!(Uo&130023424)&&(Uo=4194304)):t=1);var n=qe();e=mn(e,t),e!==null&&(xo(e,t,n),tt(e,n))}function db(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Av(e,n)}function hb(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),Av(e,n)}var Fv;Fv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ze.current)Je=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Je=!1,eb(e,t,n);Je=!!(e.flags&131072)}else Je=!1,ce&&t.flags&1048576&&V0(t,Wa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ya(e,t),e=t.pendingProps;var i=Mi(t,Be.current);gi(t,n),i=wd(null,t,r,e,i,n);var s=xd();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,et(r)?(s=!0,Ba(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,pd(t),i.updater=Rl,t.stateNode=i,i._reactInternals=t,Nc(t,r,e,n),t=Mc(null,t,r,!0,s,n)):(t.tag=0,ce&&s&&ad(t),He(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ya(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=mb(r),e=Rt(r,e),i){case 0:t=Dc(null,t,r,e,n);break e;case 1:t=kp(null,t,r,e,n);break e;case 11:t=Cp(null,t,r,e,n);break e;case 14:t=Ep(null,t,r,Rt(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Rt(r,i),Dc(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Rt(r,i),kp(e,t,r,i,n);case 3:e:{if(wv(t),e===null)throw Error(L(387));r=t.pendingProps,s=t.memoizedState,i=s.element,z0(e,t),qa(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=_i(Error(L(423)),t),t=Tp(e,t,r,n,i);break e}else if(r!==i){i=_i(Error(L(424)),t),t=Tp(e,t,r,n,i);break e}else for(at=zn(t.stateNode.containerInfo.firstChild),lt=t,ce=!0,Nt=null,n=q0(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ai(),r===i){t=gn(e,t,n);break e}He(e,t,r,n)}t=t.child}return t;case 5:return Q0(t),e===null&&Oc(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Pc(r,i)?o=null:s!==null&&Pc(r,s)&&(t.flags|=32),vv(e,t),He(e,t,o,n),t.child;case 6:return e===null&&Oc(t),null;case 13:return xv(e,t,n);case 4:return md(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fi(t,null,r,n):He(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Rt(r,i),Cp(e,t,r,i,n);case 7:return He(e,t,t.pendingProps,n),t.child;case 8:return He(e,t,t.pendingProps.children,n),t.child;case 12:return He(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,ie(Ha,r._currentValue),r._currentValue=o,s!==null)if(Mt(s.value,o)){if(s.children===i.children&&!Ze.current){t=gn(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=un(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Rc(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(L(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Rc(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}He(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,gi(t,n),i=Et(i),r=r(i),t.flags|=1,He(e,t,r,n),t.child;case 14:return r=t.type,i=Rt(r,t.pendingProps),i=Rt(r.type,i),Ep(e,t,r,i,n);case 15:return gv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Rt(r,i),ya(e,t),t.tag=1,et(r)?(e=!0,Ba(t)):e=!1,gi(t,n),H0(t,r,i),Nc(t,r,i,n),Mc(null,t,r,!0,e,n);case 19:return Sv(e,t,n);case 22:return yv(e,t,n)}throw Error(L(156,t.tag))};function Iv(e,t){return u0(e,t)}function pb(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,n,r){return new pb(e,t,n,r)}function jd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mb(e){if(typeof e=="function")return jd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Yf)return 11;if(e===Gf)return 14}return 2}function qn(e,t){var n=e.alternate;return n===null?(n=Pt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xa(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")jd(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Gr:return kr(n.children,i,s,t);case Qf:o=8,i|=8;break;case tc:return e=Pt(12,n,t,i|2),e.elementType=tc,e.lanes=s,e;case nc:return e=Pt(13,n,t,i),e.elementType=nc,e.lanes=s,e;case rc:return e=Pt(19,n,t,i),e.elementType=rc,e.lanes=s,e;case Ky:return Dl(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wy:o=10;break e;case Hy:o=9;break e;case Yf:o=11;break e;case Gf:o=14;break e;case Cn:o=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=Pt(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function kr(e,t,n,r){return e=Pt(7,e,r,t),e.lanes=n,e}function Dl(e,t,n,r){return e=Pt(22,e,r,t),e.elementType=Ky,e.lanes=n,e.stateNode={isHidden:!1},e}function Ou(e,t,n){return e=Pt(6,e,null,t),e.lanes=n,e}function Ru(e,t,n){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gb(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=uu(0),this.expirationTimes=uu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uu(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Nd(e,t,n,r,i,s,o,a,l){return e=new gb(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Pt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},pd(s),e}function yb(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uv)}catch(e){console.error(e)}}Uv(),Vy.exports=dt;var bb=Vy.exports,Vp=bb;Zu.createRoot=Vp.createRoot,Zu.hydrateRoot=Vp.hydrateRoot;var Yi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$i=typeof window>"u"||"Deno"in window;function xt(){}function Pb(e,t){return typeof e=="function"?e(t):e}function Kc(e){return typeof e=="number"&&e>=0&&e!==1/0}function Bv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $p(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Ad(o,t.options))return!1}else if(!to(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||typeof i<"u"&&i!==t.state.fetchStatus||s&&!s(t))}function Up(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Ar(t.options.mutationKey)!==Ar(s))return!1}else if(!to(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ad(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ar)(e)}function Ar(e){return JSON.stringify(e,(t,n)=>qc(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function to(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!to(e[n],t[n])):!1}function zv(e,t){if(e===t)return e;const n=Bp(e)&&Bp(t);if(n||qc(e)&&qc(t)){const r=n?e.length:Object.keys(e).length,i=n?t:Object.keys(t),s=i.length,o=n?[]:{};let a=0;for(let l=0;l"u")return!0;const n=t.prototype;return!(!zp(n)||!n.hasOwnProperty("isPrototypeOf"))}function zp(e){return Object.prototype.toString.call(e)==="[object Object]"}function Cb(e){return new Promise(t=>{setTimeout(t,e)})}function Qc(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?zv(e,t):t}function Eb(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function kb(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var vr,Rn,wi,yy,Tb=(yy=class extends Yi{constructor(){super();z(this,vr);z(this,Rn);z(this,wi);I(this,wi,t=>{if(!$i&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,Rn)||this.setEventListener(P(this,wi))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Rn))==null||t.call(this),I(this,Rn,void 0))}setEventListener(t){var n;I(this,wi,t),(n=P(this,Rn))==null||n.call(this),I(this,Rn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,vr)!==t&&(I(this,vr,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof P(this,vr)=="boolean"?P(this,vr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},vr=new WeakMap,Rn=new WeakMap,wi=new WeakMap,yy),rl=new Tb,xi,jn,Si,vy,Ob=(vy=class extends Yi{constructor(){super();z(this,xi,!0);z(this,jn);z(this,Si);I(this,Si,t=>{if(!$i&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,jn)||this.setEventListener(P(this,Si))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,jn))==null||t.call(this),I(this,jn,void 0))}setEventListener(t){var n;I(this,Si,t),(n=P(this,jn))==null||n.call(this),I(this,jn,t(this.setOnline.bind(this)))}setOnline(t){P(this,xi)!==t&&(I(this,xi,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,xi)}},xi=new WeakMap,jn=new WeakMap,Si=new WeakMap,vy),il=new Ob;function Rb(e){return Math.min(1e3*2**e,3e4)}function _l(e){return(e??"online")==="online"?il.isOnline():!0}var Wv=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ju(e){return e instanceof Wv}function Hv(e){let t=!1,n=0,r=!1,i,s,o;const a=new Promise((x,y)=>{s=x,o=y}),l=x=>{var y;r||(h(new Wv(x)),(y=e.abort)==null||y.call(e))},u=()=>{t=!0},c=()=>{t=!1},f=()=>!rl.isFocused()||e.networkMode!=="always"&&!il.isOnline(),d=x=>{var y;r||(r=!0,(y=e.onSuccess)==null||y.call(e,x),i==null||i(),s(x))},h=x=>{var y;r||(r=!0,(y=e.onError)==null||y.call(e,x),i==null||i(),o(x))},m=()=>new Promise(x=>{var y;i=g=>{const v=r||!f();return v&&x(g),v},(y=e.onPause)==null||y.call(e)}).then(()=>{var x;i=void 0,r||(x=e.onContinue)==null||x.call(e)}),w=()=>{if(r)return;let x;try{x=e.fn()}catch(y){x=Promise.reject(y)}Promise.resolve(x).then(d).catch(y=>{var T;if(r)return;const g=e.retry??($i?0:3),v=e.retryDelay??Rb,b=typeof v=="function"?v(n,y):v,C=g===!0||typeof g=="number"&&n{if(f())return m()}).then(()=>{t?h(y):w()})})};return _l(e.networkMode)?w():m().then(w),{promise:a,cancel:l,continue:()=>(i==null?void 0:i())?a:Promise.resolve(),cancelRetry:u,continueRetry:c}}function jb(){let e=[],t=0,n=d=>{d()},r=d=>{d()},i=d=>setTimeout(d,0);const s=d=>{i=d},o=d=>{let h;t++;try{h=d()}finally{t--,t||u()}return h},a=d=>{t?e.push(d):i(()=>{n(d)})},l=d=>(...h)=>{a(()=>{d(...h)})},u=()=>{const d=e;e=[],d.length&&i(()=>{r(()=>{d.forEach(h=>{n(h)})})})};return{batch:o,batchCalls:l,schedule:a,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{r=d},setScheduler:s}}var ke=jb(),wr,wy,Kv=(wy=class{constructor(){z(this,wr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Kc(this.gcTime)&&I(this,wr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($i?1/0:5*60*1e3))}clearGcTimeout(){P(this,wr)&&(clearTimeout(P(this,wr)),I(this,wr,void 0))}},wr=new WeakMap,wy),bi,Pi,yt,Nn,vt,Oe,po,xr,Ke,Sa,tn,xy,Nb=(xy=class extends Kv{constructor(t){super();z(this,Ke);z(this,bi);z(this,Pi);z(this,yt);z(this,Nn);z(this,vt);z(this,Oe);z(this,po);z(this,xr);I(this,xr,!1),I(this,po,t.defaultOptions),Q(this,Ke,Sa).call(this,t.options),I(this,Oe,[]),I(this,yt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,I(this,bi,t.state||Lb(this.options)),this.state=P(this,bi),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!P(this,Oe).length&&this.state.fetchStatus==="idle"&&P(this,yt).remove(this)}setData(t,n){const r=Qc(this.state.data,t,this.options);return Q(this,Ke,tn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Q(this,Ke,tn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=P(this,Nn);return(r=P(this,vt))==null||r.cancel(t),n?n.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,bi))}isActive(){return P(this,Oe).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||P(this,Oe).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!Bv(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=P(this,Oe).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,vt))==null||n.continue()}onOnline(){var n;const t=P(this,Oe).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,vt))==null||n.continue()}addObserver(t){P(this,Oe).includes(t)||(P(this,Oe).push(t),this.clearGcTimeout(),P(this,yt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){P(this,Oe).includes(t)&&(I(this,Oe,P(this,Oe).filter(n=>n!==t)),P(this,Oe).length||(P(this,vt)&&(P(this,xr)?P(this,vt).cancel({revert:!0}):P(this,vt).cancelRetry()),this.scheduleGc()),P(this,yt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return P(this,Oe).length}invalidate(){this.state.isInvalidated||Q(this,Ke,tn).call(this,{type:"invalidate"})}fetch(t,n){var u,c,f,d;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,Nn))return(u=P(this,vt))==null||u.continueRetry(),P(this,Nn)}if(t&&Q(this,Ke,Sa).call(this,t),!this.options.queryFn){const h=P(this,Oe).find(m=>m.options.queryFn);h&&Q(this,Ke,Sa).call(this,h.options)}const r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},s=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(I(this,xr,!0),r.signal)})};s(i);const o=()=>this.options.queryFn?(I(this,xr,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};s(a),(c=this.options.behavior)==null||c.onFetch(a,this),I(this,Pi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Q(this,Ke,tn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta});const l=h=>{var m,w,x,y;ju(h)&&h.silent||Q(this,Ke,tn).call(this,{type:"error",error:h}),ju(h)||((w=(m=P(this,yt).config).onError)==null||w.call(m,h,this),(y=(x=P(this,yt).config).onSettled)==null||y.call(x,this.state.data,h,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return I(this,vt,Hv({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:h=>{var m,w,x,y;if(typeof h>"u"){l(new Error(`${this.queryHash} data is undefined`));return}this.setData(h),(w=(m=P(this,yt).config).onSuccess)==null||w.call(m,h,this),(y=(x=P(this,yt).config).onSettled)==null||y.call(x,h,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(h,m)=>{Q(this,Ke,tn).call(this,{type:"failed",failureCount:h,error:m})},onPause:()=>{Q(this,Ke,tn).call(this,{type:"pause"})},onContinue:()=>{Q(this,Ke,tn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),I(this,Nn,P(this,vt).promise),P(this,Nn)}},bi=new WeakMap,Pi=new WeakMap,yt=new WeakMap,Nn=new WeakMap,vt=new WeakMap,Oe=new WeakMap,po=new WeakMap,xr=new WeakMap,Ke=new WeakSet,Sa=function(t){this.options={...P(this,po),...t},this.updateGcTime(this.options.gcTime)},tn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:_l(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return ju(i)&&i.revert&&P(this,Pi)?{...P(this,Pi),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ke.batch(()=>{P(this,Oe).forEach(r=>{r.onQueryUpdate()}),P(this,yt).notify({query:this,type:"updated",action:t})})},xy);function Lb(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ut,Sy,Db=(Sy=class extends Yi{constructor(t={}){super();z(this,Ut);this.config=t,I(this,Ut,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??Ad(i,n);let o=this.get(s);return o||(o=new Nb({cache:this,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){P(this,Ut).has(t.queryHash)||(P(this,Ut).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,Ut).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,Ut).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ke.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,Ut).get(t)}getAll(){return[...P(this,Ut).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$p(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>$p(t,r)):n}notify(t){ke.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ke.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ke.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ut=new WeakMap,Sy),Bt,mo,it,Ci,zt,bn,by,Mb=(by=class extends Kv{constructor(t){super();z(this,zt);z(this,Bt);z(this,mo);z(this,it);z(this,Ci);this.mutationId=t.mutationId,I(this,mo,t.defaultOptions),I(this,it,t.mutationCache),I(this,Bt,[]),this.state=t.state||qv(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...P(this,mo),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,Bt).includes(t)||(P(this,Bt).push(t),this.clearGcTimeout(),P(this,it).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){I(this,Bt,P(this,Bt).filter(n=>n!==t)),this.scheduleGc(),P(this,it).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,Bt).length||(this.state.status==="pending"?this.scheduleGc():P(this,it).remove(this))}continue(){var t;return((t=P(this,Ci))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,o,a,l,u,c,f,d,h,m,w,x,y,g,v,b,C,T,k;const n=()=>(I(this,Ci,Hv({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(O,F)=>{Q(this,zt,bn).call(this,{type:"failed",failureCount:O,error:F})},onPause:()=>{Q(this,zt,bn).call(this,{type:"pause"})},onContinue:()=>{Q(this,zt,bn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),P(this,Ci).promise),r=this.state.status==="pending";try{if(!r){Q(this,zt,bn).call(this,{type:"pending",variables:t}),await((s=(i=P(this,it).config).onMutate)==null?void 0:s.call(i,t,this));const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t));F!==this.state.context&&Q(this,zt,bn).call(this,{type:"pending",context:F,variables:t})}const O=await n();return await((u=(l=P(this,it).config).onSuccess)==null?void 0:u.call(l,O,t,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,O,t,this.state.context)),await((h=(d=P(this,it).config).onSettled)==null?void 0:h.call(d,O,null,this.state.variables,this.state.context,this)),await((w=(m=this.options).onSettled)==null?void 0:w.call(m,O,null,t,this.state.context)),Q(this,zt,bn).call(this,{type:"success",data:O}),O}catch(O){try{throw await((y=(x=P(this,it).config).onError)==null?void 0:y.call(x,O,t,this.state.context,this)),await((v=(g=this.options).onError)==null?void 0:v.call(g,O,t,this.state.context)),await((C=(b=P(this,it).config).onSettled)==null?void 0:C.call(b,void 0,O,this.state.variables,this.state.context,this)),await((k=(T=this.options).onSettled)==null?void 0:k.call(T,void 0,O,t,this.state.context)),O}finally{Q(this,zt,bn).call(this,{type:"error",error:O})}}}},Bt=new WeakMap,mo=new WeakMap,it=new WeakMap,Ci=new WeakMap,zt=new WeakSet,bn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!_l(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ke.batch(()=>{P(this,Bt).forEach(r=>{r.onMutationUpdate(t)}),P(this,it).notify({mutation:this,type:"updated",action:t})})},by);function qv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wt,go,Sr,Py,Ab=(Py=class extends Yi{constructor(t={}){super();z(this,wt);z(this,go);z(this,Sr);this.config=t,I(this,wt,[]),I(this,go,0)}build(t,n,r){const i=new Mb({mutationCache:this,mutationId:++Ao(this,go)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){P(this,wt).push(t),this.notify({type:"added",mutation:t})}remove(t){I(this,wt,P(this,wt).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){ke.batch(()=>{P(this,wt).forEach(t=>{this.remove(t)})})}getAll(){return P(this,wt)}find(t){const n={exact:!0,...t};return P(this,wt).find(r=>Up(n,r))}findAll(t={}){return P(this,wt).filter(n=>Up(t,n))}notify(t){ke.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return I(this,Sr,(P(this,Sr)??Promise.resolve()).then(()=>{const t=P(this,wt).filter(n=>n.state.isPaused);return ke.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(xt)),Promise.resolve()))}).then(()=>{I(this,Sr,void 0)})),P(this,Sr)}},wt=new WeakMap,go=new WeakMap,Sr=new WeakMap,Py);function Fb(e){return{onFetch:(t,n)=>{const r=async()=>{var m,w,x,y,g;const i=t.options,s=(x=(w=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:w.fetchMore)==null?void 0:x.direction,o=((y=t.state.data)==null?void 0:y.pages)||[],a=((g=t.state.data)==null?void 0:g.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),d=async(v,b,C)=>{if(u)return Promise.reject();if(b==null&&v.pages.length)return Promise.resolve(v);const T={queryKey:t.queryKey,pageParam:b,direction:C?"backward":"forward",meta:t.options.meta};c(T);const k=await f(T),{maxPages:O}=t.options,F=C?kb:Eb;return{pages:F(v.pages,k,O),pageParams:F(v.pageParams,b,O)}};let h;if(s&&o.length){const v=s==="backward",b=v?Ib:Wp,C={pages:o,pageParams:a},T=b(i,C);h=await d(C,T,v)}else{h=await d(l,a[0]??i.initialPageParam);const v=e??o.length;for(let b=1;b{var i,s;return(s=(i=t.options).persister)==null?void 0:s.call(i,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function Wp(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Ib(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var Ce,Ln,Dn,Ei,ki,Mn,Ti,Oi,Cy,_b=(Cy=class{constructor(e={}){z(this,Ce);z(this,Ln);z(this,Dn);z(this,Ei);z(this,ki);z(this,Mn);z(this,Ti);z(this,Oi);I(this,Ce,e.queryCache||new Db),I(this,Ln,e.mutationCache||new Ab),I(this,Dn,e.defaultOptions||{}),I(this,Ei,new Map),I(this,ki,new Map),I(this,Mn,0)}mount(){Ao(this,Mn)._++,P(this,Mn)===1&&(I(this,Ti,rl.subscribe(()=>{rl.isFocused()&&(this.resumePausedMutations(),P(this,Ce).onFocus())})),I(this,Oi,il.subscribe(()=>{il.isOnline()&&(this.resumePausedMutations(),P(this,Ce).onOnline())})))}unmount(){var e,t;Ao(this,Mn)._--,P(this,Mn)===0&&((e=P(this,Ti))==null||e.call(this),I(this,Ti,void 0),(t=P(this,Oi))==null||t.call(this),I(this,Oi,void 0))}isFetching(e){return P(this,Ce).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,Ln).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=P(this,Ce).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=P(this,Ce).find({queryKey:e}),i=r==null?void 0:r.state.data,s=Pb(t,i);if(typeof s>"u")return;const o=this.defaultQueryOptions({queryKey:e});return P(this,Ce).build(this,o).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return ke.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=P(this,Ce).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=P(this,Ce);ke.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,Ce),r={type:"active",...e};return ke.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=ke.batch(()=>P(this,Ce).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(xt).catch(xt)}invalidateQueries(e={},t={}){return ke.batch(()=>{if(P(this,Ce).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=ke.batch(()=>P(this,Ce).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(xt)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(xt)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=P(this,Ce).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e.behavior=Fb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}resumePausedMutations(){return P(this,Ln).resumePausedMutations()}getQueryCache(){return P(this,Ce)}getMutationCache(){return P(this,Ln)}getDefaultOptions(){return P(this,Dn)}setDefaultOptions(e){I(this,Dn,e)}setQueryDefaults(e,t){P(this,Ei).set(Ar(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,Ei).values()];let n={};return t.forEach(r=>{to(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){P(this,ki).set(Ar(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,ki).values()];let n={};return t.forEach(r=>{to(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...P(this,Dn).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ad(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,Dn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,Ce).clear(),P(this,Ln).clear()}},Ce=new WeakMap,Ln=new WeakMap,Dn=new WeakMap,Ei=new WeakMap,ki=new WeakMap,Mn=new WeakMap,Ti=new WeakMap,Oi=new WeakMap,Cy),Ge,ae,yo,We,br,Ri,Wt,vo,ji,Ni,Pr,Cr,An,Li,te,vs,Yc,Gc,Xc,Jc,Zc,ef,tf,Qv,Ey,Vb=(Ey=class extends Yi{constructor(t,n){super();z(this,te);z(this,Ge);z(this,ae);z(this,yo);z(this,We);z(this,br);z(this,Ri);z(this,Wt);z(this,vo);z(this,ji);z(this,Ni);z(this,Pr);z(this,Cr);z(this,An);z(this,Li,new Set);this.options=n,I(this,Ge,t),I(this,Wt,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,ae).addObserver(this),Hp(P(this,ae),this.options)?Q(this,te,vs).call(this):this.updateResult(),Q(this,te,Jc).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nf(P(this,ae),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nf(P(this,ae),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Q(this,te,Zc).call(this),Q(this,te,ef).call(this),P(this,ae).removeObserver(this)}setOptions(t,n){const r=this.options,i=P(this,ae);if(this.options=P(this,Ge).defaultQueryOptions(t),nl(r,this.options)||P(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,ae),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),Q(this,te,tf).call(this);const s=this.hasListeners();s&&Kp(P(this,ae),i,this.options,r)&&Q(this,te,vs).call(this),this.updateResult(n),s&&(P(this,ae)!==i||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Q(this,te,Yc).call(this);const o=Q(this,te,Gc).call(this);s&&(P(this,ae)!==i||this.options.enabled!==r.enabled||o!==P(this,An))&&Q(this,te,Xc).call(this,o)}getOptimisticResult(t){const n=P(this,Ge).getQueryCache().build(P(this,Ge),t),r=this.createResult(n,t);return Ub(this,r)&&(I(this,We,r),I(this,Ri,this.options),I(this,br,P(this,ae).state)),r}getCurrentResult(){return P(this,We)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(P(this,Li).add(r),t[r])})}),n}getCurrentQuery(){return P(this,ae)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=P(this,Ge).defaultQueryOptions(t),r=P(this,Ge).getQueryCache().build(P(this,Ge),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Q(this,te,vs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,We)))}createResult(t,n){var T;const r=P(this,ae),i=this.options,s=P(this,We),o=P(this,br),a=P(this,Ri),u=t!==r?t.state:P(this,yo),{state:c}=t;let{error:f,errorUpdatedAt:d,fetchStatus:h,status:m}=c,w=!1,x;if(n._optimisticResults){const k=this.hasListeners(),O=!k&&Hp(t,n),F=k&&Kp(t,r,n,i);(O||F)&&(h=_l(t.options.networkMode)?"fetching":"paused",c.dataUpdatedAt||(m="pending")),n._optimisticResults==="isRestoring"&&(h="idle")}if(n.select&&typeof c.data<"u")if(s&&c.data===(o==null?void 0:o.data)&&n.select===P(this,vo))x=P(this,ji);else try{I(this,vo,n.select),x=n.select(c.data),x=Qc(s==null?void 0:s.data,x,n),I(this,ji,x),I(this,Wt,null)}catch(k){I(this,Wt,k)}else x=c.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&m==="pending"){let k;if(s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))k=s.data;else if(k=typeof n.placeholderData=="function"?n.placeholderData((T=P(this,Ni))==null?void 0:T.state.data,P(this,Ni)):n.placeholderData,n.select&&typeof k<"u")try{k=n.select(k),I(this,Wt,null)}catch(O){I(this,Wt,O)}typeof k<"u"&&(m="success",x=Qc(s==null?void 0:s.data,k,n),w=!0)}P(this,Wt)&&(f=P(this,Wt),x=P(this,ji),d=Date.now(),m="error");const y=h==="fetching",g=m==="pending",v=m==="error",b=g&&y;return{status:m,fetchStatus:h,isPending:g,isSuccess:m==="success",isError:v,isInitialLoading:b,isLoading:b,data:x,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:d,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:v&&c.dataUpdatedAt===0,isPaused:h==="paused",isPlaceholderData:w,isRefetchError:v&&c.dataUpdatedAt!==0,isStale:Fd(t,n),refetch:this.refetch}}updateResult(t){const n=P(this,We),r=this.createResult(P(this,ae),this.options);if(I(this,br,P(this,ae).state),I(this,Ri,this.options),P(this,br).data!==void 0&&I(this,Ni,P(this,ae)),nl(r,n))return;I(this,We,r);const i={},s=()=>{if(!n)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!P(this,Li).size)return!0;const l=new Set(a??P(this,Li));return this.options.throwOnError&&l.add("error"),Object.keys(P(this,We)).some(u=>{const c=u;return P(this,We)[c]!==n[c]&&l.has(c)})};(t==null?void 0:t.listeners)!==!1&&s()&&(i.listeners=!0),Q(this,te,Qv).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Q(this,te,Jc).call(this)}},Ge=new WeakMap,ae=new WeakMap,yo=new WeakMap,We=new WeakMap,br=new WeakMap,Ri=new WeakMap,Wt=new WeakMap,vo=new WeakMap,ji=new WeakMap,Ni=new WeakMap,Pr=new WeakMap,Cr=new WeakMap,An=new WeakMap,Li=new WeakMap,te=new WeakSet,vs=function(t){Q(this,te,tf).call(this);let n=P(this,ae).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(xt)),n},Yc=function(){if(Q(this,te,Zc).call(this),$i||P(this,We).isStale||!Kc(this.options.staleTime))return;const n=Bv(P(this,We).dataUpdatedAt,this.options.staleTime)+1;I(this,Pr,setTimeout(()=>{P(this,We).isStale||this.updateResult()},n))},Gc=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,ae)):this.options.refetchInterval)??!1},Xc=function(t){Q(this,te,ef).call(this),I(this,An,t),!($i||this.options.enabled===!1||!Kc(P(this,An))||P(this,An)===0)&&I(this,Cr,setInterval(()=>{(this.options.refetchIntervalInBackground||rl.isFocused())&&Q(this,te,vs).call(this)},P(this,An)))},Jc=function(){Q(this,te,Yc).call(this),Q(this,te,Xc).call(this,Q(this,te,Gc).call(this))},Zc=function(){P(this,Pr)&&(clearTimeout(P(this,Pr)),I(this,Pr,void 0))},ef=function(){P(this,Cr)&&(clearInterval(P(this,Cr)),I(this,Cr,void 0))},tf=function(){const t=P(this,Ge).getQueryCache().build(P(this,Ge),this.options);if(t===P(this,ae))return;const n=P(this,ae);I(this,ae,t),I(this,yo,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Qv=function(t){ke.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(P(this,We))}),P(this,Ge).getQueryCache().notify({query:P(this,ae),type:"observerResultsUpdated"})})},Ey);function $b(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Hp(e,t){return $b(e,t)||e.state.dataUpdatedAt>0&&nf(e,t,t.refetchOnMount)}function nf(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Fd(e,t)}return!1}function Kp(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Fd(e,n)}function Fd(e,t){return e.isStaleByTime(t.staleTime)}function Ub(e,t){return!nl(e.getCurrentResult(),t)}var Fn,sn,st,on,dn,ba,rf,ky,Bb=(ky=class extends Yi{constructor(n,r){super();z(this,dn);z(this,Fn);z(this,sn);z(this,st);z(this,on);I(this,sn,void 0),I(this,Fn,n),this.setOptions(r),this.bindMethods(),Q(this,dn,ba).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=P(this,Fn).defaultMutationOptions(n),nl(r,this.options)||P(this,Fn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:P(this,st),observer:this}),(i=P(this,st))==null||i.setOptions(this.options),r!=null&&r.mutationKey&&this.options.mutationKey&&Ar(r.mutationKey)!==Ar(this.options.mutationKey)&&this.reset()}onUnsubscribe(){var n;this.hasListeners()||(n=P(this,st))==null||n.removeObserver(this)}onMutationUpdate(n){Q(this,dn,ba).call(this),Q(this,dn,rf).call(this,n)}getCurrentResult(){return P(this,sn)}reset(){var n;(n=P(this,st))==null||n.removeObserver(this),I(this,st,void 0),Q(this,dn,ba).call(this),Q(this,dn,rf).call(this)}mutate(n,r){var i;return I(this,on,r),(i=P(this,st))==null||i.removeObserver(this),I(this,st,P(this,Fn).getMutationCache().build(P(this,Fn),this.options)),P(this,st).addObserver(this),P(this,st).execute(n)}},Fn=new WeakMap,sn=new WeakMap,st=new WeakMap,on=new WeakMap,dn=new WeakSet,ba=function(){var r;const n=((r=P(this,st))==null?void 0:r.state)??qv();I(this,sn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},rf=function(n){ke.batch(()=>{var r,i,s,o,a,l,u,c;if(P(this,on)&&this.hasListeners()){const f=P(this,sn).variables,d=P(this,sn).context;(n==null?void 0:n.type)==="success"?((i=(r=P(this,on)).onSuccess)==null||i.call(r,n.data,f,d),(o=(s=P(this,on)).onSettled)==null||o.call(s,n.data,null,f,d)):(n==null?void 0:n.type)==="error"&&((l=(a=P(this,on)).onError)==null||l.call(a,n.error,f,d),(c=(u=P(this,on)).onSettled)==null||c.call(u,void 0,n.error,f,d))}this.listeners.forEach(f=>{f(P(this,sn))})})},ky),Yv=S.createContext(void 0),Id=e=>{const t=S.useContext(Yv);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zb=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),S.createElement(Yv.Provider,{value:e},t)),Gv=S.createContext(!1),Wb=()=>S.useContext(Gv);Gv.Provider;function Hb(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Kb=S.createContext(Hb()),qb=()=>S.useContext(Kb);function Xv(e,t){return typeof e=="function"?e(...t):!!e}var Qb=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},Yb=e=>{S.useEffect(()=>{e.clearReset()},[e])},Gb=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Xv(n,[e.error,r]),Xb=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},Jb=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zb=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function eP(e,t,n){const r=Id(),i=Wb(),s=qb(),o=r.defaultQueryOptions(e);o._optimisticResults=i?"isRestoring":"optimistic",Xb(o),Qb(o,s),Yb(s);const[a]=S.useState(()=>new t(r,o)),l=a.getOptimisticResult(o);if(S.useSyncExternalStore(S.useCallback(u=>{const c=i?()=>{}:a.subscribe(ke.batchCalls(u));return a.updateResult(),c},[a,i]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),S.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),Jb(o,l))throw Zb(o,a,s);if(Gb({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash)}))throw l.error;return o.notifyOnChangeProps?l:a.trackResult(l)}function tP(e,t){return eP(e,Vb)}function nP(e,t){const n=Id(),[r]=S.useState(()=>new Bb(n,e));S.useEffect(()=>{r.setOptions(e)},[r,e]);const i=S.useSyncExternalStore(S.useCallback(o=>r.subscribe(ke.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=S.useCallback((o,a)=>{r.mutate(o,a).catch(rP)},[r]);if(i.error&&Xv(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function rP(){}function Jv(e,t){return function(){return e.apply(t,arguments)}}const{toString:iP}=Object.prototype,{getPrototypeOf:_d}=Object,{iterator:Vl,toStringTag:Zv}=Symbol,$l=(e=>t=>{const n=iP.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),At=e=>(e=e.toLowerCase(),t=>$l(t)===e),Ul=e=>t=>typeof t===e,{isArray:Gi}=Array,Ui=Ul("undefined");function Co(e){return e!==null&&!Ui(e)&&e.constructor!==null&&!Ui(e.constructor)&&nt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const e1=At("ArrayBuffer");function sP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&e1(e.buffer),t}const oP=Ul("string"),nt=Ul("function"),t1=Ul("number"),Eo=e=>e!==null&&typeof e=="object",aP=e=>e===!0||e===!1,Pa=e=>{if($l(e)!=="object")return!1;const t=_d(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Zv in e)&&!(Vl in e)},lP=e=>{if(!Eo(e)||Co(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},uP=At("Date"),cP=At("File"),fP=At("Blob"),dP=At("FileList"),hP=e=>Eo(e)&&nt(e.pipe),pP=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||nt(e.append)&&((t=$l(e))==="formdata"||t==="object"&&nt(e.toString)&&e.toString()==="[object FormData]"))},mP=At("URLSearchParams"),[gP,yP,vP,wP]=["ReadableStream","Request","Response","Headers"].map(At),xP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ko(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),Gi(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,r1=e=>!Ui(e)&&e!==gr;function sf(){const{caseless:e,skipUndefined:t}=r1(this)&&this||{},n={},r=(i,s)=>{const o=e&&n1(n,s)||s;Pa(n[o])&&Pa(i)?n[o]=sf(n[o],i):Pa(i)?n[o]=sf({},i):Gi(i)?n[o]=i.slice():(!t||!Ui(i))&&(n[o]=i)};for(let i=0,s=arguments.length;i(ko(t,(i,s)=>{n&&nt(i)?e[s]=Jv(i,n):e[s]=i},{allOwnKeys:r}),e),bP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),PP=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},CP=(e,t,n,r)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&_d(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},EP=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},kP=e=>{if(!e)return null;if(Gi(e))return e;let t=e.length;if(!t1(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},TP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_d(Uint8Array)),OP=(e,t)=>{const r=(e&&e[Vl]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},RP=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},jP=At("HTMLFormElement"),NP=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),qp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),LP=At("RegExp"),i1=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ko(n,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(r[s]=o||i)}),Object.defineProperties(e,r)},DP=e=>{i1(e,(t,n)=>{if(nt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(nt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},MP=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Gi(e)?r(e):r(String(e).split(t)),n},AP=()=>{},FP=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function IP(e){return!!(e&&nt(e.append)&&e[Zv]==="FormData"&&e[Vl])}const _P=e=>{const t=new Array(10),n=(r,i)=>{if(Eo(r)){if(t.indexOf(r)>=0)return;if(Co(r))return r;if(!("toJSON"in r)){t[i]=r;const s=Gi(r)?[]:{};return ko(r,(o,a)=>{const l=n(o,i+1);!Ui(l)&&(s[a]=l)}),t[i]=void 0,s}}return r};return n(e,0)},VP=At("AsyncFunction"),$P=e=>e&&(Eo(e)||nt(e))&&nt(e.then)&&nt(e.catch),s1=((e,t)=>e?setImmediate:t?((n,r)=>(gr.addEventListener("message",({source:i,data:s})=>{i===gr&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),gr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",nt(gr.postMessage)),UP=typeof queueMicrotask<"u"?queueMicrotask.bind(gr):typeof process<"u"&&process.nextTick||s1,BP=e=>e!=null&&nt(e[Vl]),R={isArray:Gi,isArrayBuffer:e1,isBuffer:Co,isFormData:pP,isArrayBufferView:sP,isString:oP,isNumber:t1,isBoolean:aP,isObject:Eo,isPlainObject:Pa,isEmptyObject:lP,isReadableStream:gP,isRequest:yP,isResponse:vP,isHeaders:wP,isUndefined:Ui,isDate:uP,isFile:cP,isBlob:fP,isRegExp:LP,isFunction:nt,isStream:hP,isURLSearchParams:mP,isTypedArray:TP,isFileList:dP,forEach:ko,merge:sf,extend:SP,trim:xP,stripBOM:bP,inherits:PP,toFlatObject:CP,kindOf:$l,kindOfTest:At,endsWith:EP,toArray:kP,forEachEntry:OP,matchAll:RP,isHTMLForm:jP,hasOwnProperty:qp,hasOwnProp:qp,reduceDescriptors:i1,freezeMethods:DP,toObjectSet:MP,toCamelCase:NP,noop:AP,toFiniteNumber:FP,findKey:n1,global:gr,isContextDefined:r1,isSpecCompliantForm:IP,toJSONObject:_P,isAsyncFn:VP,isThenable:$P,setImmediate:s1,asap:UP,isIterable:BP};function Y(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}R.inherits(Y,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.status}}});const o1=Y.prototype,a1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{a1[e]={value:e}});Object.defineProperties(Y,a1);Object.defineProperty(o1,"isAxiosError",{value:!0});Y.from=(e,t,n,r,i,s)=>{const o=Object.create(o1);R.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return Y.call(o,a,l,n,r,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",s&&Object.assign(o,s),o};const zP=null;function of(e){return R.isPlainObject(e)||R.isArray(e)}function l1(e){return R.endsWith(e,"[]")?e.slice(0,-2):e}function Qp(e,t,n){return e?e.concat(t).map(function(i,s){return i=l1(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function WP(e){return R.isArray(e)&&!e.some(of)}const HP=R.toFlatObject(R,{},null,function(t){return/^is[A-Z]/.test(t)});function Bl(e,t,n){if(!R.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=R.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,x){return!R.isUndefined(x[w])});const r=n.metaTokens,i=n.visitor||c,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(i))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(R.isDate(m))return m.toISOString();if(R.isBoolean(m))return m.toString();if(!l&&R.isBlob(m))throw new Y("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(m)||R.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function c(m,w,x){let y=m;if(m&&!x&&typeof m=="object"){if(R.endsWith(w,"{}"))w=r?w:w.slice(0,-2),m=JSON.stringify(m);else if(R.isArray(m)&&WP(m)||(R.isFileList(m)||R.endsWith(w,"[]"))&&(y=R.toArray(m)))return w=l1(w),y.forEach(function(v,b){!(R.isUndefined(v)||v===null)&&t.append(o===!0?Qp([w],b,s):o===null?w:w+"[]",u(v))}),!1}return of(m)?!0:(t.append(Qp(x,w,s),u(m)),!1)}const f=[],d=Object.assign(HP,{defaultVisitor:c,convertValue:u,isVisitable:of});function h(m,w){if(!R.isUndefined(m)){if(f.indexOf(m)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(m),R.forEach(m,function(y,g){(!(R.isUndefined(y)||y===null)&&i.call(t,y,R.isString(g)?g.trim():g,w,d))===!0&&h(y,w?w.concat(g):[g])}),f.pop()}}if(!R.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Yp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Vd(e,t){this._pairs=[],e&&Bl(e,this,t)}const u1=Vd.prototype;u1.append=function(t,n){this._pairs.push([t,n])};u1.toString=function(t){const n=t?function(r){return t.call(this,r,Yp)}:Yp;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function KP(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function c1(e,t,n){if(!t)return e;const r=n&&n.encode||KP;R.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(t,n):s=R.isURLSearchParams(t)?t.toString():new Vd(t,n).toString(r),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Gp{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(r){r!==null&&t(r)})}}const f1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},qP=typeof URLSearchParams<"u"?URLSearchParams:Vd,QP=typeof FormData<"u"?FormData:null,YP=typeof Blob<"u"?Blob:null,GP={isBrowser:!0,classes:{URLSearchParams:qP,FormData:QP,Blob:YP},protocols:["http","https","file","blob","url","data"]},$d=typeof window<"u"&&typeof document<"u",af=typeof navigator=="object"&&navigator||void 0,XP=$d&&(!af||["ReactNative","NativeScript","NS"].indexOf(af.product)<0),JP=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ZP=$d&&window.location.href||"http://localhost",eC=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:$d,hasStandardBrowserEnv:XP,hasStandardBrowserWebWorkerEnv:JP,navigator:af,origin:ZP},Symbol.toStringTag,{value:"Module"})),$e={...eC,...GP};function tC(e,t){return Bl(e,new $e.classes.URLSearchParams,{visitor:function(n,r,i,s){return $e.isNode&&R.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function nC(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function rC(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r=n.length;return o=!o&&R.isArray(i)?i.length:o,l?(R.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!R.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],s)&&R.isArray(i[o])&&(i[o]=rC(i[o])),!a)}if(R.isFormData(e)&&R.isFunction(e.entries)){const n={};return R.forEachEntry(e,(r,i)=>{t(nC(r),i,n,0)}),n}return null}function iC(e,t,n){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const To={transitional:f1,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=R.isObject(t);if(s&&R.isHTMLForm(t)&&(t=new FormData(t)),R.isFormData(t))return i?JSON.stringify(d1(t)):t;if(R.isArrayBuffer(t)||R.isBuffer(t)||R.isStream(t)||R.isFile(t)||R.isBlob(t)||R.isReadableStream(t))return t;if(R.isArrayBufferView(t))return t.buffer;if(R.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return tC(t,this.formSerializer).toString();if((a=R.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Bl(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),iC(t)):t}],transformResponse:[function(t){const n=this.transitional||To.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(R.isResponse(t)||R.isReadableStream(t))return t;if(t&&R.isString(t)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?Y.from(a,Y.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],e=>{To.headers[e]={}});const sC=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),oC=e=>{const t={};let n,r,i;return e&&e.split(` -`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&sC[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Xp=Symbol("internals");function us(e){return e&&String(e).trim().toLowerCase()}function Ca(e){return e===!1||e==null?e:R.isArray(e)?e.map(Ca):String(e)}function aC(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const lC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Nu(e,t,n,r,i){if(R.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!R.isString(t)){if(R.isString(r))return t.indexOf(r)!==-1;if(R.isRegExp(r))return r.test(t)}}function uC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function cC(e,t){const n=R.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,o){return this[r].call(this,t,i,s,o)},configurable:!0})})}let rt=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(a,l,u){const c=us(l);if(!c)throw new Error("header name must be a non-empty string");const f=R.findKey(i,c);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||l]=Ca(a))}const o=(a,l)=>R.forEach(a,(u,c)=>s(u,c,l));if(R.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(R.isString(t)&&(t=t.trim())&&!lC(t))o(oC(t),n);else if(R.isObject(t)&&R.isIterable(t)){let a={},l,u;for(const c of t){if(!R.isArray(c))throw TypeError("Object iterator must return a key-value pair");a[u=c[0]]=(l=a[u])?R.isArray(l)?[...l,c[1]]:[l,c[1]]:c[1]}o(a,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=us(t),t){const r=R.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return aC(i);if(R.isFunction(n))return n.call(this,i,r);if(R.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=us(t),t){const r=R.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Nu(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(o){if(o=us(o),o){const a=R.findKey(r,o);a&&(!n||Nu(r,r[a],a,n))&&(delete r[a],i=!0)}}return R.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||Nu(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return R.forEach(this,(i,s)=>{const o=R.findKey(r,s);if(o){n[o]=Ca(i),delete n[s];return}const a=t?uC(s):String(s).trim();a!==s&&delete n[s],n[a]=Ca(i),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return R.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&R.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Xp]=this[Xp]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=us(o);r[a]||(cC(i,o),r[a]=!0)}return R.isArray(t)?t.forEach(s):s(t),this}};rt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);R.reduceDescriptors(rt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});R.freezeMethods(rt);function Lu(e,t){const n=this||To,r=t||n,i=rt.from(r.headers);let s=r.data;return R.forEach(e,function(a){s=a.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function h1(e){return!!(e&&e.__CANCEL__)}function Xi(e,t,n){Y.call(this,e??"canceled",Y.ERR_CANCELED,t,n),this.name="CanceledError"}R.inherits(Xi,Y,{__CANCEL__:!0});function p1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Y("Request failed with status code "+n.status,[Y.ERR_BAD_REQUEST,Y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function fC(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function dC(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=r[s];o||(o=u),n[i]=l,r[i]=u;let f=s,d=0;for(;f!==i;)d+=n[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o{n=c,i=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const c=Date.now(),f=c-n;f>=r?o(u,c):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const sl=(e,t,n=3)=>{let r=0;const i=dC(50,250);return hC(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,u=i(l),c=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&c?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},Jp=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Zp=e=>(...t)=>R.asap(()=>e(...t)),pC=$e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($e.origin),$e.navigator&&/(msie|trident)/i.test($e.navigator.userAgent)):()=>!0,mC=$e.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const o=[e+"="+encodeURIComponent(t)];R.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),R.isString(r)&&o.push("path="+r),R.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function gC(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function yC(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function m1(e,t,n){let r=!gC(t);return e&&(r||n==!1)?yC(e,t):t}const em=e=>e instanceof rt?{...e}:e;function Fr(e,t){t=t||{};const n={};function r(u,c,f,d){return R.isPlainObject(u)&&R.isPlainObject(c)?R.merge.call({caseless:d},u,c):R.isPlainObject(c)?R.merge({},c):R.isArray(c)?c.slice():c}function i(u,c,f,d){if(R.isUndefined(c)){if(!R.isUndefined(u))return r(void 0,u,f,d)}else return r(u,c,f,d)}function s(u,c){if(!R.isUndefined(c))return r(void 0,c)}function o(u,c){if(R.isUndefined(c)){if(!R.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function a(u,c,f){if(f in t)return r(u,c);if(f in e)return r(void 0,u)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,c,f)=>i(em(u),em(c),f,!0)};return R.forEach(Object.keys({...e,...t}),function(c){const f=l[c]||i,d=f(e[c],t[c],c);R.isUndefined(d)&&f!==a||(n[c]=d)}),n}const g1=e=>{const t=Fr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=rt.from(o),t.url=c1(m1(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),R.isFormData(n)){if($e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(R.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([c,f])=>{u.includes(c.toLowerCase())&&o.set(c,f)})}}if($e.hasStandardBrowserEnv&&(r&&R.isFunction(r)&&(r=r(t)),r||r!==!1&&pC(t.url))){const l=i&&s&&mC.read(s);l&&o.set(i,l)}return t},vC=typeof XMLHttpRequest<"u",wC=vC&&function(e){return new Promise(function(n,r){const i=g1(e);let s=i.data;const o=rt.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=i,c,f,d,h,m;function w(){h&&h(),m&&m(),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let x=new XMLHttpRequest;x.open(i.method.toUpperCase(),i.url,!0),x.timeout=i.timeout;function y(){if(!x)return;const v=rt.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:v,config:e,request:x};p1(function(k){n(k),w()},function(k){r(k),w()},C),x=null}"onloadend"in x?x.onloadend=y:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(y)},x.onabort=function(){x&&(r(new Y("Request aborted",Y.ECONNABORTED,e,x)),x=null)},x.onerror=function(b){const C=b&&b.message?b.message:"Network Error",T=new Y(C,Y.ERR_NETWORK,e,x);T.event=b||null,r(T),x=null},x.ontimeout=function(){let b=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||f1;i.timeoutErrorMessage&&(b=i.timeoutErrorMessage),r(new Y(b,C.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,e,x)),x=null},s===void 0&&o.setContentType(null),"setRequestHeader"in x&&R.forEach(o.toJSON(),function(b,C){x.setRequestHeader(C,b)}),R.isUndefined(i.withCredentials)||(x.withCredentials=!!i.withCredentials),a&&a!=="json"&&(x.responseType=i.responseType),u&&([d,m]=sl(u,!0),x.addEventListener("progress",d)),l&&x.upload&&([f,h]=sl(l),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(c=v=>{x&&(r(!v||v.type?new Xi(null,e,x):v),x.abort(),x=null)},i.cancelToken&&i.cancelToken.subscribe(c),i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c)));const g=fC(i.url);if(g&&$e.protocols.indexOf(g)===-1){r(new Y("Unsupported protocol "+g+":",Y.ERR_BAD_REQUEST,e));return}x.send(s||null)})},xC=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,a();const c=u instanceof Error?u:this.reason;r.abort(c instanceof Y?c:new Xi(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,s(new Y(`timeout ${t} of ms exceeded`,Y.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>R.asap(a),l}},SC=function*(e,t){let n=e.byteLength;if(n{const i=bC(e,t);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:c}=await i.next();if(u){a(),l.close();return}let f=c.byteLength;if(n){let d=s+=f;n(d)}l.enqueue(new Uint8Array(c))}catch(u){throw a(u),u}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},nm=64*1024,{isFunction:Zo}=R,CC=(({Request:e,Response:t})=>({Request:e,Response:t}))(R.global),{ReadableStream:rm,TextEncoder:im}=R.global,sm=(e,...t)=>{try{return!!e(...t)}catch{return!1}},EC=e=>{e=R.merge.call({skipUndefined:!0},CC,e);const{fetch:t,Request:n,Response:r}=e,i=t?Zo(t):typeof fetch=="function",s=Zo(n),o=Zo(r);if(!i)return!1;const a=i&&Zo(rm),l=i&&(typeof im=="function"?(m=>w=>m.encode(w))(new im):async m=>new Uint8Array(await new n(m).arrayBuffer())),u=s&&a&&sm(()=>{let m=!1;const w=new n($e.origin,{body:new rm,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!w}),c=o&&a&&sm(()=>R.isReadableStream(new r("").body)),f={stream:c&&(m=>m.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(w,x)=>{let y=w&&w[m];if(y)return y.call(w);throw new Y(`Response type '${m}' is not supported`,Y.ERR_NOT_SUPPORT,x)})});const d=async m=>{if(m==null)return 0;if(R.isBlob(m))return m.size;if(R.isSpecCompliantForm(m))return(await new n($e.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(R.isArrayBufferView(m)||R.isArrayBuffer(m))return m.byteLength;if(R.isURLSearchParams(m)&&(m=m+""),R.isString(m))return(await l(m)).byteLength},h=async(m,w)=>{const x=R.toFiniteNumber(m.getContentLength());return x??d(w)};return async m=>{let{url:w,method:x,data:y,signal:g,cancelToken:v,timeout:b,onDownloadProgress:C,onUploadProgress:T,responseType:k,headers:O,withCredentials:F="same-origin",fetchOptions:$}=g1(m),B=t||fetch;k=k?(k+"").toLowerCase():"text";let X=xC([g,v&&v.toAbortSignal()],b),me=null;const J=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let E;try{if(T&&u&&x!=="get"&&x!=="head"&&(E=await h(O,y))!==0){let A=new n(w,{method:"POST",body:y,duplex:"half"}),U;if(R.isFormData(y)&&(U=A.headers.get("content-type"))&&O.setContentType(U),A.body){const[K,ve]=Jp(E,sl(Zp(T)));y=tm(A.body,nm,K,ve)}}R.isString(F)||(F=F?"include":"omit");const N=s&&"credentials"in n.prototype,_={...$,signal:X,method:x.toUpperCase(),headers:O.normalize().toJSON(),body:y,duplex:"half",credentials:N?F:void 0};me=s&&new n(w,_);let j=await(s?B(me,$):B(w,_));const M=c&&(k==="stream"||k==="response");if(c&&(C||M&&J)){const A={};["status","statusText","headers"].forEach(pt=>{A[pt]=j[pt]});const U=R.toFiniteNumber(j.headers.get("content-length")),[K,ve]=C&&Jp(U,sl(Zp(C),!0))||[];j=new r(tm(j.body,nm,K,()=>{ve&&ve(),J&&J()}),A)}k=k||"text";let D=await f[R.findKey(f,k)||"text"](j,m);return!M&&J&&J(),await new Promise((A,U)=>{p1(A,U,{data:D,headers:rt.from(j.headers),status:j.status,statusText:j.statusText,config:m,request:me})})}catch(N){throw J&&J(),N&&N.name==="TypeError"&&/Load failed|fetch/i.test(N.message)?Object.assign(new Y("Network Error",Y.ERR_NETWORK,m,me),{cause:N.cause||N}):Y.from(N,N&&N.code,m,me)}}},kC=new Map,y1=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let o=s.length,a=o,l,u,c=kC;for(;a--;)l=s[a],u=c.get(l),u===void 0&&c.set(l,u=a?new Map:EC(t)),c=u;return u};y1();const lf={http:zP,xhr:wC,fetch:{get:y1}};R.forEach(lf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const om=e=>`- ${e}`,TC=e=>R.isFunction(e)||e===null||e===!1,v1={getAdapter:(e,t)=>{e=R.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let o=0;o`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since : -`+o.map(om).join(` -`):" "+om(o[0]):"as no adapter specified";throw new Y("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i},adapters:lf};function Du(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xi(null,e)}function am(e){return Du(e),e.headers=rt.from(e.headers),e.data=Lu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),v1.getAdapter(e.adapter||To.adapter,e)(e).then(function(r){return Du(e),r.data=Lu.call(e,e.transformResponse,r),r.headers=rt.from(r.headers),r},function(r){return h1(r)||(Du(e),r&&r.response&&(r.response.data=Lu.call(e,e.transformResponse,r.response),r.response.headers=rt.from(r.response.headers))),Promise.reject(r)})}const w1="1.12.2",zl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const lm={};zl.transitional=function(t,n,r){function i(s,o){return"[Axios v"+w1+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(t===!1)throw new Y(i(o," has been removed"+(n?" in "+n:"")),Y.ERR_DEPRECATED);return n&&!lm[o]&&(lm[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,a):!0}};zl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function OC(e,t,n){if(typeof e!="object")throw new Y("options must be an object",Y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const a=e[s],l=a===void 0||o(a,s,e);if(l!==!0)throw new Y("option "+s+" must be "+l,Y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Y("Unknown option "+s,Y.ERR_BAD_OPTION)}}const Ea={assertOptions:OC,validators:zl},_t=Ea.validators;let Tr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Gp,response:new Gp}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Fr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Ea.assertOptions(r,{silentJSONParsing:_t.transitional(_t.boolean),forcedJSONParsing:_t.transitional(_t.boolean),clarifyTimeoutError:_t.transitional(_t.boolean)},!1),i!=null&&(R.isFunction(i)?n.paramsSerializer={serialize:i}:Ea.assertOptions(i,{encode:_t.function,serialize:_t.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ea.assertOptions(n,{baseUrl:_t.spelling("baseURL"),withXsrfToken:_t.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&R.merge(s.common,s[n.method]);s&&R.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),n.headers=rt.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(l=l&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let c,f=0,d;if(!l){const m=[am.bind(this),void 0];for(m.unshift(...a),m.push(...u),d=m.length,c=Promise.resolve(n);f{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new Xi(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new x1(function(i){t=i}),cancel:t}}};function jC(e){return function(n){return e.apply(null,n)}}function NC(e){return R.isObject(e)&&e.isAxiosError===!0}const uf={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(uf).forEach(([e,t])=>{uf[t]=e});function S1(e){const t=new Tr(e),n=Jv(Tr.prototype.request,t);return R.extend(n,Tr.prototype,t,{allOwnKeys:!0}),R.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return S1(Fr(e,i))},n}const Se=S1(To);Se.Axios=Tr;Se.CanceledError=Xi;Se.CancelToken=RC;Se.isCancel=h1;Se.VERSION=w1;Se.toFormData=Bl;Se.AxiosError=Y;Se.Cancel=Se.CanceledError;Se.all=function(t){return Promise.all(t)};Se.spread=jC;Se.isAxiosError=NC;Se.mergeConfig=Fr;Se.AxiosHeaders=rt;Se.formToJSON=e=>d1(R.isHTMLForm(e)?new FormData(e):e);Se.getAdapter=v1.getAdapter;Se.HttpStatusCode=uf;Se.default=Se;const{Axios:lL,AxiosError:uL,CanceledError:cL,isCancel:fL,CancelToken:dL,VERSION:hL,all:pL,Cancel:mL,isAxiosError:gL,spread:yL,toFormData:vL,AxiosHeaders:wL,HttpStatusCode:xL,formToJSON:SL,getAdapter:bL,mergeConfig:PL}=Se;/** - * @remix-run/router v1.23.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function no(){return no=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function b1(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DC(){return Math.random().toString(36).substr(2,8)}function cm(e,t){return{usr:e.state,key:e.key,idx:t}}function cf(e,t,n,r){return n===void 0&&(n=null),no({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ji(t):t,{state:n,key:t&&t.key||r||DC()})}function ol(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ji(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function MC(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=Vn.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(no({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function f(){a=Vn.Pop;let x=c(),y=x==null?null:x-u;u=x,l&&l({action:a,location:w.location,delta:y})}function d(x,y){a=Vn.Push;let g=cf(w.location,x,y);u=c()+1;let v=cm(g,u),b=w.createHref(g);try{o.pushState(v,"",b)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(b)}s&&l&&l({action:a,location:w.location,delta:1})}function h(x,y){a=Vn.Replace;let g=cf(w.location,x,y);u=c();let v=cm(g,u),b=w.createHref(g);o.replaceState(v,"",b),s&&l&&l({action:a,location:w.location,delta:0})}function m(x){let y=i.location.origin!=="null"?i.location.origin:i.location.href,g=typeof x=="string"?x:ol(x);return g=g.replace(/ $/,"%20"),Pe(y,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,y)}let w={get action(){return a},get location(){return e(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(um,f),l=x,()=>{i.removeEventListener(um,f),l=null}},createHref(x){return t(i,x)},createURL:m,encodeLocation(x){let y=m(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:d,replace:h,go(x){return o.go(x)}};return w}var fm;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(fm||(fm={}));function AC(e,t,n){return n===void 0&&(n="/"),FC(e,t,n)}function FC(e,t,n,r){let i=typeof t=="string"?Ji(t):t,s=Ud(i.pathname||"/",n);if(s==null)return null;let o=P1(e);IC(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(Pe(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Qn([r,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(Pe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),P1(s.children,t,c,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:WC(u,s.index),routesMeta:c})};return e.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of C1(s.path))i(s,o,l)}),t}function C1(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=C1(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function IC(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:HC(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const _C=/^:[\w-]+$/,VC=3,$C=2,UC=1,BC=10,zC=-2,dm=e=>e==="*";function WC(e,t){let n=e.split("/"),r=n.length;return n.some(dm)&&(r+=zC),t&&(r+=$C),n.filter(i=>!dm(i)).reduce((i,s)=>i+(_C.test(s)?VC:s===""?UC:BC),r)}function HC(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function KC(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let a=0;a{let{paramName:d,isOptional:h}=c;if(d==="*"){let w=a[f]||"";o=s.slice(0,s.length-w.length).replace(/(.)\/+$/,"$1")}const m=a[f];return h&&!m?u[d]=void 0:u[d]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function QC(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),b1(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function YC(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return b1(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ud(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function GC(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Ji(e):e;return{pathname:n?n.startsWith("/")?n:XC(n,t):t,search:eE(r),hash:tE(i)}}function XC(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Mu(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function JC(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function E1(e,t){let n=JC(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function k1(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Ji(e):(i=no({},e),Pe(!i.pathname||!i.pathname.includes("?"),Mu("?","pathname","search",i)),Pe(!i.pathname||!i.pathname.includes("#"),Mu("#","pathname","hash",i)),Pe(!i.search||!i.search.includes("#"),Mu("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),f-=1;i.pathname=d.join("/")}a=f>=0?t[f]:"/"}let l=GC(i,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Qn=e=>e.join("/").replace(/\/\/+/g,"/"),ZC=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),eE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,tE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function nE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const T1=["post","put","patch","delete"];new Set(T1);const rE=["get",...T1];new Set(rE);/** - * React Router v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ro(){return ro=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),S.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let f=k1(u,JSON.parse(o),s,c.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Qn([t,f.pathname])),(c.replace?r.replace:r.push)(f,c.state,c)},[t,r,o,s,e])}const lE=S.createContext(null);function uE(e){let t=S.useContext(rr).outlet;return t&&S.createElement(lE.Provider,{value:e},t)}function j1(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=S.useContext(Br),{matches:i}=S.useContext(rr),{pathname:s}=Hl(),o=JSON.stringify(E1(i,r.v7_relativeSplatPath));return S.useMemo(()=>k1(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function cE(e,t){return fE(e,t)}function fE(e,t,n,r){Oo()||Pe(!1);let{navigator:i}=S.useContext(Br),{matches:s}=S.useContext(rr),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=Hl(),c;if(t){var f;let x=typeof t=="string"?Ji(t):t;l==="/"||(f=x.pathname)!=null&&f.startsWith(l)||Pe(!1),c=x}else c=u;let d=c.pathname||"/",h=d;if(l!=="/"){let x=l.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=AC(e,{pathname:h}),w=gE(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},a,x.params),pathname:Qn([l,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Qn([l,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,n,r);return t&&w?S.createElement(Wl.Provider,{value:{location:ro({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Vn.Pop}},w):w}function dE(){let e=xE(),t=nE(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),n?S.createElement("pre",{style:i},n):null,null)}const hE=S.createElement(dE,null);class pE extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?S.createElement(rr.Provider,{value:this.props.routeContext},S.createElement(O1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function mE(e){let{routeContext:t,match:n,children:r}=e,i=S.useContext(Bd);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(rr.Provider,{value:t},r)}function gE(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(i=n)==null?void 0:i.errors;if(a!=null){let c=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);c>=0||Pe(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,f,d)=>{let h,m=!1,w=null,x=null;n&&(h=a&&f.route.id?a[f.route.id]:void 0,w=f.route.errorElement||hE,l&&(u<0&&d===0?(bE("route-fallback"),m=!0,x=null):u===d&&(m=!0,x=f.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,d+1)),g=()=>{let v;return h?v=w:m?v=x:f.route.Component?v=S.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=c,S.createElement(mE,{match:f,routeContext:{outlet:c,matches:y,isDataRoute:n!=null},children:v})};return n&&(f.route.ErrorBoundary||f.route.errorElement||d===0)?S.createElement(pE,{location:n.location,revalidation:n.revalidation,component:w,error:h,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):g()},null)}var N1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(N1||{}),L1=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(L1||{});function yE(e){let t=S.useContext(Bd);return t||Pe(!1),t}function vE(e){let t=S.useContext(iE);return t||Pe(!1),t}function wE(e){let t=S.useContext(rr);return t||Pe(!1),t}function D1(e){let t=wE(),n=t.matches[t.matches.length-1];return n.route.id||Pe(!1),n.route.id}function xE(){var e;let t=S.useContext(O1),n=vE(),r=D1();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function SE(){let{router:e}=yE(N1.UseNavigateStable),t=D1(L1.UseNavigateStable),n=S.useRef(!1);return R1(()=>{n.current=!0}),S.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ro({fromRouteId:t},s)))},[e,t])}const hm={};function bE(e,t,n){hm[e]||(hm[e]=!0)}function PE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function CE(e){return uE(e.context)}function ff(e){Pe(!1)}function EE(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Vn.Pop,navigator:s,static:o=!1,future:a}=e;Oo()&&Pe(!1);let l=t.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:l,navigator:s,static:o,future:ro({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=Ji(r));let{pathname:c="/",search:f="",hash:d="",state:h=null,key:m="default"}=r,w=S.useMemo(()=>{let x=Ud(c,l);return x==null?null:{location:{pathname:x,search:f,hash:d,state:h,key:m},navigationType:i}},[l,c,f,d,h,m,i]);return w==null?null:S.createElement(Br.Provider,{value:u},S.createElement(Wl.Provider,{children:n,value:w}))}function kE(e){let{children:t,location:n}=e;return cE(df(t),n)}new Promise(()=>{});function df(e,t){t===void 0&&(t=[]);let n=[];return S.Children.forEach(e,(r,i)=>{if(!S.isValidElement(r))return;let s=[...t,i];if(r.type===S.Fragment){n.push.apply(n,df(r.props.children,s));return}r.type!==ff&&Pe(!1),!r.props.index||!r.props.children||Pe(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=df(r.props.children,s)),n.push(o)}),n}/** - * React Router DOM v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function hf(){return hf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function OE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function RE(e,t){return e.button===0&&(!t||t==="_self")&&!OE(e)}const jE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],NE="6";try{window.__reactRouterVersion=NE}catch{}const LE="startTransition",pm=d2[LE];function DE(e){let{basename:t,children:n,future:r,window:i}=e,s=S.useRef();s.current==null&&(s.current=LC({window:i,v5Compat:!0}));let o=s.current,[a,l]=S.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=S.useCallback(f=>{u&&pm?pm(()=>l(f)):l(f)},[l,u]);return S.useLayoutEffect(()=>o.listen(c),[o,c]),S.useEffect(()=>PE(r),[r]),S.createElement(EE,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const ME=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",AE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,M1=S.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:u,preventScrollReset:c,viewTransition:f}=t,d=TE(t,jE),{basename:h}=S.useContext(Br),m,w=!1;if(typeof u=="string"&&AE.test(u)&&(m=u,ME))try{let v=new URL(window.location.href),b=u.startsWith("//")?new URL(v.protocol+u):new URL(u),C=Ud(b.pathname,h);b.origin===v.origin&&C!=null?u=C+b.search+b.hash:w=!0}catch{}let x=sE(u,{relative:i}),y=FE(u,{replace:o,state:a,target:l,preventScrollReset:c,relative:i,viewTransition:f});function g(v){r&&r(v),v.defaultPrevented||y(v)}return S.createElement("a",hf({},d,{href:m||x,onClick:w||s?r:g,ref:n,target:l}))});var mm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(mm||(mm={}));var gm;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(gm||(gm={}));function FE(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:a}=t===void 0?{}:t,l=oE(),u=Hl(),c=j1(e,{relative:o});return S.useCallback(f=>{if(RE(f,n)){f.preventDefault();let d=r!==void 0?r:ol(u)===ol(c);l(e,{replace:d,state:i,preventScrollReset:s,relative:o,viewTransition:a})}},[u,l,c,r,i,n,e,s,o,a])}var IE=({as:e="div",...t},n)=>p.jsx(e,{...t,ref:n}),_E=S.forwardRef(IE),VE="https://challenges.cloudflare.com/turnstile/v0/api.js",zd="cf-turnstile-script",$E="cf-turnstile",Wd="onloadTurnstileCallback",A1=e=>!!document.getElementById(e),UE=({render:e="explicit",onLoadCallbackName:t=Wd,scriptOptions:{nonce:n="",defer:r=!0,async:i=!0,id:s="",appendTo:o,onError:a,crossOrigin:l=""}={}})=>{let u=s||zd;if(A1(u))return;let c=document.createElement("script");c.id=u,c.src=`${VE}?onload=${t}&render=${e}`,!document.querySelector(`script[src="${c.src}"]`)&&(c.defer=!!r,c.async=!!i,n&&(c.nonce=n),l&&(c.crossOrigin=l),a&&(c.onerror=a,delete window[t]),(o==="body"?document.body:document.getElementsByTagName("head")[0]).appendChild(c))},or={normal:{width:300,height:65},compact:{width:150,height:140},invisible:{width:0,height:0,overflow:"hidden"},flexible:{minWidth:300,width:"100%",height:65},interactionOnly:{width:"fit-content",height:"auto",display:"flex"}};function BE(e){if(e!=="invisible"&&e!=="interactionOnly")return e}function zE(e=zd){let[t,n]=S.useState(!1);return S.useEffect(()=>{let r=()=>{A1(e)&&n(!0)},i=new MutationObserver(r);return i.observe(document,{childList:!0,subtree:!0}),r(),()=>{i.disconnect()}},[e]),t}var Ls="unloaded",F1,WE=new Promise((e,t)=>{F1={resolve:e,reject:t},Ls==="ready"&&e(void 0)}),HE=(e=Wd)=>(Ls==="unloaded"&&(Ls="loading",window[e]=()=>{F1.resolve(),Ls="ready",delete window[e]}),WE),I1=S.forwardRef((e,t)=>{let{scriptOptions:n,options:r={},siteKey:i,onWidgetLoad:s,onSuccess:o,onExpire:a,onError:l,onBeforeInteractive:u,onAfterInteractive:c,onUnsupported:f,onTimeout:d,onLoadScript:h,id:m,style:w,as:x="div",injectScript:y=!0,rerenderOnCallbackChange:g=!1,...v}=e,b=r.size,C=S.useCallback(()=>typeof b>"u"?{}:r.execution==="execute"?or.invisible:r.appearance==="interaction-only"?or.interactionOnly:or[b],[r.execution,b,r.appearance]),[T,k]=S.useState(C()),O=S.useRef(null),[F,$]=S.useState(!1),B=S.useRef(),X=S.useRef(!1),me=m||$E,J=S.useRef({onSuccess:o,onError:l,onExpire:a,onBeforeInteractive:u,onAfterInteractive:c,onUnsupported:f,onTimeout:d});S.useEffect(()=>{g||(J.current={onSuccess:o,onError:l,onExpire:a,onBeforeInteractive:u,onAfterInteractive:c,onUnsupported:f,onTimeout:d})});let E=(n==null?void 0:n.id)||zd,N=zE(E),_=(n==null?void 0:n.onLoadCallbackName)||Wd,j=r.appearance||"always",M=S.useMemo(()=>({sitekey:i,action:r.action,cData:r.cData,theme:r.theme||"auto",language:r.language||"auto",tabindex:r.tabIndex,"response-field":r.responseField,"response-field-name":r.responseFieldName,size:BE(b),retry:r.retry||"auto","retry-interval":r.retryInterval||8e3,"refresh-expired":r.refreshExpired||"auto","refresh-timeout":r.refreshTimeout||"auto",execution:r.execution||"render",appearance:r.appearance||"always","feedback-enabled":r.feedbackEnabled||!0,callback:A=>{var U,K;X.current=!0,g?o==null||o(A):(K=(U=J.current).onSuccess)==null||K.call(U,A)},"error-callback":g?l:(...A)=>{var U,K;return(K=(U=J.current).onError)==null?void 0:K.call(U,...A)},"expired-callback":g?a:(...A)=>{var U,K;return(K=(U=J.current).onExpire)==null?void 0:K.call(U,...A)},"before-interactive-callback":g?u:(...A)=>{var U,K;return(K=(U=J.current).onBeforeInteractive)==null?void 0:K.call(U,...A)},"after-interactive-callback":g?c:(...A)=>{var U,K;return(K=(U=J.current).onAfterInteractive)==null?void 0:K.call(U,...A)},"unsupported-callback":g?f:(...A)=>{var U,K;return(K=(U=J.current).onUnsupported)==null?void 0:K.call(U,...A)},"timeout-callback":g?d:(...A)=>{var U,K;return(K=(U=J.current).onTimeout)==null?void 0:K.call(U,...A)}}),[r.action,r.appearance,r.cData,r.execution,r.language,r.refreshExpired,r.responseField,r.responseFieldName,r.retry,r.retryInterval,r.tabIndex,r.theme,r.feedbackEnabled,r.refreshTimeout,i,b,g,g?o:null,g?l:null,g?a:null,g?u:null,g?c:null,g?f:null,g?d:null]),D=S.useCallback(()=>typeof window<"u"&&!!window.turnstile,[]);return S.useEffect(function(){y&&!F&&UE({onLoadCallbackName:_,scriptOptions:{...n,id:E}})},[y,F,n,E]),S.useEffect(function(){Ls!=="ready"&&HE(_).then(()=>$(!0)).catch(console.error)},[]),S.useEffect(function(){if(!O.current||!F)return;let A=!1;return(async()=>{if(A||!O.current)return;let U=window.turnstile.render(O.current,M);B.current=U,B.current&&(s==null||s(B.current))})(),()=>{A=!0,B.current&&(window.turnstile.remove(B.current),X.current=!1)}},[me,F,M]),S.useImperativeHandle(t,()=>{let{turnstile:A}=window;return{getResponse(){if(!(A!=null&&A.getResponse)||!B.current||!D()){console.warn("Turnstile has not been loaded");return}return A.getResponse(B.current)},async getResponsePromise(U=3e4,K=100){return new Promise((ve,pt)=>{let W,Ne=async()=>{if(X.current&&window.turnstile&&B.current)try{let Ft=window.turnstile.getResponse(B.current);return W&&clearTimeout(W),Ft?ve(Ft):pt(new Error("No response received"))}catch(Ft){return W&&clearTimeout(W),console.warn("Failed to get response",Ft),pt(new Error("Failed to get response"))}W||(W=setTimeout(()=>{W&&clearTimeout(W),pt(new Error("Timeout"))},U)),await new Promise(Ft=>setTimeout(Ft,K)),await Ne()};Ne()})},reset(){if(!(A!=null&&A.reset)||!B.current||!D()){console.warn("Turnstile has not been loaded");return}r.execution==="execute"&&k(or.invisible);try{X.current=!1,A.reset(B.current)}catch(U){console.warn(`Failed to reset Turnstile widget ${B}`,U)}},remove(){if(!(A!=null&&A.remove)||!B.current||!D()){console.warn("Turnstile has not been loaded");return}k(or.invisible),X.current=!1,A.remove(B.current),B.current=null},render(){if(!(A!=null&&A.render)||!O.current||!D()||B.current){console.warn("Turnstile has not been loaded or container not found");return}let U=A.render(O.current,M);return B.current=U,B.current&&(s==null||s(B.current)),r.execution!=="execute"&&k(b?or[b]:{}),U},execute(){if(r.execution!=="execute"){console.warn('Execution mode is not set to "execute"');return}if(!(A!=null&&A.execute)||!O.current||!B.current||!D()){console.warn("Turnstile has not been loaded or container not found");return}A.execute(O.current,M),k(b?or[b]:{})},isExpired(){return!(A!=null&&A.isExpired)||!B.current||!D()?(console.warn("Turnstile has not been loaded"),!1):A.isExpired(B.current)}}},[B,r.execution,b,M,O,D,F,s]),S.useEffect(()=>{N&&!F&&window.turnstile&&$(!0)},[F,N]),S.useEffect(()=>{k(C())},[r.execution,b,j]),S.useEffect(()=>{!N||typeof h!="function"||h()},[N]),p.jsx(_E,{ref:O,as:x,id:me,style:{...T,...w},...v})});I1.displayName="Turnstile";const ym=["admiring","adoring","affectionate","agitated","amazing","angry","awesome","beautiful","blissful","bold","boring","brave","busy","charming","clever","cool","compassionate","competent","condescending","confident","cranky","crazy","dazzling","determined","distracted","dreamy","eager","ecstatic","elastic","elated","elegant","eloquent","epic","exciting","fervent","festive","flamboyant","focused","friendly","frosty","funny","gallant","gifted","goofy","gracious","great","happy","hardcore","heuristic","hopeful","hungry","infallible","inspiring","interesting","intelligent","jolly","jovial","keen","kind","laughing","loving","lucid","magical","mystifying","modest","musing","naughty","nervous","nice","nifty","nostalgic","objective","optimistic","peaceful","pedantic","pensive","practical","priceless","quirky","quizzical","recursing","relaxed","reverent","romantic","sad","serene","sharp","silly","sleepy","stoic","strange","stupefied","suspicious","sweet","tender","thirsty","trusting","unruffled","upbeat","vibrant","vigilant","vigorous","wizardly","wonderful","xenodochial","youthful","zealous","zen"],vm=["albattani","allen","almeida","antonelli","agnesi","archimedes","ardinghelli","aryabhata","austin","babbage","banach","banzai","bardeen","bartik","bassi","beaver","bell","benz","bhabha","bhaskara","black","blackburn","blackwell","bohr","booth","borg","bose","bouman","boyd","brahmagupta","brattain","brown","buck","burnell","cannon","carson","cartwright","carver","cerf","chandrasekhar","chaplygin","chatelet","chatterjee","chebyshev","cohen","chaum","clarke","colden","cori","cray","curran","curie","darwin","davinci","dewdney","dhawan","diffie","dijkstra","dirac","driscoll","dubinsky","easley","edison","einstein","elbakyan","elgamal","elion","ellis","engelbart","euclid","euler","faraday","feistel","fermat","fermi","feynman","franklin","gagarin","galileo","galois","ganguly","gates","gauss","germain","goldberg","goldstine","goldwasser","golick","goodall","gould","greider","grothendieck","haibt","hamilton","haslett","hawking","hellman","heisenberg","hermann","herschel","hertz","heyrovsky","hodgkin","hofstadter","hoover","hopper","hugle","hypatia","ishizaka","jackson","jang","jemison","jennings","jepsen","johnson","joliot","jones","kalam","kapitsa","kare","keldysh","keller","kepler","khayyam","khorana","kilby","kirch","knuth","kowalevski","lalande","lamarr","lamport","leakey","leavitt","lederberg","lehmann","lewin","lichterman","liskov","lovelace","lumiere","mahavira","margulis","matsumoto","maxwell","mayer","mccarthy","mcclintock","mclaren","mclean","mcnulty","mendel","mendeleev","meitner","meninsky","merkle","mestorf","mirzakhani","montalcini","moore","morse","murdock","moser","napier","nash","neumann","newton","niel","nightingale","nobel","noether","northcutt","noyce","panini","pare","pascal","pasteur","payne","perlman","pike","poincare","poitras","proskuriakova","ptolemy","raman","ramanujan","ride","ritchie","rhodes","robinson","roentgen","rosalind","rubin","saha","sammet","sanderson","satoshi","shamir","shannon","shaw","shirley","shockley","shtern","sinoussi","snyder","solomon","spence","stonebraker","sutherland","swanson","swartz","swirles","taussig","tereshkova","tesla","tharp","thompson","torvalds","tu","turing","varahamihira","vaughan","visvesvaraya","volhard","villani","wescoff","wilbur","wiles","williams","williamson","wilson","wing","wozniak","wright","wu","yalow","yonath","zhukovsky"],_1=(e="",t="-")=>{const n=`${ym[Math.floor(Math.random()*ym.length)]??""}${t}${vm[Math.floor(Math.random()*vm.length)]??""}`;return n===`boring${t}wozniak`?_1(e,t):e.length>0?`${e}${t}${n}`:n};function KE(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},xm=(e,t,n)=>{e.loadNamespaces(t,V1(e,n))},Sm=(e,t,n,r)=>{Or(n)&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,V1(e,r))},qE=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,s=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=t.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))},QE=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(pf("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,e))return!1}}):qE(e,t,n)},Or=e=>typeof e=="string",YE=e=>typeof e=="object"&&e!==null,GE=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,XE={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},JE=e=>XE[e],ZE=e=>e.replace(GE,JE);let mf={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ZE};const ek=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mf={...mf,...e}},tk=()=>mf;let $1;const nk=e=>{$1=e},rk=()=>$1,ik={type:"3rdParty",init(e){ek(e.options.react),nk(e)}},sk=S.createContext();class ok{constructor(){jh(this,"getUsedNamespaces",()=>Object.keys(this.usedNamespaces));this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}}const ak=(e,t)=>{const n=S.useRef();return S.useEffect(()=>{n.current=e},[e,t]),n.current},U1=(e,t,n,r)=>e.getFixedT(t,n,r),lk=(e,t,n,r)=>S.useCallback(U1(e,t,n,r),[e,t,n,r]),zr=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=S.useContext(sk)||{},s=n||r||rk();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new ok),!s){pf("You will need to pass in an i18next instance by using initReactI18next");const b=(T,k)=>Or(k)?k:YE(k)&&Or(k.defaultValue)?k.defaultValue:Array.isArray(T)?T[T.length-1]:T,C=[b,{},!1];return C.t=b,C.i18n={},C.ready=!1,C}s.options.react&&s.options.react.wait!==void 0&&pf("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...tk(),...s.options.react,...t},{useSuspense:a,keyPrefix:l}=o;let u=i||s.options&&s.options.defaultNS;u=Or(u)?[u]:u||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(u);const c=(s.isInitialized||s.initializedStoreOnce)&&u.every(b=>QE(b,s,o)),f=lk(s,t.lng||null,o.nsMode==="fallback"?u:u[0],l),d=()=>f,h=()=>U1(s,t.lng||null,o.nsMode==="fallback"?u:u[0],l),[m,w]=S.useState(d);let x=u.join();t.lng&&(x=`${t.lng}${x}`);const y=ak(x),g=S.useRef(!0);S.useEffect(()=>{const{bindI18n:b,bindI18nStore:C}=o;g.current=!0,!c&&!a&&(t.lng?Sm(s,t.lng,u,()=>{g.current&&w(h)}):xm(s,u,()=>{g.current&&w(h)})),c&&y&&y!==x&&g.current&&w(h);const T=()=>{g.current&&w(h)};return b&&s&&s.on(b,T),C&&s&&s.store.on(C,T),()=>{g.current=!1,b&&s&&b.split(" ").forEach(k=>s.off(k,T)),C&&s&&C.split(" ").forEach(k=>s.store.off(k,T))}},[s,x]),S.useEffect(()=>{g.current&&c&&w(d)},[s,l,c]);const v=[m,s,c];if(v.t=m,v.i18n=s,v.ready=c,c||!c&&!a)return v;throw new Promise(b=>{t.lng?Sm(s,t.lng,u,()=>b()):xm(s,u,()=>b())})};/*! js-cookie v3.0.5 | MIT */function ea(e){for(var t=1;t"u")){o=ea({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,o[l]!==!0&&(a+="="+o[l].split(";")[0]));return document.cookie=i+"="+e.write(s,i)+a}}function r(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],o={},a=0;a{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||ck},dk=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,hk=/\/\*[^]*?\*\/| +/g,bm=/\n+/g,On=(e,t)=>{let n="",r="",i="";for(let s in e){let o=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+o+";":r+=s[1]=="f"?On(o,s):s+"{"+On(o,s[1]=="k"?"":t)+"}":typeof o=="object"?r+=On(o,t?t.replace(/([^,])+/g,a=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):s):o!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=On.p?On.p(s,o):s+":"+o+";")}return n+(t&&i?t+"{"+i+"}":i)+r},en={},B1=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+B1(e[n]);return t}return e},pk=(e,t,n,r,i)=>{let s=B1(e),o=en[s]||(en[s]=(l=>{let u=0,c=11;for(;u>>0;return"go"+c})(s));if(!en[o]){let l=s!==e?e:(u=>{let c,f,d=[{}];for(;c=dk.exec(u.replace(hk,""));)c[4]?d.shift():c[3]?(f=c[3].replace(bm," ").trim(),d.unshift(d[0][f]=d[0][f]||{})):d[0][c[1]]=c[2].replace(bm," ").trim();return d[0]})(e);en[o]=On(i?{["@keyframes "+o]:l}:l,n?"":"."+o)}let a=n&&en.g?en.g:null;return n&&(en.g=en[o]),((l,u,c,f)=>{f?u.data=u.data.replace(f,l):u.data.indexOf(l)===-1&&(u.data=c?l+u.data:u.data+l)})(en[o],t,r,a),o},mk=(e,t,n)=>e.reduce((r,i,s)=>{let o=t[s];if(o&&o.call){let a=o(n),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=l?"."+l:a&&typeof a=="object"?a.props?"":On(a,""):a===!1?"":a}return r+i+(o??"")},"");function Kl(e){let t=this||{},n=e.call?e(t.p):e;return pk(n.unshift?n.raw?mk(n,[].slice.call(arguments,1),t.p):n.reduce((r,i)=>Object.assign(r,i&&i.call?i(t.p):i),{}):n,fk(t.target),t.g,t.o,t.k)}let z1,yf,vf;Kl.bind({g:1});let yn=Kl.bind({k:1});function gk(e,t,n,r){On.p=t,z1=e,yf=n,vf=r}function ir(e,t){let n=this||{};return function(){let r=arguments;function i(s,o){let a=Object.assign({},s),l=a.className||i.className;n.p=Object.assign({theme:yf&&yf()},a),n.o=/ *go\d+/.test(l),a.className=Kl.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),vf&&u[0]&&vf(a),z1(u,a)}return i}}var yk=e=>typeof e=="function",al=(e,t)=>yk(e)?e(t):e,vk=(()=>{let e=0;return()=>(++e).toString()})(),W1=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),wk=20,Hd="default",H1=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:r}=t;return H1(e,{type:e.toasts.find(o=>o.id===r.id)?1:0,toast:r});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(o=>o.id===i||i===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+s}))}}},ka=[],K1={toasts:[],pausedAt:void 0,settings:{toastLimit:wk}},Qt={},q1=(e,t=Hd)=>{Qt[t]=H1(Qt[t]||K1,e),ka.forEach(([n,r])=>{n===t&&r(Qt[t])})},Q1=e=>Object.keys(Qt).forEach(t=>q1(e,t)),xk=e=>Object.keys(Qt).find(t=>Qt[t].toasts.some(n=>n.id===e)),ql=(e=Hd)=>t=>{q1(t,e)},Sk={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},bk=(e={},t=Hd)=>{let[n,r]=S.useState(Qt[t]||K1),i=S.useRef(Qt[t]);S.useEffect(()=>(i.current!==Qt[t]&&r(Qt[t]),ka.push([t,r]),()=>{let o=ka.findIndex(([a])=>a===t);o>-1&&ka.splice(o,1)}),[t]);let s=n.toasts.map(o=>{var a,l,u;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((l=e[o.type])==null?void 0:l.duration)||(e==null?void 0:e.duration)||Sk[o.type],style:{...e.style,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...n,toasts:s}},Pk=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||vk()}),Ro=e=>(t,n)=>{let r=Pk(t,e,n);return ql(r.toasterId||xk(r.id))({type:2,toast:r}),r.id},Z=(e,t)=>Ro("blank")(e,t);Z.error=Ro("error");Z.success=Ro("success");Z.loading=Ro("loading");Z.custom=Ro("custom");Z.dismiss=(e,t)=>{let n={type:3,toastId:e};t?ql(t)(n):Q1(n)};Z.dismissAll=e=>Z.dismiss(void 0,e);Z.remove=(e,t)=>{let n={type:4,toastId:e};t?ql(t)(n):Q1(n)};Z.removeAll=e=>Z.remove(void 0,e);Z.promise=(e,t,n)=>{let r=Z.loading(t.loading,{...n,...n==null?void 0:n.loading});return typeof e=="function"&&(e=e()),e.then(i=>{let s=t.success?al(t.success,i):void 0;return s?Z.success(s,{id:r,...n,...n==null?void 0:n.success}):Z.dismiss(r),i}).catch(i=>{let s=t.error?al(t.error,i):void 0;s?Z.error(s,{id:r,...n,...n==null?void 0:n.error}):Z.dismiss(r)}),e};var Ck=1e3,Ek=(e,t="default")=>{let{toasts:n,pausedAt:r}=bk(e,t),i=S.useRef(new Map).current,s=S.useCallback((f,d=Ck)=>{if(i.has(f))return;let h=setTimeout(()=>{i.delete(f),o({type:4,toastId:f})},d);i.set(f,h)},[]);S.useEffect(()=>{if(r)return;let f=Date.now(),d=n.map(h=>{if(h.duration===1/0)return;let m=(h.duration||0)+h.pauseDuration-(f-h.createdAt);if(m<0){h.visible&&Z.dismiss(h.id);return}return setTimeout(()=>Z.dismiss(h.id,t),m)});return()=>{d.forEach(h=>h&&clearTimeout(h))}},[n,r,t]);let o=S.useCallback(ql(t),[t]),a=S.useCallback(()=>{o({type:5,time:Date.now()})},[o]),l=S.useCallback((f,d)=>{o({type:1,toast:{id:f,height:d}})},[o]),u=S.useCallback(()=>{r&&o({type:6,time:Date.now()})},[r,o]),c=S.useCallback((f,d)=>{let{reverseOrder:h=!1,gutter:m=8,defaultPosition:w}=d||{},x=n.filter(v=>(v.position||w)===(f.position||w)&&v.height),y=x.findIndex(v=>v.id===f.id),g=x.filter((v,b)=>bv.visible).slice(...h?[g+1]:[0,g]).reduce((v,b)=>v+(b.height||0)+m,0)},[n]);return S.useEffect(()=>{n.forEach(f=>{if(f.dismissed)s(f.id,f.removeDelay);else{let d=i.get(f.id);d&&(clearTimeout(d),i.delete(f.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:l,startPause:a,endPause:u,calculateOffset:c}}},kk=yn` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,Tk=yn` -from { - transform: scale(0); - opacity: 0; -} -to { - transform: scale(1); - opacity: 1; -}`,Ok=yn` -from { - transform: scale(0) rotate(90deg); - opacity: 0; -} -to { - transform: scale(1) rotate(90deg); - opacity: 1; -}`,Rk=ir("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${e=>e.primary||"#ff4b4b"}; - position: relative; - transform: rotate(45deg); - - animation: ${kk} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - - &:after, - &:before { - content: ''; - animation: ${Tk} 0.15s ease-out forwards; - animation-delay: 150ms; - position: absolute; - border-radius: 3px; - opacity: 0; - background: ${e=>e.secondary||"#fff"}; - bottom: 9px; - left: 4px; - height: 2px; - width: 12px; - } - - &:before { - animation: ${Ok} 0.15s ease-out forwards; - animation-delay: 180ms; - transform: rotate(90deg); - } -`,jk=yn` - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -`,Nk=ir("div")` - width: 12px; - height: 12px; - box-sizing: border-box; - border: 2px solid; - border-radius: 100%; - border-color: ${e=>e.secondary||"#e0e0e0"}; - border-right-color: ${e=>e.primary||"#616161"}; - animation: ${jk} 1s linear infinite; -`,Lk=yn` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,Dk=yn` -0% { - height: 0; - width: 0; - opacity: 0; -} -40% { - height: 0; - width: 6px; - opacity: 1; -} -100% { - opacity: 1; - height: 10px; -}`,Mk=ir("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${e=>e.primary||"#61d345"}; - position: relative; - transform: rotate(45deg); - - animation: ${Lk} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - &:after { - content: ''; - box-sizing: border-box; - animation: ${Dk} 0.2s ease-out forwards; - opacity: 0; - animation-delay: 200ms; - position: absolute; - border-right: 2px solid; - border-bottom: 2px solid; - border-color: ${e=>e.secondary||"#fff"}; - bottom: 6px; - left: 6px; - height: 10px; - width: 6px; - } -`,Ak=ir("div")` - position: absolute; -`,Fk=ir("div")` - position: relative; - display: flex; - justify-content: center; - align-items: center; - min-width: 20px; - min-height: 20px; -`,Ik=yn` -from { - transform: scale(0.6); - opacity: 0.4; -} -to { - transform: scale(1); - opacity: 1; -}`,_k=ir("div")` - position: relative; - transform: scale(0.6); - opacity: 0.4; - min-width: 20px; - animation: ${Ik} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; -`,Vk=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?S.createElement(_k,null,t):t:n==="blank"?null:S.createElement(Fk,null,S.createElement(Nk,{...r}),n!=="loading"&&S.createElement(Ak,null,n==="error"?S.createElement(Rk,{...r}):S.createElement(Mk,{...r})))},$k=e=>` -0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} -100% {transform: translate3d(0,0,0) scale(1); opacity:1;} -`,Uk=e=>` -0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} -100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} -`,Bk="0%{opacity:0;} 100%{opacity:1;}",zk="0%{opacity:1;} 100%{opacity:0;}",Wk=ir("div")` - display: flex; - align-items: center; - background: #fff; - color: #363636; - line-height: 1.3; - will-change: transform; - box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); - max-width: 350px; - pointer-events: auto; - padding: 8px 10px; - border-radius: 8px; -`,Hk=ir("div")` - display: flex; - justify-content: center; - margin: 4px 10px; - color: inherit; - flex: 1 1 auto; - white-space: pre-line; -`,Kk=(e,t)=>{let n=e.includes("top")?1:-1,[r,i]=W1()?[Bk,zk]:[$k(n),Uk(n)];return{animation:t?`${yn(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${yn(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},qk=S.memo(({toast:e,position:t,style:n,children:r})=>{let i=e.height?Kk(e.position||t||"top-center",e.visible):{opacity:0},s=S.createElement(Vk,{toast:e}),o=S.createElement(Hk,{...e.ariaProps},al(e.message,e));return S.createElement(Wk,{className:e.className,style:{...i,...n,...e.style}},typeof r=="function"?r({icon:s,message:o}):S.createElement(S.Fragment,null,s,o))});gk(S.createElement);var Qk=({id:e,className:t,style:n,onHeightUpdate:r,children:i})=>{let s=S.useCallback(o=>{if(o){let a=()=>{let l=o.getBoundingClientRect().height;r(e,l)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return S.createElement("div",{ref:s,className:t,style:n},i)},Yk=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},i=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:W1()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...i}},Gk=Kl` - z-index: 9999; - > * { - pointer-events: auto; - } -`,ta=16,Xk=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:o,containerClassName:a})=>{let{toasts:l,handlers:u}=Ek(n,s);return S.createElement("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:ta,left:ta,right:ta,bottom:ta,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(c=>{let f=c.position||t,d=u.calculateOffset(c,{reverseOrder:e,gutter:r,defaultPosition:t}),h=Yk(f,d);return S.createElement(Qk,{id:c.id,key:c.id,onHeightUpdate:u.updateHeight,className:c.visible?Gk:"",style:h},c.type==="custom"?al(c.message,c):i?i(c):S.createElement(qk,{toast:c,position:f}))}))},Jk=Z;function se(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Ir(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const Y1=6048e5,Zk=864e5,na=43200,Pm=1440;let eT={};function jo(){return eT}function _r(e,t){var a,l,u,c;const n=jo(),r=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((c=(u=n.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,i=se(e),s=i.getDay(),o=(s=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function Cm(e){const t=se(e);return t.setHours(0,0,0,0),t}function ul(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function tT(e,t){const n=Cm(e),r=Cm(t),i=n.getTime()-ul(n),s=r.getTime()-ul(r);return Math.round((i-s)/Zk)}function nT(e){const t=G1(e),n=Ir(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ll(n)}function Ta(e,t){const n=se(e),r=se(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}function rT(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function iT(e){if(!rT(e)&&typeof e!="number")return!1;const t=se(e);return!isNaN(Number(t))}function sT(e,t){const n=se(e),r=se(t),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function oT(e){return e?Math[e]:Math.trunc}function aT(e,t){return se(e).getTime()-se(t).getTime()}function lT(e){const t=se(e);return t.setHours(23,59,59,999),t}function uT(e){const t=se(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function cT(e){const t=se(e);return+lT(t)==+uT(t)}function fT(e,t){const n=se(e),r=se(t),i=Ta(n,r),s=Math.abs(sT(n,r));let o;if(s<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);let a=Ta(n,r)===-i;cT(se(e))&&s===1&&Ta(e,r)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function dT(e,t,n){const r=aT(e,t)/1e3;return oT(n==null?void 0:n.roundingMethod)(r)}function hT(e){const t=se(e),n=Ir(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const pT={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},mT=(e,t,n)=>{let r;const i=pT[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function vi(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const gT={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},yT={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vT={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wT={date:vi({formats:gT,defaultWidth:"full"}),time:vi({formats:yT,defaultWidth:"full"}),dateTime:vi({formats:vT,defaultWidth:"full"})},xT={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ST=(e,t,n,r)=>xT[e];function Kt(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):o;i=e.formattingValues[a]||e.formattingValues[o]}else{const o=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[o]}const s=e.argumentCallback?e.argumentCallback(t):t;return i[s]}}const bT={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},PT={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},CT={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ET={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},kT={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},TT={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},OT=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},RT={ordinalNumber:OT,era:Kt({values:bT,defaultWidth:"wide"}),quarter:Kt({values:PT,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Kt({values:CT,defaultWidth:"wide"}),day:Kt({values:ET,defaultWidth:"wide"}),dayPeriod:Kt({values:kT,defaultWidth:"wide",formattingValues:TT,defaultFormattingWidth:"wide"})};function qt(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;const o=s[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?NT(a,f=>f.test(o)):jT(a,f=>f.test(o));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;const c=t.slice(o.length);return{value:u,rest:c}}}function jT(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function NT(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],s=t.match(e.parsePattern);if(!s)return null;let o=e.valueCallback?e.valueCallback(s[0]):s[0];o=n.valueCallback?n.valueCallback(o):o;const a=t.slice(i.length);return{value:o,rest:a}}}const LT=/^(\d+)(th|st|nd|rd)?/i,DT=/\d+/i,MT={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},AT={any:[/^b/i,/^(a|c)/i]},FT={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},IT={any:[/1/i,/2/i,/3/i,/4/i]},_T={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},VT={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},$T={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},UT={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},BT={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},zT={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},WT={ordinalNumber:X1({matchPattern:LT,parsePattern:DT,valueCallback:e=>parseInt(e,10)}),era:qt({matchPatterns:MT,defaultMatchWidth:"wide",parsePatterns:AT,defaultParseWidth:"any"}),quarter:qt({matchPatterns:FT,defaultMatchWidth:"wide",parsePatterns:IT,defaultParseWidth:"any",valueCallback:e=>e+1}),month:qt({matchPatterns:_T,defaultMatchWidth:"wide",parsePatterns:VT,defaultParseWidth:"any"}),day:qt({matchPatterns:$T,defaultMatchWidth:"wide",parsePatterns:UT,defaultParseWidth:"any"}),dayPeriod:qt({matchPatterns:BT,defaultMatchWidth:"any",parsePatterns:zT,defaultParseWidth:"any"})},J1={code:"en-US",formatDistance:mT,formatLong:wT,formatRelative:ST,localize:RT,match:WT,options:{weekStartsOn:0,firstWeekContainsDate:1}};function HT(e){const t=se(e);return tT(t,hT(t))+1}function KT(e){const t=se(e),n=ll(t).getTime()-nT(t).getTime();return Math.round(n/Y1)+1}function Z1(e,t){var c,f,d,h;const n=se(e),r=n.getFullYear(),i=jo(),s=(t==null?void 0:t.firstWeekContainsDate)??((f=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:f.firstWeekContainsDate)??i.firstWeekContainsDate??((h=(d=i.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??1,o=Ir(e,0);o.setFullYear(r+1,0,s),o.setHours(0,0,0,0);const a=_r(o,t),l=Ir(e,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const u=_r(l,t);return n.getTime()>=a.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function qT(e,t){var a,l,u,c;const n=jo(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((c=(u=n.locale)==null?void 0:u.options)==null?void 0:c.firstWeekContainsDate)??1,i=Z1(e,t),s=Ir(e,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),_r(s,t)}function QT(e,t){const n=se(e),r=_r(n,t).getTime()-qT(n,t).getTime();return Math.round(r/Y1)+1}function ne(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Sn={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return ne(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ne(n+1,2)},d(e,t){return ne(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ne(e.getHours()%12||12,t.length)},H(e,t){return ne(e.getHours(),t.length)},m(e,t){return ne(e.getMinutes(),t.length)},s(e,t){return ne(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.floor(r*Math.pow(10,n-3));return ne(i,t.length)}},Kr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YT={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return Sn.y(e,t)},Y:function(e,t,n,r){const i=Z1(e,r),s=i>0?i:1-i;if(t==="YY"){const o=s%100;return ne(o,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):ne(s,t.length)},R:function(e,t){const n=G1(e);return ne(n,t.length)},u:function(e,t){const n=e.getFullYear();return ne(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return ne(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return ne(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Sn.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return ne(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=QT(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):ne(i,t.length)},I:function(e,t,n){const r=KT(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):ne(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Sn.d(e,t)},D:function(e,t,n){const r=HT(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ne(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return ne(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return ne(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return ne(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=Kr.noon:r===0?i=Kr.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=Kr.evening:r>=12?i=Kr.afternoon:r>=4?i=Kr.morning:i=Kr.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Sn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Sn.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ne(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):ne(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Sn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Sn.s(e,t)},S:function(e,t){return Sn.S(e,t)},X:function(e,t,n,r){const s=(r._originalDate||e).getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return km(s);case"XXXX":case"XX":return cr(s);case"XXXXX":case"XXX":default:return cr(s,":")}},x:function(e,t,n,r){const s=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return km(s);case"xxxx":case"xx":return cr(s);case"xxxxx":case"xxx":default:return cr(s,":")}},O:function(e,t,n,r){const s=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Em(s,":");case"OOOO":default:return"GMT"+cr(s,":")}},z:function(e,t,n,r){const s=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Em(s,":");case"zzzz":default:return"GMT"+cr(s,":")}},t:function(e,t,n,r){const i=r._originalDate||e,s=Math.floor(i.getTime()/1e3);return ne(s,t.length)},T:function(e,t,n,r){const s=(r._originalDate||e).getTime();return ne(s,t.length)}};function Em(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.floor(r/60),s=r%60;return s===0?n+String(i):n+String(i)+t+ne(s,2)}function km(e,t){return e%60===0?(e>0?"-":"+")+ne(Math.abs(e)/60,2):cr(e,t)}function cr(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=ne(Math.floor(r/60),2),s=ne(r%60,2);return n+i+t+s}const Tm=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ew=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},GT=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Tm(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",Tm(r,t)).replace("{{time}}",ew(i,t))},XT={p:ew,P:GT},JT=/^D+$/,ZT=/^Y+$/,e3=["D","DD","YY","YYYY"];function t3(e){return JT.test(e)}function n3(e){return ZT.test(e)}function Om(e,t,n){const r=r3(e,t,n);if(console.warn(r),e3.includes(e))throw new RangeError(r)}function r3(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const i3=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,s3=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,o3=/^'([^]*?)'?$/,a3=/''/g,l3=/[a-zA-Z]/;function u3(e,t,n){var c,f,d,h;const r=jo(),i=r.locale??J1,s=r.firstWeekContainsDate??((f=(c=r.locale)==null?void 0:c.options)==null?void 0:f.firstWeekContainsDate)??1,o=r.weekStartsOn??((h=(d=r.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??0,a=se(e);if(!iT(a))throw new RangeError("Invalid time value");const l={firstWeekContainsDate:s,weekStartsOn:o,locale:i,_originalDate:a};return t.match(s3).map(function(m){const w=m[0];if(w==="p"||w==="P"){const x=XT[w];return x(m,i.formatLong)}return m}).join("").match(i3).map(function(m){if(m==="''")return"'";const w=m[0];if(w==="'")return c3(m);const x=YT[w];if(x)return n3(m)&&Om(m,t,String(e)),t3(m)&&Om(m,t,String(e)),x(a,m,i.localize,l);if(w.match(l3))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return m}).join("")}function c3(e){const t=e.match(o3);return t?t[1].replace(a3,"'"):e}function f3(e,t,n){const r=jo(),i=(n==null?void 0:n.locale)??r.locale??J1,s=2520,o=Ta(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let l,u;o>0?(l=se(t),u=se(e)):(l=se(e),u=se(t));const c=dT(u,l),f=(ul(u)-ul(l))/1e3,d=Math.round((c-f)/60);let h;if(d<2)return n!=null&&n.includeSeconds?c<5?i.formatDistance("lessThanXSeconds",5,a):c<10?i.formatDistance("lessThanXSeconds",10,a):c<20?i.formatDistance("lessThanXSeconds",20,a):c<40?i.formatDistance("halfAMinute",0,a):c<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):d===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",d,a);if(d<45)return i.formatDistance("xMinutes",d,a);if(d<90)return i.formatDistance("aboutXHours",1,a);if(d{let r;const i=p3[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},g3={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},y3={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},v3={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},w3={date:vi({formats:g3,defaultWidth:"full"}),time:vi({formats:y3,defaultWidth:"full"}),dateTime:vi({formats:v3,defaultWidth:"full"})};function Rm(e,t,n){const r="eeee p";return h3(e,t,n)?r:e.getTime()>t.getTime()?"'下个'"+r:"'上个'"+r}const x3={lastWeek:Rm,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Rm,other:"PP p"},S3=(e,t,n,r)=>{const i=x3[e];return typeof i=="function"?i(t,n,r):i},b3={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},P3={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},C3={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},E3={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},k3={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},T3={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},O3=(e,t)=>{const n=Number(e);switch(t==null?void 0:t.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},R3={ordinalNumber:O3,era:Kt({values:b3,defaultWidth:"wide"}),quarter:Kt({values:P3,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Kt({values:C3,defaultWidth:"wide"}),day:Kt({values:E3,defaultWidth:"wide"}),dayPeriod:Kt({values:k3,defaultWidth:"wide",formattingValues:T3,defaultFormattingWidth:"wide"})},j3=/^(第\s*)?\d+(日|时|分|秒)?/i,N3=/\d+/i,L3={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},D3={any:[/^(前)/i,/^(公元)/i]},M3={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},A3={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},F3={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},I3={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},_3={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},V3={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},$3={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},U3={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},B3={ordinalNumber:X1({matchPattern:j3,parsePattern:N3,valueCallback:e=>parseInt(e,10)}),era:qt({matchPatterns:L3,defaultMatchWidth:"wide",parsePatterns:D3,defaultParseWidth:"any"}),quarter:qt({matchPatterns:M3,defaultMatchWidth:"wide",parsePatterns:A3,defaultParseWidth:"any",valueCallback:e=>e+1}),month:qt({matchPatterns:F3,defaultMatchWidth:"wide",parsePatterns:I3,defaultParseWidth:"any"}),day:qt({matchPatterns:_3,defaultMatchWidth:"wide",parsePatterns:V3,defaultParseWidth:"any"}),dayPeriod:qt({matchPatterns:$3,defaultMatchWidth:"any",parsePatterns:U3,defaultParseWidth:"any"})},z3={code:"zh-CN",formatDistance:m3,formatLong:w3,formatRelative:S3,localize:R3,match:B3,options:{weekStartsOn:1,firstWeekContainsDate:4}};function tw(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t${e.text}`,className:"w-full h-[60vh] border-0",sandbox:"allow-popups allow-popups-to-escape-sandbox",title:"Email Content"})})]})}function K3(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})})}function q3(e){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M20.25 20.25v-4.5m0 4.5h-4.5m4.5 0L15 15M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15m11.25-6L15 9"})})}function Q3({emails:e,isLoading:t,isFetching:n,onDelete:r,isDeleting:i,onRefresh:s,selectedIds:o,setSelectedIds:a,isAddressCreated:l,onSelectEmail:u,showViewPasswordButton:c,onShowPassword:f,selectedEmail:d,onCloseDetail:h,onExpand:m}){const{t:w}=zr(),x=v=>{a(b=>b.includes(v)?b.filter(C=>C!==v):[...b,v])},y=()=>{e.length!==0&&(o.length===e.length?a([]):a(e.map(v=>v.id)))},g=()=>d?p.jsx(iw,{email:d,onClose:h}):l?t?p.jsxs("div",{className:"w-full items-center h-full flex-col justify-center flex",children:[p.jsx(jm,{}),p.jsx("p",{className:"text-zinc-400 mt-6",children:w("Waiting for emails...")})]}):e.length===0?p.jsxs("div",{className:"w-full items-center h-full flex-col justify-center flex",children:[p.jsx(jm,{}),p.jsx("p",{className:"text-zinc-400 mt-6",children:w("Waiting for emails...")})]}):e.map(v=>{var b,C;return p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-neutral-300 bg-neutral-100 data-[state=checked]:border-neutral-900 data-[state=checked]:bg-neutral-600 data-[state=checked]:text-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:data-[state=checked]:border-neutral-300 dark:data-[state=checked]:bg-neutral-300",checked:o.includes(v.id),onChange:()=>x(v.id)}),p.jsxs("div",{onClick:()=>u(v),className:"cursor-pointer flex-1 flex flex-col items-start gap-2 rounded-lg border border-zinc-600 p-3 text-left text-sm transition-all hover:bg-zinc-700",children:[p.jsxs("div",{className:"flex w-full flex-col gap-1",children:[p.jsxs("div",{className:"flex items-center",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("div",{className:"font-semibold",children:[((b=v.from)==null?void 0:b.name)||v.messageFrom," ",((C=v.from)==null?void 0:C.address)&&`(${v.from.address})`]})}),p.jsx("div",{className:"ml-auto text-xs",children:d3(new Date(v.date||v.createdAt),{addSuffix:!0,locale:z3})})]}),p.jsx("div",{className:"text-xs font-medium",children:v.subject})]}),p.jsx("div",{className:"line-clamp-2 text-xs text-zinc-300 font-normal w-full",children:(v.text||v.html||"").substring(0,300)})]})]},v.id)}):p.jsxs("div",{className:"w-full items-center h-full flex-col justify-center flex",children:[p.jsx(W3,{}),p.jsx("p",{className:"text-zinc-400 mt-6",children:"请先创建一个临时邮箱地址"})]});return p.jsxs("div",{className:"rounded-md border border-cyan-50/20 text-white",children:[p.jsxs("div",{className:"w-full rounded-t-md p-2 flex items-center bg-zinc-800 text-zinc-200 gap-2",children:[p.jsxs("div",{className:"flex items-center justify-start gap-2 font-bold",children:[p.jsx(nw,{className:"size-6"}),w("INBOX"),l&&e.length>0&&!d&&p.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-zinc-600 rounded-full",children:e.length}),d&&p.jsxs("button",{onClick:h,className:"flex items-center gap-1 text-sm font-semibold text-cyan-400 hover:text-cyan-300 ml-2",children:[p.jsx(K3,{}),"返回邮件列表"]})]}),p.jsx("div",{className:"ml-auto flex items-center gap-2",children:d?p.jsxs(p.Fragment,{children:[p.jsx("button",{onClick:m,className:"p-1 rounded text-cyan-400 hover:text-cyan-300",title:"放大",children:p.jsx(q3,{className:"w-5 h-5"})}),p.jsx("button",{onClick:()=>r([d.id]),disabled:i,className:"p-1 rounded text-red-500 disabled:text-gray-500 hover:text-red-400",title:"删除",children:p.jsx(Nm,{className:"w-5 h-5"})})]}):p.jsxs(p.Fragment,{children:[c&&p.jsx("button",{className:"p-1 rounded text-cyan-400 hover:text-cyan-300",title:"查看密码",onClick:f,children:p.jsx(wf,{className:"w-5 h-5"})}),l&&e.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded bg-zinc-700 border-zinc-600 text-cyan-600 focus:ring-cyan-500",title:"全选",checked:o.length===e.length&&e.length>0,onChange:y}),p.jsx("button",{onClick:()=>r(o),disabled:o.length===0||i,className:"p-1 rounded text-red-500 disabled:text-gray-500 hover:text-red-400",title:"删除选中",children:p.jsx(Nm,{className:"w-5 h-5"})})]}),p.jsx("button",{className:"p-1 rounded",title:"refresh",onClick:s,disabled:!l||n,children:p.jsx(rw,{className:io("size-6",l&&"animate-spin")})})]})})]}),p.jsx("div",{className:io("flex flex-col flex-1 overflow-y-auto p-2",!d&&"grids h-[488px]"),children:g()})]})}function Y3(e){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),p.jsx("path",{d:"M5 12l5 5l10 -10"})]})}function G3(e){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),p.jsx("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),p.jsx("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"})]})}function Lm({text:e,className:t}){const[n,r]=S.useState(!1),{t:i}=zr(),s=async()=>{try{await navigator.clipboard.writeText(e),r(!0),Z.success(i("Copied to clipboard"))}catch(o){console.error("复制文本失败: ",o)}};return S.useEffect(()=>{if(n){const o=setTimeout(()=>{r(!1)},2e3);return()=>clearTimeout(o)}},[n]),p.jsx("button",{onClick:s,className:io("focus:outline-none focus-visible:outline-none",t),"aria-label":"Copy to clipboard",children:n?p.jsx(Y3,{className:"h-5 w-5 text-green-500"}):p.jsx(G3,{className:"h-5 w-5 text-gray-400"})})}const Ql="/api";async function X3(e){const t=await fetch(`${Ql}/emails`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});if(!t.ok)throw new Error("Network response was not ok");return t.json()}async function J3(e){const t=await fetch(`${Ql}/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});if(!t.ok){const n=await t.json();throw new Error(n.message||"Turnstile verification failed")}return t.json()}async function Z3(e){const t=await fetch(`${Ql}/delete-emails`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})});if(!t.ok)throw new Error("Failed to delete emails");return t.json()}async function eO(e){const t=await fetch(`${Ql}/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(!t.ok){const n=await t.json();throw new Error(n.message||"Login failed")}return t.json()}const sw=S.createContext(null),tO=()=>{const e=S.useContext(sw);if(!e)throw new Error("useConfig 必须在 ConfigProvider 内部使用");return e};function nO(){const e="abcdefghijklmnopqrstuvwxyz.";return e.charAt(Math.floor(Math.random()*e.length))}function rO(e,t){let n="";for(let r=0;r{function n(){t({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)},[]),{windowSize:e,isMobile:typeof(e==null?void 0:e.width)=="number"&&(e==null?void 0:e.width)<768,isDesktop:typeof(e==null?void 0:e.width)=="number"&&(e==null?void 0:e.width)>=768}}const Kd=S.createContext({});function Yl(e){const t=S.useRef(null);return t.current===null&&(t.current=e()),t.current}const Gl=S.createContext(null),qd=S.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class sO extends S.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function oO({children:e,isPresent:t}){const n=S.useId(),r=S.useRef(null),i=S.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=S.useContext(qd);return S.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return s&&(c.nonce=s),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` - [data-motion-pop-id="${n}"] { - position: absolute !important; - width: ${o}px !important; - height: ${a}px !important; - top: ${l}px !important; - left: ${u}px !important; - } - `),()=>{document.head.removeChild(c)}},[t]),p.jsx(sO,{isPresent:t,childRef:r,sizeRef:i,children:S.cloneElement(e,{ref:r})})}const aO=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=Yl(lO),l=S.useId(),u=S.useCallback(f=>{a.set(f,!0);for(const d of a.values())if(!d)return;r&&r()},[a,r]),c=S.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(a.set(f,!1),()=>a.delete(f))}),s?[Math.random(),u]:[n,u]);return S.useMemo(()=>{a.forEach((f,d)=>a.set(d,!1))},[n]),S.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(e=p.jsx(oO,{isPresent:n,children:e})),p.jsx(Gl.Provider,{value:c,children:e})};function lO(){return new Map}function ow(e=!0){const t=S.useContext(Gl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=S.useId();S.useEffect(()=>{e&&i(s)},[e]);const o=S.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,o]:[!0]}const ra=e=>e.key||"";function Dm(e){const t=[];return S.Children.forEach(e,n=>{S.isValidElement(n)&&t.push(n)}),t}const Qd=typeof window<"u",Yd=Qd?S.useLayoutEffect:S.useEffect,uO=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:o=!1})=>{const[a,l]=ow(o),u=S.useMemo(()=>Dm(e),[e]),c=o&&!a?[]:u.map(ra),f=S.useRef(!0),d=S.useRef(u),h=Yl(()=>new Map),[m,w]=S.useState(u),[x,y]=S.useState(u);Yd(()=>{f.current=!1,d.current=u;for(let b=0;b{const C=ra(b),T=o&&!a?!1:u===x||c.includes(C),k=()=>{if(h.has(C))h.set(C,!0);else return;let O=!0;h.forEach(F=>{F||(O=!1)}),O&&(v==null||v(),y(d.current),o&&(l==null||l()),r&&r())};return p.jsx(aO,{isPresent:T,initial:!f.current||n?void 0:!1,custom:T?void 0:t,presenceAffectsLayout:i,mode:s,onExitComplete:T?void 0:k,children:b},C)})})},ut=e=>e;let aw=ut;function Gd(e){let t;return()=>(t===void 0&&(t=e()),t)}const Bi=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},cn=e=>e*1e3,fn=e=>e/1e3,cO={useManualTiming:!1};function fO(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){s.has(u)&&(l.schedule(u),e()),u(o)}const l={schedule:(u,c=!1,f=!1)=>{const h=f&&r?t:n;return c&&s.add(u),h.has(u)||h.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(o=u,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(a),t.clear(),r=!1,i&&(i=!1,l.process(u))}};return l}const ia=["read","resolveKeyframes","update","preRender","render","postRender"],dO=40;function lw(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=ia.reduce((y,g)=>(y[g]=fO(s),y),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:f,postRender:d}=o,h=()=>{const y=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(y-i.timestamp,dO),1),i.timestamp=y,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),f.process(i),d.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},m=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:ia.reduce((y,g)=>{const v=o[g];return y[g]=(b,C=!1,T=!1)=>(n||m(),v.schedule(b,C,T)),y},{}),cancel:y=>{for(let g=0;gMm[e].some(n=>!!t[n])};function hO(e){for(const t in e)zi[t]={...zi[t],...e[t]}}const pO=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function cl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pO.has(e)}let cw=e=>!cl(e);function mO(e){e&&(cw=t=>t.startsWith("on")?!cl(t):e(t))}try{mO(require("@emotion/is-prop-valid").default)}catch{}function gO(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(cw(i)||n===!0&&cl(i)||!t&&!cl(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function yO(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const Xl=S.createContext({});function so(e){return typeof e=="string"||Array.isArray(e)}function Jl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Xd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Jd=["initial",...Xd];function Zl(e){return Jl(e.animate)||Jd.some(t=>so(e[t]))}function fw(e){return!!(Zl(e)||e.variants)}function vO(e,t){if(Zl(e)){const{initial:n,animate:r}=e;return{initial:n===!1||so(n)?n:void 0,animate:so(r)?r:void 0}}return e.inherit!==!1?t:{}}function wO(e){const{initial:t,animate:n}=vO(e,S.useContext(Xl));return S.useMemo(()=>({initial:t,animate:n}),[Am(t),Am(n)])}function Am(e){return Array.isArray(e)?e.join(" "):e}const xO=Symbol.for("motionComponentSymbol");function ai(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function SO(e,t,n){return S.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):ai(n)&&(n.current=r))},[t])}const Zd=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),bO="framerAppearId",dw="data-"+Zd(bO),{schedule:eh}=lw(queueMicrotask,!1),hw=S.createContext({});function PO(e,t,n,r,i){var s,o;const{visualElement:a}=S.useContext(Xl),l=S.useContext(uw),u=S.useContext(Gl),c=S.useContext(qd).reducedMotion,f=S.useRef(null);r=r||l.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:a,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:c}));const d=f.current,h=S.useContext(hw);d&&!d.projection&&i&&(d.type==="html"||d.type==="svg")&&CO(f.current,n,i,h);const m=S.useRef(!1);S.useInsertionEffect(()=>{d&&m.current&&d.update(n,u)});const w=n[dw],x=S.useRef(!!w&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,w))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,w)));return Yd(()=>{d&&(m.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),eh.render(d.render),x.current&&d.animationState&&d.animationState.animateChanges())}),S.useEffect(()=>{d&&(!x.current&&d.animationState&&d.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,w)}),x.current=!1))}),d}function CO(e,t,n,r){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:pw(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&ai(a),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function pw(e){if(e)return e.options.allowProjection!==!1?e.projection:pw(e.parent)}function EO({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,o;e&&hO(e);function a(u,c){let f;const d={...S.useContext(qd),...u,layoutId:kO(u)},{isStatic:h}=d,m=wO(u),w=r(u,h);if(!h&&Qd){TO();const x=OO(d);f=x.MeasureLayout,m.visualElement=PO(i,w,d,t,x.ProjectionNode)}return p.jsxs(Xl.Provider,{value:m,children:[f&&m.visualElement?p.jsx(f,{visualElement:m.visualElement,...d}):null,n(i,u,SO(w,m.visualElement,c),w,h,m.visualElement)]})}a.displayName=`motion.${typeof i=="string"?i:`create(${(o=(s=i.displayName)!==null&&s!==void 0?s:i.name)!==null&&o!==void 0?o:""})`}`;const l=S.forwardRef(a);return l[xO]=i,l}function kO({layoutId:e}){const t=S.useContext(Kd).id;return t&&e!==void 0?t+"-"+e:e}function TO(e,t){S.useContext(uw).strict}function OO(e){const{drag:t,layout:n}=zi;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const RO=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function th(e){return typeof e!="string"||e.includes("-")?!1:!!(RO.indexOf(e)>-1||/[A-Z]/u.test(e))}function Fm(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function nh(e,t,n,r){if(typeof t=="function"){const[i,s]=Fm(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=Fm(r);t=t(n!==void 0?n:e.custom,i,s)}return t}const xf=e=>Array.isArray(e),jO=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),NO=e=>xf(e)?e[e.length-1]||0:e,Ue=e=>!!(e&&e.getVelocity);function Oa(e){const t=Ue(e)?e.get():e;return jO(t)?t.toValue():t}function LO({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,s){const o={latestValues:DO(r,i,s,e),renderState:t()};return n&&(o.onMount=a=>n({props:r,current:a,...o}),o.onUpdate=a=>n(a)),o}const mw=e=>(t,n)=>{const r=S.useContext(Xl),i=S.useContext(Gl),s=()=>LO(e,t,r,i);return n?s():Yl(s)};function DO(e,t,n,r){const i={},s=r(e,{});for(const d in s)i[d]=Oa(s[d]);let{initial:o,animate:a}=e;const l=Zl(e),u=fw(e);t&&u&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const f=c?a:o;if(f&&typeof f!="boolean"&&!Jl(f)){const d=Array.isArray(f)?f:[f];for(let h=0;ht=>typeof t=="string"&&t.startsWith(e),yw=gw("--"),MO=gw("var(--"),rh=e=>MO(e)?AO.test(e.split("/*")[0].trim()):!1,AO=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vw=(e,t)=>t&&typeof e=="number"?t.transform(e):e,vn=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},oo={...es,transform:e=>vn(0,1,e)},sa={...es,default:1},No=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Pn=No("deg"),Jt=No("%"),H=No("px"),FO=No("vh"),IO=No("vw"),Im={...Jt,parse:e=>Jt.parse(e)/100,transform:e=>Jt.transform(e*100)},_O={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,radius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,backgroundPositionX:H,backgroundPositionY:H},VO={rotate:Pn,rotateX:Pn,rotateY:Pn,rotateZ:Pn,scale:sa,scaleX:sa,scaleY:sa,scaleZ:sa,skew:Pn,skewX:Pn,skewY:Pn,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:oo,originX:Im,originY:Im,originZ:H},_m={...es,transform:Math.round},ih={..._O,...VO,zIndex:_m,size:H,fillOpacity:oo,strokeOpacity:oo,numOctaves:_m},$O={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UO=Zi.length;function BO(e,t,n){let r="",i=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),ww=()=>({...ah(),attrs:{}}),lh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function xw(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const s in n)e.style.setProperty(s,n[s])}const Sw=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function bw(e,t,n,r){xw(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Sw.has(i)?i:Zd(i),t.attrs[i])}const fl={};function qO(e){Object.assign(fl,e)}function Pw(e,{layout:t,layoutId:n}){return Wr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!fl[e]||e==="opacity")}function uh(e,t,n){var r;const{style:i}=e,s={};for(const o in i)(Ue(i[o])||t.style&&Ue(t.style[o])||Pw(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function Cw(e,t,n){const r=uh(e,t,n);for(const i in e)if(Ue(e[i])||Ue(t[i])){const s=Zi.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function QO(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const $m=["x","y","width","height","cx","cy","r"],YO={useVisualState:mw({scrapeMotionValuesFromProps:Cw,createRenderState:ww,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let s=!!e.drag;if(!s){for(const a in i)if(Wr.has(a)){s=!0;break}}if(!s)return;let o=!t;if(t)for(let a=0;a<$m.length;a++){const l=$m[a];e[l]!==t[l]&&(o=!0)}o&&ue.read(()=>{QO(n,r),ue.render(()=>{oh(r,i,lh(n.tagName),e.transformTemplate),bw(n,r)})})}})},GO={useVisualState:mw({scrapeMotionValuesFromProps:uh,createRenderState:ah})};function Ew(e,t,n){for(const r in t)!Ue(t[r])&&!Pw(r,n)&&(e[r]=t[r])}function XO({transformTemplate:e},t){return S.useMemo(()=>{const n=ah();return sh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function JO(e,t){const n=e.style||{},r={};return Ew(r,n,e),Object.assign(r,XO(e,t)),r}function ZO(e,t){const n={},r=JO(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function eR(e,t,n,r){const i=S.useMemo(()=>{const s=ww();return oh(s,t,lh(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};Ew(s,e.style,e),i.style={...s,...i.style}}return i}function tR(e=!1){return(n,r,i,{latestValues:s},o)=>{const l=(th(n)?eR:ZO)(r,s,o,n),u=gO(r,typeof n=="string",e),c=n!==S.Fragment?{...u,...l,ref:i}:{},{children:f}=r,d=S.useMemo(()=>Ue(f)?f.get():f,[f]);return S.createElement(n,{...c,children:d})}}function nR(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...th(r)?YO:GO,preloadedFeatures:e,useRender:tR(i),createVisualElement:t,Component:r};return EO(o)}}function kw(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rwindow.ScrollTimeline!==void 0);class iR{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(rR()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{r.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class sR extends iR{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function ch(e,t){return e?e[t]||e.default||e:void 0}const Sf=2e4;function Tw(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=Sf?1/0:t}function fh(e){return typeof e=="function"}function Um(e,t){e.timeline=t,e.onfinish=null}const dh=e=>Array.isArray(e)&&typeof e[0]=="number",oR={linearEasing:void 0};function aR(e,t){const n=Gd(e);return()=>{var r;return(r=oR[t])!==null&&r!==void 0?r:n()}}const dl=aR(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ow=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s`cubic-bezier(${e}, ${t}, ${n}, ${r})`,bf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ws([0,.65,.55,1]),circOut:ws([.55,0,1,.45]),backIn:ws([.31,.01,.66,-.59]),backOut:ws([.33,1.53,.69,.99])};function jw(e,t){if(e)return typeof e=="function"&&dl()?Ow(e,t):dh(e)?ws(e):Array.isArray(e)?e.map(n=>jw(n,t)||bf.easeOut):bf[e]}const Ot={x:!1,y:!1};function Nw(){return Ot.x||Ot.y}function lR(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const s=(r=void 0)!==null&&r!==void 0?r:i.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function Lw(e,t){const n=lR(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Bm(e){return t=>{t.pointerType==="touch"||Nw()||e(t)}}function uR(e,t,n={}){const[r,i,s]=Lw(e,n),o=Bm(a=>{const{target:l}=a,u=t(a);if(typeof u!="function"||!l)return;const c=Bm(f=>{u(f),l.removeEventListener("pointerleave",c)});l.addEventListener("pointerleave",c,i)});return r.forEach(a=>{a.addEventListener("pointerenter",o,i)}),s}const Dw=(e,t)=>t?e===t?!0:Dw(e,t.parentElement):!1,hh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,cR=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function fR(e){return cR.has(e.tagName)||e.tabIndex!==-1}const xs=new WeakSet;function zm(e){return t=>{t.key==="Enter"&&e(t)}}function Fu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const dR=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=zm(()=>{if(xs.has(n))return;Fu(n,"down");const i=zm(()=>{Fu(n,"up")}),s=()=>Fu(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Wm(e){return hh(e)&&!Nw()}function hR(e,t,n={}){const[r,i,s]=Lw(e,n),o=a=>{const l=a.currentTarget;if(!Wm(a)||xs.has(l))return;xs.add(l);const u=t(a),c=(h,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",d),!(!Wm(h)||!xs.has(l))&&(xs.delete(l),typeof u=="function"&&u(h,{success:m}))},f=h=>{c(h,n.useGlobalTarget||Dw(l,h.target))},d=h=>{c(h,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",d,i)};return r.forEach(a=>{!fR(a)&&a.getAttribute("tabindex")===null&&(a.tabIndex=0),(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),a.addEventListener("focus",u=>dR(u,i),i)}),s}function pR(e){return e==="x"||e==="y"?Ot[e]?null:(Ot[e]=!0,()=>{Ot[e]=!1}):Ot.x||Ot.y?null:(Ot.x=Ot.y=!0,()=>{Ot.x=Ot.y=!1})}const Mw=new Set(["width","height","top","left","right","bottom",...Zi]);let Ra;function mR(){Ra=void 0}const Zt={now:()=>(Ra===void 0&&Zt.set(De.isProcessing||cO.useManualTiming?De.timestamp:performance.now()),Ra),set:e=>{Ra=e,queueMicrotask(mR)}};function ph(e,t){e.indexOf(t)===-1&&e.push(t)}function mh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class gh{constructor(){this.subscriptions=[]}add(t){return ph(this.subscriptions,t),()=>mh(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s!isNaN(parseFloat(e));class yR{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=Zt.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Zt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=gR(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new gh);const r=this.events[t].add(n);return t==="change"?()=>{r(),ue.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Zt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Hm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Hm);return Aw(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ao(e,t){return new yR(e,t)}function vR(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ao(n))}function yh(e,t){const n=eu(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const o in s){const a=NO(s[o]);vR(e,o,a)}}function wR(e){return!!(Ue(e)&&e.add)}function Pf(e,t){const n=e.getValue("willChange");if(wR(n))return n.add(t)}function Fw(e){return e.props[dw]}const Iw=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,xR=1e-7,SR=12;function bR(e,t,n,r,i){let s,o,a=0;do o=t+(n-t)/2,s=Iw(o,r,i)-e,s>0?n=o:t=o;while(Math.abs(s)>xR&&++abR(s,0,1,e,n);return s=>s===0||s===1?s:Iw(i(s),t,r)}const _w=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Vw=e=>t=>1-e(1-t),$w=Lo(.33,1.53,.69,.99),vh=Vw($w),Uw=_w(vh),Bw=e=>(e*=2)<1?.5*vh(e):.5*(2-Math.pow(2,-10*(e-1))),wh=e=>1-Math.sin(Math.acos(e)),zw=Vw(wh),Ww=_w(wh),Hw=e=>/^0[^.\s]+$/u.test(e);function PR(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Hw(e):!0}const Ds=e=>Math.round(e*1e5)/1e5,xh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CR(e){return e==null}const ER=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Sh=(e,t)=>n=>!!(typeof n=="string"&&ER.test(n)&&n.startsWith(e)||t&&!CR(n)&&Object.prototype.hasOwnProperty.call(n,t)),Kw=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,o,a]=r.match(xh);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},kR=e=>vn(0,255,e),Iu={...es,transform:e=>Math.round(kR(e))},yr={test:Sh("rgb","red"),parse:Kw("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Iu.transform(e)+", "+Iu.transform(t)+", "+Iu.transform(n)+", "+Ds(oo.transform(r))+")"};function TR(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Cf={test:Sh("#"),parse:TR,transform:yr.transform},li={test:Sh("hsl","hue"),parse:Kw("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Jt.transform(Ds(t))+", "+Jt.transform(Ds(n))+", "+Ds(oo.transform(r))+")"},_e={test:e=>yr.test(e)||Cf.test(e)||li.test(e),parse:e=>yr.test(e)?yr.parse(e):li.test(e)?li.parse(e):Cf.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?yr.transform(e):li.transform(e)},OR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function RR(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(xh))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(OR))===null||n===void 0?void 0:n.length)||0)>0}const qw="number",Qw="color",jR="var",NR="var(",Km="${}",LR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lo(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const a=t.replace(LR,l=>(_e.test(l)?(r.color.push(s),i.push(Qw),n.push(_e.parse(l))):l.startsWith(NR)?(r.var.push(s),i.push(jR),n.push(l)):(r.number.push(s),i.push(qw),n.push(parseFloat(l))),++s,Km)).split(Km);return{values:n,split:a,indexes:r,types:i}}function Yw(e){return lo(e).values}function Gw(e){const{split:t,types:n}=lo(e),r=t.length;return i=>{let s="";for(let o=0;otypeof e=="number"?0:e;function MR(e){const t=Yw(e);return Gw(e)(t.map(DR))}const Jn={test:RR,parse:Yw,createTransformer:Gw,getAnimatableNone:MR},AR=new Set(["brightness","contrast","saturate","opacity"]);function FR(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(xh)||[];if(!r)return e;const i=n.replace(r,"");let s=AR.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const IR=/\b([a-z-]*)\(.*?\)/gu,Ef={...Jn,getAnimatableNone:e=>{const t=e.match(IR);return t?t.map(FR).join(" "):e}},_R={...ih,color:_e,backgroundColor:_e,outlineColor:_e,fill:_e,stroke:_e,borderColor:_e,borderTopColor:_e,borderRightColor:_e,borderBottomColor:_e,borderLeftColor:_e,filter:Ef,WebkitFilter:Ef},bh=e=>_R[e];function Xw(e,t){let n=bh(e);return n!==Ef&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const VR=new Set(["auto","none","0"]);function $R(e,t,n){let r=0,i;for(;re===es||e===H,Qm=(e,t)=>parseFloat(e.split(", ")[t]),Ym=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return Qm(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?Qm(s[1],e):0}},UR=new Set(["x","y","z"]),BR=Zi.filter(e=>!UR.has(e));function zR(e){const t=[];return BR.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Wi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Ym(4,13),y:Ym(5,14)};Wi.translateX=Wi.x;Wi.translateY=Wi.y;const Rr=new Set;let kf=!1,Tf=!1;function Jw(){if(Tf){const e=Array.from(Rr).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=zR(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,o])=>{var a;(a=r.getValue(s))===null||a===void 0||a.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Tf=!1,kf=!1,Rr.forEach(e=>e.complete()),Rr.clear()}function Zw(){Rr.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Tf=!0)})}function WR(){Zw(),Jw()}class Ph{constructor(t,n,r,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Rr.add(this),kf||(kf=!0,ue.read(Zw),ue.resolveKeyframes(Jw))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;for(let s=0;s/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),HR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function KR(e){const t=HR.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function tx(e,t,n=1){const[r,i]=KR(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const o=s.trim();return ex(o)?parseFloat(o):o}return rh(i)?tx(i,t,n+1):i}const nx=e=>t=>t.test(e),qR={test:e=>e==="auto",parse:e=>e},rx=[es,H,Jt,Pn,IO,FO,qR],Gm=e=>rx.find(nx(e));class ix extends Ph{constructor(t,n,r,i,s){super(t,n,r,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const Xm=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Jn.test(e)||e==="0")&&!e.startsWith("url("));function QR(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function tu(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(GR),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const XR=40;class sx{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Zt.now(),this.options={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:o,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>XR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&WR(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Zt.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!YR(t,r,i,s))if(o)this.options.duration=0;else{l&&l(tu(t,this.options,n)),a&&a(),this.resolveFinishedPromise();return}const c=this.initPlayback(t,n);c!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const de=(e,t,n)=>e+(t-e)*n;function _u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function JR({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,o=0;if(!t)i=s=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=_u(l,a,e+1/3),s=_u(l,a,e),o=_u(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function hl(e,t){return n=>n>0?t:e}const Vu=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},ZR=[Cf,yr,li],ej=e=>ZR.find(t=>t.test(e));function Jm(e){const t=ej(e);if(!t)return!1;let n=t.parse(e);return t===li&&(n=JR(n)),n}const Zm=(e,t)=>{const n=Jm(e),r=Jm(t);if(!n||!r)return hl(e,t);const i={...n};return s=>(i.red=Vu(n.red,r.red,s),i.green=Vu(n.green,r.green,s),i.blue=Vu(n.blue,r.blue,s),i.alpha=de(n.alpha,r.alpha,s),yr.transform(i))},tj=(e,t)=>n=>t(e(n)),Do=(...e)=>e.reduce(tj),Of=new Set(["none","hidden"]);function nj(e,t){return Of.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rj(e,t){return n=>de(e,t,n)}function Ch(e){return typeof e=="number"?rj:typeof e=="string"?rh(e)?hl:_e.test(e)?Zm:oj:Array.isArray(e)?ox:typeof e=="object"?_e.test(e)?Zm:ij:hl}function ox(e,t){const n=[...e],r=n.length,i=e.map((s,o)=>Ch(s)(s,t[o]));return s=>{for(let o=0;o{for(const s in r)n[s]=r[s](i);return n}}function sj(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=Jn.createTransformer(t),r=lo(e),i=lo(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Of.has(e)&&!i.values.length||Of.has(t)&&!r.values.length?nj(e,t):Do(ox(sj(r,i),i.values),n):hl(e,t)};function ax(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?de(e,t,n):Ch(e)(e,t)}const aj=5;function lx(e,t,n){const r=Math.max(t-aj,0);return Aw(n-e(r),t-r)}const ge={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},$u=.001;function lj({duration:e=ge.duration,bounce:t=ge.bounce,velocity:n=ge.velocity,mass:r=ge.mass}){let i,s,o=1-t;o=vn(ge.minDamping,ge.maxDamping,o),e=vn(ge.minDuration,ge.maxDuration,fn(e)),o<1?(i=u=>{const c=u*o,f=c*e,d=c-n,h=Rf(u,o),m=Math.exp(-f);return $u-d/h*m},s=u=>{const f=u*o*e,d=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*e,m=Math.exp(-f),w=Rf(Math.pow(u,2),o);return(-i(u)+$u>0?-1:1)*((d-h)*m)/w}):(i=u=>{const c=Math.exp(-u*e),f=(u-n)*e+1;return-$u+c*f},s=u=>{const c=Math.exp(-u*e),f=(n-u)*(e*e);return c*f});const a=5/e,l=cj(i,s,a);if(e=cn(e),isNaN(l))return{stiffness:ge.stiffness,damping:ge.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const uj=12;function cj(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function hj(e){let t={velocity:ge.velocity,stiffness:ge.stiffness,damping:ge.damping,mass:ge.mass,isResolvedFromDuration:!1,...e};if(!eg(e,dj)&&eg(e,fj))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*vn(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ge.mass,stiffness:i,damping:s}}else{const n=lj(e);t={...t,...n,mass:ge.mass},t.isResolvedFromDuration=!0}return t}function ux(e=ge.visualDuration,t=ge.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:s},{stiffness:l,damping:u,mass:c,duration:f,velocity:d,isResolvedFromDuration:h}=hj({...n,velocity:-fn(n.velocity||0)}),m=d||0,w=u/(2*Math.sqrt(l*c)),x=o-s,y=fn(Math.sqrt(l/c)),g=Math.abs(x)<5;r||(r=g?ge.restSpeed.granular:ge.restSpeed.default),i||(i=g?ge.restDelta.granular:ge.restDelta.default);let v;if(w<1){const C=Rf(y,w);v=T=>{const k=Math.exp(-w*y*T);return o-k*((m+w*y*x)/C*Math.sin(C*T)+x*Math.cos(C*T))}}else if(w===1)v=C=>o-Math.exp(-y*C)*(x+(m+y*x)*C);else{const C=y*Math.sqrt(w*w-1);v=T=>{const k=Math.exp(-w*y*T),O=Math.min(C*T,300);return o-k*((m+w*y*x)*Math.sinh(O)+C*x*Math.cosh(O))/C}}const b={calculatedDuration:h&&f||null,next:C=>{const T=v(C);if(h)a.done=C>=f;else{let k=0;w<1&&(k=C===0?cn(m):lx(v,C,T));const O=Math.abs(k)<=r,F=Math.abs(o-T)<=i;a.done=O&&F}return a.value=a.done?o:T,a},toString:()=>{const C=Math.min(Tw(b),Sf),T=Ow(k=>b.next(C*k).value,C,30);return C+"ms "+T}};return b}function tg({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=e[0],d={done:!1,value:f},h=O=>a!==void 0&&Ol,m=O=>a===void 0?l:l===void 0||Math.abs(a-O)-w*Math.exp(-O/r),v=O=>y+g(O),b=O=>{const F=g(O),$=v(O);d.done=Math.abs(F)<=u,d.value=d.done?y:$};let C,T;const k=O=>{h(d.value)&&(C=O,T=ux({keyframes:[d.value,m(d.value)],velocity:lx(v,O,d.value),damping:i,stiffness:s,restDelta:u,restSpeed:c}))};return k(0),{calculatedDuration:null,next:O=>{let F=!1;return!T&&C===void 0&&(F=!0,b(O),k(O)),C!==void 0&&O>=C?T.next(O-C):(!F&&b(O),d)}}}const pj=Lo(.42,0,1,1),mj=Lo(0,0,.58,1),cx=Lo(.42,0,.58,1),gj=e=>Array.isArray(e)&&typeof e[0]!="number",yj={linear:ut,easeIn:pj,easeInOut:cx,easeOut:mj,circIn:wh,circInOut:Ww,circOut:zw,backIn:vh,backInOut:Uw,backOut:$w,anticipate:Bw},ng=e=>{if(dh(e)){aw(e.length===4);const[t,n,r,i]=e;return Lo(t,n,r,i)}else if(typeof e=="string")return yj[e];return e};function vj(e,t,n){const r=[],i=n||ax,s=e.length-1;for(let o=0;ot[0];if(s===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=vj(t,r,i),l=a.length,u=c=>{if(o&&c1)for(;fu(vn(e[0],e[s-1],c)):u}function xj(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Bi(0,t,r);e.push(de(n,1,i))}}function Sj(e){const t=[0];return xj(t,e.length-1),t}function bj(e,t){return e.map(n=>n*t)}function Pj(e,t){return e.map(()=>t||cx).splice(0,e.length-1)}function pl({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=gj(r)?r.map(ng):ng(r),s={done:!1,value:t[0]},o=bj(n&&n.length===t.length?n:Sj(t),e),a=wj(o,t,{ease:Array.isArray(i)?i:Pj(t,i)});return{calculatedDuration:e,next:l=>(s.value=a(l),s.done=l>=e,s)}}const Cj=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ue.update(t,!0),stop:()=>Xn(t),now:()=>De.isProcessing?De.timestamp:Zt.now()}},Ej={decay:tg,inertia:tg,tween:pl,keyframes:pl,spring:ux},kj=e=>e/100;class Eh extends sx{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Ph,a=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new o(s,a,n,r,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=fh(n)?n:Ej[n]||pl;let l,u;a!==pl&&typeof t[0]!="number"&&(l=Do(kj,ax(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});s==="mirror"&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Tw(c));const{calculatedDuration:f}=c,d=f+i,h=d*(r+1)-i;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:O}=this.options;return{done:!0,value:O[O.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:f}=r;if(this.startTime===null)return s.next(0);const{delay:d,repeat:h,repeatType:m,repeatDelay:w,onUpdate:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-d*(this.speed>=0?1:-1),g=this.speed>=0?y<0:y>c;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let v=this.currentTime,b=s;if(h){const O=Math.min(this.currentTime,c)/f;let F=Math.floor(O),$=O%1;!$&&O>=1&&($=1),$===1&&F--,F=Math.min(F,h+1),!!(F%2)&&(m==="reverse"?($=1-$,w&&($-=w/f)):m==="mirror"&&(b=o)),v=vn(0,1,$)*f}const C=g?{done:!1,value:l[0]}:b.next(v);a&&(C.value=a(C.value));let{done:T}=C;!g&&u!==null&&(T=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return k&&i!==void 0&&(C.value=tu(l,this.options,i)),x&&x(C.value),k&&this.finish(),C}get duration(){const{resolved:t}=this;return t?fn(t.calculatedDuration):0}get time(){return fn(this.currentTime)}set time(t){t=cn(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=fn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=Cj,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Tj=new Set(["opacity","clipPath","filter","transform"]);function Oj(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=jw(a,i);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const Rj=Gd(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ml=10,jj=2e4;function Nj(e){return fh(e.type)||e.type==="spring"||!Rw(e.ease)}function Lj(e,t){const n=new Eh({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const i=[];let s=0;for(;!r.done&&sthis.onKeyframesResolved(o,a),n,r,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:i,ease:s,type:o,motionValue:a,name:l,startTime:u}=this.options;if(!a.owner||!a.owner.current)return!1;if(typeof s=="string"&&dl()&&Dj(s)&&(s=fx[s]),Nj(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,element:m,...w}=this.options,x=Lj(t,w);t=x.keyframes,t.length===1&&(t[1]=t[0]),r=x.duration,i=x.times,s=x.ease,o="keyframes"}const c=Oj(a.owner.current,l,t,{...this.options,duration:r,times:i,ease:s});return c.startTime=u??this.calcStartTime(),this.pendingTimeline?(Um(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:f}=this.options;a.set(tu(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:r,times:i,type:o,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return fn(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return fn(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=cn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return ut;const{animation:r}=n;Um(r,t)}return ut}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:i,type:s,ease:o,times:a}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:c,onComplete:f,element:d,...h}=this.options,m=new Eh({...h,keyframes:r,duration:i,type:s,ease:o,times:a,isGenerator:!0}),w=cn(this.time);u.setWithVelocity(m.sample(w-ml).value,m.sample(w).value,ml)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:i,repeatType:s,damping:o,type:a}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=n.owner.getProps();return Rj()&&r&&Tj.has(r)&&!l&&!u&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}const Mj={type:"spring",stiffness:500,damping:25,restSpeed:10},Aj=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Fj={type:"keyframes",duration:.8},Ij={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},_j=(e,{keyframes:t})=>t.length>2?Fj:Wr.has(e)?e.startsWith("scale")?Aj(t[1]):Mj:Ij;function Vj({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}const kh=(e,t,n,r={},i,s)=>o=>{const a=ch(r,e)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-cn(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:d=>{t.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:s?void 0:i};Vj(a)||(c={...c,..._j(e,c)}),c.duration&&(c.duration=cn(c.duration)),c.repeatDelay&&(c.repeatDelay=cn(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(f=!0)),f&&!s&&t.get()!==void 0){const d=tu(c.keyframes,a);if(d!==void 0)return ue.update(()=>{c.onUpdate(d),c.onComplete()}),new sR([])}return!s&&rg.supports(c)?new rg(c):new Eh(c)};function $j({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function dx(e,t,{delay:n=0,transitionOverride:r,type:i}={}){var s;let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;r&&(o=r);const u=[],c=i&&e.animationState&&e.animationState.getState()[i];for(const f in l){const d=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),h=l[f];if(h===void 0||c&&$j(c,f))continue;const m={delay:n,...ch(o||{},f)};let w=!1;if(window.MotionHandoffAnimation){const y=Fw(e);if(y){const g=window.MotionHandoffAnimation(y,f,ue);g!==null&&(m.startTime=g,w=!0)}}Pf(e,f),d.start(kh(f,d,h,e.shouldReduceMotion&&Mw.has(f)?{type:!1}:m,e,w));const x=d.animation;x&&u.push(x)}return a&&Promise.all(u).then(()=>{ue.update(()=>{a&&yh(e,a)})}),u}function jf(e,t,n={}){var r;const i=eu(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const o=i?()=>Promise.all(dx(e,i,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:d}=s;return Uj(e,t,c+u,f,d,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function Uj(e,t,n=0,r=0,i=1,s){const o=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(Bj).forEach((u,c)=>{u.notify("AnimationStart",t),o.push(jf(u,t,{...s,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function Bj(e,t){return e.sortNodePosition(t)}function hx(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>jf(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=jf(e,t,n);else{const i=typeof t=="function"?eu(e,t,n.custom):t;r=Promise.all(dx(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const zj=Jd.length;function px(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?px(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>hx(e,n,r)))}function qj(e){let t=Kj(e),n=ig(),r=!0;const i=l=>(u,c)=>{var f;const d=eu(e,c,l==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:m,...w}=d;u={...u,...w,...m}}return u};function s(l){t=l(e)}function o(l){const{props:u}=e,c=px(e.parent)||{},f=[],d=new Set;let h={},m=1/0;for(let x=0;xm&&b,F=!1;const $=Array.isArray(v)?v:[v];let B=$.reduce(i(y),{});C===!1&&(B={});const{prevResolvedValues:X={}}=g,me={...X,...B},J=_=>{O=!0,d.has(_)&&(F=!0,d.delete(_)),g.needsAnimating[_]=!0;const j=e.getValue(_);j&&(j.liveStyle=!1)};for(const _ in me){const j=B[_],M=X[_];if(h.hasOwnProperty(_))continue;let D=!1;xf(j)&&xf(M)?D=!kw(j,M):D=j!==M,D?j!=null?J(_):d.add(_):j!==void 0&&d.has(_)?J(_):g.protectedKeys[_]=!0}g.prevProp=v,g.prevResolvedValues=B,g.isActive&&(h={...h,...B}),r&&e.blockInitialAnimation&&(O=!1),O&&(!(T&&k)||F)&&f.push(...$.map(_=>({animation:_,options:{type:y}})))}if(d.size){const x={};d.forEach(y=>{const g=e.getBaseTarget(y),v=e.getValue(y);v&&(v.liveStyle=!0),x[y]=g??null}),f.push({animation:x})}let w=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(f):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=e.variantChildren)===null||c===void 0||c.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,u)}),n[l].isActive=u;const f=o(l);for(const d in n)n[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=ig(),r=!0}}}function Qj(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!kw(t,e):!1}function ar(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ig(){return{animate:ar(!0),whileInView:ar(),whileHover:ar(),whileTap:ar(),whileDrag:ar(),whileFocus:ar(),exit:ar()}}class sr{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Yj extends sr{constructor(t){super(t),t.animationState||(t.animationState=qj(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Jl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let Gj=0;class Xj extends sr{constructor(){super(...arguments),this.id=Gj++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const Jj={animation:{Feature:Yj},exit:{Feature:Xj}};function uo(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Mo(e){return{point:{x:e.pageX,y:e.pageY}}}const Zj=e=>t=>hh(t)&&e(t,Mo(t));function Ms(e,t,n,r){return uo(e,t,Zj(n),r)}const sg=(e,t)=>Math.abs(e-t);function e5(e,t){const n=sg(e.x,t.x),r=sg(e.y,t.y);return Math.sqrt(n**2+r**2)}class mx{constructor(t,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Bu(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=e5(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:m}=f,{timestamp:w}=De;this.history.push({...m,timestamp:w});const{onStart:x,onMove:y}=this.handlers;d||(x&&x(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Uu(d,this.transformPagePoint),ue.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:m,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Bu(f.type==="pointercancel"?this.lastMoveEventInfo:Uu(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,x),m&&m(f,x)},!hh(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const o=Mo(t),a=Uu(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=De;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(t,Bu(a,this.history)),this.removeListeners=Do(Ms(this.contextWindow,"pointermove",this.handlePointerMove),Ms(this.contextWindow,"pointerup",this.handlePointerUp),Ms(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Xn(this.updatePoint)}}function Uu(e,t){return t?{point:t(e.point)}:e}function og(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Bu({point:e},t){return{point:e,delta:og(e,gx(t)),offset:og(e,t5(t)),velocity:n5(t,.1)}}function t5(e){return e[0]}function gx(e){return e[e.length-1]}function n5(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=gx(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>cn(t)));)n--;if(!r)return{x:0,y:0};const s=fn(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const yx=1e-4,r5=1-yx,i5=1+yx,vx=.01,s5=0-vx,o5=0+vx;function ft(e){return e.max-e.min}function a5(e,t,n){return Math.abs(e-t)<=n}function ag(e,t,n,r=.5){e.origin=r,e.originPoint=de(t.min,t.max,e.origin),e.scale=ft(n)/ft(t),e.translate=de(n.min,n.max,e.origin)-e.originPoint,(e.scale>=r5&&e.scale<=i5||isNaN(e.scale))&&(e.scale=1),(e.translate>=s5&&e.translate<=o5||isNaN(e.translate))&&(e.translate=0)}function As(e,t,n,r){ag(e.x,t.x,n.x,r?r.originX:void 0),ag(e.y,t.y,n.y,r?r.originY:void 0)}function lg(e,t,n){e.min=n.min+t.min,e.max=e.min+ft(t)}function l5(e,t,n){lg(e.x,t.x,n.x),lg(e.y,t.y,n.y)}function ug(e,t,n){e.min=t.min-n.min,e.max=e.min+ft(t)}function Fs(e,t,n){ug(e.x,t.x,n.x),ug(e.y,t.y,n.y)}function u5(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?de(n,e,r.max):Math.min(e,n)),e}function cg(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function c5(e,{top:t,left:n,bottom:r,right:i}){return{x:cg(e.x,n,i),y:cg(e.y,t,r)}}function fg(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Bi(t.min,t.max-r,e.min):r>i&&(n=Bi(e.min,e.max-i,t.min)),vn(0,1,n)}function h5(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Nf=.35;function p5(e=Nf){return e===!1?e=0:e===!0&&(e=Nf),{x:dg(e,"left","right"),y:dg(e,"top","bottom")}}function dg(e,t,n){return{min:hg(e,t),max:hg(e,n)}}function hg(e,t){return typeof e=="number"?e:e[t]||0}const pg=()=>({translate:0,scale:1,origin:0,originPoint:0}),ui=()=>({x:pg(),y:pg()}),mg=()=>({min:0,max:0}),we=()=>({x:mg(),y:mg()});function gt(e){return[e("x"),e("y")]}function wx({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function m5({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function g5(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function zu(e){return e===void 0||e===1}function Lf({scale:e,scaleX:t,scaleY:n}){return!zu(e)||!zu(t)||!zu(n)}function fr(e){return Lf(e)||xx(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function xx(e){return gg(e.x)||gg(e.y)}function gg(e){return e&&e!=="0%"}function gl(e,t,n){const r=e-n,i=t*r;return n+i}function yg(e,t,n,r,i){return i!==void 0&&(e=gl(e,i,r)),gl(e,n,r)+t}function Df(e,t=0,n=1,r,i){e.min=yg(e.min,t,n,r,i),e.max=yg(e.max,t,n,r,i)}function Sx(e,{x:t,y:n}){Df(e.x,t.translate,t.scale,t.originPoint),Df(e.y,n.translate,n.scale,n.originPoint)}const vg=.999999999999,wg=1.0000000000001;function y5(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,o;for(let a=0;avg&&(t.x=1),t.yvg&&(t.y=1)}function ci(e,t){e.min=e.min+t,e.max=e.max+t}function xg(e,t,n,r,i=.5){const s=de(e.min,e.max,i);Df(e,t,n,s,r)}function fi(e,t){xg(e.x,t.x,t.scaleX,t.scale,t.originX),xg(e.y,t.y,t.scaleY,t.scale,t.originY)}function bx(e,t){return wx(g5(e.getBoundingClientRect(),t))}function v5(e,t,n){const r=bx(e,n),{scroll:i}=t;return i&&(ci(r.x,i.offset.x),ci(r.y,i.offset.y)),r}const Px=({current:e})=>e?e.ownerDocument.defaultView:null,w5=new WeakMap;class x5{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=we(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=c=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Mo(c).point)},s=(c,f)=>{const{drag:d,dragPropagation:h,onDragStart:m}=this.getProps();if(d&&!h&&(this.openDragLock&&this.openDragLock(),this.openDragLock=pR(d),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),gt(x=>{let y=this.getAxisMotionValue(x).get()||0;if(Jt.test(y)){const{projection:g}=this.visualElement;if(g&&g.layout){const v=g.layout.layoutBox[x];v&&(y=ft(v)*(parseFloat(y)/100))}}this.originPoint[x]=y}),m&&ue.postRender(()=>m(c,f)),Pf(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},o=(c,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:m,onDrag:w}=this.getProps();if(!d&&!this.openDragLock)return;const{offset:x}=f;if(h&&this.currentDirection===null){this.currentDirection=S5(x),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,x),this.updateAxis("y",f.point,x),this.visualElement.render(),w&&w(c,f)},a=(c,f)=>this.stop(c,f),l=()=>gt(c=>{var f;return this.getAnimationState(c)==="paused"&&((f=this.getAxisMotionValue(c).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new mx(t,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Px(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&ue.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!oa(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=u5(o,this.constraints[t],this.elastic[t])),s.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&ai(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=c5(i.layoutBox,n):this.constraints=!1,this.elastic=p5(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&>(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=h5(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ai(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=v5(r,i.root,this.visualElement.getTransformPagePoint());let o=f5(i.layout.layoutBox,s);if(n){const a=n(m5(o));this.hasMutatedConstraints=!!a,a&&(o=wx(a))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=gt(c=>{if(!oa(c,n,this.currentDirection))return;let f=l&&l[c]||{};o&&(f={min:0,max:0});const d=i?200:1e6,h=i?40:1e7,m={type:"inertia",velocity:r?t[c]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(c,m)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Pf(this.visualElement,t),r.start(kh(t,r,0,n,this.visualElement,!1))}stopAnimation(){gt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){gt(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){gt(n=>{const{drag:r}=this.getProps();if(!oa(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];s.set(t[n]-de(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ai(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};gt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();i[o]=d5({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),gt(o=>{if(!oa(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(de(l,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;w5.set(this.visualElement,this);const t=this.visualElement.current,n=Ms(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();ai(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),ue.read(r);const o=uo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(gt(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),s(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=Nf,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function oa(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function S5(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class b5 extends sr{constructor(t){super(t),this.removeGroupControls=ut,this.removeListeners=ut,this.controls=new x5(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ut}unmount(){this.removeGroupControls(),this.removeListeners()}}const Sg=e=>(t,n)=>{e&&ue.postRender(()=>e(t,n))};class P5 extends sr{constructor(){super(...arguments),this.removePointerDownListener=ut}onPointerDown(t){this.session=new mx(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Px(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Sg(t),onStart:Sg(n),onMove:r,onEnd:(s,o)=>{delete this.session,i&&ue.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Ms(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ja={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function bg(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const cs={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(H.test(e))e=parseFloat(e);else return e;const n=bg(e,t.target.x),r=bg(e,t.target.y);return`${n}% ${r}%`}},C5={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Jn.parse(e);if(i.length>5)return r;const s=Jn.createTransformer(e),o=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+o]/=a,i[1+o]/=l;const u=de(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=u),typeof i[3+o]=="number"&&(i[3+o]/=u),s(i)}};class E5 extends S.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;qO(k5),s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),ja.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,o=r.projection;return o&&(o.isPresent=s,i||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||ue.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),eh.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Cx(e){const[t,n]=ow(),r=S.useContext(Kd);return p.jsx(E5,{...e,layoutGroup:r,switchLayoutGroup:S.useContext(hw),isPresent:t,safeToRemove:n})}const k5={borderRadius:{...cs,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:cs,borderTopRightRadius:cs,borderBottomLeftRadius:cs,borderBottomRightRadius:cs,boxShadow:C5};function T5(e,t,n){const r=Ue(e)?e:ao(e);return r.start(kh("",r,t,n)),r.animation}function O5(e){return e instanceof SVGElement&&e.tagName!=="svg"}const R5=(e,t)=>e.depth-t.depth;class j5{constructor(){this.children=[],this.isDirty=!1}add(t){ph(this.children,t),this.isDirty=!0}remove(t){mh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(R5),this.isDirty=!1,this.children.forEach(t)}}function N5(e,t){const n=Zt.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Xn(r),e(s-t))};return ue.read(r,!0),()=>Xn(r)}const Ex=["TopLeft","TopRight","BottomLeft","BottomRight"],L5=Ex.length,Pg=e=>typeof e=="string"?parseFloat(e):e,Cg=e=>typeof e=="number"||H.test(e);function D5(e,t,n,r,i,s){i?(e.opacity=de(0,n.opacity!==void 0?n.opacity:1,M5(r)),e.opacityExit=de(t.opacity!==void 0?t.opacity:1,0,A5(r))):s&&(e.opacity=de(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;ort?1:n(Bi(e,t,r))}function kg(e,t){e.min=t.min,e.max=t.max}function mt(e,t){kg(e.x,t.x),kg(e.y,t.y)}function Tg(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Og(e,t,n,r,i){return e-=t,e=gl(e,1/n,r),i!==void 0&&(e=gl(e,1/i,r)),e}function F5(e,t=0,n=1,r=.5,i,s=e,o=e){if(Jt.test(t)&&(t=parseFloat(t),t=de(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=de(s.min,s.max,r);e===s&&(a-=t),e.min=Og(e.min,t,n,a,i),e.max=Og(e.max,t,n,a,i)}function Rg(e,t,[n,r,i],s,o){F5(e,t[n],t[r],t[i],t.scale,s,o)}const I5=["x","scaleX","originX"],_5=["y","scaleY","originY"];function jg(e,t,n,r){Rg(e.x,t,I5,n?n.x:void 0,r?r.x:void 0),Rg(e.y,t,_5,n?n.y:void 0,r?r.y:void 0)}function Ng(e){return e.translate===0&&e.scale===1}function Tx(e){return Ng(e.x)&&Ng(e.y)}function Lg(e,t){return e.min===t.min&&e.max===t.max}function V5(e,t){return Lg(e.x,t.x)&&Lg(e.y,t.y)}function Dg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ox(e,t){return Dg(e.x,t.x)&&Dg(e.y,t.y)}function Mg(e){return ft(e.x)/ft(e.y)}function Ag(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class $5{constructor(){this.members=[]}add(t){ph(this.members,t),t.scheduleRender()}remove(t){if(mh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function U5(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:d,skewX:h,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),m&&(r+=`skewY(${m}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const dr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ss=typeof window<"u"&&window.MotionDebug!==void 0,Wu=["","X","Y","Z"],B5={visibility:"hidden"},Fg=1e3;let z5=0;function Hu(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Rx(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Fw(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ue,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Rx(r)}function jx({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=t==null?void 0:t()){this.id=z5++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ss&&(dr.totalNodes=dr.resolvedTargetDeltas=dr.recalculatedProjection=0),this.nodes.forEach(K5),this.nodes.forEach(X5),this.nodes.forEach(J5),this.nodes.forEach(q5),Ss&&window.MotionDebug.record(dr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=N5(d,250),ja.hasAnimatedSinceResize&&(ja.hasAnimatedSinceResize=!1,this.nodes.forEach(_g))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||c.getDefaultTransition()||r4,{onLayoutAnimationStart:x,onLayoutAnimationComplete:y}=c.getProps(),g=!this.targetLayout||!Ox(this.targetLayout,m)||h,v=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||v||d&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,v);const b={...ch(w,"layout"),onPlay:x,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else d||_g(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Xn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z5),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Rx(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const C=b/1e3;Vg(f.x,o.x,C),Vg(f.y,o.y,C),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Fs(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),t4(this.relativeTarget,this.relativeTargetOrigin,d,C),v&&V5(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=we()),mt(v,this.relativeTarget)),w&&(this.animationValues=c,D5(c,u,this.latestValues,C,g,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Xn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ue.update(()=>{ja.hasAnimatedSinceResize=!0,this.currentAnimation=T5(0,Fg,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Fg),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&Nx(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||we();const f=ft(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=ft(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}mt(a,l),fi(a,c),As(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new $5),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Hu("z",o,u,this.animationValues);for(let c=0;c{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(Ig),this.root.sharedNodes.clear()}}}function W5(e){e.updateLayout()}function H5(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:s}=e.options,o=n.source!==e.layout.source;s==="size"?gt(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=ft(d);d.min=r[f].min,d.max=d.min+h}):Nx(s,n.layoutBox,r)&>(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=ft(r[f]);d.max=d.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+h)});const a=ui();As(a,r,n.layoutBox);const l=ui();o?As(l,e.applyTransform(i,!0),n.measuredBox):As(l,r,n.layoutBox);const u=!Tx(a);let c=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const m=we();Fs(m,n.layoutBox,d.layoutBox);const w=we();Fs(w,r,h.layoutBox),Ox(m,w)||(c=!0),f.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function K5(e){Ss&&dr.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function q5(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Q5(e){e.clearSnapshot()}function Ig(e){e.clearMeasurements()}function Y5(e){e.isLayoutDirty=!1}function G5(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function _g(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function X5(e){e.resolveTargetDelta()}function J5(e){e.calcProjection()}function Z5(e){e.resetSkewAndRotation()}function e4(e){e.removeLeadSnapshot()}function Vg(e,t,n){e.translate=de(t.translate,0,n),e.scale=de(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function $g(e,t,n,r){e.min=de(t.min,n.min,r),e.max=de(t.max,n.max,r)}function t4(e,t,n,r){$g(e.x,t.x,n.x,r),$g(e.y,t.y,n.y,r)}function n4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const r4={duration:.45,ease:[.4,0,.1,1]},Ug=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Bg=Ug("applewebkit/")&&!Ug("chrome/")?Math.round:ut;function zg(e){e.min=Bg(e.min),e.max=Bg(e.max)}function i4(e){zg(e.x),zg(e.y)}function Nx(e,t,n){return e==="position"||e==="preserve-aspect"&&!a5(Mg(t),Mg(n),.2)}function s4(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const o4=jx({attachResizeListener:(e,t)=>uo(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Ku={current:void 0},Lx=jx({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ku.current){const e=new o4({});e.mount(window),e.setOptions({layoutScroll:!0}),Ku.current=e}return Ku.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),a4={pan:{Feature:P5},drag:{Feature:b5,ProjectionNode:Lx,MeasureLayout:Cx}};function Wg(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,s=r[i];s&&ue.postRender(()=>s(t,Mo(t)))}class l4 extends sr{mount(){const{current:t}=this.node;t&&(this.unmount=uR(t,n=>(Wg(this.node,n,"Start"),r=>Wg(this.node,r,"End"))))}unmount(){}}class u4 extends sr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Do(uo(this.node.current,"focus",()=>this.onFocus()),uo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Hg(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),s=r[i];s&&ue.postRender(()=>s(t,Mo(t)))}class c4 extends sr{mount(){const{current:t}=this.node;t&&(this.unmount=hR(t,n=>(Hg(this.node,n,"Start"),(r,{success:i})=>Hg(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Mf=new WeakMap,qu=new WeakMap,f4=e=>{const t=Mf.get(e.target);t&&t(e)},d4=e=>{e.forEach(f4)};function h4({root:e,...t}){const n=e||document;qu.has(n)||qu.set(n,{});const r=qu.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(d4,{root:e,...t})),r[i]}function p4(e,t,n){const r=h4(t);return Mf.set(e,n),r.observe(e),()=>{Mf.delete(e),r.unobserve(e)}}const m4={some:0,all:1};class g4 extends sr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:m4[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),d=u?c:f;d&&d(l)};return p4(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(y4(t,n))&&this.startObserver()}unmount(){}}function y4({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const v4={inView:{Feature:g4},tap:{Feature:c4},focus:{Feature:u4},hover:{Feature:l4}},w4={layout:{ProjectionNode:Lx,MeasureLayout:Cx}},Af={current:null},Dx={current:!1};function x4(){if(Dx.current=!0,!!Qd)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Af.current=e.matches;e.addListener(t),t()}else Af.current=!1}const S4=[...rx,_e,Jn],b4=e=>S4.find(nx(e)),Kg=new WeakMap;function P4(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Ue(i))e.addValue(r,i);else if(Ue(s))e.addValue(r,ao(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,ao(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const qg=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class C4{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ph,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=Zt.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Dx.current||x4(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Af.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Kg.delete(this.current),this.projection&&this.projection.unmount(),Xn(this.notifyUpdate),Xn(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Wr.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&ue.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in zi){const n=zi[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):we()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=ao(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(ex(i)||Hw(i))?i=parseFloat(i):!b4(i)&&Jn.test(n)&&(i=Xw(t,n)),this.setBaseTarget(t,Ue(i)?i.get():i)),Ue(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const o=nh(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(i=o[t])}if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Ue(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new gh),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class Mx extends C4{constructor(){super(...arguments),this.KeyframeResolver=ix}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ue(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function E4(e){return window.getComputedStyle(e)}class k4 extends Mx{constructor(){super(...arguments),this.type="html",this.renderInstance=xw}readValueFromInstance(t,n){if(Wr.has(n)){const r=bh(n);return r&&r.default||0}else{const r=E4(t),i=(yw(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return bx(t,n)}build(t,n,r){sh(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return uh(t,n,r)}}class T4 extends Mx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=we}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Wr.has(n)){const r=bh(n);return r&&r.default||0}return n=Sw.has(n)?n:Zd(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Cw(t,n,r)}build(t,n,r){oh(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){bw(t,n,r,i)}mount(t){this.isSVGTag=lh(t.tagName),super.mount(t)}}const O4=(e,t)=>th(e)?new T4(t):new k4(t,{allowProjection:e!==S.Fragment}),R4=nR({...Jj,...v4,...a4,...w4},O4),Qg=yO(R4);function j4(e){e.values.forEach(t=>t.stop())}function Ff(e,t){[...t].reverse().forEach(r=>{const i=e.getVariant(r);i&&yh(e,i),e.variantChildren&&e.variantChildren.forEach(s=>{Ff(s,t)})})}function N4(e,t){if(Array.isArray(t))return Ff(e,t);if(typeof t=="string")return Ff(e,[t]);yh(e,t)}function L4(){const e=new Set,t={subscribe(n){return e.add(n),()=>void e.delete(n)},start(n,r){const i=[];return e.forEach(s=>{i.push(hx(s,n,{transitionOverride:r}))}),Promise.all(i)},set(n){return e.forEach(r=>{N4(r,n)})},stop(){e.forEach(n=>{j4(n)})},mount(){return()=>{t.stop()}}};return t}function D4(){const e=Yl(L4);return Yd(e.mount,[]),e}const M4=D4;function A4({setShow:e,showBlur:t,children:n,theme:r="light"}){const i=S.useRef(null),s=M4(),o={type:"spring",stiffness:500,damping:30};S.useEffect(()=>{s.start({y:20,transition:o})},[]);async function a(l,u){var h;const c=u.offset.y,f=u.velocity.y,d=((h=i.current)==null?void 0:h.getBoundingClientRect().height)||0;c>d/2||f>800?(await s.start({y:"100%",transition:o}),e(!1)):s.start({y:0,transition:o})}return p.jsxs(uO,{children:[p.jsxs(Qg.div,{ref:i,className:io("group fixed inset-x-0 bottom-0 z-40 w-screen cursor-grab overflow-y-scroll pb-5 active:cursor-grabbing sm:hidden",r==="light"?"bg-white":"bg-neutral-800/95"),style:{maxHeight:"95%"},initial:{y:"100%"},animate:s,exit:{y:"100%"},transition:o,drag:"y",dragDirectionLock:!0,onDragEnd:a,dragElastic:{top:0,bottom:1},dragConstraints:{top:0,bottom:0},children:[p.jsxs("div",{className:io("rounded-t-4xl -mb-1 flex h-7 w-full items-center justify-center border-t",r==="light"?"border-gray-200":"border-cyan-50/20"),children:[p.jsx("div",{className:"-mr-1 h-1 w-6 rounded-full bg-gray-300 transition-all group-active:rotate-12"}),p.jsx("div",{className:"h-1 w-6 rounded-full bg-gray-300 transition-all group-active:-rotate-12"})]}),n]},"leaflet"),t&&p.jsx(Qg.div,{className:"fixed inset-0 z-30 bg-gray-100 bg-opacity-10 backdrop-blur",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>e(!1)},"leaflet-backdrop")]})}function Ax({children:e,showModal:t,setShowModal:n,theme:r="light"}){const i=S.useRef(null),{isMobile:s}=iO();S.useEffect(()=>{function a(l){i.current&&!i.current.contains(l.target)&&n(!1)}return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[i,n]);const o=S.useCallback(a=>{a.key==="Escape"&&n(!1)},[n]);return S.useEffect(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),s?t?p.jsx(A4,{setShow:n,showBlur:!0,theme:r,children:e}):null:p.jsx(p.Fragment,{children:t&&p.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center",style:{backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",backgroundColor:"rgba(0, 0, 0, 0.4)"},children:p.jsx("div",{className:"relative z-50 w-full max-w-lg",ref:i,children:e})})})}function Th(e){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[p.jsx("path",{d:"M18 6 6 18"}),p.jsx("path",{d:"m6 6 12 12"})]})}function F4({showPasswordModal:e,setShowPasswordModal:t,onLogin:n,isLoggingIn:r}){const{t:i}=zr(),[s,o]=S.useState(""),a=async l=>{if(l.preventDefault(),!s){Jk.error(i("Password is required"));return}await n(s)};return p.jsx(Ax,{showModal:e,setShowModal:t,children:p.jsxs("div",{className:"w-full overflow-hidden bg-white/95 backdrop-blur-xl shadow-xl p-4 md:max-w-3xl md:rounded-2xl md:border md:border-gray-200",children:[p.jsx(Th,{className:"absolute top-4 right-4 h-6 w-6 text-gray-500 hover:text-gray-700 cursor-pointer",onClick:()=>t(!1),onPointerDown:l=>l.stopPropagation()}),p.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-5 text-center md:px-16",children:[p.jsx("h3",{className:"font-display text-2xl font-bold",children:i("Save password")}),p.jsx("p",{className:"text-gray-500",children:i("Save your password and continue using this email in 1 day")})]}),p.jsxs("form",{onSubmit:a,className:"flex flex-col mt-4 space-y-4 px-4",children:[p.jsx("input",{value:s,onChange:l=>o(l.target.value),type:"text",name:"password",placeholder:i("Enter your password *"),required:!0,className:"rounded-md border border-slate-200 px-3 py-2 shadow-inner w-full"}),p.jsxs("p",{className:"text-sm",children:[i("How to get a password? Click to create a temporary email and receive at least one email to generate a password"),"."]}),p.jsxs("p",{className:"text-sm text-yellow-600",children:[i("Remember your password, otherwise your email will expire and cannot be retrieved"),"."]}),p.jsx("button",{type:"submit",disabled:r,className:"py-2.5 text-white rounded-md w-full bg-cyan-600 hover:opacity-90 disabled:cursor-not-allowed disabled:bg-zinc-500",children:i(r?"Submitting...":"Login")})]})]})})}function I4(){const[e,t]=S.useState(!1),n=S.useCallback(({onLogin:r,isLoggingIn:i})=>p.jsx(F4,{showPasswordModal:e,setShowPasswordModal:t,onLogin:r,isLoggingIn:i}),[e]);return S.useMemo(()=>({showPasswordModal:e,setShowPasswordModal:t,PasswordModal:n}),[t,n,e])}function _4(e){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"#0891b2",d:"M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8q0-.425-.288-.712T12 7q-.425 0-.712.288T11 8q0 .425.288.713T12 9m0 13q-3.475-.875-5.738-3.988T4 11.1V5l8-3l8 3v6.1q0 3.8-2.262 6.913T12 22m0-2.1q2.6-.825 4.3-3.3t1.7-5.5V6.375l-6-2.25l-6 2.25V11.1q0 3.025 1.7 5.5t4.3 3.3m0-7.9"})})}function V4(e){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 280 117",children:[p.jsx("path",{fill:"#FBAD41",d:"M205.52 50.813c-.858 0-1.705.03-2.551.058c-.137.007-.272.04-.398.094a1.424 1.424 0 0 0-.92.994l-3.628 12.672c-1.565 5.449-.983 10.48 1.646 14.174c2.41 3.416 6.42 5.421 11.289 5.655l19.679 1.194c.585.03 1.092.312 1.4.776a1.92 1.92 0 0 1 .2 1.692a2.496 2.496 0 0 1-2.134 1.662l-20.448 1.193c-11.11.515-23.062 9.58-27.255 20.633l-1.474 3.9a1.092 1.092 0 0 0 .967 1.49h70.425a1.872 1.872 0 0 0 1.81-1.365A51.172 51.172 0 0 0 256 101.828c0-28.16-22.582-50.984-50.449-50.984"}),p.jsx("path",{fill:"#F6821F",d:"m174.782 115.362l1.303-4.583c1.568-5.449.987-10.48-1.639-14.173c-2.418-3.417-6.424-5.422-11.296-5.656l-92.312-1.193a1.822 1.822 0 0 1-1.459-.776a1.919 1.919 0 0 1-.203-1.693a2.496 2.496 0 0 1 2.154-1.662l93.173-1.193c11.063-.511 23.015-9.58 27.208-20.633l5.313-14.04c.214-.596.27-1.238.156-1.86C191.126 20.51 166.91 0 137.96 0C111.269 0 88.626 17.403 80.5 41.596a26.996 26.996 0 0 0-19.156-5.359C48.549 37.524 38.25 47.946 36.979 60.88a27.905 27.905 0 0 0 .702 9.642C16.773 71.145 0 88.454 0 109.726c0 1.923.137 3.818.413 5.667c.115.897.879 1.57 1.783 1.568h170.48a2.223 2.223 0 0 0 2.106-1.63"})]})}function Fx(e){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 22 22",children:p.jsx("path",{fill:"#0891b2",d:"M7.376 6.745c-.447.275 1.197 4.242 1.598 4.888a1.206 1.206 0 0 0 2.053-1.266c-.397-.648-3.205-3.898-3.651-3.622m-.335-4.343a8.98 8.98 0 0 1 5.918 0c.329.114.765-.115.572-.611c-.141-.36-.277-.712-.332-.855c-.131-.339-.6-.619-.804-.665C11.623.097 10.823 0 10 0S8.377.097 7.604.271c-.204.046-.672.326-.803.665l-.332.855c-.193.496.243.726.572.611m12.057.784a10.132 10.132 0 0 0-1.283-1.285c-.153-.129-.603-.234-.888.051l-1.648 1.647a9.27 9.27 0 0 1 1.155.966c.362.361.677.752.966 1.155l1.647-1.647c.286-.286.181-.735.051-.887M10 2.9A8.1 8.1 0 0 0 1.899 11A8.1 8.1 0 0 0 10 19.101A8.1 8.1 0 0 0 10 2.9m0 14.201A6.1 6.1 0 1 1 10.001 4.9A6.1 6.1 0 0 1 10 17.1z"})})}function $4(e){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 26 26",children:p.jsxs("g",{fill:"none",stroke:"#0891b2",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[p.jsx("path",{d:"m12.802 2.165l5.575 2.389c.48.206.863.589 1.07 1.07l2.388 5.574c.22.512.22 1.092 0 1.604l-2.389 5.575c-.206.48-.589.863-1.07 1.07l-5.574 2.388c-.512.22-1.092.22-1.604 0l-5.575-2.389a2.036 2.036 0 0 1-1.07-1.07l-2.388-5.574a2.036 2.036 0 0 1 0-1.604l2.389-5.575c.206-.48.589-.863 1.07-1.07l5.574-2.388a2.036 2.036 0 0 1 1.604 0M12 9h.01"}),p.jsx("path",{d:"M11 12h1v4h1"})]})})}function Na({showModal:e,setShowModal:t,title:n,children:r}){return p.jsx(Ax,{showModal:e,setShowModal:t,theme:"dark",children:p.jsxs("div",{className:"w-full max-h-[80vh] flex flex-col bg-neutral-800/95 backdrop-blur-xl shadow-xl md:max-w-3xl md:rounded-2xl md:border md:border-cyan-50/20",children:[p.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center p-4 border-b border-cyan-50/20 relative",children:[p.jsx("h3",{className:"font-display text-2xl font-bold text-white",children:n}),p.jsx(Th,{className:"absolute top-4 right-4 h-6 w-6 text-gray-400 hover:text-white cursor-pointer",onClick:()=>t(!1),onPointerDown:i=>i.stopPropagation()})]}),p.jsx("div",{className:"flex-grow overflow-y-auto text-white p-6",children:p.jsx("div",{className:"text-white",children:r})})]})})}const Qu=e=>e<10?`0${e}`:`${e}`;function U4({expiryTimestamp:e,onReset:t}){const{t:n}=zr(),r=S.useCallback(()=>{const o=e-Date.now();let a={hours:"00",minutes:"00",seconds:"00",expired:o<=0};if(o>0){const l=Math.floor(o/1e3),u=l%60,c=Math.floor(l/60),f=c%60,d=Math.floor(c/60);a={hours:Qu(d),minutes:Qu(f),seconds:Qu(u),expired:!1}}return a},[e]),[i,s]=S.useState(r());return S.useEffect(()=>{s(r());const o=setInterval(()=>{s(r())},1e3);return()=>clearInterval(o)},[e,r]),S.useEffect(()=>{i.expired},[i.expired]),p.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-cyan-400 my-4 p-3 bg-white/5 rounded-md border border-cyan-50/20 shadow-inner",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[" ",p.jsx(Fx,{className:"w-5 h-5"}),i.expired?p.jsx("span",{children:n("Email expired")}):p.jsxs("span",{children:[n("Expires in"),": ",i.hours,":",i.minutes,":",i.seconds]})]}),!i.expired&&p.jsxs("button",{onClick:t,className:"p-1 rounded text-cyan-400 hover:text-cyan-300 focus:outline-none focus:ring-1 focus:ring-cyan-500",title:n("Reset validity"),children:[p.jsx(rw,{className:"w-5 h-5"})," "]})]})}function B4(){const e=tO(),{t}=zr(),n=Id(),[r,i]=S.useState(()=>Vt.get("userMailbox")),[s,o]=S.useState(()=>{const W=Vt.get("emailExpiry");return W?parseInt(W,10):void 0}),[a,l]=S.useState(""),[u,c]=S.useState([]),[f,d]=S.useState(!1),[h,m]=S.useState(null),[w,x]=S.useState(e.emailDomain[0]),[y,g]=S.useState(!1),{PasswordModal:v,setShowPasswordModal:b}=I4(),[C,T]=S.useState(!1),[k,O]=S.useState(!1),{data:F=[],isLoading:$,isFetching:B,refetch:X}=tP({queryKey:["emails",r],queryFn:()=>X3(r),enabled:!!r,refetchInterval:2e4,onError:W=>{Z.error(`${t("Failed to get emails")}: ${W.message}`,{duration:5e3})},retry:!1}),me=S.useCallback(W=>{Z(Ne=>p.jsxs("div",{className:"w-full max-w-lg p-4 bg-slate-800 text-white rounded-lg shadow-lg border border-slate-700",children:[p.jsxs("div",{className:"flex items-center justify-between pb-2 mb-3 border-b border-slate-700",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(wf,{className:"h-6 w-6 text-cyan-400"}),p.jsx("h3",{className:"text-lg font-semibold",children:t("View password")})]}),p.jsx("button",{onClick:()=>Z.dismiss(Ne.id),className:"p-1 rounded-full text-gray-400 hover:bg-slate-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-cyan-500","aria-label":"Close",children:p.jsx(Th,{className:"h-5 w-5"})})]}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-gray-300",children:t("Save your password and continue using this email in 1 day")}),p.jsxs("div",{className:"mt-2 flex items-center text-sm bg-slate-700 px-2 py-1 rounded",children:[p.jsx("span",{className:"flex-1 font-mono break-all text-gray-100",children:W}),p.jsx(Lm,{text:W,className:"p-1"})]}),p.jsx("p",{className:"mt-3 text-xs text-yellow-400",children:t("Remember your password, otherwise your email will expire and cannot be retrieved")})]})]}),{id:"password-notification",duration:5e3,position:"top-center",style:{background:"transparent",border:"none",padding:0,boxShadow:"none"}})},[t]),J=S.useRef(F.length);S.useEffect(()=>{if(F.length>0&&!k&&O(!0),!r)O(!1),o(void 0),Z.dismiss("password-notification");else{const W=Vt.get("emailExpiry");W&&!s&&o(parseInt(W,10))}J.current=F.length},[F,r,k,s]);const E=async()=>{if(!a){Z.error(t("No captcha response"));return}try{await J3(a),d(!0);const W=`${_1("",nO())}@${w}`,Ft=Date.now()+24*60*60*1e3;Vt.set("userMailbox",W,{expires:1}),Vt.set("emailExpiry",Ft.toString(),{expires:1}),i(W),o(Ft),O(!1),Z.success(t("Email created successfully"))}catch(W){Z.error(t("Failed to verify captcha")),console.error("Turnstile verification failed:",W)}},N=()=>{Vt.remove("userMailbox"),Vt.remove("emailExpiry"),i(void 0),O(!1),m(null),o(void 0),n.invalidateQueries({queryKey:["emails"]})},_=()=>{X(),Z.success(t("Mailbox refreshed"))},j=S.useCallback(()=>{const W=Date.now()+864e5,Ne=new Date(Date.now()+24*60*60*1e3);Vt.set("emailExpiry",W.toString(),{expires:Ne}),o(W),Z.success(t("Validity reset successfully"))},[t]),M=nP({mutationFn:W=>Z3(W),onSuccess:()=>{Z.success(t("Emails deleted successfully")),c([]),h&&u.includes(h.id)&&m(null),n.invalidateQueries({queryKey:["emails",r]})},onError:()=>{Z.error(t("Failed to delete emails"))}}),D=W=>{if(W.length===0){Z.error(t("Please select emails to delete"));return}M.mutate(W)},A=async W=>{T(!0);try{const Ne=await eO(W),Oh=Date.now()+24*60*60*1e3;Vt.set("userMailbox",Ne.address,{expires:1}),Vt.set("emailExpiry",Oh.toString(),{expires:1}),i(Ne.address),o(Oh),b(!1),Z.success(t("Login successful"))}catch(Ne){Z.error(`${t("Login failed")}: ${t(Ne.message)}`)}finally{T(!1)}},U=S.useCallback(()=>r&&e.cookiesSecret?rO(r,e.cookiesSecret):null,[r,e.cookiesSecret]),K=W=>{m(W)},ve=()=>{m(null)},pt=()=>{g(!0)};return p.jsxs("div",{className:"h-full flex flex-col gap-4 md:flex-row justify-center items-start mt-24 mx-6 md:mx-10",children:[p.jsx(v,{onLogin:A,isLoggingIn:C}),h&&p.jsx(Na,{showModal:y,setShowModal:g,title:t("Email Detail"),children:p.jsx(iw,{email:h,onClose:()=>g(!1)})}),p.jsxs("div",{className:"flex flex-col text-white items-start w-full md:w-[350px] mx-auto gap-2",children:[p.jsxs("div",{className:"w-full mb-4 md:max-w-[350px] shrink-0 group group-hover:before:duration-500 group-hover:after:duration-500 after:duration-500 hover:border-cyan-600 hover:before:[box-shadow:_20px_20px_20px_30px_#a21caf] duration-500 before:duration-500 hover:duration-500 hover:after:-right-8 hover:before:right-12 hover:before:-bottom-8 hover:before:blur origin-left hover:decoration-2 relative bg-neutral-800 h-full border text-left p-4 rounded-lg overflow-hidden border-cyan-50/20 before:absolute before:w-12 before:h-12 before:content[''] before:right-1 before:top-1 before:z-10 before:bg-violet-500 before:rounded-full before:blur-lg after:absolute after:z-10 after:w-20 after:h-20 after:content[''] after:bg-rose-300 after:right-8 after:top-3 after:rounded-full after:blur-lg",children:[p.jsx("h1",{className:"text-gray-50 text-xl font-bold mb-7 group-hover:text-cyan-500 duration-500",children:t("Virtual Temporary Email")}),p.jsxs("div",{className:"flex flex-col gap-4 text-sm text-gray-200",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(_4,{})," ",t("Privacy friendly")]}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Fx,{}),t("Valid for 1 Day")]}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx($4,{}),t("AD friendly")]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(V4,{}),t("100% Run on Cloudflare")]})]})]}),r?p.jsxs("div",{className:"w-full md:max-w-[350px] mb-4",children:[p.jsx("div",{className:"mb-4 font-semibold text-sm",children:t("Email address")}),p.jsxs("div",{className:"flex items-center text-zinc-100 bg-white/10 backdrop-blur-xl shadow-inner px-4 py-4 rounded-md w-full",children:[p.jsx("span",{className:"truncate",children:r}),p.jsx(Lm,{text:r,className:"p-1 rounded-md ml-auto"})]}),s&&p.jsx(U4,{expiryTimestamp:s,onReset:j}),p.jsx("button",{onClick:N,className:"py-2.5 rounded-md w-full bg-cyan-600 hover:opacity-90 disabled:cursor-not-allowed disabled:bg-zinc-500",children:t("Stop")})]}):p.jsxs("div",{className:"w-full md:max-w-[350px]",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("div",{className:"mb-3 font-semibold",children:t("Domain")}),p.jsx("select",{value:w,onChange:W=>x(W.target.value),className:"w-full p-2.5 rounded-md bg-white/10 text-white border border-cyan-50/20",children:e.emailDomain.map(W=>p.jsxs("option",{value:W,className:"text-black",children:["@",W]},W))})]}),p.jsxs("div",{className:"text-sm relative mb-4",children:[p.jsx("div",{className:"mb-3 font-semibold",children:t("Validater")}),p.jsx("div",{className:"[&_iframe]:!w-full h-[65px] max-w-[300px] bg-gray-700",children:p.jsx(I1,{siteKey:e.turnstileKey,onSuccess:l,options:{theme:"dark"}})})]}),p.jsx("button",{onClick:E,disabled:!a,className:"py-2.5 rounded-md w-full bg-cyan-600 hover:opacity-90 disabled:cursor-not-allowed disabled:bg-zinc-500",children:t("Create temporary email")}),p.jsxs("p",{className:"mt-4 text-sm text-cyan-500 cursor-pointer",onClick:()=>b(!0),children:[p.jsx(wf,{className:"inline-block w-4 h-4 mr-2"}),t("Have a password? Login.")]})]})]}),p.jsx("div",{className:"w-full flex-1 overflow-hidden",children:p.jsx(Q3,{isAddressCreated:!!r,emails:F,isLoading:$,isFetching:B,onDelete:D,isDeleting:M.isPending,onRefresh:_,selectedIds:u,setSelectedIds:c,onSelectEmail:K,showViewPasswordButton:k,onShowPassword:()=>{const W=U();W&&me(W)},selectedEmail:h,onCloseDetail:ve,onExpand:pt})})]})}function z4(){return p.jsxs("svg",{id:"iconce.com",width:"32",height:"32",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[p.jsxs("defs",{children:[p.jsxs("linearGradient",{id:"r5",gradientUnits:"userSpaceOnUse",gradientTransform:"rotate(45)",style:{transformOrigin:"center center"},children:[p.jsx("stop",{stopColor:"#5C5C5C"}),p.jsx("stop",{offset:"1",stopColor:"#0F1015"})]}),p.jsxs("radialGradient",{id:"r6",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(256) rotate(90) scale(512)",children:[p.jsx("stop",{stopColor:"white"}),p.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})]}),p.jsx("rect",{id:"r4",width:"256",height:"256",x:"0",y:"0",rx:"48",fill:"url(#r5)",stroke:"#FFFFFF",strokeWidth:"0",strokeOpacity:"100%",paintOrder:"stroke"}),p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"170",height:"170",viewBox:"0 0 24 24",fill:"none",stroke:"#FFFFFF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white",alignmentBaseline:"middle",x:"43",y:"43",children:[p.jsx("path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z"}),p.jsx("polyline",{points:"15,9 18,9 18,11"}),p.jsx("path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2v0"}),p.jsx("line",{x1:"6",x2:"7",y1:"10",y2:"10"})]})]})}function W4({className:e}){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-[1px]",children:p.jsx("path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5"})})}function H4(){return p.jsx("div",{children:p.jsxs("div",{className:"max-w-[1400px] ",children:[p.jsxs("p",{className:"mt-8",children:[p.jsx("strong",{children:"Vmail.DEV "})," is a Virtual temporary email service."," "]}),p.jsxs("p",{className:"mt-4",children:["You can get a temporary email without revealing any personal information, which greatly protects your privacy."," "]}),p.jsxs("p",{className:"mt-4",children:["It supports selecting one domain names, making it convenient for you to use in different scenarios."," "]}),p.jsxs("p",{className:"mt-4",children:["100% running on the ",p.jsx("strong",{children:"Cloudflare "})," network, providing you with a super-fast experience."," "]}),p.jsx("p",{className:"mt-4",children:"Misuse of the temporary email service not only violates our terms of service but can also impact the normal use of other users. We encourage each user to use our services responsibly to ensure that resources are allocated and used appropriately."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"copyrights",children:p.jsx("a",{href:"#copyrights",children:"Copyrights "})}),p.jsxs("p",{className:"mt-4",children:["All copyrights belong to"," ",p.jsxs("a",{href:"https://vmail.dev",rel:"nofollow",children:[p.jsx("strong",{children:"Vmail.DEV "})," "]}),"."," "]})]})})}function K4(){return p.jsx("div",{children:p.jsxs("div",{className:"max-w-[1400px] ",children:[p.jsx("p",{className:"mt-8",children:"At Vmail.DEV, we value the privacy of our users and are committed to protecting their personal information. This Privacy Policy outlines the practices we follow regarding the collection, use, storage, and deletion of data on our one-time email website."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Collection of Information",children:"1. Collection of Information"}),p.jsx("p",{className:"mt-4",children:"We only collect and store an email name for the duration of the session. This information is necessary to facilitate the functioning of our one-time email service."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Storage of Emails",children:"2. Storage of Emails"}),p.jsx("p",{className:"mt-4",children:"All emails sent and received through our one-time email service are temporarily stored in Cloudflare data centers. This storage is essential for the proper delivery and retrieval of emails during the active session."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Deletion of Emails",children:"3. Deletion of Emails"}),p.jsx("p",{className:"mt-4",children:"Once an email expires, we ensure the complete deletion of the email from our system. This means that all associated data, including the email content and any related information, will be permanently removed from our servers."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Data Security",children:"4. Data Security"}),p.jsx("p",{className:"mt-4",children:"We take appropriate measures to protect the personal information and emails stored on our website. However, it is important to note that no method of data transmission or storage is completely secure. While we strive to use commercially acceptable means to protect user data, we cannot guarantee absolute security."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Third-Party Services",children:"5. Third-Party Services"}),p.jsx("p",{className:"mt-4",children:"We may use third-party services, such as Cloudflare, to assist in the operation and maintenance of our website. These third-party services may have access to certain user data, including email names and content, solely for the purpose of providing their services. We ensure that any third-party services we use are reputable and have appropriate data protection measures in place."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"",children:"6. Information Sharing"}),p.jsx("p",{className:"mt-4",children:"We do not share, sell, or disclose any personal information or email content to third parties, except as required by law or as necessary to protect our rights, property, or safety."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Cookies",children:"7. Cookies"}),p.jsx("p",{className:"mt-4",children:"We may use cookies to enhance the user experience on our website. These cookies may collect non-personal information and are used solely for website analytics and functionality purposes."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Children's Privacy",children:"8. Children's Privacy"}),p.jsx("p",{className:"mt-4",children:"Our website is not intended for use by individuals under the age of 13. We do not knowingly collect personal information from children. If you believe that we may have inadvertently collected personal information from a child under 13, please contact us immediately, and we will take appropriate steps to delete such information."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Changes to the Privacy Policy",children:"9. Changes to the Privacy Policy"}),p.jsx("p",{className:"mt-4",children:"We reserve the right to modify or update this Privacy Policy at any time. Any changes made will be effective immediately upon posting the revised Privacy Policy on our website. It is advisable to review this Privacy Policy periodically for any updates."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Contact Us",children:"10. Contact Us"}),p.jsx("p",{className:"mt-4",children:"If you have any questions, concerns, or feedback regarding this Privacy Policy or our website's privacy practices, please contact us."}),p.jsx("p",{className:"mt-8",children:"Last updated: 2024-03-15"})]})})}function q4(){return p.jsx("div",{children:p.jsxs("div",{className:"max-w-[1400px] ",children:[p.jsx("p",{className:"mt-8",children:'Welcome to Vmail.DEV! These Terms of Service ("Terms") govern your access to and use of our website and services. By accessing or using our services, you agree to be bound by these Terms. If you do not agree to these Terms, please do not use our services.'}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Collection of Information",children:"1. Description of Service"}),p.jsx("p",{className:"mt-4",children:"Vmail.DEV is a minimalistic temporary email service that allows you to obtain a temporary email address without disclosing any personal information, ensuring the protection of your privacy. Our service supports the selection of multiple domain names, providing you with the convenience of using it in various scenarios. Additionally, Vmail.DEV operates on the Cloudflare network, guaranteeing a super-fast experience."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Storage of Emails",children:"2. Usage Restrictions"}),p.jsx("p",{className:"mt-4",children:"2.1 Availability: Please note that Vmail.DEV is not available in China Mainland. We apologize for any inconvenience caused."}),p.jsx("p",{className:"mt-4",children:"2.2 Copyright: All copyrights related to Vmail.DEV and its services belong to Vmail.DEV. You may not copy, reproduce, distribute, modify, or create derivative works of Vmail.DEV or any part thereof without explicit permission from Vmail.DEV."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Deletion of Emails",children:"3. User Responsibilities"}),p.jsx("p",{className:"mt-4",children:"3.1 Registration: You are not required to register or provide any personal information to use Vmail.DEV. However, you are solely responsible for maintaining the confidentiality of any temporary email addresses generated through our service."}),p.jsx("p",{className:"mt-4",children:"3.2 Prohibited Activities: While using Vmail.DEV, you agree not to engage in any activities that may violate any applicable laws, regulations, or these Terms. Prohibited activities include, but are not limited to:"}),p.jsxs("ul",{className:"mt-4",children:[p.jsx("li",{children:"a) Sending spam or unsolicited emails. "}),p.jsx("li",{children:"b) Interfering with or disrupting the operation of our services."}),p.jsx("li",{children:"c) Attempting to gain unauthorized access to our systems or networks."})]}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Data Security",children:"4. Disclaimer of Warranty"}),p.jsx("p",{className:"mt-4",children:'Vmail.DEV is provided on an "as is" and "as available" basis. We do not warrant that our services will be uninterrupted, error-free, or secure. Your use of Vmail.DEV is at your own risk, and we disclaim all warranties, whether express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement.'}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Third-Party Services",children:"5. Limitation of Liability"}),p.jsx("p",{className:"mt-4",children:"To the maximum extent permitted by law, in no event shall Vmail.DEV or its affiliates be liable for any indirect, incidental, special, consequential, or punitive damages, including without limitation, loss of profits, data, use, goodwill, or other intangible losses, resulting from your access to or use of Vmail.DEV or any content or services provided through Vmail.DEV."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"",children:"6. Modification of Terms"}),p.jsx("p",{className:"mt-4",children:"We reserve the right to modify these Terms at any time, without prior notice. Any changes to the Terms will be effective immediately upon posting. Your continued use of Vmail.DEV after the posting of any modified Terms constitutes your acceptance of such changes."}),p.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Cookies",children:"7. Governing Law and Jurisdiction"}),p.jsx("p",{className:"mt-4",children:"These Terms shall be governed by and construed in accordance with the laws of the jurisdiction where Vmail.DEV is located. Any disputes arising out of or in connection with these Terms shall be subject to the exclusive jurisdiction of the courts in that jurisdiction."}),p.jsx("p",{className:"mt-4",children:"If you have any questions or concerns regarding these Terms, please contact us."}),p.jsx("p",{className:"mt-8",children:"Last updated: 2024-04-10"})]})})}function Q4(){const{t:e}=zr(),[t,n]=S.useState(!1),[r,i]=S.useState(!1),[s,o]=S.useState(!1);return p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:"fixed top-0 z-20 h-20 w-full px-5 backdrop-blur-xl md:px-10 text-white flex items-center justify-between shadow-sm",children:[p.jsxs(M1,{to:"/",className:"font-bold flex items-center justify-center gap-3",children:[p.jsx(z4,{}),p.jsx("button",{className:"cool-btn",children:p.jsx("span",{children:"VMAIL.DEV"})})]}),p.jsxs("nav",{className:"flex items-center",children:[p.jsx("button",{onClick:()=>n(!0),className:"ml-3 md:ml-8 text-sm md:text-base hidden md:block hover:text-cyan-400",children:e("About")}),p.jsx("button",{onClick:()=>i(!0),className:"ml-3 md:ml-8 text-sm md:text-base hidden md:block hover:text-cyan-400",children:e("Privacy")}),p.jsx("button",{onClick:()=>o(!0),className:"ml-3 md:ml-8 text-sm md:text-base hidden md:block hover:text-cyan-400",children:e("Terms")}),p.jsx("a",{className:"ml-3 md:ml-8",target:"_blank",rel:"noopener noreferrer",href:"https://github.com/oiov/vmail",children:p.jsxs("button",{className:"whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-transparent hover:bg-accent hover:text-accent-foreground text-md flex h-[32px] w-[85px] cursor-pointer items-center justify-center rounded-md border-2 p-2 font-semibold hover:opacity-50",children:[p.jsx(W4,{}),p.jsx("div",{className:"ml-1.5 text-sm",children:"Star"})]})})]})]}),p.jsx(Na,{showModal:t,setShowModal:n,title:e("About"),children:p.jsx(H4,{})}),p.jsx(Na,{showModal:r,setShowModal:i,title:e("Privacy"),children:p.jsx(K4,{})}),p.jsx(Na,{showModal:s,setShowModal:o,title:e("Terms"),children:p.jsx(q4,{})})]})}function Y4({className:e}){return p.jsx("svg",{width:"512",height:"512",viewBox:"0 0 24 24",className:"h-6 w-6",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("path",{fill:"currentColor",d:"M8.5 2h2.5L11 2h-2.5zM13 2h2.5L15.5 2h-2.5zM10.5 2h5v0h-5zM8.5 2h5v0h-5zM10 2h3.5L13.5 2h-3.5z",children:p.jsx("animate",{fill:"freeze",attributeName:"d",dur:"0.4s",keyTimes:"0;0.3;0.5;1",values:` - M8.5 2h2.5L11 2h-2.5zM13 2h2.5L15.5 2h-2.5zM10.5 2h5v0h-5zM8.5 2h5v0h-5zM10 2h3.5L13.5 2h-3.5z; - M8.5 2h2.5L11 22h-2.5zM13 2h2.5L15.5 22h-2.5zM10.5 2h5v2h-5zM8.5 20h5v2h-5zM10 2h3.5L13.5 22h-3.5z; - M8.5 2h2.5L11 22h-2.5zM13 2h2.5L15.5 22h-2.5zM10.5 2h5v2h-5zM8.5 20h5v2h-5zM10 2h3.5L13.5 22h-3.5z; - M1 2h2.5L18.5 22h-2.5zM5.5 2h2.5L23 22h-2.5zM3 2h5v2h-5zM16 20h5v2h-5zM18.5 2h3.5L5 22h-3.5z`})})})}function G4({className:e}){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"512",height:"512",viewBox:"0 0 24 24",className:"h-6 w-6",fill:"currentColor",children:p.jsx("path",{d:"M1 150c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z",children:p.jsx("animate",{fill:"freeze",attributeName:"d",dur:"0.4s",keyTimes:"0;0.3;0.5;1",values:`M4 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z; - M8 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z; - M10 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z; - M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z`})})})}function X4(e){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{color:"#0070f3",strokeWidth:"3",d:"m12 14 4-4"}),p.jsx("defs",{children:p.jsxs("linearGradient",{id:"gradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",style:{stopColor:"rgb(35, 35, 35)",stopOpacity:"1"}}),p.jsx("stop",{offset:"100%",style:{stopColor:"rgb(100,100,100)",stopOpacity:"1"}})]})}),p.jsx("path",{d:"M3.34 19a10 10 0 1 1 17.32 0",stroke:"url(#gradient)",strokeWidth:"3"})]})}function J4(){return p.jsxs("div",{className:"text-white w-full mt-auto flex flex-col items-center justify-between px-5 pt-16 mb-10 md:px-10 mx-auto sm:flex-row",children:[p.jsx(M1,{to:"/",className:"text-xl font-black leading-none select-none logo",children:"VMAIL.DEV"})," ",p.jsxs("p",{className:"mt-4 text-sm text-gray-400 sm:ml-4 sm:pl-4 sm:border-l sm:border-gray-200 sm:mt-0",children:["© 2024 Products of"," ",p.jsx("a",{className:"font-semibold underline hover:text-gray-600",href:"https://www.oiov.dev",target:"_blank",rel:"noopener noreferrer",children:"oiov"}),"."]}),p.jsxs("div",{className:"inline-flex justify-center mt-4 space-x-5 sm:ml-auto sm:mt-0 sm:justify-start",children:[p.jsx("a",{href:"https://wr.do",target:"_blank",rel:"noopener noreferrer",title:"WR.DO",className:"text-gray-400 hover:text-gray-500 scale-[1.2]",children:p.jsx(X4,{className:"w-6 h-6"})}),p.jsx("a",{href:"mailto:hi@oiov.dev",title:"Email",className:"text-gray-400 hover:text-gray-500",children:p.jsx(nw,{className:"w-6 h-6"})}),p.jsx("a",{href:"https://twitter.com/yesmoree",target:"_blank",rel:"noopener noreferrer",title:"Twitter",className:"text-gray-400 hover:text-gray-500",children:p.jsx(Y4,{})}),p.jsx("a",{href:"https://github.com/oiov/vmail",target:"_blank",rel:"noopener noreferrer",title:"Github",className:"text-gray-400 hover:text-gray-500",children:p.jsx(G4,{})})]})]})}function Z4(){return p.jsxs("div",{className:"mx-auto min-h-screen flex flex-col bg-[#1f2023]",children:[p.jsx(Q4,{}),p.jsx(CE,{}),p.jsx(J4,{}),p.jsx(Xk,{position:"bottom-right",toastOptions:{style:{background:"#333",color:"#fff"}}})]})}const eN=new _b;function tN(){const[e,t]=S.useState(null);return S.useEffect(()=>{Se.get("/config").then(n=>{t(n.data)})},[]),e?p.jsx(sw.Provider,{value:e,children:p.jsx(zb,{client:eN,children:p.jsx(DE,{children:p.jsx(kE,{children:p.jsx(ff,{element:p.jsx(Z4,{}),children:p.jsx(ff,{path:"/",element:p.jsx(B4,{})})})})})})}):p.jsx("div",{className:"bg-[#1f2023] text-white w-screen h-screen flex items-center justify-center",children:"Loading..."})}const q=e=>typeof e=="string",fs=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},Yg=e=>e==null?"":""+e,nN=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},rN=/###/g,Gg=e=>e&&e.indexOf("###")>-1?e.replace(rN,"."):e,Xg=e=>!e||q(e),Is=(e,t,n)=>{const r=q(t)?t.split("."):t;let i=0;for(;i{const{obj:r,k:i}=Is(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let s=t[t.length-1],o=t.slice(0,t.length-1),a=Is(e,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=Is(e,o,Object),a&&a.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},iN=(e,t,n,r)=>{const{obj:i,k:s}=Is(e,t,Object);i[s]=i[s]||[],i[s].push(n)},yl=(e,t)=>{const{obj:n,k:r}=Is(e,t);if(n)return n[r]},sN=(e,t,n)=>{const r=yl(e,n);return r!==void 0?r:yl(t,n)},Ix=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?q(e[r])||e[r]instanceof String||q(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Ix(e[r],t[r],n):e[r]=t[r]);return e},qr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var oN={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const aN=e=>q(e)?e.replace(/[&<>"'\/]/g,t=>oN[t]):e;class lN{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const uN=[" ",",","?","!",";"],cN=new lN(20),fN=(e,t,n)=>{t=t||"",n=n||"";const r=uN.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=cN.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(e);if(!s){const o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(s=!0)}return s},If=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let s=0;s-1&&le&&e.replace("_","-"),dN={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class wl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||dN,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{let[a,l]=o;for(let u=0;u{let[a,l]=o;for(let u=0;u1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):q(r)&&s?a.push(...r.split(s)):a.push(r)));const l=yl(this.data,a);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),l||!o||!q(r)?l:If(this.data&&this.data[t]&&this.data[t][n],r,s)}addResource(t,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),Jg(this.data,a,i),s.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(q(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=yl(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?Ix(l,r,s):l={...l,...r},Jg(this.data,a,l),o.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var _x={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(s=>{this.processors[s]&&(t=this.processors[s].process(t,n,r,i))}),t}};const ey={};class xl extends nu{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),nN(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Yt.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!fN(t,r,i);if(o&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:q(s)?[s]:s};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),t=u.join(i)}return{key:t,namespaces:q(s)?[s]:s}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${b}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const f=this.resolve(t,n);let d=f&&f.res;const h=f&&f.usedKey||o,m=f&&f.exactUsedKey||o,w=Object.prototype.toString.apply(d),x=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject,v=!q(d)&&typeof d!="boolean"&&typeof d!="number";if(g&&d&&v&&x.indexOf(w)<0&&!(q(y)&&Array.isArray(d))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,d,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(f.res=b,f.usedParams=this.getUsedParamsDetails(n),f):b}if(s){const b=Array.isArray(d),C=b?[]:{},T=b?m:h;for(const k in d)if(Object.prototype.hasOwnProperty.call(d,k)){const O=`${T}${s}${k}`;C[k]=this.translate(O,{...n,joinArrays:!1,ns:a}),C[k]===O&&(C[k]=d[k])}d=C}}else if(g&&q(y)&&Array.isArray(d))d=d.join(y),d&&(d=this.extendTranslation(d,t,n,r));else{let b=!1,C=!1;const T=n.count!==void 0&&!q(n.count),k=xl.hasDefaultValue(n),O=T?this.pluralResolver.getSuffix(u,n.count,n):"",F=n.ordinal&&T?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",$=T&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),B=$&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${O}`]||n[`defaultValue${F}`]||n.defaultValue;!this.isValidLookup(d)&&k&&(b=!0,d=B),this.isValidLookup(d)||(C=!0,d=o);const me=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:d,J=k&&B!==d&&this.options.updateMissing;if(C||b||J){if(this.logger.log(J?"updateKey":"missingKey",u,l,o,J?B:d),s){const j=this.resolve(o,{...n,keySeparator:!1});j&&j.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const N=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&N&&N[0])for(let j=0;j{const A=k&&D!==d?D:me;this.options.missingKeyHandler?this.options.missingKeyHandler(j,l,M,A,J,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(j,l,M,A,J,n),this.emit("missingKey",j,l,M,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&T?E.forEach(j=>{const M=this.pluralResolver.getSuffixes(j,n);$&&n[`defaultValue${this.options.pluralSeparator}zero`]&&M.indexOf(`${this.options.pluralSeparator}zero`)<0&&M.push(`${this.options.pluralSeparator}zero`),M.forEach(D=>{_([j],o+D,n[`defaultValue${D}`]||B)})}):_(E,o,B))}d=this.extendTranslation(d,t,n,f,r),C&&d===o&&this.options.appendNamespaceToMissingKey&&(d=`${l}:${o}`),(C||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,b?d:void 0):d=this.options.parseMissingKeyHandler(d))}return i?(f.res=d,f.usedParams=this.getUsedParamsDetails(n),f):d}extendTranslation(t,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=q(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const d=t.match(this.interpolator.nestingRegexp);c=d&&d.length}let f=r.replace&&!q(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||i.usedLng,r),u){const d=t.match(this.interpolator.nestingRegexp),h=d&&d.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,a;return q(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=n.count!==void 0&&!q(n.count),h=d&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),m=n.context!==void 0&&(q(n.context)||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(x=>{this.isValidLookup(r)||(a=x,!ey[`${w[0]}-${x}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(ey[`${w[0]}-${x}`]=!0,this.logger.warn(`key "${i}" for languages "${w.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(y=>{if(this.isValidLookup(r))return;o=y;const g=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(g,c,y,x,n);else{let b;d&&(b=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(g.push(c+b),n.ordinal&&b.indexOf(T)===0&&g.push(c+b.replace(T,this.options.pluralSeparator)),h&&g.push(c+C)),m){const k=`${c}${this.options.contextSeparator}${n.context}`;g.push(k),d&&(g.push(k+b),n.ordinal&&b.indexOf(T)===0&&g.push(k+b.replace(T,this.options.pluralSeparator)),h&&g.push(k+C))}}let v;for(;v=g.pop();)this.isValidLookup(r)||(s=v,r=this.getResource(y,x,v,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!q(t.replace);let i=r?t.replace:t;if(r&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const Yu=e=>e.charAt(0).toUpperCase()+e.slice(1);class ty{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Yt.create("languageUtils")}getScriptPartFromCode(t){if(t=vl(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=vl(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(q(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Yu(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Yu(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Yu(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&(s.indexOf("-")>0&&i.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===i||s.indexOf(i)===0&&i.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),q(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return q(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):q(t)&&s(this.formatLanguageCode(t)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let hN=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],pN={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const mN=["v1","v2","v3"],gN=["v4"],ny={zero:0,one:1,two:2,few:3,many:4,other:5},yN=()=>{const e={};return hN.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:pN[t.fc]}})}),e};class vN{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Yt.create("pluralResolver"),(!this.options.compatibilityJSON||gN.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=yN(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=vl(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(l,n)}return this.pluralRulesCache[s]=o,o}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>ny[i]-ny[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!mN.includes(this.options.compatibilityJSON)}}const ry=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=sN(e,t,n);return!s&&i&&q(n)&&(s=If(e,n,r),s===void 0&&(s=If(t,n,r))),s},Gu=e=>e.replace(/\$/g,"$$$$");class wN{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Yt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:m,nestingSuffixEscaped:w,nestingOptionsSeparator:x,maxReplaces:y,alwaysFormat:g}=t.interpolation;this.escape=n!==void 0?n:aN,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?qr(s):o||"{{",this.suffix=a?qr(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?qr(d):h||qr("$t("),this.nestingSuffix=m?qr(m):w||qr(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=y||1e3,this.alwaysFormat=g!==void 0?g:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,i){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=ry(n,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:h}):y}const m=h.split(this.formatSeparator),w=m.shift().trim(),x=m.join(this.formatSeparator).trim();return this.format(ry(n,l,w,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,{...i,...n,interpolationkey:w})};this.resetRegExp();const c=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Gu(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Gu(this.escape(h)):Gu(h)}].forEach(h=>{for(a=0;s=h.regex.exec(t);){const m=s[1].trim();if(o=u(m),o===void 0)if(typeof c=="function"){const x=c(t,s,i);o=q(x)?x:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),o="";else!q(o)&&!this.useRawValueToEscape&&(o=Yg(o));const w=h.safeValue(o);if(t=t.replace(s[0],w),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;const a=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const f=l.split(new RegExp(`${c}[ ]*{`));let d=`{${f[1]}`;l=f[0],d=this.interpolate(d,o);const h=d.match(/'/g),m=d.match(/"/g);(h&&h.length%2===0&&!m||m.length%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),u&&(o={...u,...o})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,w),`${l}${c}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(t);){let l=[];o={...r},o=o.replace&&!q(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=c.shift(),l=c,u=!0}if(s=n(a.call(this,i[1].trim(),o),o),s&&i[0]===t&&!q(s))return s;q(s)||(s=Yg(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),u&&(s=l.reduce((c,f)=>this.format(c,f,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}}const xN=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();n[c]||(n[c]=u),u==="false"&&(n[c]=!1),u==="true"&&(n[c]=!0),isNaN(u)||(n[c]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Qr=e=>{const t={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const o=r+JSON.stringify(s);let a=t[o];return a||(a=e(vl(r),i),t[o]=a),a(n)}};class SN{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Yt.create("formatter"),this.options=t,this.formats={number:Qr((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:Qr((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:Qr((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:Qr((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:Qr((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Qr(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){const a=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,l)=>{const{formatName:u,formatOptions:c}=xN(l);if(this.formats[u]){let f=a;try{const d=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=d.locale||d.lng||i.locale||i.lng||r;f=this.formats[u](a,h,{...c,...i,...d})}catch(d){this.logger.warn(d)}return f}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const bN=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class PN extends nu{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Yt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const s={},o={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(f=>{const d=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,c=!1,o[d]===void 0&&(o[d]=!0),s[d]===void 0&&(s[d]=!0),l[f]===void 0&&(l[f]=!0)))}),c||(a[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(l=>{iN(l.loaded,[s],o),bN(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(f=>{a[u][f]===void 0&&(a[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,s*2,o)},s);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();q(t)&&(t=this.languageUtils.toResolveHierarchy(t)),q(n)&&(n=[n]);const s=this.queueLoad(t,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,a),this.loaded(t,o,a)})}saveMissing(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(f=>a(null,f)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,i,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}const iy=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),q(e[1])&&(t.defaultValue=e[1]),q(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),sy=e=>(q(e.ns)&&(e.ns=[e.ns]),q(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),q(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),aa=()=>{},CN=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class co extends nu{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=sy(t),this.services={},this.logger=Yt,this.modules={external:[]},CN(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(q(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=iy();this.options={...i,...this.options,...sy(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Yt.init(s(this.modules.logger),this.options):Yt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=SN);const f=new ty(this.options);this.store=new Zg(this.options.resources,this.options);const d=this.services;d.logger=Yt,d.resourceStore=this.store,d.languageUtils=f,d.pluralResolver=new vN(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(d.formatter=s(c),d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new wN(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new PN(s(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",function(h){for(var m=arguments.length,w=new Array(m>1?m-1:0),x=1;x1?m-1:0),x=1;x{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=aa),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=fs(),u=()=>{const c=(f,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(d),r(f,d)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:aa;const i=q(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=fs();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=aa),this.services.backendConnector.reload(t,n,s=>{i.resolve(),r(s)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&_x.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=fs();this.emit("languageChanging",t);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=q(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{o(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const s=function(o,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),f=2;f`${l.keyPrefix}${d}${m}`):h=l.keyPrefix?`${l.keyPrefix}${d}${o}`:o,i.t(h,l)};return q(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!i||o(s,t)))}loadNamespaces(t,n){const r=fs();return this.options.ns?(q(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=fs();q(t)&&(t=[t]);const i=this.options.preload||[],s=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new ty(iy());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new co(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:aa;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},s=new co(i);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new Zg(this.store.data,i),s.services.resourceStore=s.store),s.translator=new xl(s.services,i),s.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!oy.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!oy.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},ay={create:function(t,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=DN(t,encodeURIComponent(n),s)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===t.lookupQuerystring&&(n=s[o].substring(a+1))}}}return n}},ds=null,ly=function(){if(ds!==null)return ds;try{ds=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{ds=!1}return ds},FN={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&ly()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&ly()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},hs=null,uy=function(){if(hs!==null)return hs;try{hs=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{hs=!1}return hs},IN={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&uy()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&uy()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},_N={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},VN={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},$N={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},UN={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},$x=!1;try{document.cookie,$x=!0}catch{}var Ux=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];$x||Ux.splice(1,1);function BN(){return{order:Ux,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var Bx=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};EN(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return RN(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=LN(r,this.options||{},BN()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(MN),this.addDetector(AN),this.addDetector(FN),this.addDetector(IN),this.addDetector(_N),this.addDetector(VN),this.addDetector($N),this.addDetector(UN)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(n,i.options)}))}}])}();Bx.type="languageDetector";function _f(e){"@babel/helpers - typeof";return _f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_f(e)}function zx(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":_f(XMLHttpRequest))==="object"}function zN(e){return!!e&&typeof e.then=="function"}function WN(e){return zN(e)?e:Promise.resolve(e)}function HN(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vf={exports:{}},la={exports:{}},cy;function KN(){return cy||(cy=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof bs<"u"&&bs,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(E){return E&&DataView.prototype.isPrototypeOf(E)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(E){return E&&c.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(E)||E==="")throw new TypeError('Invalid character in header field name: "'+E+'"');return E.toLowerCase()}function h(E){return typeof E!="string"&&(E=String(E)),E}function m(E){var N={next:function(){var _=E.shift();return{done:_===void 0,value:_}}};return l.iterable&&(N[Symbol.iterator]=function(){return N}),N}function w(E){this.map={},E instanceof w?E.forEach(function(N,_){this.append(_,N)},this):Array.isArray(E)?E.forEach(function(N){this.append(N[0],N[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(N){this.append(N,E[N])},this)}w.prototype.append=function(E,N){E=d(E),N=h(N);var _=this.map[E];this.map[E]=_?_+", "+N:N},w.prototype.delete=function(E){delete this.map[d(E)]},w.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},w.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},w.prototype.set=function(E,N){this.map[d(E)]=h(N)},w.prototype.forEach=function(E,N){for(var _ in this.map)this.map.hasOwnProperty(_)&&E.call(N,this.map[_],_,this)},w.prototype.keys=function(){var E=[];return this.forEach(function(N,_){E.push(_)}),m(E)},w.prototype.values=function(){var E=[];return this.forEach(function(N){E.push(N)}),m(E)},w.prototype.entries=function(){var E=[];return this.forEach(function(N,_){E.push([_,N])}),m(E)},l.iterable&&(w.prototype[Symbol.iterator]=w.prototype.entries);function x(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function y(E){return new Promise(function(N,_){E.onload=function(){N(E.result)},E.onerror=function(){_(E.error)}})}function g(E){var N=new FileReader,_=y(N);return N.readAsArrayBuffer(E),_}function v(E){var N=new FileReader,_=y(N);return N.readAsText(E),_}function b(E){for(var N=new Uint8Array(E),_=new Array(N.length),j=0;j-1?N:E}function F(E,N){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');N=N||{};var _=N.body;if(E instanceof F){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,N.headers||(this.headers=new w(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!_&&E._bodyInit!=null&&(_=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=N.credentials||this.credentials||"same-origin",(N.headers||!this.headers)&&(this.headers=new w(N.headers)),this.method=O(N.method||this.method||"GET"),this.mode=N.mode||this.mode||null,this.signal=N.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(_),(this.method==="GET"||this.method==="HEAD")&&(N.cache==="no-store"||N.cache==="no-cache")){var j=/([?&])_=[^&]*/;if(j.test(this.url))this.url=this.url.replace(j,"$1_="+new Date().getTime());else{var M=/\?/;this.url+=(M.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}F.prototype.clone=function(){return new F(this,{body:this._bodyInit})};function $(E){var N=new FormData;return E.trim().split("&").forEach(function(_){if(_){var j=_.split("="),M=j.shift().replace(/\+/g," "),D=j.join("=").replace(/\+/g," ");N.append(decodeURIComponent(M),decodeURIComponent(D))}}),N}function B(E){var N=new w,_=E.replace(/\r?\n[\t ]+/g," ");return _.split("\r").map(function(j){return j.indexOf(` -`)===0?j.substr(1,j.length):j}).forEach(function(j){var M=j.split(":"),D=M.shift().trim();if(D){var A=M.join(":").trim();N.append(D,A)}}),N}T.call(F.prototype);function X(E,N){if(!(this instanceof X))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');N||(N={}),this.type="default",this.status=N.status===void 0?200:N.status,this.ok=this.status>=200&&this.status<300,this.statusText=N.statusText===void 0?"":""+N.statusText,this.headers=new w(N.headers),this.url=N.url||"",this._initBody(E)}T.call(X.prototype),X.prototype.clone=function(){return new X(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new w(this.headers),url:this.url})},X.error=function(){var E=new X(null,{status:0,statusText:""});return E.type="error",E};var me=[301,302,303,307,308];X.redirect=function(E,N){if(me.indexOf(N)===-1)throw new RangeError("Invalid status code");return new X(null,{status:N,headers:{location:E}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(N,_){this.message=N,this.name=_;var j=Error(N);this.stack=j.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function J(E,N){return new Promise(function(_,j){var M=new F(E,N);if(M.signal&&M.signal.aborted)return j(new o.DOMException("Aborted","AbortError"));var D=new XMLHttpRequest;function A(){D.abort()}D.onload=function(){var K={status:D.status,statusText:D.statusText,headers:B(D.getAllResponseHeaders()||"")};K.url="responseURL"in D?D.responseURL:K.headers.get("X-Request-URL");var ve="response"in D?D.response:D.responseText;setTimeout(function(){_(new X(ve,K))},0)},D.onerror=function(){setTimeout(function(){j(new TypeError("Network request failed"))},0)},D.ontimeout=function(){setTimeout(function(){j(new TypeError("Network request failed"))},0)},D.onabort=function(){setTimeout(function(){j(new o.DOMException("Aborted","AbortError"))},0)};function U(K){try{return K===""&&a.location.href?a.location.href:K}catch{return K}}D.open(M.method,U(M.url),!0),M.credentials==="include"?D.withCredentials=!0:M.credentials==="omit"&&(D.withCredentials=!1),"responseType"in D&&(l.blob?D.responseType="blob":l.arrayBuffer&&M.headers.get("Content-Type")&&M.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(D.responseType="arraybuffer")),N&&typeof N.headers=="object"&&!(N.headers instanceof w)?Object.getOwnPropertyNames(N.headers).forEach(function(K){D.setRequestHeader(K,h(N.headers[K]))}):M.headers.forEach(function(K,ve){D.setRequestHeader(ve,K)}),M.signal&&(M.signal.addEventListener("abort",A),D.onreadystatechange=function(){D.readyState===4&&M.signal.removeEventListener("abort",A)}),D.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return J.polyfill=!0,a.fetch||(a.fetch=J,a.Headers=w,a.Request=F,a.Response=X),o.Headers=w,o.Request=F,o.Response=X,o.fetch=J,o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(la,la.exports)),la.exports}(function(e,t){var n=typeof fetch=="function"?fetch:void 0;if(typeof bs<"u"&&bs.fetch?n=bs.fetch:typeof window<"u"&&window.fetch&&(n=window.fetch),typeof HN<"u"&&typeof window>"u"){var r=n||KN();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Vf,Vf.exports);var Wx=Vf.exports;const Hx=Oy(Wx),fy=Ty({__proto__:null,default:Hx},[Wx]);function dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hy(e){for(var t=1;t"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(s["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(s["Content-Type"]="application/json");var o=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=hy({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:s},my?{}:o),l=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{py(n,a,i,l)}catch(u){if(!o||Object.keys(o).length===0||!u.message||u.message.indexOf("not implemented")<0)return i(u);try{Object.keys(o).forEach(function(c){delete a[c]}),py(n,a,i,l),my=!0}catch(c){i(c)}}},XN=function(t,n,r,i){r&&Vr(r)==="object"&&(r=$f("",r).slice(1)),t.queryStringParams&&(n=$f(n,t.queryStringParams));try{var s;ho?s=new ho:s=new Sl("MSXML2.XMLHTTP.3.0"),s.open(r?"POST":"GET",n,1),t.crossDomain||s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.withCredentials=!!t.withCredentials,r&&s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.overrideMimeType&&s.overrideMimeType("application/json");var o=t.customHeaders;if(o=typeof o=="function"?o():o,o)for(var a in o)s.setRequestHeader(a,o[a]);s.onreadystatechange=function(){s.readyState>3&&i(s.status>=400?s.statusText:null,{status:s.status,data:s.responseText})},s.send(r)}catch(l){console&&console.log(l)}},JN=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Zn&&n.indexOf("file:")!==0)return GN(t,n,r,i);if(zx()||typeof ActiveXObject=="function")return XN(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Hi(e){"@babel/helpers - typeof";return Hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hi(e)}function gy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ZN(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return tL(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Xu(Xu(Xu({},rL()),this.options||{}),i),this.allOptions=s,this.services&&this.options.reloadInterval){var o=setInterval(function(){return r.reload()},this.options.reloadInterval);Hi(o)==="object"&&typeof o.unref=="function"&&o.unref()}}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,s,o){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=WN(l),l.then(function(u){if(!u)return o(null,{});var c=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});a.loadUrl(c,o,r,s)})}},{key:"loadUrl",value:function(n,r,i,s){var o=this,a=typeof i=="string"?[i]:i,l=typeof s=="string"?[s]:s,u=this.options.parseLoadPayload(a,l);this.options.request(this.options,n,u,function(c,f){if(f&&(f.status>=500&&f.status<600||!f.status))return r("failed loading "+n+"; status code: "+f.status,!0);if(f&&f.status>=400&&f.status<500)return r("failed loading "+n+"; status code: "+f.status,!1);if(!f&&c&&c.message){var d=c.message.toLowerCase(),h=["failed","fetch","network","load"].find(function(x){return d.indexOf(x)>-1});if(h)return r("failed loading "+n+": "+c.message,!0)}if(c)return r(c,!1);var m,w;try{typeof f.data=="string"?m=o.options.parse(f.data,i,s):m=f.data}catch{w="failed parsing "+n+" to json"}if(w)return r(w,!1);r(null,m)})}},{key:"create",value:function(n,r,i,s,o){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,s),u=0,c=[],f=[];n.forEach(function(d){var h=a.options.addPath;typeof a.options.addPath=="function"&&(h=a.options.addPath(d,r));var m=a.services.interpolator.interpolate(h,{lng:d,ns:r});a.options.request(a.options,m,l,function(w,x){u+=1,c.push(w),f.push(x),u===n.length&&typeof o=="function"&&o(c,f)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,s=r.languageUtils,o=r.logger,a=i.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(f){var d=s.toResolveHierarchy(f);d.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(f){i.read(c,f,"read",null,null,function(d,h){d&&o.warn("loading namespace ".concat(f," for language ").concat(c," failed"),d),!d&&h&&o.log("loaded namespace ".concat(f," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(f),d,h)})})})}}}])}();Qx.type="backend";ze.use(Qx).use(Bx).use(ik).init({debug:!0,fallbackLng:"en",ns:["common"],defaultNS:"common",supportedLngs:["en","zh","fr","ja","hi","de","ko","zh-TW","it","pt","tr","ru"],backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["cookie","localStorage","htmlTag","path","subdomain"],caches:["cookie","localStorage"]}});Zu.createRoot(document.getElementById("root")).render(p.jsx(Ju.StrictMode,{children:p.jsx(Ju.Suspense,{fallback:"loading...",children:p.jsx(tN,{})})})); diff --git a/frontend/build/client/assets/main-MaFOzO4x.js b/frontend/build/client/assets/main-MaFOzO4x.js new file mode 100644 index 0000000..54bf812 --- /dev/null +++ b/frontend/build/client/assets/main-MaFOzO4x.js @@ -0,0 +1,341 @@ +var Yw=Object.defineProperty;var Ah=e=>{throw TypeError(e)};var Xw=(e,t,n)=>t in e?Yw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Lh=(e,t,n)=>Xw(e,typeof t!="symbol"?t+"":t,n),su=(e,t,n)=>t.has(e)||Ah("Cannot "+n);var P=(e,t,n)=>(su(e,t,"read from private field"),n?n.call(e):t.get(e)),z=(e,t,n)=>t.has(e)?Ah("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),I=(e,t,n,r)=>(su(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Q=(e,t,n)=>(su(e,t,"access private method"),n);var Mo=(e,t,n,r)=>({set _(s){I(e,t,s,n)},get _(){return P(e,t,r)}});function Ny(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Si=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ry={exports:{}},Pl={},Ay={exports:{}},X={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xo=Symbol.for("react.element"),Jw=Symbol.for("react.portal"),Zw=Symbol.for("react.fragment"),e2=Symbol.for("react.strict_mode"),t2=Symbol.for("react.profiler"),n2=Symbol.for("react.provider"),r2=Symbol.for("react.context"),s2=Symbol.for("react.forward_ref"),i2=Symbol.for("react.suspense"),o2=Symbol.for("react.memo"),a2=Symbol.for("react.lazy"),Dh=Symbol.iterator;function l2(e){return e===null||typeof e!="object"?null:(e=Dh&&e[Dh]||e["@@iterator"],typeof e=="function"?e:null)}var Ly={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dy=Object.assign,My={};function Ks(e,t,n){this.props=e,this.context=t,this.refs=My,this.updater=n||Ly}Ks.prototype.isReactComponent={};Ks.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ks.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fy(){}Fy.prototype=Ks.prototype;function $d(e,t,n){this.props=e,this.context=t,this.refs=My,this.updater=n||Ly}var Bd=$d.prototype=new Fy;Bd.constructor=$d;Dy(Bd,Ks.prototype);Bd.isPureReactComponent=!0;var Mh=Array.isArray,Iy=Object.prototype.hasOwnProperty,zd={current:null},_y={key:!0,ref:!0,__self:!0,__source:!0};function Vy(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Iy.call(t,r)&&!_y.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1>>1,$=O[M];if(0>>1;Ms(pt,L))W<$&&0>s(Re,pt)?(O[M]=Re,O[W]=L,M=W):(O[M]=pt,O[ve]=L,M=ve);else if(W<$&&0>s(Re,L))O[M]=Re,O[W]=L,M=W;else break e}}return D}function s(O,D){var L=O.sortIndex-D.sortIndex;return L!==0?L:O.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,d=null,f=3,p=!1,m=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(O){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=O)r(u),D.sortIndex=D.expirationTime,t(l,D);else break;D=n(u)}}function S(O){if(x=!1,v(O),!m)if(n(l)!==null)m=!0,R(C);else{var D=n(u);D!==null&&_(S,D.startTime-O)}}function C(O,D){m=!1,x&&(x=!1,y(j),j=-1),p=!0;var L=f;try{for(v(D),d=n(l);d!==null&&(!(d.expirationTime>D)||O&&!B());){var M=d.callback;if(typeof M=="function"){d.callback=null,f=d.priorityLevel;var $=M(d.expirationTime<=D);D=e.unstable_now(),typeof $=="function"?d.callback=$:d===n(l)&&r(l),v(D)}else r(l);d=n(l)}if(d!==null)var K=!0;else{var ve=n(u);ve!==null&&_(S,ve.startTime-D),K=!1}return K}finally{d=null,f=L,p=!1}}var T=!1,E=null,j=-1,F=5,U=-1;function B(){return!(e.unstable_now()-UO||125M?(O.sortIndex=L,t(u,O),n(l)===null&&O===n(u)&&(x?(y(j),j=-1):x=!0,_(S,L-M))):(O.sortIndex=$,t(l,O),m||p||(m=!0,R(C))),O},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(O){var D=f;return function(){var L=f;f=D;try{return O.apply(this,arguments)}finally{f=L}}}})(zy);By.exports=zy;var w2=By.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Wy=b,ct=w2;function A(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tc=Object.prototype.hasOwnProperty,b2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ih={},_h={};function S2(e){return tc.call(_h,e)?!0:tc.call(Ih,e)?!1:b2.test(e)?_h[e]=!0:(Ih[e]=!0,!1)}function P2(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function C2(e,t,n,r){if(t===null||typeof t>"u"||P2(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ge(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Me[e]=new Ge(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Me[t]=new Ge(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Me[e]=new Ge(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Me[e]=new Ge(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Me[e]=new Ge(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Me[e]=new Ge(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Me[e]=new Ge(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Me[e]=new Ge(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Me[e]=new Ge(e,5,!1,e.toLowerCase(),null,!1,!1)});var Hd=/[\-:]([a-z])/g;function Kd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Hd,Kd);Me[t]=new Ge(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Hd,Kd);Me[t]=new Ge(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Hd,Kd);Me[t]=new Ge(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Me[e]=new Ge(e,1,!1,e.toLowerCase(),null,!1,!1)});Me.xlinkHref=new Ge("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Me[e]=new Ge(e,1,!1,e.toLowerCase(),null,!0,!0)});function qd(e,t,n,r){var s=Me.hasOwnProperty(t)?Me[t]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var l=` +`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{au=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?pi(e):""}function k2(e){switch(e.tag){case 5:return pi(e.type);case 16:return pi("Lazy");case 13:return pi("Suspense");case 19:return pi("SuspenseList");case 0:case 2:case 15:return e=lu(e.type,!1),e;case 11:return e=lu(e.type.render,!1),e;case 1:return e=lu(e.type,!0),e;default:return""}}function ic(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Yr:return"Fragment";case Gr:return"Portal";case nc:return"Profiler";case Qd:return"StrictMode";case rc:return"Suspense";case sc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case qy:return(e.displayName||"Context")+".Consumer";case Ky:return(e._context.displayName||"Context")+".Provider";case Gd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Yd:return t=e.displayName||null,t!==null?t:ic(e.type)||"Memo";case Cn:t=e._payload,e=e._init;try{return ic(e(t))}catch{}}return null}function E2(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ic(t);case 8:return t===Qd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Gn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function T2(e){var t=Gy(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _o(e){e._valueTracker||(e._valueTracker=T2(e))}function Yy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Gy(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function La(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function oc(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Uh(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xy(e,t){t=t.checked,t!=null&&qd(e,"checked",t,!1)}function ac(e,t){Xy(e,t);var n=Gn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?lc(e,t.type,n):t.hasOwnProperty("defaultValue")&&lc(e,t.type,Gn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $h(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function lc(e,t,n){(t!=="number"||La(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var mi=Array.isArray;function fs(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Vo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},j2=["Webkit","ms","Moz","O"];Object.keys(Pi).forEach(function(e){j2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pi[t]=Pi[e]})});function t0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Pi.hasOwnProperty(e)&&Pi[e]?(""+t).trim():t+"px"}function n0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=t0(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var N2=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function dc(e,t){if(t){if(N2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function fc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hc=null;function Xd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pc=null,hs=null,ps=null;function Wh(e){if(e=So(e)){if(typeof pc!="function")throw Error(A(280));var t=e.stateNode;t&&(t=jl(t),pc(e.stateNode,e.type,t))}}function r0(e){hs?ps?ps.push(e):ps=[e]:hs=e}function s0(){if(hs){var e=hs,t=ps;if(ps=hs=null,Wh(e),t)for(e=0;e>>=0,e===0?32:31-(U2(e)/$2|0)|0}var Uo=64,$o=4194304;function gi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ia(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=gi(a):(i&=o,i!==0&&(r=gi(i)))}else o=n&~s,o!==0?r=gi(o):i!==0&&(r=gi(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function wo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-At(t),e[t]=n}function H2(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ki),Zh=" ",ep=!1;function C0(e,t){switch(e){case"keyup":return xb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function k0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xr=!1;function bb(e,t){switch(e){case"compositionend":return k0(t);case"keypress":return t.which!==32?null:(ep=!0,Zh);case"textInput":return e=t.data,e===Zh&&ep?null:e;default:return null}}function Sb(e,t){if(Xr)return e==="compositionend"||!of&&C0(e,t)?(e=S0(),fa=nf=In=null,Xr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=sp(n)}}function N0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?N0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function O0(){for(var e=window,t=La();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=La(e.document)}return t}function af(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Rb(e){var t=O0(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&N0(n.ownerDocument.documentElement,n)){if(r!==null&&af(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=ip(n,i);var o=ip(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jr=null,wc=null,Ti=null,bc=!1;function op(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bc||Jr==null||Jr!==La(r)||(r=Jr,"selectionStart"in r&&af(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ti&&Hi(Ti,r)||(Ti=r,r=Ua(wc,"onSelect"),0ts||(e.current=Tc[ts],Tc[ts]=null,ts--)}function se(e,t){ts++,Tc[ts]=e.current,e.current=t}var Yn={},Be=tr(Yn),Ze=tr(!1),Rr=Yn;function Ds(e,t){var n=e.type.contextTypes;if(!n)return Yn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function et(e){return e=e.childContextTypes,e!=null}function Ba(){le(Ze),le(Be)}function hp(e,t,n){if(Be.current!==Yn)throw Error(A(168));se(Be,t),se(Ze,n)}function V0(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(A(108,E2(e)||"Unknown",s));return pe({},n,r)}function za(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yn,Rr=Be.current,se(Be,e),se(Ze,Ze.current),!0}function pp(e,t,n){var r=e.stateNode;if(!r)throw Error(A(169));n?(e=V0(e,t,Rr),r.__reactInternalMemoizedMergedChildContext=e,le(Ze),le(Be),se(Be,e)):le(Ze),se(Ze,n)}var rn=null,Nl=!1,Su=!1;function U0(e){rn===null?rn=[e]:rn.push(e)}function zb(e){Nl=!0,U0(e)}function nr(){if(!Su&&rn!==null){Su=!0;var e=0,t=re;try{var n=rn;for(re=1;e>=o,s-=o,an=1<<32-At(t)+s|n<j?(F=E,E=null):F=E.sibling;var U=f(y,E,v[j],S);if(U===null){E===null&&(E=F);break}e&&E&&U.alternate===null&&t(y,E),g=i(U,g,j),T===null?C=U:T.sibling=U,T=U,E=F}if(j===v.length)return n(y,E),ce&&ur(y,j),C;if(E===null){for(;jj?(F=E,E=null):F=E.sibling;var B=f(y,E,U.value,S);if(B===null){E===null&&(E=F);break}e&&E&&B.alternate===null&&t(y,E),g=i(B,g,j),T===null?C=B:T.sibling=B,T=B,E=F}if(U.done)return n(y,E),ce&&ur(y,j),C;if(E===null){for(;!U.done;j++,U=v.next())U=d(y,U.value,S),U!==null&&(g=i(U,g,j),T===null?C=U:T.sibling=U,T=U);return ce&&ur(y,j),C}for(E=r(y,E);!U.done;j++,U=v.next())U=p(E,y,j,U.value,S),U!==null&&(e&&U.alternate!==null&&E.delete(U.key===null?j:U.key),g=i(U,g,j),T===null?C=U:T.sibling=U,T=U);return e&&E.forEach(function(J){return t(y,J)}),ce&&ur(y,j),C}function w(y,g,v,S){if(typeof v=="object"&&v!==null&&v.type===Yr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Io:e:{for(var C=v.key,T=g;T!==null;){if(T.key===C){if(C=v.type,C===Yr){if(T.tag===7){n(y,T.sibling),g=s(T,v.props.children),g.return=y,y=g;break e}}else if(T.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Cn&&bp(C)===T.type){n(y,T.sibling),g=s(T,v.props),g.ref=oi(y,T,v),g.return=y,y=g;break e}n(y,T);break}else t(y,T);T=T.sibling}v.type===Yr?(g=Tr(v.props.children,y.mode,S,v.key),g.return=y,y=g):(S=wa(v.type,v.key,v.props,null,y.mode,S),S.ref=oi(y,g,v),S.return=y,y=S)}return o(y);case Gr:e:{for(T=v.key;g!==null;){if(g.key===T)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(y,g.sibling),g=s(g,v.children||[]),g.return=y,y=g;break e}else{n(y,g);break}else t(y,g);g=g.sibling}g=Ou(v,y.mode,S),g.return=y,y=g}return o(y);case Cn:return T=v._init,w(y,g,T(v._payload),S)}if(mi(v))return m(y,g,v,S);if(ti(v))return x(y,g,v,S);Qo(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(y,g.sibling),g=s(g,v),g.return=y,y=g):(n(y,g),g=Nu(v,y.mode,S),g.return=y,y=g),o(y)):n(y,g)}return w}var Fs=Q0(!0),G0=Q0(!1),Po={},Xt=tr(Po),Gi=tr(Po),Yi=tr(Po);function gr(e){if(e===Po)throw Error(A(174));return e}function gf(e,t){switch(se(Yi,t),se(Gi,e),se(Xt,Po),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:cc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=cc(t,e)}le(Xt),se(Xt,t)}function Is(){le(Xt),le(Gi),le(Yi)}function Y0(e){gr(Yi.current);var t=gr(Xt.current),n=cc(t,e.type);t!==n&&(se(Gi,e),se(Xt,n))}function yf(e){Gi.current===e&&(le(Xt),le(Gi))}var de=tr(0);function Ga(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Pu=[];function vf(){for(var e=0;en?n:4,e(!0);var r=Cu.transition;Cu.transition={};try{e(!1),t()}finally{re=n,Cu.transition=r}}function fv(){return Et().memoizedState}function qb(e,t,n){var r=Kn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hv(e))pv(t,n);else if(n=W0(e,t,n,r),n!==null){var s=qe();Lt(n,e,r,s),mv(n,t,r)}}function Qb(e,t,n){var r=Kn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hv(e))pv(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Dt(a,o)){var l=t.interleaved;l===null?(s.next=s,pf(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=W0(e,t,s,r),n!==null&&(s=qe(),Lt(n,e,r,s),mv(n,t,r))}}function hv(e){var t=e.alternate;return e===he||t!==null&&t===he}function pv(e,t){ji=Ya=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function mv(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zd(e,n)}}var Xa={readContext:kt,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useInsertionEffect:Fe,useLayoutEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useMutableSource:Fe,useSyncExternalStore:Fe,useId:Fe,unstable_isNewReconciler:!1},Gb={readContext:kt,useCallback:function(e,t){return Ut().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:Pp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ga(4194308,4,av.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ga(4194308,4,e,t)},useInsertionEffect:function(e,t){return ga(4,2,e,t)},useMemo:function(e,t){var n=Ut();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ut();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=qb.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=Ut();return e={current:e},t.memoizedState=e},useState:Sp,useDebugValue:Pf,useDeferredValue:function(e){return Ut().memoizedState=e},useTransition:function(){var e=Sp(!1),t=e[0];return e=Kb.bind(null,e[1]),Ut().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=he,s=Ut();if(ce){if(n===void 0)throw Error(A(407));n=n()}else{if(n=t(),Oe===null)throw Error(A(349));Lr&30||Z0(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Pp(tv.bind(null,r,i,e),[e]),r.flags|=2048,Zi(9,ev.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ut(),t=Oe.identifierPrefix;if(ce){var n=ln,r=an;n=(r&~(1<<32-At(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xi++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ht]=t,e[Qi]=r,Cv(e,t,!1,!1),t.stateNode=e;e:{switch(o=fc(n,r),n){case"dialog":oe("cancel",e),oe("close",e),s=r;break;case"iframe":case"object":case"embed":oe("load",e),s=r;break;case"video":case"audio":for(s=0;sVs&&(t.flags|=128,r=!0,ai(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ga(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ai(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ce)return Ie(t),null}else 2*we()-i.renderingStartTime>Vs&&n!==1073741824&&(t.flags|=128,r=!0,ai(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=we(),t.sibling=null,n=de.current,se(de,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Nf(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ot&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function rS(e,t){switch(uf(t),t.tag){case 1:return et(t.type)&&Ba(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Is(),le(Ze),le(Be),vf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return yf(t),null;case 13:if(le(de),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));Ms()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(de),null;case 4:return Is(),null;case 10:return hf(t.type._context),null;case 22:case 23:return Nf(),null;case 24:return null;default:return null}}var Yo=!1,Ve=!1,sS=typeof WeakSet=="function"?WeakSet:Set,V=null;function is(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function Vc(e,t,n){try{n()}catch(r){ye(e,t,r)}}var Ap=!1;function iS(e,t){if(Sc=_a,e=O0(),af(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==n||s!==0&&d.nodeType!==3||(a=o+s),d!==i||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++u===s&&(a=o),f===i&&++c===r&&(l=o),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pc={focusedElem:e,selectionRange:n},_a=!1,V=t;V!==null;)if(t=V,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,V=e;else for(;V!==null;){t=V;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,w=m.memoizedState,y=t.stateNode,g=y.getSnapshotBeforeUpdate(t.elementType===t.type?x:Nt(t.type,x),w);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(S){ye(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return m=Ap,Ap=!1,m}function Ni(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Vc(t,n,i)}s=s.next}while(s!==r)}}function Al(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Uc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Tv(e){var t=e.alternate;t!==null&&(e.alternate=null,Tv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ht],delete t[Qi],delete t[Ec],delete t[$b],delete t[Bb])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function jv(e){return e.tag===5||e.tag===3||e.tag===4}function Lp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$a));else if(r!==4&&(e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function Bc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Bc(e,t,n),e=e.sibling;e!==null;)Bc(e,t,n),e=e.sibling}var Ae=null,Ot=!1;function wn(e,t,n){for(n=n.child;n!==null;)Nv(e,t,n),n=n.sibling}function Nv(e,t,n){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Cl,n)}catch{}switch(n.tag){case 5:Ve||is(n,t);case 6:var r=Ae,s=Ot;Ae=null,wn(e,t,n),Ae=r,Ot=s,Ae!==null&&(Ot?(e=Ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ae.removeChild(n.stateNode));break;case 18:Ae!==null&&(Ot?(e=Ae,n=n.stateNode,e.nodeType===8?bu(e.parentNode,n):e.nodeType===1&&bu(e,n),zi(e)):bu(Ae,n.stateNode));break;case 4:r=Ae,s=Ot,Ae=n.stateNode.containerInfo,Ot=!0,wn(e,t,n),Ae=r,Ot=s;break;case 0:case 11:case 14:case 15:if(!Ve&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Vc(n,t,o),s=s.next}while(s!==r)}wn(e,t,n);break;case 1:if(!Ve&&(is(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ye(n,t,a)}wn(e,t,n);break;case 21:wn(e,t,n);break;case 22:n.mode&1?(Ve=(r=Ve)||n.memoizedState!==null,wn(e,t,n),Ve=r):wn(e,t,n);break;default:wn(e,t,n)}}function Dp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new sS),t.forEach(function(r){var s=pS.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Tt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=we()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*aS(r/1960))-r,10e?16:e,_n===null)var r=!1;else{if(e=_n,_n=null,el=0,ee&6)throw Error(A(331));var s=ee;for(ee|=4,V=e.current;V!==null;){var i=V,o=i.child;if(V.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lwe()-Tf?Er(e,0):Ef|=n),tt(e,t)}function Iv(e,t){t===0&&(e.mode&1?(t=$o,$o<<=1,!($o&130023424)&&($o=4194304)):t=1);var n=qe();e=mn(e,t),e!==null&&(wo(e,t,n),tt(e,n))}function hS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Iv(e,n)}function pS(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(A(314))}r!==null&&r.delete(t),Iv(e,n)}var _v;_v=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ze.current)Je=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Je=!1,tS(e,t,n);Je=!!(e.flags&131072)}else Je=!1,ce&&t.flags&1048576&&$0(t,Ha,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ya(e,t),e=t.pendingProps;var s=Ds(t,Be.current);gs(t,n),s=wf(null,t,r,e,s,n);var i=bf();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,et(r)?(i=!0,za(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,mf(t),s.updater=Ol,t.stateNode=s,s._reactInternals=t,Ac(t,r,e,n),t=Mc(null,t,r,!0,i,n)):(t.tag=0,ce&&i&&lf(t),He(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ya(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=gS(r),e=Nt(r,e),s){case 0:t=Dc(null,t,r,e,n);break e;case 1:t=Np(null,t,r,e,n);break e;case 11:t=Tp(null,t,r,e,n);break e;case 14:t=jp(null,t,r,Nt(r.type,e),n);break e}throw Error(A(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Nt(r,s),Dc(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Nt(r,s),Np(e,t,r,s,n);case 3:e:{if(bv(t),e===null)throw Error(A(387));r=t.pendingProps,i=t.memoizedState,s=i.element,H0(e,t),Qa(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=_s(Error(A(423)),t),t=Op(e,t,r,n,s);break e}else if(r!==s){s=_s(Error(A(424)),t),t=Op(e,t,r,n,s);break e}else for(at=zn(t.stateNode.containerInfo.firstChild),lt=t,ce=!0,Rt=null,n=G0(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ms(),r===s){t=gn(e,t,n);break e}He(e,t,r,n)}t=t.child}return t;case 5:return Y0(t),e===null&&Nc(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Cc(r,s)?o=null:i!==null&&Cc(r,i)&&(t.flags|=32),wv(e,t),He(e,t,o,n),t.child;case 6:return e===null&&Nc(t),null;case 13:return Sv(e,t,n);case 4:return gf(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fs(t,null,r,n):He(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Nt(r,s),Tp(e,t,r,s,n);case 7:return He(e,t,t.pendingProps,n),t.child;case 8:return He(e,t,t.pendingProps.children,n),t.child;case 12:return He(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,se(Ka,r._currentValue),r._currentValue=o,i!==null)if(Dt(i.value,o)){if(i.children===s.children&&!Ze.current){t=gn(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=un(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Oc(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(A(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Oc(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}He(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,gs(t,n),s=kt(s),r=r(s),t.flags|=1,He(e,t,r,n),t.child;case 14:return r=t.type,s=Nt(r,t.pendingProps),s=Nt(r.type,s),jp(e,t,r,s,n);case 15:return vv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Nt(r,s),ya(e,t),t.tag=1,et(r)?(e=!0,za(t)):e=!1,gs(t,n),q0(t,r,s),Ac(t,r,s,n),Mc(null,t,r,!0,e,n);case 19:return Pv(e,t,n);case 22:return xv(e,t,n)}throw Error(A(156,t.tag))};function Vv(e,t){return d0(e,t)}function mS(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,n,r){return new mS(e,t,n,r)}function Rf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gS(e){if(typeof e=="function")return Rf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Gd)return 11;if(e===Yd)return 14}return 2}function qn(e,t){var n=e.alternate;return n===null?(n=Pt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function wa(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")Rf(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Yr:return Tr(n.children,s,i,t);case Qd:o=8,s|=8;break;case nc:return e=Pt(12,n,t,s|2),e.elementType=nc,e.lanes=i,e;case rc:return e=Pt(13,n,t,s),e.elementType=rc,e.lanes=i,e;case sc:return e=Pt(19,n,t,s),e.elementType=sc,e.lanes=i,e;case Qy:return Dl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ky:o=10;break e;case qy:o=9;break e;case Gd:o=11;break e;case Yd:o=14;break e;case Cn:o=16,r=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=Pt(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Tr(e,t,n,r){return e=Pt(7,e,r,t),e.lanes=n,e}function Dl(e,t,n,r){return e=Pt(22,e,r,t),e.elementType=Qy,e.lanes=n,e.stateNode={isHidden:!1},e}function Nu(e,t,n){return e=Pt(6,e,null,t),e.lanes=n,e}function Ou(e,t,n){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function yS(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cu(0),this.expirationTimes=cu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cu(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Af(e,t,n,r,s,i,o,a,l){return e=new yS(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},mf(i),e}function vS(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(zv)}catch(e){console.error(e)}}zv(),$y.exports=ft;var PS=$y.exports,Bp=PS;ec.createRoot=Bp.createRoot,ec.hydrateRoot=Bp.hydrateRoot;var Gs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Us=typeof window>"u"||"Deno"in window;function wt(){}function CS(e,t){return typeof e=="function"?e(t):e}function qc(e){return typeof e=="number"&&e>=0&&e!==1/0}function Wv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zp(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Ff(o,t.options))return!1}else if(!to(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||typeof s<"u"&&s!==t.state.fetchStatus||i&&!i(t))}function Wp(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Fr(t.options.mutationKey)!==Fr(i))return!1}else if(!to(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Ff(e,t){return((t==null?void 0:t.queryKeyHashFn)||Fr)(e)}function Fr(e){return JSON.stringify(e,(t,n)=>Qc(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function to(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!to(e[n],t[n])):!1}function Hv(e,t){if(e===t)return e;const n=Hp(e)&&Hp(t);if(n||Qc(e)&&Qc(t)){const r=n?e.length:Object.keys(e).length,s=n?t:Object.keys(t),i=s.length,o=n?[]:{};let a=0;for(let l=0;l"u")return!0;const n=t.prototype;return!(!Kp(n)||!n.hasOwnProperty("isPrototypeOf"))}function Kp(e){return Object.prototype.toString.call(e)==="[object Object]"}function kS(e){return new Promise(t=>{setTimeout(t,e)})}function Gc(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Hv(e,t):t}function ES(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function TS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var xr,Nn,xs,xy,jS=(xy=class extends Gs{constructor(){super();z(this,xr);z(this,Nn);z(this,xs);I(this,xs,t=>{if(!Us&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,Nn)||this.setEventListener(P(this,xs))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Nn))==null||t.call(this),I(this,Nn,void 0))}setEventListener(t){var n;I(this,xs,t),(n=P(this,Nn))==null||n.call(this),I(this,Nn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,xr)!==t&&(I(this,xr,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof P(this,xr)=="boolean"?P(this,xr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},xr=new WeakMap,Nn=new WeakMap,xs=new WeakMap,xy),sl=new jS,ws,On,bs,wy,NS=(wy=class extends Gs{constructor(){super();z(this,ws,!0);z(this,On);z(this,bs);I(this,bs,t=>{if(!Us&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,On)||this.setEventListener(P(this,bs))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,On))==null||t.call(this),I(this,On,void 0))}setEventListener(t){var n;I(this,bs,t),(n=P(this,On))==null||n.call(this),I(this,On,t(this.setOnline.bind(this)))}setOnline(t){P(this,ws)!==t&&(I(this,ws,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,ws)}},ws=new WeakMap,On=new WeakMap,bs=new WeakMap,wy),il=new NS;function OS(e){return Math.min(1e3*2**e,3e4)}function Vl(e){return(e??"online")==="online"?il.isOnline():!0}var Kv=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ru(e){return e instanceof Kv}function qv(e){let t=!1,n=0,r=!1,s,i,o;const a=new Promise((w,y)=>{i=w,o=y}),l=w=>{var y;r||(p(new Kv(w)),(y=e.abort)==null||y.call(e))},u=()=>{t=!0},c=()=>{t=!1},d=()=>!sl.isFocused()||e.networkMode!=="always"&&!il.isOnline(),f=w=>{var y;r||(r=!0,(y=e.onSuccess)==null||y.call(e,w),s==null||s(),i(w))},p=w=>{var y;r||(r=!0,(y=e.onError)==null||y.call(e,w),s==null||s(),o(w))},m=()=>new Promise(w=>{var y;s=g=>{const v=r||!d();return v&&w(g),v},(y=e.onPause)==null||y.call(e)}).then(()=>{var w;s=void 0,r||(w=e.onContinue)==null||w.call(e)}),x=()=>{if(r)return;let w;try{w=e.fn()}catch(y){w=Promise.reject(y)}Promise.resolve(w).then(f).catch(y=>{var T;if(r)return;const g=e.retry??(Us?0:3),v=e.retryDelay??OS,S=typeof v=="function"?v(n,y):v,C=g===!0||typeof g=="number"&&n{if(d())return m()}).then(()=>{t?p(y):x()})})};return Vl(e.networkMode)?x():m().then(x),{promise:a,cancel:l,continue:()=>(s==null?void 0:s())?a:Promise.resolve(),cancelRetry:u,continueRetry:c}}function RS(){let e=[],t=0,n=f=>{f()},r=f=>{f()},s=f=>setTimeout(f,0);const i=f=>{s=f},o=f=>{let p;t++;try{p=f()}finally{t--,t||u()}return p},a=f=>{t?e.push(f):s(()=>{n(f)})},l=f=>(...p)=>{a(()=>{f(...p)})},u=()=>{const f=e;e=[],f.length&&s(()=>{r(()=>{f.forEach(p=>{n(p)})})})};return{batch:o,batchCalls:l,schedule:a,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{r=f},setScheduler:i}}var Ee=RS(),wr,by,Qv=(by=class{constructor(){z(this,wr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qc(this.gcTime)&&I(this,wr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Us?1/0:5*60*1e3))}clearGcTimeout(){P(this,wr)&&(clearTimeout(P(this,wr)),I(this,wr,void 0))}},wr=new WeakMap,by),Ss,Ps,yt,Rn,vt,je,po,br,Ke,ba,tn,Sy,AS=(Sy=class extends Qv{constructor(t){super();z(this,Ke);z(this,Ss);z(this,Ps);z(this,yt);z(this,Rn);z(this,vt);z(this,je);z(this,po);z(this,br);I(this,br,!1),I(this,po,t.defaultOptions),Q(this,Ke,ba).call(this,t.options),I(this,je,[]),I(this,yt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,I(this,Ss,t.state||LS(this.options)),this.state=P(this,Ss),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!P(this,je).length&&this.state.fetchStatus==="idle"&&P(this,yt).remove(this)}setData(t,n){const r=Gc(this.state.data,t,this.options);return Q(this,Ke,tn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Q(this,Ke,tn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=P(this,Rn);return(r=P(this,vt))==null||r.cancel(t),n?n.then(wt).catch(wt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,Ss))}isActive(){return P(this,je).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||P(this,je).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!Wv(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=P(this,je).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,vt))==null||n.continue()}onOnline(){var n;const t=P(this,je).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,vt))==null||n.continue()}addObserver(t){P(this,je).includes(t)||(P(this,je).push(t),this.clearGcTimeout(),P(this,yt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){P(this,je).includes(t)&&(I(this,je,P(this,je).filter(n=>n!==t)),P(this,je).length||(P(this,vt)&&(P(this,br)?P(this,vt).cancel({revert:!0}):P(this,vt).cancelRetry()),this.scheduleGc()),P(this,yt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return P(this,je).length}invalidate(){this.state.isInvalidated||Q(this,Ke,tn).call(this,{type:"invalidate"})}fetch(t,n){var u,c,d,f;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,Rn))return(u=P(this,vt))==null||u.continueRetry(),P(this,Rn)}if(t&&Q(this,Ke,ba).call(this,t),!this.options.queryFn){const p=P(this,je).find(m=>m.options.queryFn);p&&Q(this,Ke,ba).call(this,p.options)}const r=new AbortController,s={queryKey:this.queryKey,meta:this.meta},i=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(I(this,br,!0),r.signal)})};i(s);const o=()=>this.options.queryFn?(I(this,br,!1),this.options.persister?this.options.persister(this.options.queryFn,s,this):this.options.queryFn(s)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(a),(c=this.options.behavior)==null||c.onFetch(a,this),I(this,Ps,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Q(this,Ke,tn).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta});const l=p=>{var m,x,w,y;Ru(p)&&p.silent||Q(this,Ke,tn).call(this,{type:"error",error:p}),Ru(p)||((x=(m=P(this,yt).config).onError)==null||x.call(m,p,this),(y=(w=P(this,yt).config).onSettled)==null||y.call(w,this.state.data,p,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return I(this,vt,qv({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:p=>{var m,x,w,y;if(typeof p>"u"){l(new Error(`${this.queryHash} data is undefined`));return}this.setData(p),(x=(m=P(this,yt).config).onSuccess)==null||x.call(m,p,this),(y=(w=P(this,yt).config).onSettled)==null||y.call(w,p,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(p,m)=>{Q(this,Ke,tn).call(this,{type:"failed",failureCount:p,error:m})},onPause:()=>{Q(this,Ke,tn).call(this,{type:"pause"})},onContinue:()=>{Q(this,Ke,tn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),I(this,Rn,P(this,vt).promise),P(this,Rn)}},Ss=new WeakMap,Ps=new WeakMap,yt=new WeakMap,Rn=new WeakMap,vt=new WeakMap,je=new WeakMap,po=new WeakMap,br=new WeakMap,Ke=new WeakSet,ba=function(t){this.options={...P(this,po),...t},this.updateGcTime(this.options.gcTime)},tn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:Vl(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Ru(s)&&s.revert&&P(this,Ps)?{...P(this,Ps),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ee.batch(()=>{P(this,je).forEach(r=>{r.onQueryUpdate()}),P(this,yt).notify({query:this,type:"updated",action:t})})},Sy);function LS(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var $t,Py,DS=(Py=class extends Gs{constructor(t={}){super();z(this,$t);this.config=t,I(this,$t,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Ff(s,n);let o=this.get(i);return o||(o=new AS({cache:this,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){P(this,$t).has(t.queryHash)||(P(this,$t).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,$t).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,$t).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ee.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,$t).get(t)}getAll(){return[...P(this,$t).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>zp(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>zp(t,r)):n}notify(t){Ee.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ee.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ee.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},$t=new WeakMap,Py),Bt,mo,st,Cs,zt,Sn,Cy,MS=(Cy=class extends Qv{constructor(t){super();z(this,zt);z(this,Bt);z(this,mo);z(this,st);z(this,Cs);this.mutationId=t.mutationId,I(this,mo,t.defaultOptions),I(this,st,t.mutationCache),I(this,Bt,[]),this.state=t.state||Gv(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...P(this,mo),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,Bt).includes(t)||(P(this,Bt).push(t),this.clearGcTimeout(),P(this,st).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){I(this,Bt,P(this,Bt).filter(n=>n!==t)),this.scheduleGc(),P(this,st).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,Bt).length||(this.state.status==="pending"?this.scheduleGc():P(this,st).remove(this))}continue(){var t;return((t=P(this,Cs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,i,o,a,l,u,c,d,f,p,m,x,w,y,g,v,S,C,T,E;const n=()=>(I(this,Cs,qv({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(j,F)=>{Q(this,zt,Sn).call(this,{type:"failed",failureCount:j,error:F})},onPause:()=>{Q(this,zt,Sn).call(this,{type:"pause"})},onContinue:()=>{Q(this,zt,Sn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),P(this,Cs).promise),r=this.state.status==="pending";try{if(!r){Q(this,zt,Sn).call(this,{type:"pending",variables:t}),await((i=(s=P(this,st).config).onMutate)==null?void 0:i.call(s,t,this));const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t));F!==this.state.context&&Q(this,zt,Sn).call(this,{type:"pending",context:F,variables:t})}const j=await n();return await((u=(l=P(this,st).config).onSuccess)==null?void 0:u.call(l,j,t,this.state.context,this)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,j,t,this.state.context)),await((p=(f=P(this,st).config).onSettled)==null?void 0:p.call(f,j,null,this.state.variables,this.state.context,this)),await((x=(m=this.options).onSettled)==null?void 0:x.call(m,j,null,t,this.state.context)),Q(this,zt,Sn).call(this,{type:"success",data:j}),j}catch(j){try{throw await((y=(w=P(this,st).config).onError)==null?void 0:y.call(w,j,t,this.state.context,this)),await((v=(g=this.options).onError)==null?void 0:v.call(g,j,t,this.state.context)),await((C=(S=P(this,st).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((E=(T=this.options).onSettled)==null?void 0:E.call(T,void 0,j,t,this.state.context)),j}finally{Q(this,zt,Sn).call(this,{type:"error",error:j})}}}},Bt=new WeakMap,mo=new WeakMap,st=new WeakMap,Cs=new WeakMap,zt=new WeakSet,Sn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!Vl(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ee.batch(()=>{P(this,Bt).forEach(r=>{r.onMutationUpdate(t)}),P(this,st).notify({mutation:this,type:"updated",action:t})})},Cy);function Gv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var xt,go,Sr,ky,FS=(ky=class extends Gs{constructor(t={}){super();z(this,xt);z(this,go);z(this,Sr);this.config=t,I(this,xt,[]),I(this,go,0)}build(t,n,r){const s=new MS({mutationCache:this,mutationId:++Mo(this,go)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){P(this,xt).push(t),this.notify({type:"added",mutation:t})}remove(t){I(this,xt,P(this,xt).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Ee.batch(()=>{P(this,xt).forEach(t=>{this.remove(t)})})}getAll(){return P(this,xt)}find(t){const n={exact:!0,...t};return P(this,xt).find(r=>Wp(n,r))}findAll(t={}){return P(this,xt).filter(n=>Wp(t,n))}notify(t){Ee.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return I(this,Sr,(P(this,Sr)??Promise.resolve()).then(()=>{const t=P(this,xt).filter(n=>n.state.isPaused);return Ee.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(wt)),Promise.resolve()))}).then(()=>{I(this,Sr,void 0)})),P(this,Sr)}},xt=new WeakMap,go=new WeakMap,Sr=new WeakMap,ky);function IS(e){return{onFetch:(t,n)=>{const r=async()=>{var m,x,w,y,g;const s=t.options,i=(w=(x=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:x.fetchMore)==null?void 0:w.direction,o=((y=t.state.data)==null?void 0:y.pages)||[],a=((g=t.state.data)==null?void 0:g.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},d=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),f=async(v,S,C)=>{if(u)return Promise.reject();if(S==null&&v.pages.length)return Promise.resolve(v);const T={queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};c(T);const E=await d(T),{maxPages:j}=t.options,F=C?TS:ES;return{pages:F(v.pages,E,j),pageParams:F(v.pageParams,S,j)}};let p;if(i&&o.length){const v=i==="backward",S=v?_S:qp,C={pages:o,pageParams:a},T=S(s,C);p=await f(C,T,v)}else{p=await f(l,a[0]??s.initialPageParam);const v=e??o.length;for(let S=1;S{var s,i;return(i=(s=t.options).persister)==null?void 0:i.call(s,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function qp(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function _S(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var Ce,An,Ln,ks,Es,Dn,Ts,js,Ey,VS=(Ey=class{constructor(e={}){z(this,Ce);z(this,An);z(this,Ln);z(this,ks);z(this,Es);z(this,Dn);z(this,Ts);z(this,js);I(this,Ce,e.queryCache||new DS),I(this,An,e.mutationCache||new FS),I(this,Ln,e.defaultOptions||{}),I(this,ks,new Map),I(this,Es,new Map),I(this,Dn,0)}mount(){Mo(this,Dn)._++,P(this,Dn)===1&&(I(this,Ts,sl.subscribe(()=>{sl.isFocused()&&(this.resumePausedMutations(),P(this,Ce).onFocus())})),I(this,js,il.subscribe(()=>{il.isOnline()&&(this.resumePausedMutations(),P(this,Ce).onOnline())})))}unmount(){var e,t;Mo(this,Dn)._--,P(this,Dn)===0&&((e=P(this,Ts))==null||e.call(this),I(this,Ts,void 0),(t=P(this,js))==null||t.call(this),I(this,js,void 0))}isFetching(e){return P(this,Ce).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,An).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=P(this,Ce).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=P(this,Ce).find({queryKey:e}),s=r==null?void 0:r.state.data,i=CS(t,s);if(typeof i>"u")return;const o=this.defaultQueryOptions({queryKey:e});return P(this,Ce).build(this,o).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Ee.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=P(this,Ce).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=P(this,Ce);Ee.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,Ce),r={type:"active",...e};return Ee.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Ee.batch(()=>P(this,Ce).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(wt).catch(wt)}invalidateQueries(e={},t={}){return Ee.batch(()=>{if(P(this,Ce).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Ee.batch(()=>P(this,Ce).findAll(e).filter(s=>!s.isDisabled()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(wt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(wt)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=P(this,Ce).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(wt).catch(wt)}fetchInfiniteQuery(e){return e.behavior=IS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(wt).catch(wt)}resumePausedMutations(){return P(this,An).resumePausedMutations()}getQueryCache(){return P(this,Ce)}getMutationCache(){return P(this,An)}getDefaultOptions(){return P(this,Ln)}setDefaultOptions(e){I(this,Ln,e)}setQueryDefaults(e,t){P(this,ks).set(Fr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,ks).values()];let n={};return t.forEach(r=>{to(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){P(this,Es).set(Fr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,Es).values()];let n={};return t.forEach(r=>{to(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...P(this,Ln).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ff(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,Ln).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,Ce).clear(),P(this,An).clear()}},Ce=new WeakMap,An=new WeakMap,Ln=new WeakMap,ks=new WeakMap,Es=new WeakMap,Dn=new WeakMap,Ts=new WeakMap,js=new WeakMap,Ey),Ye,ae,yo,We,Pr,Ns,Wt,vo,Os,Rs,Cr,kr,Mn,As,te,vi,Yc,Xc,Jc,Zc,ed,td,nd,Yv,Ty,US=(Ty=class extends Gs{constructor(t,n){super();z(this,te);z(this,Ye);z(this,ae);z(this,yo);z(this,We);z(this,Pr);z(this,Ns);z(this,Wt);z(this,vo);z(this,Os);z(this,Rs);z(this,Cr);z(this,kr);z(this,Mn);z(this,As,new Set);this.options=n,I(this,Ye,t),I(this,Wt,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,ae).addObserver(this),Qp(P(this,ae),this.options)?Q(this,te,vi).call(this):this.updateResult(),Q(this,te,Zc).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rd(P(this,ae),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rd(P(this,ae),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Q(this,te,ed).call(this),Q(this,te,td).call(this),P(this,ae).removeObserver(this)}setOptions(t,n){const r=this.options,s=P(this,ae);if(this.options=P(this,Ye).defaultQueryOptions(t),rl(r,this.options)||P(this,Ye).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,ae),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),Q(this,te,nd).call(this);const i=this.hasListeners();i&&Gp(P(this,ae),s,this.options,r)&&Q(this,te,vi).call(this),this.updateResult(n),i&&(P(this,ae)!==s||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Q(this,te,Yc).call(this);const o=Q(this,te,Xc).call(this);i&&(P(this,ae)!==s||this.options.enabled!==r.enabled||o!==P(this,Mn))&&Q(this,te,Jc).call(this,o)}getOptimisticResult(t){const n=P(this,Ye).getQueryCache().build(P(this,Ye),t),r=this.createResult(n,t);return BS(this,r)&&(I(this,We,r),I(this,Ns,this.options),I(this,Pr,P(this,ae).state)),r}getCurrentResult(){return P(this,We)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(P(this,As).add(r),t[r])})}),n}getCurrentQuery(){return P(this,ae)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=P(this,Ye).defaultQueryOptions(t),r=P(this,Ye).getQueryCache().build(P(this,Ye),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Q(this,te,vi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,We)))}createResult(t,n){var T;const r=P(this,ae),s=this.options,i=P(this,We),o=P(this,Pr),a=P(this,Ns),u=t!==r?t.state:P(this,yo),{state:c}=t;let{error:d,errorUpdatedAt:f,fetchStatus:p,status:m}=c,x=!1,w;if(n._optimisticResults){const E=this.hasListeners(),j=!E&&Qp(t,n),F=E&&Gp(t,r,n,s);(j||F)&&(p=Vl(t.options.networkMode)?"fetching":"paused",c.dataUpdatedAt||(m="pending")),n._optimisticResults==="isRestoring"&&(p="idle")}if(n.select&&typeof c.data<"u")if(i&&c.data===(o==null?void 0:o.data)&&n.select===P(this,vo))w=P(this,Os);else try{I(this,vo,n.select),w=n.select(c.data),w=Gc(i==null?void 0:i.data,w,n),I(this,Os,w),I(this,Wt,null)}catch(E){I(this,Wt,E)}else w=c.data;if(typeof n.placeholderData<"u"&&typeof w>"u"&&m==="pending"){let E;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))E=i.data;else if(E=typeof n.placeholderData=="function"?n.placeholderData((T=P(this,Rs))==null?void 0:T.state.data,P(this,Rs)):n.placeholderData,n.select&&typeof E<"u")try{E=n.select(E),I(this,Wt,null)}catch(j){I(this,Wt,j)}typeof E<"u"&&(m="success",w=Gc(i==null?void 0:i.data,E,n),x=!0)}P(this,Wt)&&(d=P(this,Wt),w=P(this,Os),f=Date.now(),m="error");const y=p==="fetching",g=m==="pending",v=m==="error",S=g&&y;return{status:m,fetchStatus:p,isPending:g,isSuccess:m==="success",isError:v,isInitialLoading:S,isLoading:S,data:w,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:v&&c.dataUpdatedAt===0,isPaused:p==="paused",isPlaceholderData:x,isRefetchError:v&&c.dataUpdatedAt!==0,isStale:If(t,n),refetch:this.refetch}}updateResult(t){const n=P(this,We),r=this.createResult(P(this,ae),this.options);if(I(this,Pr,P(this,ae).state),I(this,Ns,this.options),P(this,Pr).data!==void 0&&I(this,Rs,P(this,ae)),rl(r,n))return;I(this,We,r);const s={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!P(this,As).size)return!0;const l=new Set(a??P(this,As));return this.options.throwOnError&&l.add("error"),Object.keys(P(this,We)).some(u=>{const c=u;return P(this,We)[c]!==n[c]&&l.has(c)})};(t==null?void 0:t.listeners)!==!1&&i()&&(s.listeners=!0),Q(this,te,Yv).call(this,{...s,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Q(this,te,Zc).call(this)}},Ye=new WeakMap,ae=new WeakMap,yo=new WeakMap,We=new WeakMap,Pr=new WeakMap,Ns=new WeakMap,Wt=new WeakMap,vo=new WeakMap,Os=new WeakMap,Rs=new WeakMap,Cr=new WeakMap,kr=new WeakMap,Mn=new WeakMap,As=new WeakMap,te=new WeakSet,vi=function(t){Q(this,te,nd).call(this);let n=P(this,ae).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(wt)),n},Yc=function(){if(Q(this,te,ed).call(this),Us||P(this,We).isStale||!qc(this.options.staleTime))return;const n=Wv(P(this,We).dataUpdatedAt,this.options.staleTime)+1;I(this,Cr,setTimeout(()=>{P(this,We).isStale||this.updateResult()},n))},Xc=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,ae)):this.options.refetchInterval)??!1},Jc=function(t){Q(this,te,td).call(this),I(this,Mn,t),!(Us||this.options.enabled===!1||!qc(P(this,Mn))||P(this,Mn)===0)&&I(this,kr,setInterval(()=>{(this.options.refetchIntervalInBackground||sl.isFocused())&&Q(this,te,vi).call(this)},P(this,Mn)))},Zc=function(){Q(this,te,Yc).call(this),Q(this,te,Jc).call(this,Q(this,te,Xc).call(this))},ed=function(){P(this,Cr)&&(clearTimeout(P(this,Cr)),I(this,Cr,void 0))},td=function(){P(this,kr)&&(clearInterval(P(this,kr)),I(this,kr,void 0))},nd=function(){const t=P(this,Ye).getQueryCache().build(P(this,Ye),this.options);if(t===P(this,ae))return;const n=P(this,ae);I(this,ae,t),I(this,yo,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Yv=function(t){Ee.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(P(this,We))}),P(this,Ye).getQueryCache().notify({query:P(this,ae),type:"observerResultsUpdated"})})},Ty);function $S(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Qp(e,t){return $S(e,t)||e.state.dataUpdatedAt>0&&rd(e,t,t.refetchOnMount)}function rd(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&If(e,t)}return!1}function Gp(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&If(e,n)}function If(e,t){return e.isStaleByTime(t.staleTime)}function BS(e,t){return!rl(e.getCurrentResult(),t)}var Fn,sn,it,on,fn,Sa,sd,jy,zS=(jy=class extends Gs{constructor(n,r){super();z(this,fn);z(this,Fn);z(this,sn);z(this,it);z(this,on);I(this,sn,void 0),I(this,Fn,n),this.setOptions(r),this.bindMethods(),Q(this,fn,Sa).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=P(this,Fn).defaultMutationOptions(n),rl(r,this.options)||P(this,Fn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:P(this,it),observer:this}),(s=P(this,it))==null||s.setOptions(this.options),r!=null&&r.mutationKey&&this.options.mutationKey&&Fr(r.mutationKey)!==Fr(this.options.mutationKey)&&this.reset()}onUnsubscribe(){var n;this.hasListeners()||(n=P(this,it))==null||n.removeObserver(this)}onMutationUpdate(n){Q(this,fn,Sa).call(this),Q(this,fn,sd).call(this,n)}getCurrentResult(){return P(this,sn)}reset(){var n;(n=P(this,it))==null||n.removeObserver(this),I(this,it,void 0),Q(this,fn,Sa).call(this),Q(this,fn,sd).call(this)}mutate(n,r){var s;return I(this,on,r),(s=P(this,it))==null||s.removeObserver(this),I(this,it,P(this,Fn).getMutationCache().build(P(this,Fn),this.options)),P(this,it).addObserver(this),P(this,it).execute(n)}},Fn=new WeakMap,sn=new WeakMap,it=new WeakMap,on=new WeakMap,fn=new WeakSet,Sa=function(){var r;const n=((r=P(this,it))==null?void 0:r.state)??Gv();I(this,sn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},sd=function(n){Ee.batch(()=>{var r,s,i,o,a,l,u,c;if(P(this,on)&&this.hasListeners()){const d=P(this,sn).variables,f=P(this,sn).context;(n==null?void 0:n.type)==="success"?((s=(r=P(this,on)).onSuccess)==null||s.call(r,n.data,d,f),(o=(i=P(this,on)).onSettled)==null||o.call(i,n.data,null,d,f)):(n==null?void 0:n.type)==="error"&&((l=(a=P(this,on)).onError)==null||l.call(a,n.error,d,f),(c=(u=P(this,on)).onSettled)==null||c.call(u,void 0,n.error,d,f))}this.listeners.forEach(d=>{d(P(this,sn))})})},jy),Xv=b.createContext(void 0),_f=e=>{const t=b.useContext(Xv);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},WS=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),b.createElement(Xv.Provider,{value:e},t)),Jv=b.createContext(!1),HS=()=>b.useContext(Jv);Jv.Provider;function KS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qS=b.createContext(KS()),QS=()=>b.useContext(qS);function Zv(e,t){return typeof e=="function"?e(...t):!!e}var GS=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},YS=e=>{b.useEffect(()=>{e.clearReset()},[e])},XS=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Zv(n,[e.error,r]),JS=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},ZS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,eP=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function tP(e,t,n){const r=_f(),s=HS(),i=QS(),o=r.defaultQueryOptions(e);o._optimisticResults=s?"isRestoring":"optimistic",JS(o),GS(o,i),YS(i);const[a]=b.useState(()=>new t(r,o)),l=a.getOptimisticResult(o);if(b.useSyncExternalStore(b.useCallback(u=>{const c=s?()=>{}:a.subscribe(Ee.batchCalls(u));return a.updateResult(),c},[a,s]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),b.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),ZS(o,l))throw eP(o,a,i);if(XS({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash)}))throw l.error;return o.notifyOnChangeProps?l:a.trackResult(l)}function nP(e,t){return tP(e,US)}function rP(e,t){const n=_f(),[r]=b.useState(()=>new zS(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const s=b.useSyncExternalStore(b.useCallback(o=>r.subscribe(Ee.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=b.useCallback((o,a)=>{r.mutate(o,a).catch(sP)},[r]);if(s.error&&Zv(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function sP(){}function e1(e,t){return function(){return e.apply(t,arguments)}}const{toString:iP}=Object.prototype,{getPrototypeOf:Vf}=Object,{iterator:Ul,toStringTag:t1}=Symbol,$l=(e=>t=>{const n=iP.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Mt=e=>(e=e.toLowerCase(),t=>$l(t)===e),Bl=e=>t=>typeof t===e,{isArray:Ys}=Array,$s=Bl("undefined");function Co(e){return e!==null&&!$s(e)&&e.constructor!==null&&!$s(e.constructor)&&nt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const n1=Mt("ArrayBuffer");function oP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&n1(e.buffer),t}const aP=Bl("string"),nt=Bl("function"),r1=Bl("number"),ko=e=>e!==null&&typeof e=="object",lP=e=>e===!0||e===!1,Pa=e=>{if($l(e)!=="object")return!1;const t=Vf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(t1 in e)&&!(Ul in e)},uP=e=>{if(!ko(e)||Co(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},cP=Mt("Date"),dP=Mt("File"),fP=Mt("Blob"),hP=Mt("FileList"),pP=e=>ko(e)&&nt(e.pipe),mP=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||nt(e.append)&&((t=$l(e))==="formdata"||t==="object"&&nt(e.toString)&&e.toString()==="[object FormData]"))},gP=Mt("URLSearchParams"),[yP,vP,xP,wP]=["ReadableStream","Request","Response","Headers"].map(Mt),bP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Eo(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Ys(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const yr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,i1=e=>!$s(e)&&e!==yr;function id(){const{caseless:e,skipUndefined:t}=i1(this)&&this||{},n={},r=(s,i)=>{const o=e&&s1(n,i)||i;Pa(n[o])&&Pa(s)?n[o]=id(n[o],s):Pa(s)?n[o]=id({},s):Ys(s)?n[o]=s.slice():(!t||!$s(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s(Eo(t,(s,i)=>{n&&nt(s)?e[i]=e1(s,n):e[i]=s},{allOwnKeys:r}),e),PP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),CP=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},kP=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&Vf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},EP=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},TP=e=>{if(!e)return null;if(Ys(e))return e;let t=e.length;if(!r1(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},jP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Vf(Uint8Array)),NP=(e,t)=>{const r=(e&&e[Ul]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},OP=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},RP=Mt("HTMLFormElement"),AP=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Yp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),LP=Mt("RegExp"),o1=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Eo(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},DP=e=>{o1(e,(t,n)=>{if(nt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(nt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},MP=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Ys(e)?r(e):r(String(e).split(t)),n},FP=()=>{},IP=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function _P(e){return!!(e&&nt(e.append)&&e[t1]==="FormData"&&e[Ul])}const VP=e=>{const t=new Array(10),n=(r,s)=>{if(ko(r)){if(t.indexOf(r)>=0)return;if(Co(r))return r;if(!("toJSON"in r)){t[s]=r;const i=Ys(r)?[]:{};return Eo(r,(o,a)=>{const l=n(o,s+1);!$s(l)&&(i[a]=l)}),t[s]=void 0,i}}return r};return n(e,0)},UP=Mt("AsyncFunction"),$P=e=>e&&(ko(e)||nt(e))&&nt(e.then)&&nt(e.catch),a1=((e,t)=>e?setImmediate:t?((n,r)=>(yr.addEventListener("message",({source:s,data:i})=>{s===yr&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),yr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",nt(yr.postMessage)),BP=typeof queueMicrotask<"u"?queueMicrotask.bind(yr):typeof process<"u"&&process.nextTick||a1,zP=e=>e!=null&&nt(e[Ul]),N={isArray:Ys,isArrayBuffer:n1,isBuffer:Co,isFormData:mP,isArrayBufferView:oP,isString:aP,isNumber:r1,isBoolean:lP,isObject:ko,isPlainObject:Pa,isEmptyObject:uP,isReadableStream:yP,isRequest:vP,isResponse:xP,isHeaders:wP,isUndefined:$s,isDate:cP,isFile:dP,isBlob:fP,isRegExp:LP,isFunction:nt,isStream:pP,isURLSearchParams:gP,isTypedArray:jP,isFileList:hP,forEach:Eo,merge:id,extend:SP,trim:bP,stripBOM:PP,inherits:CP,toFlatObject:kP,kindOf:$l,kindOfTest:Mt,endsWith:EP,toArray:TP,forEachEntry:NP,matchAll:OP,isHTMLForm:RP,hasOwnProperty:Yp,hasOwnProp:Yp,reduceDescriptors:o1,freezeMethods:DP,toObjectSet:MP,toCamelCase:AP,noop:FP,toFiniteNumber:IP,findKey:s1,global:yr,isContextDefined:i1,isSpecCompliantForm:_P,toJSONObject:VP,isAsyncFn:UP,isThenable:$P,setImmediate:a1,asap:BP,isIterable:zP};function G(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}N.inherits(G,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:N.toJSONObject(this.config),code:this.code,status:this.status}}});const l1=G.prototype,u1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{u1[e]={value:e}});Object.defineProperties(G,u1);Object.defineProperty(l1,"isAxiosError",{value:!0});G.from=(e,t,n,r,s,i)=>{const o=Object.create(l1);N.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return G.call(o,a,l,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const WP=null;function od(e){return N.isPlainObject(e)||N.isArray(e)}function c1(e){return N.endsWith(e,"[]")?e.slice(0,-2):e}function Xp(e,t,n){return e?e.concat(t).map(function(s,i){return s=c1(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function HP(e){return N.isArray(e)&&!e.some(od)}const KP=N.toFlatObject(N,{},null,function(t){return/^is[A-Z]/.test(t)});function zl(e,t,n){if(!N.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=N.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,w){return!N.isUndefined(w[x])});const r=n.metaTokens,s=n.visitor||c,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&N.isSpecCompliantForm(t);if(!N.isFunction(s))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(N.isDate(m))return m.toISOString();if(N.isBoolean(m))return m.toString();if(!l&&N.isBlob(m))throw new G("Blob is not supported. Use a Buffer instead.");return N.isArrayBuffer(m)||N.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function c(m,x,w){let y=m;if(m&&!w&&typeof m=="object"){if(N.endsWith(x,"{}"))x=r?x:x.slice(0,-2),m=JSON.stringify(m);else if(N.isArray(m)&&HP(m)||(N.isFileList(m)||N.endsWith(x,"[]"))&&(y=N.toArray(m)))return x=c1(x),y.forEach(function(v,S){!(N.isUndefined(v)||v===null)&&t.append(o===!0?Xp([x],S,i):o===null?x:x+"[]",u(v))}),!1}return od(m)?!0:(t.append(Xp(w,x,i),u(m)),!1)}const d=[],f=Object.assign(KP,{defaultVisitor:c,convertValue:u,isVisitable:od});function p(m,x){if(!N.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+x.join("."));d.push(m),N.forEach(m,function(y,g){(!(N.isUndefined(y)||y===null)&&s.call(t,y,N.isString(g)?g.trim():g,x,f))===!0&&p(y,x?x.concat(g):[g])}),d.pop()}}if(!N.isObject(e))throw new TypeError("data must be an object");return p(e),t}function Jp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Uf(e,t){this._pairs=[],e&&zl(e,this,t)}const d1=Uf.prototype;d1.append=function(t,n){this._pairs.push([t,n])};d1.toString=function(t){const n=t?function(r){return t.call(this,r,Jp)}:Jp;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function qP(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function f1(e,t,n){if(!t)return e;const r=n&&n.encode||qP;N.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=N.isURLSearchParams(t)?t.toString():new Uf(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Zp{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){N.forEach(this.handlers,function(r){r!==null&&t(r)})}}const h1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},QP=typeof URLSearchParams<"u"?URLSearchParams:Uf,GP=typeof FormData<"u"?FormData:null,YP=typeof Blob<"u"?Blob:null,XP={isBrowser:!0,classes:{URLSearchParams:QP,FormData:GP,Blob:YP},protocols:["http","https","file","blob","url","data"]},$f=typeof window<"u"&&typeof document<"u",ad=typeof navigator=="object"&&navigator||void 0,JP=$f&&(!ad||["ReactNative","NativeScript","NS"].indexOf(ad.product)<0),ZP=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",eC=$f&&window.location.href||"http://localhost",tC=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:$f,hasStandardBrowserEnv:JP,hasStandardBrowserWebWorkerEnv:ZP,navigator:ad,origin:eC},Symbol.toStringTag,{value:"Module"})),Ue={...tC,...XP};function nC(e,t){return zl(e,new Ue.classes.URLSearchParams,{visitor:function(n,r,s,i){return Ue.isNode&&N.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function rC(e){return N.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function sC(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&N.isArray(s)?s.length:o,l?(N.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!N.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&N.isArray(s[o])&&(s[o]=sC(s[o])),!a)}if(N.isFormData(e)&&N.isFunction(e.entries)){const n={};return N.forEachEntry(e,(r,s)=>{t(rC(r),s,n,0)}),n}return null}function iC(e,t,n){if(N.isString(e))try{return(t||JSON.parse)(e),N.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const To={transitional:h1,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=N.isObject(t);if(i&&N.isHTMLForm(t)&&(t=new FormData(t)),N.isFormData(t))return s?JSON.stringify(p1(t)):t;if(N.isArrayBuffer(t)||N.isBuffer(t)||N.isStream(t)||N.isFile(t)||N.isBlob(t)||N.isReadableStream(t))return t;if(N.isArrayBufferView(t))return t.buffer;if(N.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return nC(t,this.formSerializer).toString();if((a=N.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return zl(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),iC(t)):t}],transformResponse:[function(t){const n=this.transitional||To.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(N.isResponse(t)||N.isReadableStream(t))return t;if(t&&N.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?G.from(a,G.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch"],e=>{To.headers[e]={}});const oC=N.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),aC=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&oC[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},em=Symbol("internals");function ui(e){return e&&String(e).trim().toLowerCase()}function Ca(e){return e===!1||e==null?e:N.isArray(e)?e.map(Ca):String(e)}function lC(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const uC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Au(e,t,n,r,s){if(N.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!N.isString(t)){if(N.isString(r))return t.indexOf(r)!==-1;if(N.isRegExp(r))return r.test(t)}}function cC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function dC(e,t){const n=N.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let rt=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,u){const c=ui(l);if(!c)throw new Error("header name must be a non-empty string");const d=N.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||l]=Ca(a))}const o=(a,l)=>N.forEach(a,(u,c)=>i(u,c,l));if(N.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(N.isString(t)&&(t=t.trim())&&!uC(t))o(aC(t),n);else if(N.isObject(t)&&N.isIterable(t)){let a={},l,u;for(const c of t){if(!N.isArray(c))throw TypeError("Object iterator must return a key-value pair");a[u=c[0]]=(l=a[u])?N.isArray(l)?[...l,c[1]]:[l,c[1]]:c[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=ui(t),t){const r=N.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return lC(s);if(N.isFunction(n))return n.call(this,s,r);if(N.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ui(t),t){const r=N.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Au(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=ui(o),o){const a=N.findKey(r,o);a&&(!n||Au(r,r[a],a,n))&&(delete r[a],s=!0)}}return N.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||Au(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return N.forEach(this,(s,i)=>{const o=N.findKey(r,i);if(o){n[o]=Ca(s),delete n[i];return}const a=t?cC(i):String(i).trim();a!==i&&delete n[i],n[a]=Ca(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return N.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&N.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[em]=this[em]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ui(o);r[a]||(dC(s,o),r[a]=!0)}return N.isArray(t)?t.forEach(i):i(t),this}};rt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors(rt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});N.freezeMethods(rt);function Lu(e,t){const n=this||To,r=t||n,s=rt.from(r.headers);let i=r.data;return N.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function m1(e){return!!(e&&e.__CANCEL__)}function Xs(e,t,n){G.call(this,e??"canceled",G.ERR_CANCELED,t,n),this.name="CanceledError"}N.inherits(Xs,G,{__CANCEL__:!0});function g1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new G("Request failed with status code "+n.status,[G.ERR_BAD_REQUEST,G.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function fC(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function hC(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=r[i];o||(o=u),n[s]=l,r[s]=u;let d=i,f=0;for(;d!==s;)f+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const ol=(e,t,n=3)=>{let r=0;const s=hC(50,250);return pC(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,u=s(l),c=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&c?(a-o)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},tm=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},nm=e=>(...t)=>N.asap(()=>e(...t)),mC=Ue.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ue.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ue.origin),Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent)):()=>!0,gC=Ue.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const o=[e+"="+encodeURIComponent(t)];N.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),N.isString(r)&&o.push("path="+r),N.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function yC(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function vC(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function y1(e,t,n){let r=!yC(t);return e&&(r||n==!1)?vC(e,t):t}const rm=e=>e instanceof rt?{...e}:e;function Ir(e,t){t=t||{};const n={};function r(u,c,d,f){return N.isPlainObject(u)&&N.isPlainObject(c)?N.merge.call({caseless:f},u,c):N.isPlainObject(c)?N.merge({},c):N.isArray(c)?c.slice():c}function s(u,c,d,f){if(N.isUndefined(c)){if(!N.isUndefined(u))return r(void 0,u,d,f)}else return r(u,c,d,f)}function i(u,c){if(!N.isUndefined(c))return r(void 0,c)}function o(u,c){if(N.isUndefined(c)){if(!N.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function a(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,c,d)=>s(rm(u),rm(c),d,!0)};return N.forEach(Object.keys({...e,...t}),function(c){const d=l[c]||s,f=d(e[c],t[c],c);N.isUndefined(f)&&d!==a||(n[c]=f)}),n}const v1=e=>{const t=Ir({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=rt.from(o),t.url=f1(y1(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),N.isFormData(n)){if(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(N.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([c,d])=>{u.includes(c.toLowerCase())&&o.set(c,d)})}}if(Ue.hasStandardBrowserEnv&&(r&&N.isFunction(r)&&(r=r(t)),r||r!==!1&&mC(t.url))){const l=s&&i&&gC.read(i);l&&o.set(s,l)}return t},xC=typeof XMLHttpRequest<"u",wC=xC&&function(e){return new Promise(function(n,r){const s=v1(e);let i=s.data;const o=rt.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=s,c,d,f,p,m;function x(){p&&p(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let w=new XMLHttpRequest;w.open(s.method.toUpperCase(),s.url,!0),w.timeout=s.timeout;function y(){if(!w)return;const v=rt.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:v,config:e,request:w};g1(function(E){n(E),x()},function(E){r(E),x()},C),w=null}"onloadend"in w?w.onloadend=y:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(y)},w.onabort=function(){w&&(r(new G("Request aborted",G.ECONNABORTED,e,w)),w=null)},w.onerror=function(S){const C=S&&S.message?S.message:"Network Error",T=new G(C,G.ERR_NETWORK,e,w);T.event=S||null,r(T),w=null},w.ontimeout=function(){let S=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||h1;s.timeoutErrorMessage&&(S=s.timeoutErrorMessage),r(new G(S,C.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,w)),w=null},i===void 0&&o.setContentType(null),"setRequestHeader"in w&&N.forEach(o.toJSON(),function(S,C){w.setRequestHeader(C,S)}),N.isUndefined(s.withCredentials)||(w.withCredentials=!!s.withCredentials),a&&a!=="json"&&(w.responseType=s.responseType),u&&([f,m]=ol(u,!0),w.addEventListener("progress",f)),l&&w.upload&&([d,p]=ol(l),w.upload.addEventListener("progress",d),w.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(c=v=>{w&&(r(!v||v.type?new Xs(null,e,w):v),w.abort(),w=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const g=fC(s.url);if(g&&Ue.protocols.indexOf(g)===-1){r(new G("Unsupported protocol "+g+":",G.ERR_BAD_REQUEST,e));return}w.send(i||null)})},bC=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,a();const c=u instanceof Error?u:this.reason;r.abort(c instanceof G?c:new Xs(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new G(`timeout ${t} of ms exceeded`,G.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>N.asap(a),l}},SC=function*(e,t){let n=e.byteLength;if(n{const s=PC(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:c}=await s.next();if(u){a(),l.close();return}let d=c.byteLength;if(n){let f=i+=d;n(f)}l.enqueue(new Uint8Array(c))}catch(u){throw a(u),u}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},im=64*1024,{isFunction:Zo}=N,kC=(({Request:e,Response:t})=>({Request:e,Response:t}))(N.global),{ReadableStream:om,TextEncoder:am}=N.global,lm=(e,...t)=>{try{return!!e(...t)}catch{return!1}},EC=e=>{e=N.merge.call({skipUndefined:!0},kC,e);const{fetch:t,Request:n,Response:r}=e,s=t?Zo(t):typeof fetch=="function",i=Zo(n),o=Zo(r);if(!s)return!1;const a=s&&Zo(om),l=s&&(typeof am=="function"?(m=>x=>m.encode(x))(new am):async m=>new Uint8Array(await new n(m).arrayBuffer())),u=i&&a&&lm(()=>{let m=!1;const x=new n(Ue.origin,{body:new om,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!x}),c=o&&a&&lm(()=>N.isReadableStream(new r("").body)),d={stream:c&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!d[m]&&(d[m]=(x,w)=>{let y=x&&x[m];if(y)return y.call(x);throw new G(`Response type '${m}' is not supported`,G.ERR_NOT_SUPPORT,w)})});const f=async m=>{if(m==null)return 0;if(N.isBlob(m))return m.size;if(N.isSpecCompliantForm(m))return(await new n(Ue.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(N.isArrayBufferView(m)||N.isArrayBuffer(m))return m.byteLength;if(N.isURLSearchParams(m)&&(m=m+""),N.isString(m))return(await l(m)).byteLength},p=async(m,x)=>{const w=N.toFiniteNumber(m.getContentLength());return w??f(x)};return async m=>{let{url:x,method:w,data:y,signal:g,cancelToken:v,timeout:S,onDownloadProgress:C,onUploadProgress:T,responseType:E,headers:j,withCredentials:F="same-origin",fetchOptions:U}=v1(m),B=t||fetch;E=E?(E+"").toLowerCase():"text";let J=bC([g,v&&v.toAbortSignal()],S),me=null;const Z=J&&J.unsubscribe&&(()=>{J.unsubscribe()});let k;try{if(T&&u&&w!=="get"&&w!=="head"&&(k=await p(j,y))!==0){let M=new n(x,{method:"POST",body:y,duplex:"half"}),$;if(N.isFormData(y)&&($=M.headers.get("content-type"))&&j.setContentType($),M.body){const[K,ve]=tm(k,ol(nm(T)));y=sm(M.body,im,K,ve)}}N.isString(F)||(F=F?"include":"omit");const R=i&&"credentials"in n.prototype,_={...U,signal:J,method:w.toUpperCase(),headers:j.normalize().toJSON(),body:y,duplex:"half",credentials:R?F:void 0};me=i&&new n(x,_);let O=await(i?B(me,U):B(x,_));const D=c&&(E==="stream"||E==="response");if(c&&(C||D&&Z)){const M={};["status","statusText","headers"].forEach(pt=>{M[pt]=O[pt]});const $=N.toFiniteNumber(O.headers.get("content-length")),[K,ve]=C&&tm($,ol(nm(C),!0))||[];O=new r(sm(O.body,im,K,()=>{ve&&ve(),Z&&Z()}),M)}E=E||"text";let L=await d[N.findKey(d,E)||"text"](O,m);return!D&&Z&&Z(),await new Promise((M,$)=>{g1(M,$,{data:L,headers:rt.from(O.headers),status:O.status,statusText:O.statusText,config:m,request:me})})}catch(R){throw Z&&Z(),R&&R.name==="TypeError"&&/Load failed|fetch/i.test(R.message)?Object.assign(new G("Network Error",G.ERR_NETWORK,m,me),{cause:R.cause||R}):G.from(R,R&&R.code,m,me)}}},TC=new Map,x1=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,u,c=TC;for(;a--;)l=i[a],u=c.get(l),u===void 0&&c.set(l,u=a?new Map:EC(t)),c=u;return u};x1();const ld={http:WP,xhr:wC,fetch:{get:x1}};N.forEach(ld,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const um=e=>`- ${e}`,jC=e=>N.isFunction(e)||e===null||e===!1,w1={getAdapter:(e,t)=>{e=N.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since : +`+o.map(um).join(` +`):" "+um(o[0]):"as no adapter specified";throw new G("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:ld};function Du(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xs(null,e)}function cm(e){return Du(e),e.headers=rt.from(e.headers),e.data=Lu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),w1.getAdapter(e.adapter||To.adapter,e)(e).then(function(r){return Du(e),r.data=Lu.call(e,e.transformResponse,r),r.headers=rt.from(r.headers),r},function(r){return m1(r)||(Du(e),r&&r.response&&(r.response.data=Lu.call(e,e.transformResponse,r.response),r.response.headers=rt.from(r.response.headers))),Promise.reject(r)})}const b1="1.12.2",Wl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Wl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const dm={};Wl.transitional=function(t,n,r){function s(i,o){return"[Axios v"+b1+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new G(s(o," has been removed"+(n?" in "+n:"")),G.ERR_DEPRECATED);return n&&!dm[o]&&(dm[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};Wl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function NC(e,t,n){if(typeof e!="object")throw new G("options must be an object",G.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new G("option "+i+" must be "+l,G.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new G("Unknown option "+i,G.ERR_BAD_OPTION)}}const ka={assertOptions:NC,validators:Wl},_t=ka.validators;let jr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Zp,response:new Zp}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ir(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ka.assertOptions(r,{silentJSONParsing:_t.transitional(_t.boolean),forcedJSONParsing:_t.transitional(_t.boolean),clarifyTimeoutError:_t.transitional(_t.boolean)},!1),s!=null&&(N.isFunction(s)?n.paramsSerializer={serialize:s}:ka.assertOptions(s,{encode:_t.function,serialize:_t.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ka.assertOptions(n,{baseUrl:_t.spelling("baseURL"),withXsrfToken:_t.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&N.merge(i.common,i[n.method]);i&&N.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=rt.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(n)===!1||(l=l&&x.synchronous,a.unshift(x.fulfilled,x.rejected))});const u=[];this.interceptors.response.forEach(function(x){u.push(x.fulfilled,x.rejected)});let c,d=0,f;if(!l){const m=[cm.bind(this),void 0];for(m.unshift(...a),m.push(...u),f=m.length,c=Promise.resolve(n);d{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Xs(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new S1(function(s){t=s}),cancel:t}}};function RC(e){return function(n){return e.apply(null,n)}}function AC(e){return N.isObject(e)&&e.isAxiosError===!0}const ud={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ud).forEach(([e,t])=>{ud[t]=e});function P1(e){const t=new jr(e),n=e1(jr.prototype.request,t);return N.extend(n,jr.prototype,t,{allOwnKeys:!0}),N.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return P1(Ir(e,s))},n}const be=P1(To);be.Axios=jr;be.CanceledError=Xs;be.CancelToken=OC;be.isCancel=m1;be.VERSION=b1;be.toFormData=zl;be.AxiosError=G;be.Cancel=be.CanceledError;be.all=function(t){return Promise.all(t)};be.spread=RC;be.isAxiosError=AC;be.mergeConfig=Ir;be.AxiosHeaders=rt;be.formToJSON=e=>p1(N.isHTMLForm(e)?new FormData(e):e);be.getAdapter=w1.getAdapter;be.HttpStatusCode=ud;be.default=be;const{Axios:uA,AxiosError:cA,CanceledError:dA,isCancel:fA,CancelToken:hA,VERSION:pA,all:mA,Cancel:gA,isAxiosError:yA,spread:vA,toFormData:xA,AxiosHeaders:wA,HttpStatusCode:bA,formToJSON:SA,getAdapter:PA,mergeConfig:CA}=be;/** + * @remix-run/router v1.23.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function no(){return no=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function C1(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DC(){return Math.random().toString(36).substr(2,8)}function hm(e,t){return{usr:e.state,key:e.key,idx:t}}function cd(e,t,n,r){return n===void 0&&(n=null),no({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Js(t):t,{state:n,key:t&&t.key||r||DC()})}function al(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Js(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function MC(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=Vn.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(no({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){a=Vn.Pop;let w=c(),y=w==null?null:w-u;u=w,l&&l({action:a,location:x.location,delta:y})}function f(w,y){a=Vn.Push;let g=cd(x.location,w,y);u=c()+1;let v=hm(g,u),S=x.createHref(g);try{o.pushState(v,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(S)}i&&l&&l({action:a,location:x.location,delta:1})}function p(w,y){a=Vn.Replace;let g=cd(x.location,w,y);u=c();let v=hm(g,u),S=x.createHref(g);o.replaceState(v,"",S),i&&l&&l({action:a,location:x.location,delta:0})}function m(w){let y=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof w=="string"?w:al(w);return g=g.replace(/ $/,"%20"),Pe(y,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,y)}let x={get action(){return a},get location(){return e(s,o)},listen(w){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(fm,d),l=w,()=>{s.removeEventListener(fm,d),l=null}},createHref(w){return t(s,w)},createURL:m,encodeLocation(w){let y=m(w);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(w){return o.go(w)}};return x}var pm;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(pm||(pm={}));function FC(e,t,n){return n===void 0&&(n="/"),IC(e,t,n)}function IC(e,t,n,r){let s=typeof t=="string"?Js(t):t,i=Bf(s.pathname||"/",n);if(i==null)return null;let o=k1(e);_C(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(Pe(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Qn([r,l.relativePath]),c=n.concat(l);i.children&&i.children.length>0&&(Pe(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),k1(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:HC(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let l of E1(i.path))s(i,o,l)}),t}function E1(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=E1(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function _C(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:KC(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const VC=/^:[\w-]+$/,UC=3,$C=2,BC=1,zC=10,WC=-2,mm=e=>e==="*";function HC(e,t){let n=e.split("/"),r=n.length;return n.some(mm)&&(r+=WC),t&&(r+=$C),n.filter(s=>!mm(s)).reduce((s,i)=>s+(VC.test(i)?UC:i===""?BC:zC),r)}function KC(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function qC(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let a=0;a{let{paramName:f,isOptional:p}=c;if(f==="*"){let x=a[d]||"";o=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const m=a[d];return p&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function GC(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),C1(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function YC(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return C1(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Bf(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function XC(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Js(e):e;return{pathname:n?n.startsWith("/")?n:JC(n,t):t,search:tk(r),hash:nk(s)}}function JC(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Mu(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function ZC(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function T1(e,t){let n=ZC(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function j1(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Js(e):(s=no({},e),Pe(!s.pathname||!s.pathname.includes("?"),Mu("?","pathname","search",s)),Pe(!s.pathname||!s.pathname.includes("#"),Mu("#","pathname","hash",s)),Pe(!s.search||!s.search.includes("#"),Mu("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let d=t.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;s.pathname=f.join("/")}a=d>=0?t[d]:"/"}let l=XC(s,a),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Qn=e=>e.join("/").replace(/\/\/+/g,"/"),ek=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),tk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,nk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function rk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const N1=["post","put","patch","delete"];new Set(N1);const sk=["get",...N1];new Set(sk);/** + * React Router v6.30.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function ro(){return ro=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),b.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=j1(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Qn([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,o,i,e])}const uk=b.createContext(null);function ck(e){let t=b.useContext(rr).outlet;return t&&b.createElement(uk.Provider,{value:e},t)}function A1(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=b.useContext(zr),{matches:s}=b.useContext(rr),{pathname:i}=Kl(),o=JSON.stringify(T1(s,r.v7_relativeSplatPath));return b.useMemo(()=>j1(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function dk(e,t){return fk(e,t)}function fk(e,t,n,r){jo()||Pe(!1);let{navigator:s}=b.useContext(zr),{matches:i}=b.useContext(rr),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=Kl(),c;if(t){var d;let w=typeof t=="string"?Js(t):t;l==="/"||(d=w.pathname)!=null&&d.startsWith(l)||Pe(!1),c=w}else c=u;let f=c.pathname||"/",p=f;if(l!=="/"){let w=l.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(w.length).join("/")}let m=FC(e,{pathname:p}),x=yk(m&&m.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:Qn([l,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?l:Qn([l,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),i,n,r);return t&&x?b.createElement(Hl.Provider,{value:{location:ro({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Vn.Pop}},x):x}function hk(){let e=bk(),t=rk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,null)}const pk=b.createElement(hk,null);class mk extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?b.createElement(rr.Provider,{value:this.props.routeContext},b.createElement(O1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function gk(e){let{routeContext:t,match:n,children:r}=e,s=b.useContext(zf);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(rr.Provider,{value:t},r)}function yk(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let c=o.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);c>=0||Pe(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,d,f)=>{let p,m=!1,x=null,w=null;n&&(p=a&&d.route.id?a[d.route.id]:void 0,x=d.route.errorElement||pk,l&&(u<0&&f===0?(Pk("route-fallback"),m=!0,w=null):u===f&&(m=!0,w=d.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,f+1)),g=()=>{let v;return p?v=x:m?v=w:d.route.Component?v=b.createElement(d.route.Component,null):d.route.element?v=d.route.element:v=c,b.createElement(gk,{match:d,routeContext:{outlet:c,matches:y,isDataRoute:n!=null},children:v})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?b.createElement(mk,{location:n.location,revalidation:n.revalidation,component:x,error:p,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):g()},null)}var L1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(L1||{}),D1=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(D1||{});function vk(e){let t=b.useContext(zf);return t||Pe(!1),t}function xk(e){let t=b.useContext(ik);return t||Pe(!1),t}function wk(e){let t=b.useContext(rr);return t||Pe(!1),t}function M1(e){let t=wk(),n=t.matches[t.matches.length-1];return n.route.id||Pe(!1),n.route.id}function bk(){var e;let t=b.useContext(O1),n=xk(),r=M1();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Sk(){let{router:e}=vk(L1.UseNavigateStable),t=M1(D1.UseNavigateStable),n=b.useRef(!1);return R1(()=>{n.current=!0}),b.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,ro({fromRouteId:t},i)))},[e,t])}const gm={};function Pk(e,t,n){gm[e]||(gm[e]=!0)}function Ck(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function kk(e){return ck(e.context)}function Ea(e){Pe(!1)}function Ek(e){let{basename:t="/",children:n=null,location:r,navigationType:s=Vn.Pop,navigator:i,static:o=!1,future:a}=e;jo()&&Pe(!1);let l=t.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:l,navigator:i,static:o,future:ro({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof r=="string"&&(r=Js(r));let{pathname:c="/",search:d="",hash:f="",state:p=null,key:m="default"}=r,x=b.useMemo(()=>{let w=Bf(c,l);return w==null?null:{location:{pathname:w,search:d,hash:f,state:p,key:m},navigationType:s}},[l,c,d,f,p,m,s]);return x==null?null:b.createElement(zr.Provider,{value:u},b.createElement(Hl.Provider,{children:n,value:x}))}function Tk(e){let{children:t,location:n}=e;return dk(dd(t),n)}new Promise(()=>{});function dd(e,t){t===void 0&&(t=[]);let n=[];return b.Children.forEach(e,(r,s)=>{if(!b.isValidElement(r))return;let i=[...t,s];if(r.type===b.Fragment){n.push.apply(n,dd(r.props.children,i));return}r.type!==Ea&&Pe(!1),!r.props.index||!r.props.children||Pe(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=dd(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function fd(){return fd=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function Nk(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ok(e,t){return e.button===0&&(!t||t==="_self")&&!Nk(e)}const Rk=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Ak="6";try{window.__reactRouterVersion=Ak}catch{}const Lk="startTransition",ym=h2[Lk];function Dk(e){let{basename:t,children:n,future:r,window:s}=e,i=b.useRef();i.current==null&&(i.current=LC({window:s,v5Compat:!0}));let o=i.current,[a,l]=b.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=b.useCallback(d=>{u&&ym?ym(()=>l(d)):l(d)},[l,u]);return b.useLayoutEffect(()=>o.listen(c),[o,c]),b.useEffect(()=>Ck(r),[r]),b.createElement(Ek,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const Mk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Fk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Wf=b.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:a,target:l,to:u,preventScrollReset:c,viewTransition:d}=t,f=jk(t,Rk),{basename:p}=b.useContext(zr),m,x=!1;if(typeof u=="string"&&Fk.test(u)&&(m=u,Mk))try{let v=new URL(window.location.href),S=u.startsWith("//")?new URL(v.protocol+u):new URL(u),C=Bf(S.pathname,p);S.origin===v.origin&&C!=null?u=C+S.search+S.hash:x=!0}catch{}let w=ok(u,{relative:s}),y=Ik(u,{replace:o,state:a,target:l,preventScrollReset:c,relative:s,viewTransition:d});function g(v){r&&r(v),v.defaultPrevented||y(v)}return b.createElement("a",fd({},f,{href:m||w,onClick:x||i?r:g,ref:n,target:l}))});var vm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vm||(vm={}));var xm;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(xm||(xm={}));function Ik(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:a}=t===void 0?{}:t,l=ak(),u=Kl(),c=A1(e,{relative:o});return b.useCallback(d=>{if(Ok(d,n)){d.preventDefault();let f=r!==void 0?r:al(u)===al(c);l(e,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:a})}},[u,l,c,r,s,n,e,i,o,a])}var _k=({as:e="div",...t},n)=>h.jsx(e,{...t,ref:n}),Vk=b.forwardRef(_k),Uk="https://challenges.cloudflare.com/turnstile/v0/api.js",Hf="cf-turnstile-script",$k="cf-turnstile",Kf="onloadTurnstileCallback",F1=e=>!!document.getElementById(e),Bk=({render:e="explicit",onLoadCallbackName:t=Kf,scriptOptions:{nonce:n="",defer:r=!0,async:s=!0,id:i="",appendTo:o,onError:a,crossOrigin:l=""}={}})=>{let u=i||Hf;if(F1(u))return;let c=document.createElement("script");c.id=u,c.src=`${Uk}?onload=${t}&render=${e}`,!document.querySelector(`script[src="${c.src}"]`)&&(c.defer=!!r,c.async=!!s,n&&(c.nonce=n),l&&(c.crossOrigin=l),a&&(c.onerror=a,delete window[t]),(o==="body"?document.body:document.getElementsByTagName("head")[0]).appendChild(c))},ar={normal:{width:300,height:65},compact:{width:150,height:140},invisible:{width:0,height:0,overflow:"hidden"},flexible:{minWidth:300,width:"100%",height:65},interactionOnly:{width:"fit-content",height:"auto",display:"flex"}};function zk(e){if(e!=="invisible"&&e!=="interactionOnly")return e}function Wk(e=Hf){let[t,n]=b.useState(!1);return b.useEffect(()=>{let r=()=>{F1(e)&&n(!0)},s=new MutationObserver(r);return s.observe(document,{childList:!0,subtree:!0}),r(),()=>{s.disconnect()}},[e]),t}var Ai="unloaded",I1,Hk=new Promise((e,t)=>{I1={resolve:e,reject:t},Ai==="ready"&&e(void 0)}),Kk=(e=Kf)=>(Ai==="unloaded"&&(Ai="loading",window[e]=()=>{I1.resolve(),Ai="ready",delete window[e]}),Hk),qf=b.forwardRef((e,t)=>{let{scriptOptions:n,options:r={},siteKey:s,onWidgetLoad:i,onSuccess:o,onExpire:a,onError:l,onBeforeInteractive:u,onAfterInteractive:c,onUnsupported:d,onTimeout:f,onLoadScript:p,id:m,style:x,as:w="div",injectScript:y=!0,rerenderOnCallbackChange:g=!1,...v}=e,S=r.size,C=b.useCallback(()=>typeof S>"u"?{}:r.execution==="execute"?ar.invisible:r.appearance==="interaction-only"?ar.interactionOnly:ar[S],[r.execution,S,r.appearance]),[T,E]=b.useState(C()),j=b.useRef(null),[F,U]=b.useState(!1),B=b.useRef(),J=b.useRef(!1),me=m||$k,Z=b.useRef({onSuccess:o,onError:l,onExpire:a,onBeforeInteractive:u,onAfterInteractive:c,onUnsupported:d,onTimeout:f});b.useEffect(()=>{g||(Z.current={onSuccess:o,onError:l,onExpire:a,onBeforeInteractive:u,onAfterInteractive:c,onUnsupported:d,onTimeout:f})});let k=(n==null?void 0:n.id)||Hf,R=Wk(k),_=(n==null?void 0:n.onLoadCallbackName)||Kf,O=r.appearance||"always",D=b.useMemo(()=>({sitekey:s,action:r.action,cData:r.cData,theme:r.theme||"auto",language:r.language||"auto",tabindex:r.tabIndex,"response-field":r.responseField,"response-field-name":r.responseFieldName,size:zk(S),retry:r.retry||"auto","retry-interval":r.retryInterval||8e3,"refresh-expired":r.refreshExpired||"auto","refresh-timeout":r.refreshTimeout||"auto",execution:r.execution||"render",appearance:r.appearance||"always","feedback-enabled":r.feedbackEnabled||!0,callback:M=>{var $,K;J.current=!0,g?o==null||o(M):(K=($=Z.current).onSuccess)==null||K.call($,M)},"error-callback":g?l:(...M)=>{var $,K;return(K=($=Z.current).onError)==null?void 0:K.call($,...M)},"expired-callback":g?a:(...M)=>{var $,K;return(K=($=Z.current).onExpire)==null?void 0:K.call($,...M)},"before-interactive-callback":g?u:(...M)=>{var $,K;return(K=($=Z.current).onBeforeInteractive)==null?void 0:K.call($,...M)},"after-interactive-callback":g?c:(...M)=>{var $,K;return(K=($=Z.current).onAfterInteractive)==null?void 0:K.call($,...M)},"unsupported-callback":g?d:(...M)=>{var $,K;return(K=($=Z.current).onUnsupported)==null?void 0:K.call($,...M)},"timeout-callback":g?f:(...M)=>{var $,K;return(K=($=Z.current).onTimeout)==null?void 0:K.call($,...M)}}),[r.action,r.appearance,r.cData,r.execution,r.language,r.refreshExpired,r.responseField,r.responseFieldName,r.retry,r.retryInterval,r.tabIndex,r.theme,r.feedbackEnabled,r.refreshTimeout,s,S,g,g?o:null,g?l:null,g?a:null,g?u:null,g?c:null,g?d:null,g?f:null]),L=b.useCallback(()=>typeof window<"u"&&!!window.turnstile,[]);return b.useEffect(function(){y&&!F&&Bk({onLoadCallbackName:_,scriptOptions:{...n,id:k}})},[y,F,n,k]),b.useEffect(function(){Ai!=="ready"&&Kk(_).then(()=>U(!0)).catch(console.error)},[]),b.useEffect(function(){if(!j.current||!F)return;let M=!1;return(async()=>{if(M||!j.current)return;let $=window.turnstile.render(j.current,D);B.current=$,B.current&&(i==null||i(B.current))})(),()=>{M=!0,B.current&&(window.turnstile.remove(B.current),J.current=!1)}},[me,F,D]),b.useImperativeHandle(t,()=>{let{turnstile:M}=window;return{getResponse(){if(!(M!=null&&M.getResponse)||!B.current||!L()){console.warn("Turnstile has not been loaded");return}return M.getResponse(B.current)},async getResponsePromise($=3e4,K=100){return new Promise((ve,pt)=>{let W,Re=async()=>{if(J.current&&window.turnstile&&B.current)try{let Ft=window.turnstile.getResponse(B.current);return W&&clearTimeout(W),Ft?ve(Ft):pt(new Error("No response received"))}catch(Ft){return W&&clearTimeout(W),console.warn("Failed to get response",Ft),pt(new Error("Failed to get response"))}W||(W=setTimeout(()=>{W&&clearTimeout(W),pt(new Error("Timeout"))},$)),await new Promise(Ft=>setTimeout(Ft,K)),await Re()};Re()})},reset(){if(!(M!=null&&M.reset)||!B.current||!L()){console.warn("Turnstile has not been loaded");return}r.execution==="execute"&&E(ar.invisible);try{J.current=!1,M.reset(B.current)}catch($){console.warn(`Failed to reset Turnstile widget ${B}`,$)}},remove(){if(!(M!=null&&M.remove)||!B.current||!L()){console.warn("Turnstile has not been loaded");return}E(ar.invisible),J.current=!1,M.remove(B.current),B.current=null},render(){if(!(M!=null&&M.render)||!j.current||!L()||B.current){console.warn("Turnstile has not been loaded or container not found");return}let $=M.render(j.current,D);return B.current=$,B.current&&(i==null||i(B.current)),r.execution!=="execute"&&E(S?ar[S]:{}),$},execute(){if(r.execution!=="execute"){console.warn('Execution mode is not set to "execute"');return}if(!(M!=null&&M.execute)||!j.current||!B.current||!L()){console.warn("Turnstile has not been loaded or container not found");return}M.execute(j.current,D),E(S?ar[S]:{})},isExpired(){return!(M!=null&&M.isExpired)||!B.current||!L()?(console.warn("Turnstile has not been loaded"),!1):M.isExpired(B.current)}}},[B,r.execution,S,D,j,L,F,i]),b.useEffect(()=>{R&&!F&&window.turnstile&&U(!0)},[F,R]),b.useEffect(()=>{E(C())},[r.execution,S,O]),b.useEffect(()=>{!R||typeof p!="function"||p()},[R]),h.jsx(Vk,{ref:j,as:w,id:me,style:{...T,...x},...v})});qf.displayName="Turnstile";const wm=["admiring","adoring","affectionate","agitated","amazing","angry","awesome","beautiful","blissful","bold","boring","brave","busy","charming","clever","cool","compassionate","competent","condescending","confident","cranky","crazy","dazzling","determined","distracted","dreamy","eager","ecstatic","elastic","elated","elegant","eloquent","epic","exciting","fervent","festive","flamboyant","focused","friendly","frosty","funny","gallant","gifted","goofy","gracious","great","happy","hardcore","heuristic","hopeful","hungry","infallible","inspiring","interesting","intelligent","jolly","jovial","keen","kind","laughing","loving","lucid","magical","mystifying","modest","musing","naughty","nervous","nice","nifty","nostalgic","objective","optimistic","peaceful","pedantic","pensive","practical","priceless","quirky","quizzical","recursing","relaxed","reverent","romantic","sad","serene","sharp","silly","sleepy","stoic","strange","stupefied","suspicious","sweet","tender","thirsty","trusting","unruffled","upbeat","vibrant","vigilant","vigorous","wizardly","wonderful","xenodochial","youthful","zealous","zen"],bm=["albattani","allen","almeida","antonelli","agnesi","archimedes","ardinghelli","aryabhata","austin","babbage","banach","banzai","bardeen","bartik","bassi","beaver","bell","benz","bhabha","bhaskara","black","blackburn","blackwell","bohr","booth","borg","bose","bouman","boyd","brahmagupta","brattain","brown","buck","burnell","cannon","carson","cartwright","carver","cerf","chandrasekhar","chaplygin","chatelet","chatterjee","chebyshev","cohen","chaum","clarke","colden","cori","cray","curran","curie","darwin","davinci","dewdney","dhawan","diffie","dijkstra","dirac","driscoll","dubinsky","easley","edison","einstein","elbakyan","elgamal","elion","ellis","engelbart","euclid","euler","faraday","feistel","fermat","fermi","feynman","franklin","gagarin","galileo","galois","ganguly","gates","gauss","germain","goldberg","goldstine","goldwasser","golick","goodall","gould","greider","grothendieck","haibt","hamilton","haslett","hawking","hellman","heisenberg","hermann","herschel","hertz","heyrovsky","hodgkin","hofstadter","hoover","hopper","hugle","hypatia","ishizaka","jackson","jang","jemison","jennings","jepsen","johnson","joliot","jones","kalam","kapitsa","kare","keldysh","keller","kepler","khayyam","khorana","kilby","kirch","knuth","kowalevski","lalande","lamarr","lamport","leakey","leavitt","lederberg","lehmann","lewin","lichterman","liskov","lovelace","lumiere","mahavira","margulis","matsumoto","maxwell","mayer","mccarthy","mcclintock","mclaren","mclean","mcnulty","mendel","mendeleev","meitner","meninsky","merkle","mestorf","mirzakhani","montalcini","moore","morse","murdock","moser","napier","nash","neumann","newton","niel","nightingale","nobel","noether","northcutt","noyce","panini","pare","pascal","pasteur","payne","perlman","pike","poincare","poitras","proskuriakova","ptolemy","raman","ramanujan","ride","ritchie","rhodes","robinson","roentgen","rosalind","rubin","saha","sammet","sanderson","satoshi","shamir","shannon","shaw","shirley","shockley","shtern","sinoussi","snyder","solomon","spence","stonebraker","sutherland","swanson","swartz","swirles","taussig","tereshkova","tesla","tharp","thompson","torvalds","tu","turing","varahamihira","vaughan","visvesvaraya","volhard","villani","wescoff","wilbur","wiles","williams","williamson","wilson","wing","wozniak","wright","wu","yalow","yonath","zhukovsky"],_1=(e="",t="-")=>{const n=`${wm[Math.floor(Math.random()*wm.length)]??""}${t}${bm[Math.floor(Math.random()*bm.length)]??""}`;return n===`boring${t}wozniak`?_1(e,t):e.length>0?`${e}${t}${n}`:n};function qk(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},Pm=(e,t,n)=>{e.loadNamespaces(t,V1(e,n))},Cm=(e,t,n,r)=>{Nr(n)&&(n=[n]),n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,V1(e,r))},Qk=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=t.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||o(r,e)&&(!s||o(i,e)))},Gk=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(hd("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}):Qk(e,t,n)},Nr=e=>typeof e=="string",Yk=e=>typeof e=="object"&&e!==null,Xk=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Jk={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Zk=e=>Jk[e],eE=e=>e.replace(Xk,Zk);let pd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:eE};const tE=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pd={...pd,...e}},nE=()=>pd;let U1;const rE=e=>{U1=e},sE=()=>U1,iE={type:"3rdParty",init(e){tE(e.options.react),rE(e)}},oE=b.createContext();class aE{constructor(){Lh(this,"getUsedNamespaces",()=>Object.keys(this.usedNamespaces));this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}}const lE=(e,t)=>{const n=b.useRef();return b.useEffect(()=>{n.current=e},[e,t]),n.current},$1=(e,t,n,r)=>e.getFixedT(t,n,r),uE=(e,t,n,r)=>b.useCallback($1(e,t,n,r),[e,t,n,r]),sr=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=b.useContext(oE)||{},i=n||r||sE();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new aE),!i){hd("You will need to pass in an i18next instance by using initReactI18next");const S=(T,E)=>Nr(E)?E:Yk(E)&&Nr(E.defaultValue)?E.defaultValue:Array.isArray(T)?T[T.length-1]:T,C=[S,{},!1];return C.t=S,C.i18n={},C.ready=!1,C}i.options.react&&i.options.react.wait!==void 0&&hd("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...nE(),...i.options.react,...t},{useSuspense:a,keyPrefix:l}=o;let u=s||i.options&&i.options.defaultNS;u=Nr(u)?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const c=(i.isInitialized||i.initializedStoreOnce)&&u.every(S=>Gk(S,i,o)),d=uE(i,t.lng||null,o.nsMode==="fallback"?u:u[0],l),f=()=>d,p=()=>$1(i,t.lng||null,o.nsMode==="fallback"?u:u[0],l),[m,x]=b.useState(f);let w=u.join();t.lng&&(w=`${t.lng}${w}`);const y=lE(w),g=b.useRef(!0);b.useEffect(()=>{const{bindI18n:S,bindI18nStore:C}=o;g.current=!0,!c&&!a&&(t.lng?Cm(i,t.lng,u,()=>{g.current&&x(p)}):Pm(i,u,()=>{g.current&&x(p)})),c&&y&&y!==w&&g.current&&x(p);const T=()=>{g.current&&x(p)};return S&&i&&i.on(S,T),C&&i&&i.store.on(C,T),()=>{g.current=!1,S&&i&&S.split(" ").forEach(E=>i.off(E,T)),C&&i&&C.split(" ").forEach(E=>i.store.off(E,T))}},[i,w]),b.useEffect(()=>{g.current&&c&&x(f)},[i,l,c]);const v=[m,i,c];if(v.t=m,v.i18n=i,v.ready=c,c||!c&&!a)return v;throw new Promise(S=>{t.lng?Cm(i,t.lng,u,()=>S()):Pm(i,u,()=>S())})};/*! js-cookie v3.0.5 | MIT */function ea(e){for(var t=1;t"u")){o=ea({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,o[l]!==!0&&(a+="="+o[l].split(";")[0]));return document.cookie=s+"="+e.write(i,s)+a}}function r(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],o={},a=0;a{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||dE},hE=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,pE=/\/\*[^]*?\*\/| +/g,km=/\n+/g,jn=(e,t)=>{let n="",r="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?n=i+" "+o+";":r+=i[1]=="f"?jn(o,i):i+"{"+jn(o,i[1]=="k"?"":t)+"}":typeof o=="object"?r+=jn(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):i):o!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=jn.p?jn.p(i,o):i+":"+o+";")}return n+(t&&s?t+"{"+s+"}":s)+r},en={},B1=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+B1(e[n]);return t}return e},mE=(e,t,n,r,s)=>{let i=B1(e),o=en[i]||(en[i]=(l=>{let u=0,c=11;for(;u>>0;return"go"+c})(i));if(!en[o]){let l=i!==e?e:(u=>{let c,d,f=[{}];for(;c=hE.exec(u.replace(pE,""));)c[4]?f.shift():c[3]?(d=c[3].replace(km," ").trim(),f.unshift(f[0][d]=f[0][d]||{})):f[0][c[1]]=c[2].replace(km," ").trim();return f[0]})(e);en[o]=jn(s?{["@keyframes "+o]:l}:l,n?"":"."+o)}let a=n&&en.g?en.g:null;return n&&(en.g=en[o]),((l,u,c,d)=>{d?u.data=u.data.replace(d,l):u.data.indexOf(l)===-1&&(u.data=c?l+u.data:u.data+l)})(en[o],t,r,a),o},gE=(e,t,n)=>e.reduce((r,s,i)=>{let o=t[i];if(o&&o.call){let a=o(n),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=l?"."+l:a&&typeof a=="object"?a.props?"":jn(a,""):a===!1?"":a}return r+s+(o??"")},"");function ql(e){let t=this||{},n=e.call?e(t.p):e;return mE(n.unshift?n.raw?gE(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,fE(t.target),t.g,t.o,t.k)}let z1,gd,yd;ql.bind({g:1});let yn=ql.bind({k:1});function yE(e,t,n,r){jn.p=t,z1=e,gd=n,yd=r}function ir(e,t){let n=this||{};return function(){let r=arguments;function s(i,o){let a=Object.assign({},i),l=a.className||s.className;n.p=Object.assign({theme:gd&&gd()},a),n.o=/ *go\d+/.test(l),a.className=ql.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),yd&&u[0]&&yd(a),z1(u,a)}return s}}var vE=e=>typeof e=="function",ll=(e,t)=>vE(e)?e(t):e,xE=(()=>{let e=0;return()=>(++e).toString()})(),W1=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),wE=20,Qf="default",H1=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:r}=t;return H1(e,{type:e.toasts.find(o=>o.id===r.id)?1:0,toast:r});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},Ta=[],K1={toasts:[],pausedAt:void 0,settings:{toastLimit:wE}},Qt={},q1=(e,t=Qf)=>{Qt[t]=H1(Qt[t]||K1,e),Ta.forEach(([n,r])=>{n===t&&r(Qt[t])})},Q1=e=>Object.keys(Qt).forEach(t=>q1(e,t)),bE=e=>Object.keys(Qt).find(t=>Qt[t].toasts.some(n=>n.id===e)),Ql=(e=Qf)=>t=>{q1(t,e)},SE={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},PE=(e={},t=Qf)=>{let[n,r]=b.useState(Qt[t]||K1),s=b.useRef(Qt[t]);b.useEffect(()=>(s.current!==Qt[t]&&r(Qt[t]),Ta.push([t,r]),()=>{let o=Ta.findIndex(([a])=>a===t);o>-1&&Ta.splice(o,1)}),[t]);let i=n.toasts.map(o=>{var a,l,u;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((l=e[o.type])==null?void 0:l.duration)||(e==null?void 0:e.duration)||SE[o.type],style:{...e.style,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...n,toasts:i}},CE=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||xE()}),No=e=>(t,n)=>{let r=CE(t,e,n);return Ql(r.toasterId||bE(r.id))({type:2,toast:r}),r.id},Y=(e,t)=>No("blank")(e,t);Y.error=No("error");Y.success=No("success");Y.loading=No("loading");Y.custom=No("custom");Y.dismiss=(e,t)=>{let n={type:3,toastId:e};t?Ql(t)(n):Q1(n)};Y.dismissAll=e=>Y.dismiss(void 0,e);Y.remove=(e,t)=>{let n={type:4,toastId:e};t?Ql(t)(n):Q1(n)};Y.removeAll=e=>Y.remove(void 0,e);Y.promise=(e,t,n)=>{let r=Y.loading(t.loading,{...n,...n==null?void 0:n.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?ll(t.success,s):void 0;return i?Y.success(i,{id:r,...n,...n==null?void 0:n.success}):Y.dismiss(r),s}).catch(s=>{let i=t.error?ll(t.error,s):void 0;i?Y.error(i,{id:r,...n,...n==null?void 0:n.error}):Y.dismiss(r)}),e};var kE=1e3,EE=(e,t="default")=>{let{toasts:n,pausedAt:r}=PE(e,t),s=b.useRef(new Map).current,i=b.useCallback((d,f=kE)=>{if(s.has(d))return;let p=setTimeout(()=>{s.delete(d),o({type:4,toastId:d})},f);s.set(d,p)},[]);b.useEffect(()=>{if(r)return;let d=Date.now(),f=n.map(p=>{if(p.duration===1/0)return;let m=(p.duration||0)+p.pauseDuration-(d-p.createdAt);if(m<0){p.visible&&Y.dismiss(p.id);return}return setTimeout(()=>Y.dismiss(p.id,t),m)});return()=>{f.forEach(p=>p&&clearTimeout(p))}},[n,r,t]);let o=b.useCallback(Ql(t),[t]),a=b.useCallback(()=>{o({type:5,time:Date.now()})},[o]),l=b.useCallback((d,f)=>{o({type:1,toast:{id:d,height:f}})},[o]),u=b.useCallback(()=>{r&&o({type:6,time:Date.now()})},[r,o]),c=b.useCallback((d,f)=>{let{reverseOrder:p=!1,gutter:m=8,defaultPosition:x}=f||{},w=n.filter(v=>(v.position||x)===(d.position||x)&&v.height),y=w.findIndex(v=>v.id===d.id),g=w.filter((v,S)=>Sv.visible).slice(...p?[g+1]:[0,g]).reduce((v,S)=>v+(S.height||0)+m,0)},[n]);return b.useEffect(()=>{n.forEach(d=>{if(d.dismissed)i(d.id,d.removeDelay);else{let f=s.get(d.id);f&&(clearTimeout(f),s.delete(d.id))}})},[n,i]),{toasts:n,handlers:{updateHeight:l,startPause:a,endPause:u,calculateOffset:c}}},TE=yn` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,jE=yn` +from { + transform: scale(0); + opacity: 0; +} +to { + transform: scale(1); + opacity: 1; +}`,NE=yn` +from { + transform: scale(0) rotate(90deg); + opacity: 0; +} +to { + transform: scale(1) rotate(90deg); + opacity: 1; +}`,OE=ir("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${e=>e.primary||"#ff4b4b"}; + position: relative; + transform: rotate(45deg); + + animation: ${TE} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + + &:after, + &:before { + content: ''; + animation: ${jE} 0.15s ease-out forwards; + animation-delay: 150ms; + position: absolute; + border-radius: 3px; + opacity: 0; + background: ${e=>e.secondary||"#fff"}; + bottom: 9px; + left: 4px; + height: 2px; + width: 12px; + } + + &:before { + animation: ${NE} 0.15s ease-out forwards; + animation-delay: 180ms; + transform: rotate(90deg); + } +`,RE=yn` + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +`,AE=ir("div")` + width: 12px; + height: 12px; + box-sizing: border-box; + border: 2px solid; + border-radius: 100%; + border-color: ${e=>e.secondary||"#e0e0e0"}; + border-right-color: ${e=>e.primary||"#616161"}; + animation: ${RE} 1s linear infinite; +`,LE=yn` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,DE=yn` +0% { + height: 0; + width: 0; + opacity: 0; +} +40% { + height: 0; + width: 6px; + opacity: 1; +} +100% { + opacity: 1; + height: 10px; +}`,ME=ir("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${e=>e.primary||"#61d345"}; + position: relative; + transform: rotate(45deg); + + animation: ${LE} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + &:after { + content: ''; + box-sizing: border-box; + animation: ${DE} 0.2s ease-out forwards; + opacity: 0; + animation-delay: 200ms; + position: absolute; + border-right: 2px solid; + border-bottom: 2px solid; + border-color: ${e=>e.secondary||"#fff"}; + bottom: 6px; + left: 6px; + height: 10px; + width: 6px; + } +`,FE=ir("div")` + position: absolute; +`,IE=ir("div")` + position: relative; + display: flex; + justify-content: center; + align-items: center; + min-width: 20px; + min-height: 20px; +`,_E=yn` +from { + transform: scale(0.6); + opacity: 0.4; +} +to { + transform: scale(1); + opacity: 1; +}`,VE=ir("div")` + position: relative; + transform: scale(0.6); + opacity: 0.4; + min-width: 20px; + animation: ${_E} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; +`,UE=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?b.createElement(VE,null,t):t:n==="blank"?null:b.createElement(IE,null,b.createElement(AE,{...r}),n!=="loading"&&b.createElement(FE,null,n==="error"?b.createElement(OE,{...r}):b.createElement(ME,{...r})))},$E=e=>` +0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} +100% {transform: translate3d(0,0,0) scale(1); opacity:1;} +`,BE=e=>` +0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} +100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} +`,zE="0%{opacity:0;} 100%{opacity:1;}",WE="0%{opacity:1;} 100%{opacity:0;}",HE=ir("div")` + display: flex; + align-items: center; + background: #fff; + color: #363636; + line-height: 1.3; + will-change: transform; + box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); + max-width: 350px; + pointer-events: auto; + padding: 8px 10px; + border-radius: 8px; +`,KE=ir("div")` + display: flex; + justify-content: center; + margin: 4px 10px; + color: inherit; + flex: 1 1 auto; + white-space: pre-line; +`,qE=(e,t)=>{let n=e.includes("top")?1:-1,[r,s]=W1()?[zE,WE]:[$E(n),BE(n)];return{animation:t?`${yn(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${yn(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},QE=b.memo(({toast:e,position:t,style:n,children:r})=>{let s=e.height?qE(e.position||t||"top-center",e.visible):{opacity:0},i=b.createElement(UE,{toast:e}),o=b.createElement(KE,{...e.ariaProps},ll(e.message,e));return b.createElement(HE,{className:e.className,style:{...s,...n,...e.style}},typeof r=="function"?r({icon:i,message:o}):b.createElement(b.Fragment,null,i,o))});yE(b.createElement);var GE=({id:e,className:t,style:n,onHeightUpdate:r,children:s})=>{let i=b.useCallback(o=>{if(o){let a=()=>{let l=o.getBoundingClientRect().height;r(e,l)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return b.createElement("div",{ref:i,className:t,style:n},s)},YE=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:W1()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...s}},XE=ql` + z-index: 9999; + > * { + pointer-events: auto; + } +`,ta=16,JE=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:l,handlers:u}=EE(n,i);return b.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:ta,left:ta,right:ta,bottom:ta,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(c=>{let d=c.position||t,f=u.calculateOffset(c,{reverseOrder:e,gutter:r,defaultPosition:t}),p=YE(d,f);return b.createElement(GE,{id:c.id,key:c.id,onHeightUpdate:u.updateHeight,className:c.visible?XE:"",style:p},c.type==="custom"?ll(c.message,c):s?s(c):b.createElement(QE,{toast:c,position:d}))}))},ZE=Y;function ie(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function _r(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const G1=6048e5,e3=864e5,na=43200,Em=1440;let t3={};function Oo(){return t3}function Vr(e,t){var a,l,u,c;const n=Oo(),r=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((c=(u=n.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,s=ie(e),i=s.getDay(),o=(i=s.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function Tm(e){const t=ie(e);return t.setHours(0,0,0,0),t}function cl(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function n3(e,t){const n=Tm(e),r=Tm(t),s=n.getTime()-cl(n),i=r.getTime()-cl(r);return Math.round((s-i)/e3)}function r3(e){const t=Y1(e),n=_r(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ul(n)}function ja(e,t){const n=ie(e),r=ie(t),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function s3(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function i3(e){if(!s3(e)&&typeof e!="number")return!1;const t=ie(e);return!isNaN(Number(t))}function o3(e,t){const n=ie(e),r=ie(t),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function a3(e){return e?Math[e]:Math.trunc}function l3(e,t){return ie(e).getTime()-ie(t).getTime()}function u3(e){const t=ie(e);return t.setHours(23,59,59,999),t}function c3(e){const t=ie(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function d3(e){const t=ie(e);return+u3(t)==+c3(t)}function f3(e,t){const n=ie(e),r=ie(t),s=ja(n,r),i=Math.abs(o3(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let a=ja(n,r)===-s;d3(ie(e))&&i===1&&ja(e,r)===1&&(a=!1),o=s*(i-Number(a))}return o===0?0:o}function h3(e,t,n){const r=l3(e,t)/1e3;return a3(n==null?void 0:n.roundingMethod)(r)}function p3(e){const t=ie(e),n=_r(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const m3={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},g3=(e,t,n)=>{let r;const s=m3[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function vs(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const y3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},v3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},x3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},w3={date:vs({formats:y3,defaultWidth:"full"}),time:vs({formats:v3,defaultWidth:"full"}),dateTime:vs({formats:x3,defaultWidth:"full"})},b3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},S3=(e,t,n,r)=>b3[e];function Kt(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):o;s=e.formattingValues[a]||e.formattingValues[o]}else{const o=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[a]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const P3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},C3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},k3={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},E3={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},T3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},j3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},N3=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},O3={ordinalNumber:N3,era:Kt({values:P3,defaultWidth:"wide"}),quarter:Kt({values:C3,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Kt({values:k3,defaultWidth:"wide"}),day:Kt({values:E3,defaultWidth:"wide"}),dayPeriod:Kt({values:T3,defaultWidth:"wide",formattingValues:j3,defaultFormattingWidth:"wide"})};function qt(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?A3(a,d=>d.test(o)):R3(a,d=>d.test(o));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;const c=t.slice(o.length);return{value:u,rest:c}}}function R3(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function A3(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const a=t.slice(s.length);return{value:o,rest:a}}}const L3=/^(\d+)(th|st|nd|rd)?/i,D3=/\d+/i,M3={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},F3={any:[/^b/i,/^(a|c)/i]},I3={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},_3={any:[/1/i,/2/i,/3/i,/4/i]},V3={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},U3={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},$3={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},B3={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},z3={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},W3={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},H3={ordinalNumber:X1({matchPattern:L3,parsePattern:D3,valueCallback:e=>parseInt(e,10)}),era:qt({matchPatterns:M3,defaultMatchWidth:"wide",parsePatterns:F3,defaultParseWidth:"any"}),quarter:qt({matchPatterns:I3,defaultMatchWidth:"wide",parsePatterns:_3,defaultParseWidth:"any",valueCallback:e=>e+1}),month:qt({matchPatterns:V3,defaultMatchWidth:"wide",parsePatterns:U3,defaultParseWidth:"any"}),day:qt({matchPatterns:$3,defaultMatchWidth:"wide",parsePatterns:B3,defaultParseWidth:"any"}),dayPeriod:qt({matchPatterns:z3,defaultMatchWidth:"any",parsePatterns:W3,defaultParseWidth:"any"})},J1={code:"en-US",formatDistance:g3,formatLong:w3,formatRelative:S3,localize:O3,match:H3,options:{weekStartsOn:0,firstWeekContainsDate:1}};function K3(e){const t=ie(e);return n3(t,p3(t))+1}function q3(e){const t=ie(e),n=ul(t).getTime()-r3(t).getTime();return Math.round(n/G1)+1}function Z1(e,t){var c,d,f,p;const n=ie(e),r=n.getFullYear(),s=Oo(),i=(t==null?void 0:t.firstWeekContainsDate)??((d=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(f=s.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=_r(e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const a=Vr(o,t),l=_r(e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const u=Vr(l,t);return n.getTime()>=a.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function Q3(e,t){var a,l,u,c;const n=Oo(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((c=(u=n.locale)==null?void 0:u.options)==null?void 0:c.firstWeekContainsDate)??1,s=Z1(e,t),i=_r(e,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Vr(i,t)}function G3(e,t){const n=ie(e),r=Vr(n,t).getTime()-Q3(n,t).getTime();return Math.round(r/G1)+1}function ne(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const bn={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return ne(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ne(n+1,2)},d(e,t){return ne(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ne(e.getHours()%12||12,t.length)},H(e,t){return ne(e.getHours(),t.length)},m(e,t){return ne(e.getMinutes(),t.length)},s(e,t){return ne(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.floor(r*Math.pow(10,n-3));return ne(s,t.length)}},Kr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Y3={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return bn.y(e,t)},Y:function(e,t,n,r){const s=Z1(e,r),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return ne(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):ne(i,t.length)},R:function(e,t){const n=Y1(e);return ne(n,t.length)},u:function(e,t){const n=e.getFullYear();return ne(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return ne(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return ne(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return bn.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return ne(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=G3(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):ne(s,t.length)},I:function(e,t,n){const r=q3(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):ne(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):bn.d(e,t)},D:function(e,t,n){const r=K3(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ne(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return ne(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return ne(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return ne(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=Kr.noon:r===0?s=Kr.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=Kr.evening:r>=12?s=Kr.afternoon:r>=4?s=Kr.morning:s=Kr.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return bn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):bn.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ne(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):ne(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):bn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):bn.s(e,t)},S:function(e,t){return bn.S(e,t)},X:function(e,t,n,r){const i=(r._originalDate||e).getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Nm(i);case"XXXX":case"XX":return dr(i);case"XXXXX":case"XXX":default:return dr(i,":")}},x:function(e,t,n,r){const i=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Nm(i);case"xxxx":case"xx":return dr(i);case"xxxxx":case"xxx":default:return dr(i,":")}},O:function(e,t,n,r){const i=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+jm(i,":");case"OOOO":default:return"GMT"+dr(i,":")}},z:function(e,t,n,r){const i=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+jm(i,":");case"zzzz":default:return"GMT"+dr(i,":")}},t:function(e,t,n,r){const s=r._originalDate||e,i=Math.floor(s.getTime()/1e3);return ne(i,t.length)},T:function(e,t,n,r){const i=(r._originalDate||e).getTime();return ne(i,t.length)}};function jm(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),i=r%60;return i===0?n+String(s):n+String(s)+t+ne(i,2)}function Nm(e,t){return e%60===0?(e>0?"-":"+")+ne(Math.abs(e)/60,2):dr(e,t)}function dr(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=ne(Math.floor(r/60),2),i=ne(r%60,2);return n+s+t+i}const Om=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ex=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},X3=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return Om(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",Om(r,t)).replace("{{time}}",ex(s,t))},J3={p:ex,P:X3},Z3=/^D+$/,eT=/^Y+$/,tT=["D","DD","YY","YYYY"];function nT(e){return Z3.test(e)}function rT(e){return eT.test(e)}function Rm(e,t,n){const r=sT(e,t,n);if(console.warn(r),tT.includes(e))throw new RangeError(r)}function sT(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const iT=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,oT=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,aT=/^'([^]*?)'?$/,lT=/''/g,uT=/[a-zA-Z]/;function cT(e,t,n){var c,d,f,p;const r=Oo(),s=r.locale??J1,i=r.firstWeekContainsDate??((d=(c=r.locale)==null?void 0:c.options)==null?void 0:d.firstWeekContainsDate)??1,o=r.weekStartsOn??((p=(f=r.locale)==null?void 0:f.options)==null?void 0:p.weekStartsOn)??0,a=ie(e);if(!i3(a))throw new RangeError("Invalid time value");const l={firstWeekContainsDate:i,weekStartsOn:o,locale:s,_originalDate:a};return t.match(oT).map(function(m){const x=m[0];if(x==="p"||x==="P"){const w=J3[x];return w(m,s.formatLong)}return m}).join("").match(iT).map(function(m){if(m==="''")return"'";const x=m[0];if(x==="'")return dT(m);const w=Y3[x];if(w)return rT(m)&&Rm(m,t,String(e)),nT(m)&&Rm(m,t,String(e)),w(a,m,s.localize,l);if(x.match(uT))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return m}).join("")}function dT(e){const t=e.match(aT);return t?t[1].replace(lT,"'"):e}function fT(e,t,n){const r=Oo(),s=(n==null?void 0:n.locale)??r.locale??J1,i=2520,o=ja(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let l,u;o>0?(l=ie(t),u=ie(e)):(l=ie(e),u=ie(t));const c=h3(u,l),d=(cl(u)-cl(l))/1e3,f=Math.round((c-d)/60);let p;if(f<2)return n!=null&&n.includeSeconds?c<5?s.formatDistance("lessThanXSeconds",5,a):c<10?s.formatDistance("lessThanXSeconds",10,a):c<20?s.formatDistance("lessThanXSeconds",20,a):c<40?s.formatDistance("halfAMinute",0,a):c<60?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",1,a):f===0?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",f,a);if(f<45)return s.formatDistance("xMinutes",f,a);if(f<90)return s.formatDistance("aboutXHours",1,a);if(f{let r;const s=mT[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},yT={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},vT={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},xT={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},wT={date:vs({formats:yT,defaultWidth:"full"}),time:vs({formats:vT,defaultWidth:"full"}),dateTime:vs({formats:xT,defaultWidth:"full"})};function Am(e,t,n){const r="eeee p";return pT(e,t,n)?r:e.getTime()>t.getTime()?"'下个'"+r:"'上个'"+r}const bT={lastWeek:Am,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Am,other:"PP p"},ST=(e,t,n,r)=>{const s=bT[e];return typeof s=="function"?s(t,n,r):s},PT={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},CT={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},kT={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},ET={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},TT={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},jT={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},NT=(e,t)=>{const n=Number(e);switch(t==null?void 0:t.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},OT={ordinalNumber:NT,era:Kt({values:PT,defaultWidth:"wide"}),quarter:Kt({values:CT,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Kt({values:kT,defaultWidth:"wide"}),day:Kt({values:ET,defaultWidth:"wide"}),dayPeriod:Kt({values:TT,defaultWidth:"wide",formattingValues:jT,defaultFormattingWidth:"wide"})},RT=/^(第\s*)?\d+(日|时|分|秒)?/i,AT=/\d+/i,LT={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},DT={any:[/^(前)/i,/^(公元)/i]},MT={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},FT={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},IT={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},_T={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},VT={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},UT={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},$T={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},BT={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},zT={ordinalNumber:X1({matchPattern:RT,parsePattern:AT,valueCallback:e=>parseInt(e,10)}),era:qt({matchPatterns:LT,defaultMatchWidth:"wide",parsePatterns:DT,defaultParseWidth:"any"}),quarter:qt({matchPatterns:MT,defaultMatchWidth:"wide",parsePatterns:FT,defaultParseWidth:"any",valueCallback:e=>e+1}),month:qt({matchPatterns:IT,defaultMatchWidth:"wide",parsePatterns:_T,defaultParseWidth:"any"}),day:qt({matchPatterns:VT,defaultMatchWidth:"wide",parsePatterns:UT,defaultParseWidth:"any"}),dayPeriod:qt({matchPatterns:$T,defaultMatchWidth:"any",parsePatterns:BT,defaultParseWidth:"any"})},WT={code:"zh-CN",formatDistance:gT,formatLong:wT,formatRelative:ST,localize:OT,match:zT,options:{weekStartsOn:1,firstWeekContainsDate:4}};function tx(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t${e.text}`,className:"w-full h-[60vh] border-0",sandbox:"allow-popups allow-popups-to-escape-sandbox",title:"Email Content"})})]})}function qT(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})})}function QT(e){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M20.25 20.25v-4.5m0 4.5h-4.5m4.5 0L15 15M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15m11.25-6L15 9"})})}function GT({emails:e,isLoading:t,isFetching:n,onDelete:r,isDeleting:s,onRefresh:i,selectedIds:o,setSelectedIds:a,isAddressCreated:l,onSelectEmail:u,showViewPasswordButton:c,onShowPassword:d,selectedEmail:f,onCloseDetail:p,onExpand:m}){const{t:x}=sr(),w=v=>{a(S=>S.includes(v)?S.filter(C=>C!==v):[...S,v])},y=()=>{e.length!==0&&(o.length===e.length?a([]):a(e.map(v=>v.id)))},g=()=>f?h.jsx(sx,{email:f,onClose:p}):l?t?h.jsxs("div",{className:"w-full items-center h-full flex-col justify-center flex",children:[h.jsx(Lm,{}),h.jsx("p",{className:"text-zinc-400 mt-6",children:x("Waiting for emails...")})]}):e.length===0?h.jsxs("div",{className:"w-full items-center h-full flex-col justify-center flex",children:[h.jsx(Lm,{}),h.jsx("p",{className:"text-zinc-400 mt-6",children:x("Waiting for emails...")})]}):e.map(v=>{var S,C;return h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-neutral-300 bg-neutral-100 data-[state=checked]:border-neutral-900 data-[state=checked]:bg-neutral-600 data-[state=checked]:text-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:data-[state=checked]:border-neutral-300 dark:data-[state=checked]:bg-neutral-300",checked:o.includes(v.id),onChange:()=>w(v.id)}),h.jsxs("div",{onClick:()=>u(v),className:"cursor-pointer flex-1 flex flex-col items-start gap-2 rounded-lg border border-zinc-600 p-3 text-left text-sm transition-all hover:bg-zinc-700",children:[h.jsxs("div",{className:"flex w-full flex-col gap-1",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsxs("div",{className:"font-semibold",children:[((S=v.from)==null?void 0:S.name)||v.messageFrom," ",((C=v.from)==null?void 0:C.address)&&`(${v.from.address})`]})}),h.jsx("div",{className:"ml-auto text-xs",children:hT(new Date(v.date||v.createdAt),{addSuffix:!0,locale:WT})})]}),h.jsx("div",{className:"text-xs font-medium",children:v.subject})]}),h.jsx("div",{className:"line-clamp-2 text-xs text-zinc-300 font-normal w-full",children:(v.text||v.html||"").substring(0,300)})]})]},v.id)}):h.jsxs("div",{className:"w-full items-center h-full flex-col justify-center flex",children:[h.jsx(HT,{}),h.jsx("p",{className:"text-zinc-400 mt-6",children:"请先创建一个临时邮箱地址"})]});return h.jsxs("div",{className:"rounded-md border border-cyan-50/20 text-white",children:[h.jsxs("div",{className:"w-full rounded-t-md p-2 flex items-center bg-zinc-800 text-zinc-200 gap-2",children:[h.jsxs("div",{className:"flex items-center justify-start gap-2 font-bold",children:[h.jsx(nx,{className:"size-6"}),x("INBOX"),l&&e.length>0&&!f&&h.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-zinc-600 rounded-full",children:e.length}),f&&h.jsxs("button",{onClick:p,className:"flex items-center gap-1 text-sm font-semibold text-cyan-400 hover:text-cyan-300 ml-2",children:[h.jsx(qT,{}),"返回邮件列表"]})]}),h.jsx("div",{className:"ml-auto flex items-center gap-2",children:f?h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:m,className:"p-1 rounded text-cyan-400 hover:text-cyan-300",title:"放大",children:h.jsx(QT,{className:"w-5 h-5"})}),h.jsx("button",{onClick:()=>r([f.id]),disabled:s,className:"p-1 rounded text-red-500 disabled:text-gray-500 hover:text-red-400",title:"删除",children:h.jsx(Dm,{className:"w-5 h-5"})})]}):h.jsxs(h.Fragment,{children:[c&&h.jsx("button",{className:"p-1 rounded text-cyan-400 hover:text-cyan-300",title:"查看密码",onClick:d,children:h.jsx(vd,{className:"w-5 h-5"})}),l&&e.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded bg-zinc-700 border-zinc-600 text-cyan-600 focus:ring-cyan-500",title:"全选",checked:o.length===e.length&&e.length>0,onChange:y}),h.jsx("button",{onClick:()=>r(o),disabled:o.length===0||s,className:"p-1 rounded text-red-500 disabled:text-gray-500 hover:text-red-400",title:"删除选中",children:h.jsx(Dm,{className:"w-5 h-5"})})]}),h.jsx("button",{className:"p-1 rounded",title:"refresh",onClick:i,disabled:!l||n,children:h.jsx(rx,{className:so("size-6",l&&"animate-spin")})})]})})]}),h.jsx("div",{className:so("flex flex-col flex-1 overflow-y-auto p-2",!f&&"grids h-[488px]"),children:g()})]})}function YT(e){return h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),h.jsx("path",{d:"M5 12l5 5l10 -10"})]})}function XT(e){return h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[h.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),h.jsx("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),h.jsx("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"})]})}function xd({text:e,className:t}){const[n,r]=b.useState(!1),{t:s}=sr(),i=async()=>{try{await navigator.clipboard.writeText(e),r(!0),Y.success(s("Copied to clipboard"))}catch(o){console.error("复制文本失败: ",o)}};return b.useEffect(()=>{if(n){const o=setTimeout(()=>{r(!1)},2e3);return()=>clearTimeout(o)}},[n]),h.jsx("button",{onClick:i,className:so("focus:outline-none focus-visible:outline-none",t),"aria-label":"Copy to clipboard",children:n?h.jsx(YT,{className:"h-5 w-5 text-green-500"}):h.jsx(XT,{className:"h-5 w-5 text-gray-400"})})}const Gl="/api";async function JT(e){const t=await fetch(`${Gl}/emails`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});if(!t.ok)throw new Error("Network response was not ok");return t.json()}async function ZT(e){const t=await fetch(`${Gl}/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});if(!t.ok){const n=await t.json();throw new Error(n.message||"Turnstile verification failed")}return t.json()}async function ej(e){const t=await fetch(`${Gl}/delete-emails`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})});if(!t.ok)throw new Error("Failed to delete emails");return t.json()}async function tj(e){const t=await fetch(`${Gl}/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(!t.ok){const n=await t.json();throw new Error(n.message||"Login failed")}return t.json()}const ix=b.createContext(null),ox=()=>{const e=b.useContext(ix);if(!e)throw new Error("useConfig 必须在 ConfigProvider 内部使用");return e};function nj(){const e="abcdefghijklmnopqrstuvwxyz.";return e.charAt(Math.floor(Math.random()*e.length))}function rj(e,t){let n="";for(let r=0;r{function n(){t({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)},[]),{windowSize:e,isMobile:typeof(e==null?void 0:e.width)=="number"&&(e==null?void 0:e.width)<768,isDesktop:typeof(e==null?void 0:e.width)=="number"&&(e==null?void 0:e.width)>=768}}const Gf=b.createContext({});function Yl(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const Xl=b.createContext(null),Yf=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class ij extends b.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function oj({children:e,isPresent:t}){const n=b.useId(),r=b.useRef(null),s=b.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=b.useContext(Yf);return b.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=s.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return i&&(c.nonce=i),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${l}px !important; + left: ${u}px !important; + } + `),()=>{document.head.removeChild(c)}},[t]),h.jsx(ij,{isPresent:t,childRef:r,sizeRef:s,children:b.cloneElement(e,{ref:r})})}const aj=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=Yl(lj),l=b.useId(),u=b.useCallback(d=>{a.set(d,!0);for(const f of a.values())if(!f)return;r&&r()},[a,r]),c=b.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:u,register:d=>(a.set(d,!1),()=>a.delete(d))}),i?[Math.random(),u]:[n,u]);return b.useMemo(()=>{a.forEach((d,f)=>a.set(f,!1))},[n]),b.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(e=h.jsx(oj,{isPresent:n,children:e})),h.jsx(Xl.Provider,{value:c,children:e})};function lj(){return new Map}function ax(e=!0){const t=b.useContext(Xl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=b.useId();b.useEffect(()=>{e&&s(i)},[e]);const o=b.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const ra=e=>e.key||"";function Mm(e){const t=[];return b.Children.forEach(e,n=>{b.isValidElement(n)&&t.push(n)}),t}const Xf=typeof window<"u",Jf=Xf?b.useLayoutEffect:b.useEffect,uj=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[a,l]=ax(o),u=b.useMemo(()=>Mm(e),[e]),c=o&&!a?[]:u.map(ra),d=b.useRef(!0),f=b.useRef(u),p=Yl(()=>new Map),[m,x]=b.useState(u),[w,y]=b.useState(u);Jf(()=>{d.current=!1,f.current=u;for(let S=0;S{const C=ra(S),T=o&&!a?!1:u===w||c.includes(C),E=()=>{if(p.has(C))p.set(C,!0);else return;let j=!0;p.forEach(F=>{F||(j=!1)}),j&&(v==null||v(),y(f.current),o&&(l==null||l()),r&&r())};return h.jsx(aj,{isPresent:T,initial:!d.current||n?void 0:!1,custom:T?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:T?void 0:E,children:S},C)})})},ut=e=>e;let lx=ut;function Zf(e){let t;return()=>(t===void 0&&(t=e()),t)}const Bs=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},cn=e=>e*1e3,dn=e=>e/1e3,cj={useManualTiming:!1};function dj(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){i.has(u)&&(l.schedule(u),e()),u(o)}const l={schedule:(u,c=!1,d=!1)=>{const p=d&&r?t:n;return c&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(a),t.clear(),r=!1,s&&(s=!1,l.process(u))}};return l}const sa=["read","resolveKeyframes","update","preRender","render","postRender"],fj=40;function ux(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=sa.reduce((y,g)=>(y[g]=dj(i),y),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:d,postRender:f}=o,p=()=>{const y=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(y-s.timestamp,fj),1),s.timestamp=y,s.isProcessing=!0,a.process(s),l.process(s),u.process(s),c.process(s),d.process(s),f.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:sa.reduce((y,g)=>{const v=o[g];return y[g]=(S,C=!1,T=!1)=>(n||m(),v.schedule(S,C,T)),y},{}),cancel:y=>{for(let g=0;gFm[e].some(n=>!!t[n])};function hj(e){for(const t in e)zs[t]={...zs[t],...e[t]}}const pj=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function dl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pj.has(e)}let dx=e=>!dl(e);function mj(e){e&&(dx=t=>t.startsWith("on")?!dl(t):e(t))}try{mj(require("@emotion/is-prop-valid").default)}catch{}function gj(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(dx(s)||n===!0&&dl(s)||!t&&!dl(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function yj(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const Jl=b.createContext({});function io(e){return typeof e=="string"||Array.isArray(e)}function Zl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const eh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],th=["initial",...eh];function eu(e){return Zl(e.animate)||th.some(t=>io(e[t]))}function fx(e){return!!(eu(e)||e.variants)}function vj(e,t){if(eu(e)){const{initial:n,animate:r}=e;return{initial:n===!1||io(n)?n:void 0,animate:io(r)?r:void 0}}return e.inherit!==!1?t:{}}function xj(e){const{initial:t,animate:n}=vj(e,b.useContext(Jl));return b.useMemo(()=>({initial:t,animate:n}),[Im(t),Im(n)])}function Im(e){return Array.isArray(e)?e.join(" "):e}const wj=Symbol.for("motionComponentSymbol");function as(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function bj(e,t,n){return b.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):as(n)&&(n.current=r))},[t])}const nh=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Sj="framerAppearId",hx="data-"+nh(Sj),{schedule:rh}=ux(queueMicrotask,!1),px=b.createContext({});function Pj(e,t,n,r,s){var i,o;const{visualElement:a}=b.useContext(Jl),l=b.useContext(cx),u=b.useContext(Xl),c=b.useContext(Yf).reducedMotion,d=b.useRef(null);r=r||l.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:a,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:c}));const f=d.current,p=b.useContext(px);f&&!f.projection&&s&&(f.type==="html"||f.type==="svg")&&Cj(d.current,n,s,p);const m=b.useRef(!1);b.useInsertionEffect(()=>{f&&m.current&&f.update(n,u)});const x=n[hx],w=b.useRef(!!x&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,x))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,x)));return Jf(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),rh.render(f.render),w.current&&f.animationState&&f.animationState.animateChanges())}),b.useEffect(()=>{f&&(!w.current&&f.animationState&&f.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,x)}),w.current=!1))}),f}function Cj(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:mx(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&as(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function mx(e){if(e)return e.options.allowProjection!==!1?e.projection:mx(e.parent)}function kj({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&hj(e);function a(u,c){let d;const f={...b.useContext(Yf),...u,layoutId:Ej(u)},{isStatic:p}=f,m=xj(u),x=r(u,p);if(!p&&Xf){Tj();const w=jj(f);d=w.MeasureLayout,m.visualElement=Pj(s,x,f,t,w.ProjectionNode)}return h.jsxs(Jl.Provider,{value:m,children:[d&&m.visualElement?h.jsx(d,{visualElement:m.visualElement,...f}):null,n(s,u,bj(x,m.visualElement,c),x,p,m.visualElement)]})}a.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const l=b.forwardRef(a);return l[wj]=s,l}function Ej({layoutId:e}){const t=b.useContext(Gf).id;return t&&e!==void 0?t+"-"+e:e}function Tj(e,t){b.useContext(cx).strict}function jj(e){const{drag:t,layout:n}=zs;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const Nj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function sh(e){return typeof e!="string"||e.includes("-")?!1:!!(Nj.indexOf(e)>-1||/[A-Z]/u.test(e))}function _m(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function ih(e,t,n,r){if(typeof t=="function"){const[s,i]=_m(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=_m(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const wd=e=>Array.isArray(e),Oj=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Rj=e=>wd(e)?e[e.length-1]||0:e,$e=e=>!!(e&&e.getVelocity);function Na(e){const t=$e(e)?e.get():e;return Oj(t)?t.toValue():t}function Aj({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:Lj(r,s,i,e),renderState:t()};return n&&(o.onMount=a=>n({props:r,current:a,...o}),o.onUpdate=a=>n(a)),o}const gx=e=>(t,n)=>{const r=b.useContext(Jl),s=b.useContext(Xl),i=()=>Aj(e,t,r,s);return n?i():Yl(i)};function Lj(e,t,n,r){const s={},i=r(e,{});for(const f in i)s[f]=Na(i[f]);let{initial:o,animate:a}=e;const l=eu(e),u=fx(e);t&&u&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const d=c?a:o;if(d&&typeof d!="boolean"&&!Zl(d)){const f=Array.isArray(d)?d:[d];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),vx=yx("--"),Dj=yx("var(--"),oh=e=>Dj(e)?Mj.test(e.split("/*")[0].trim()):!1,Mj=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,xx=(e,t)=>t&&typeof e=="number"?t.transform(e):e,vn=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},oo={...ei,transform:e=>vn(0,1,e)},ia={...ei,default:1},Ro=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Pn=Ro("deg"),Jt=Ro("%"),H=Ro("px"),Fj=Ro("vh"),Ij=Ro("vw"),Vm={...Jt,parse:e=>Jt.parse(e)/100,transform:e=>Jt.transform(e*100)},_j={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,radius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,backgroundPositionX:H,backgroundPositionY:H},Vj={rotate:Pn,rotateX:Pn,rotateY:Pn,rotateZ:Pn,scale:ia,scaleX:ia,scaleY:ia,scaleZ:ia,skew:Pn,skewX:Pn,skewY:Pn,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:oo,originX:Vm,originY:Vm,originZ:H},Um={...ei,transform:Math.round},ah={..._j,...Vj,zIndex:Um,size:H,fillOpacity:oo,strokeOpacity:oo,numOctaves:Um},Uj={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$j=Zs.length;function Bj(e,t,n){let r="",s=!0;for(let i=0;i<$j;i++){const o=Zs[i],a=e[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||n){const u=xx(a,ah[o]);if(!l){s=!1;const c=Uj[o]||o;r+=`${c}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function lh(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,a=!1;for(const l in t){const u=t[l];if(Wr.has(l)){o=!0;continue}else if(vx(l)){s[l]=u;continue}else{const c=xx(u,ah[l]);l.startsWith("origin")?(a=!0,i[l]=c):r[l]=c}}if(t.transform||(o||n?r.transform=Bj(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:u="50%",originZ:c=0}=i;r.transformOrigin=`${l} ${u} ${c}`}}const zj={offset:"stroke-dashoffset",array:"stroke-dasharray"},Wj={offset:"strokeDashoffset",array:"strokeDasharray"};function Hj(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?zj:Wj;e[i.offset]=H.transform(-r);const o=H.transform(t),a=H.transform(n);e[i.array]=`${o} ${a}`}function $m(e,t,n){return typeof e=="string"?e:H.transform(t+n*e)}function Kj(e,t,n){const r=$m(t,e.x,e.width),s=$m(n,e.y,e.height);return`${r} ${s}`}function uh(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},c,d){if(lh(e,u,d),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:p,dimensions:m}=e;f.transform&&(m&&(p.transform=f.transform),delete f.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=Kj(m,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),o!==void 0&&Hj(f,o,a,l,!1)}const ch=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),wx=()=>({...ch(),attrs:{}}),dh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function bx(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const Sx=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Px(e,t,n,r){bx(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(Sx.has(s)?s:nh(s),t.attrs[s])}const fl={};function qj(e){Object.assign(fl,e)}function Cx(e,{layout:t,layoutId:n}){return Wr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!fl[e]||e==="opacity")}function fh(e,t,n){var r;const{style:s}=e,i={};for(const o in s)($e(s[o])||t.style&&$e(t.style[o])||Cx(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function kx(e,t,n){const r=fh(e,t,n);for(const s in e)if($e(e[s])||$e(t[s])){const i=Zs.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function Qj(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Bm=["x","y","width","height","cx","cy","r"],Gj={useVisualState:gx({scrapeMotionValuesFromProps:kx,createRenderState:wx,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const a in s)if(Wr.has(a)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let a=0;a{Qj(n,r),ue.render(()=>{uh(r,s,dh(n.tagName),e.transformTemplate),Px(n,r)})})}})},Yj={useVisualState:gx({scrapeMotionValuesFromProps:fh,createRenderState:ch})};function Ex(e,t,n){for(const r in t)!$e(t[r])&&!Cx(r,n)&&(e[r]=t[r])}function Xj({transformTemplate:e},t){return b.useMemo(()=>{const n=ch();return lh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Jj(e,t){const n=e.style||{},r={};return Ex(r,n,e),Object.assign(r,Xj(e,t)),r}function Zj(e,t){const n={},r=Jj(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function eN(e,t,n,r){const s=b.useMemo(()=>{const i=wx();return uh(i,t,dh(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Ex(i,e.style,e),s.style={...i,...s.style}}return s}function tN(e=!1){return(n,r,s,{latestValues:i},o)=>{const l=(sh(n)?eN:Zj)(r,i,o,n),u=gj(r,typeof n=="string",e),c=n!==b.Fragment?{...u,...l,ref:s}:{},{children:d}=r,f=b.useMemo(()=>$e(d)?d.get():d,[d]);return b.createElement(n,{...c,children:f})}}function nN(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...sh(r)?Gj:Yj,preloadedFeatures:e,useRender:tN(s),createVisualElement:t,Component:r};return kj(o)}}function Tx(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rwindow.ScrollTimeline!==void 0);class sN{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(rN()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class iN extends sN{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function hh(e,t){return e?e[t]||e.default||e:void 0}const bd=2e4;function jx(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=bd?1/0:t}function ph(e){return typeof e=="function"}function zm(e,t){e.timeline=t,e.onfinish=null}const mh=e=>Array.isArray(e)&&typeof e[0]=="number",oN={linearEasing:void 0};function aN(e,t){const n=Zf(e);return()=>{var r;return(r=oN[t])!==null&&r!==void 0?r:n()}}const hl=aN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Nx=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Sd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xi([0,.65,.55,1]),circOut:xi([.55,0,1,.45]),backIn:xi([.31,.01,.66,-.59]),backOut:xi([.33,1.53,.69,.99])};function Rx(e,t){if(e)return typeof e=="function"&&hl()?Nx(e,t):mh(e)?xi(e):Array.isArray(e)?e.map(n=>Rx(n,t)||Sd.easeOut):Sd[e]}const jt={x:!1,y:!1};function Ax(){return jt.x||jt.y}function lN(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function Lx(e,t){const n=lN(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Wm(e){return t=>{t.pointerType==="touch"||Ax()||e(t)}}function uN(e,t,n={}){const[r,s,i]=Lx(e,n),o=Wm(a=>{const{target:l}=a,u=t(a);if(typeof u!="function"||!l)return;const c=Wm(d=>{u(d),l.removeEventListener("pointerleave",c)});l.addEventListener("pointerleave",c,s)});return r.forEach(a=>{a.addEventListener("pointerenter",o,s)}),i}const Dx=(e,t)=>t?e===t?!0:Dx(e,t.parentElement):!1,gh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,cN=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dN(e){return cN.has(e.tagName)||e.tabIndex!==-1}const wi=new WeakSet;function Hm(e){return t=>{t.key==="Enter"&&e(t)}}function Iu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const fN=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Hm(()=>{if(wi.has(n))return;Iu(n,"down");const s=Hm(()=>{Iu(n,"up")}),i=()=>Iu(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Km(e){return gh(e)&&!Ax()}function hN(e,t,n={}){const[r,s,i]=Lx(e,n),o=a=>{const l=a.currentTarget;if(!Km(a)||wi.has(l))return;wi.add(l);const u=t(a),c=(p,m)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),!(!Km(p)||!wi.has(l))&&(wi.delete(l),typeof u=="function"&&u(p,{success:m}))},d=p=>{c(p,n.useGlobalTarget||Dx(l,p.target))},f=p=>{c(p,!1)};window.addEventListener("pointerup",d,s),window.addEventListener("pointercancel",f,s)};return r.forEach(a=>{!dN(a)&&a.getAttribute("tabindex")===null&&(a.tabIndex=0),(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),a.addEventListener("focus",u=>fN(u,s),s)}),i}function pN(e){return e==="x"||e==="y"?jt[e]?null:(jt[e]=!0,()=>{jt[e]=!1}):jt.x||jt.y?null:(jt.x=jt.y=!0,()=>{jt.x=jt.y=!1})}const Mx=new Set(["width","height","top","left","right","bottom",...Zs]);let Oa;function mN(){Oa=void 0}const Zt={now:()=>(Oa===void 0&&Zt.set(Le.isProcessing||cj.useManualTiming?Le.timestamp:performance.now()),Oa),set:e=>{Oa=e,queueMicrotask(mN)}};function yh(e,t){e.indexOf(t)===-1&&e.push(t)}function vh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class xh{constructor(){this.subscriptions=[]}add(t){return yh(this.subscriptions,t),()=>vh(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class yN{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Zt.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Zt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=gN(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new xh);const r=this.events[t].add(n);return t==="change"?()=>{r(),ue.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Zt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>qm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,qm);return Fx(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ao(e,t){return new yN(e,t)}function vN(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ao(n))}function wh(e,t){const n=tu(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=Rj(i[o]);vN(e,o,a)}}function xN(e){return!!($e(e)&&e.add)}function Pd(e,t){const n=e.getValue("willChange");if(xN(n))return n.add(t)}function Ix(e){return e.props[hx]}const _x=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,wN=1e-7,bN=12;function SN(e,t,n,r,s){let i,o,a=0;do o=t+(n-t)/2,i=_x(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>wN&&++aSN(i,0,1,e,n);return i=>i===0||i===1?i:_x(s(i),t,r)}const Vx=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ux=e=>t=>1-e(1-t),$x=Ao(.33,1.53,.69,.99),bh=Ux($x),Bx=Vx(bh),zx=e=>(e*=2)<1?.5*bh(e):.5*(2-Math.pow(2,-10*(e-1))),Sh=e=>1-Math.sin(Math.acos(e)),Wx=Ux(Sh),Hx=Vx(Sh),Kx=e=>/^0[^.\s]+$/u.test(e);function PN(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Kx(e):!0}const Li=e=>Math.round(e*1e5)/1e5,Ph=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CN(e){return e==null}const kN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ch=(e,t)=>n=>!!(typeof n=="string"&&kN.test(n)&&n.startsWith(e)||t&&!CN(n)&&Object.prototype.hasOwnProperty.call(n,t)),qx=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(Ph);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},EN=e=>vn(0,255,e),_u={...ei,transform:e=>Math.round(EN(e))},vr={test:Ch("rgb","red"),parse:qx("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+_u.transform(e)+", "+_u.transform(t)+", "+_u.transform(n)+", "+Li(oo.transform(r))+")"};function TN(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Cd={test:Ch("#"),parse:TN,transform:vr.transform},ls={test:Ch("hsl","hue"),parse:qx("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Jt.transform(Li(t))+", "+Jt.transform(Li(n))+", "+Li(oo.transform(r))+")"},_e={test:e=>vr.test(e)||Cd.test(e)||ls.test(e),parse:e=>vr.test(e)?vr.parse(e):ls.test(e)?ls.parse(e):Cd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?vr.transform(e):ls.transform(e)},jN=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NN(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ph))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(jN))===null||n===void 0?void 0:n.length)||0)>0}const Qx="number",Gx="color",ON="var",RN="var(",Qm="${}",AN=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lo(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=t.replace(AN,l=>(_e.test(l)?(r.color.push(i),s.push(Gx),n.push(_e.parse(l))):l.startsWith(RN)?(r.var.push(i),s.push(ON),n.push(l)):(r.number.push(i),s.push(Qx),n.push(parseFloat(l))),++i,Qm)).split(Qm);return{values:n,split:a,indexes:r,types:s}}function Yx(e){return lo(e).values}function Xx(e){const{split:t,types:n}=lo(e),r=t.length;return s=>{let i="";for(let o=0;otypeof e=="number"?0:e;function DN(e){const t=Yx(e);return Xx(e)(t.map(LN))}const Jn={test:NN,parse:Yx,createTransformer:Xx,getAnimatableNone:DN},MN=new Set(["brightness","contrast","saturate","opacity"]);function FN(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ph)||[];if(!r)return e;const s=n.replace(r,"");let i=MN.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const IN=/\b([a-z-]*)\(.*?\)/gu,kd={...Jn,getAnimatableNone:e=>{const t=e.match(IN);return t?t.map(FN).join(" "):e}},_N={...ah,color:_e,backgroundColor:_e,outlineColor:_e,fill:_e,stroke:_e,borderColor:_e,borderTopColor:_e,borderRightColor:_e,borderBottomColor:_e,borderLeftColor:_e,filter:kd,WebkitFilter:kd},kh=e=>_N[e];function Jx(e,t){let n=kh(e);return n!==kd&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const VN=new Set(["auto","none","0"]);function UN(e,t,n){let r=0,s;for(;re===ei||e===H,Ym=(e,t)=>parseFloat(e.split(", ")[t]),Xm=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return Ym(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?Ym(i[1],e):0}},$N=new Set(["x","y","z"]),BN=Zs.filter(e=>!$N.has(e));function zN(e){const t=[];return BN.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Ws={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Xm(4,13),y:Xm(5,14)};Ws.translateX=Ws.x;Ws.translateY=Ws.y;const Or=new Set;let Ed=!1,Td=!1;function Zx(){if(Td){const e=Array.from(Or).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=zN(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Td=!1,Ed=!1,Or.forEach(e=>e.complete()),Or.clear()}function ew(){Or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Td=!0)})}function WN(){ew(),Zx()}class Eh{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Or.add(this),Ed||(Ed=!0,ue.read(ew),ue.resolveKeyframes(Zx))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),HN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function KN(e){const t=HN.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function nw(e,t,n=1){const[r,s]=KN(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return tw(o)?parseFloat(o):o}return oh(s)?nw(s,t,n+1):s}const rw=e=>t=>t.test(e),qN={test:e=>e==="auto",parse:e=>e},sw=[ei,H,Jt,Pn,Ij,Fj,qN],Jm=e=>sw.find(rw(e));class iw extends Eh{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const Zm=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Jn.test(e)||e==="0")&&!e.startsWith("url("));function QN(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function nu(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(YN),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const XN=40;class ow{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Zt.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>XN?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&WN(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Zt.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!GN(t,r,s,i))if(o)this.options.duration=0;else{l&&l(nu(t,this.options,n)),a&&a(),this.resolveFinishedPromise();return}const c=this.initPlayback(t,n);c!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const fe=(e,t,n)=>e+(t-e)*n;function Vu(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function JN({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=Vu(l,a,e+1/3),i=Vu(l,a,e),o=Vu(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function pl(e,t){return n=>n>0?t:e}const Uu=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},ZN=[Cd,vr,ls],e4=e=>ZN.find(t=>t.test(e));function eg(e){const t=e4(e);if(!t)return!1;let n=t.parse(e);return t===ls&&(n=JN(n)),n}const tg=(e,t)=>{const n=eg(e),r=eg(t);if(!n||!r)return pl(e,t);const s={...n};return i=>(s.red=Uu(n.red,r.red,i),s.green=Uu(n.green,r.green,i),s.blue=Uu(n.blue,r.blue,i),s.alpha=fe(n.alpha,r.alpha,i),vr.transform(s))},t4=(e,t)=>n=>t(e(n)),Lo=(...e)=>e.reduce(t4),jd=new Set(["none","hidden"]);function n4(e,t){return jd.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function r4(e,t){return n=>fe(e,t,n)}function Th(e){return typeof e=="number"?r4:typeof e=="string"?oh(e)?pl:_e.test(e)?tg:o4:Array.isArray(e)?aw:typeof e=="object"?_e.test(e)?tg:s4:pl}function aw(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Th(i)(i,t[o]));return i=>{for(let o=0;o{for(const i in r)n[i]=r[i](s);return n}}function i4(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=Jn.createTransformer(t),r=lo(e),s=lo(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?jd.has(e)&&!s.values.length||jd.has(t)&&!r.values.length?n4(e,t):Lo(aw(i4(r,s),s.values),n):pl(e,t)};function lw(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?fe(e,t,n):Th(e)(e,t)}const a4=5;function uw(e,t,n){const r=Math.max(t-a4,0);return Fx(n-e(r),t-r)}const ge={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},$u=.001;function l4({duration:e=ge.duration,bounce:t=ge.bounce,velocity:n=ge.velocity,mass:r=ge.mass}){let s,i,o=1-t;o=vn(ge.minDamping,ge.maxDamping,o),e=vn(ge.minDuration,ge.maxDuration,dn(e)),o<1?(s=u=>{const c=u*o,d=c*e,f=c-n,p=Nd(u,o),m=Math.exp(-d);return $u-f/p*m},i=u=>{const d=u*o*e,f=d*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,m=Math.exp(-d),x=Nd(Math.pow(u,2),o);return(-s(u)+$u>0?-1:1)*((f-p)*m)/x}):(s=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-$u+c*d},i=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const a=5/e,l=c4(s,i,a);if(e=cn(e),isNaN(l))return{stiffness:ge.stiffness,damping:ge.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const u4=12;function c4(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function h4(e){let t={velocity:ge.velocity,stiffness:ge.stiffness,damping:ge.damping,mass:ge.mass,isResolvedFromDuration:!1,...e};if(!ng(e,f4)&&ng(e,d4))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*vn(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:ge.mass,stiffness:s,damping:i}}else{const n=l4(e);t={...t,...n,mass:ge.mass},t.isResolvedFromDuration=!0}return t}function cw(e=ge.visualDuration,t=ge.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:u,mass:c,duration:d,velocity:f,isResolvedFromDuration:p}=h4({...n,velocity:-dn(n.velocity||0)}),m=f||0,x=u/(2*Math.sqrt(l*c)),w=o-i,y=dn(Math.sqrt(l/c)),g=Math.abs(w)<5;r||(r=g?ge.restSpeed.granular:ge.restSpeed.default),s||(s=g?ge.restDelta.granular:ge.restDelta.default);let v;if(x<1){const C=Nd(y,x);v=T=>{const E=Math.exp(-x*y*T);return o-E*((m+x*y*w)/C*Math.sin(C*T)+w*Math.cos(C*T))}}else if(x===1)v=C=>o-Math.exp(-y*C)*(w+(m+y*w)*C);else{const C=y*Math.sqrt(x*x-1);v=T=>{const E=Math.exp(-x*y*T),j=Math.min(C*T,300);return o-E*((m+x*y*w)*Math.sinh(j)+C*w*Math.cosh(j))/C}}const S={calculatedDuration:p&&d||null,next:C=>{const T=v(C);if(p)a.done=C>=d;else{let E=0;x<1&&(E=C===0?cn(m):uw(v,C,T));const j=Math.abs(E)<=r,F=Math.abs(o-T)<=s;a.done=j&&F}return a.value=a.done?o:T,a},toString:()=>{const C=Math.min(jx(S),bd),T=Nx(E=>S.next(C*E).value,C,30);return C+"ms "+T}};return S}function rg({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},p=j=>a!==void 0&&jl,m=j=>a===void 0?l:l===void 0||Math.abs(a-j)-x*Math.exp(-j/r),v=j=>y+g(j),S=j=>{const F=g(j),U=v(j);f.done=Math.abs(F)<=u,f.value=f.done?y:U};let C,T;const E=j=>{p(f.value)&&(C=j,T=cw({keyframes:[f.value,m(f.value)],velocity:uw(v,j,f.value),damping:s,stiffness:i,restDelta:u,restSpeed:c}))};return E(0),{calculatedDuration:null,next:j=>{let F=!1;return!T&&C===void 0&&(F=!0,S(j),E(j)),C!==void 0&&j>=C?T.next(j-C):(!F&&S(j),f)}}}const p4=Ao(.42,0,1,1),m4=Ao(0,0,.58,1),dw=Ao(.42,0,.58,1),g4=e=>Array.isArray(e)&&typeof e[0]!="number",y4={linear:ut,easeIn:p4,easeInOut:dw,easeOut:m4,circIn:Sh,circInOut:Hx,circOut:Wx,backIn:bh,backInOut:Bx,backOut:$x,anticipate:zx},sg=e=>{if(mh(e)){lx(e.length===4);const[t,n,r,s]=e;return Ao(t,n,r,s)}else if(typeof e=="string")return y4[e];return e};function v4(e,t,n){const r=[],s=n||lw,i=e.length-1;for(let o=0;ot[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=v4(t,r,s),l=a.length,u=c=>{if(o&&c1)for(;du(vn(e[0],e[i-1],c)):u}function w4(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Bs(0,t,r);e.push(fe(n,1,s))}}function b4(e){const t=[0];return w4(t,e.length-1),t}function S4(e,t){return e.map(n=>n*t)}function P4(e,t){return e.map(()=>t||dw).splice(0,e.length-1)}function ml({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=g4(r)?r.map(sg):sg(r),i={done:!1,value:t[0]},o=S4(n&&n.length===t.length?n:b4(t),e),a=x4(o,t,{ease:Array.isArray(s)?s:P4(t,s)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}const C4=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ue.update(t,!0),stop:()=>Xn(t),now:()=>Le.isProcessing?Le.timestamp:Zt.now()}},k4={decay:rg,inertia:rg,tween:ml,keyframes:ml,spring:cw},E4=e=>e/100;class jh extends ow{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Eh,a=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new o(i,a,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=ph(n)?n:k4[n]||ml;let l,u;a!==ml&&typeof t[0]!="number"&&(l=Lo(E4,lw(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});i==="mirror"&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=jx(c));const{calculatedDuration:d}=c,f=d+s,p=f*(r+1)-s;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:d,resolvedDuration:f,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:j}=this.options;return{done:!0,value:j[j.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:d}=r;if(this.startTime===null)return i.next(0);const{delay:f,repeat:p,repeatType:m,repeatDelay:x,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-f*(this.speed>=0?1:-1),g=this.speed>=0?y<0:y>c;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let v=this.currentTime,S=i;if(p){const j=Math.min(this.currentTime,c)/d;let F=Math.floor(j),U=j%1;!U&&j>=1&&(U=1),U===1&&F--,F=Math.min(F,p+1),!!(F%2)&&(m==="reverse"?(U=1-U,x&&(U-=x/d)):m==="mirror"&&(S=o)),v=vn(0,1,U)*d}const C=g?{done:!1,value:l[0]}:S.next(v);a&&(C.value=a(C.value));let{done:T}=C;!g&&u!==null&&(T=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return E&&s!==void 0&&(C.value=nu(l,this.options,s)),w&&w(C.value),E&&this.finish(),C}get duration(){const{resolved:t}=this;return t?dn(t.calculatedDuration):0}get time(){return dn(this.currentTime)}set time(t){t=cn(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=dn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=C4,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const T4=new Set(["opacity","clipPath","filter","transform"]);function j4(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeInOut",times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=Rx(a,s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const N4=Zf(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gl=10,O4=2e4;function R4(e){return ph(e.type)||e.type==="spring"||!Ox(e.ease)}function A4(e,t){const n=new jh({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(o,a),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:a,name:l,startTime:u}=this.options;if(!a.owner||!a.owner.current)return!1;if(typeof i=="string"&&hl()&&L4(i)&&(i=fw[i]),R4(this.options)){const{onComplete:d,onUpdate:f,motionValue:p,element:m,...x}=this.options,w=A4(t,x);t=w.keyframes,t.length===1&&(t[1]=t[0]),r=w.duration,s=w.times,i=w.ease,o="keyframes"}const c=j4(a.owner.current,l,t,{...this.options,duration:r,times:s,ease:i});return c.startTime=u??this.calcStartTime(),this.pendingTimeline?(zm(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:d}=this.options;a.set(nu(t,this.options,n)),d&&d(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return dn(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return dn(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=cn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return ut;const{animation:r}=n;zm(r,t)}return ut}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:a}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:c,onComplete:d,element:f,...p}=this.options,m=new jh({...p,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),x=cn(this.time);u.setWithVelocity(m.sample(x-gl).value,m.sample(x).value,gl)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=n.owner.getProps();return N4()&&r&&T4.has(r)&&!l&&!u&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}const D4={type:"spring",stiffness:500,damping:25,restSpeed:10},M4=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),F4={type:"keyframes",duration:.8},I4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},_4=(e,{keyframes:t})=>t.length>2?F4:Wr.has(e)?e.startsWith("scale")?M4(t[1]):D4:I4;function V4({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}const Nh=(e,t,n,r={},s,i)=>o=>{const a=hh(r,e)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-cn(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:s};V4(a)||(c={...c,..._4(e,c)}),c.duration&&(c.duration=cn(c.duration)),c.repeatDelay&&(c.repeatDelay=cn(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let d=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(d=!0)),d&&!i&&t.get()!==void 0){const f=nu(c.keyframes,a);if(f!==void 0)return ue.update(()=>{c.onUpdate(f),c.onComplete()}),new iN([])}return!i&&ig.supports(c)?new ig(c):new jh(c)};function U4({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function hw(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;r&&(o=r);const u=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const d in l){const f=e.getValue(d,(i=e.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||c&&U4(c,d))continue;const m={delay:n,...hh(o||{},d)};let x=!1;if(window.MotionHandoffAnimation){const y=Ix(e);if(y){const g=window.MotionHandoffAnimation(y,d,ue);g!==null&&(m.startTime=g,x=!0)}}Pd(e,d),f.start(Nh(d,f,p,e.shouldReduceMotion&&Mx.has(d)?{type:!1}:m,e,x));const w=f.animation;w&&u.push(w)}return a&&Promise.all(u).then(()=>{ue.update(()=>{a&&wh(e,a)})}),u}function Od(e,t,n={}){var r;const s=tu(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(hw(e,s,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:d,staggerDirection:f}=i;return $4(e,t,c+u,d,f,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function $4(e,t,n=0,r=0,s=1,i){const o=[],a=(e.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(B4).forEach((u,c)=>{u.notify("AnimationStart",t),o.push(Od(u,t,{...i,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function B4(e,t){return e.sortNodePosition(t)}function pw(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Od(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Od(e,t,n);else{const s=typeof t=="function"?tu(e,t,n.custom):t;r=Promise.all(hw(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const z4=th.length;function mw(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?mw(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>pw(e,n,r)))}function q4(e){let t=K4(e),n=og(),r=!0;const s=l=>(u,c)=>{var d;const f=tu(e,c,l==="exit"?(d=e.presenceContext)===null||d===void 0?void 0:d.custom:void 0);if(f){const{transition:p,transitionEnd:m,...x}=f;u={...u,...x,...m}}return u};function i(l){t=l(e)}function o(l){const{props:u}=e,c=mw(e.parent)||{},d=[],f=new Set;let p={},m=1/0;for(let w=0;wm&&S,F=!1;const U=Array.isArray(v)?v:[v];let B=U.reduce(s(y),{});C===!1&&(B={});const{prevResolvedValues:J={}}=g,me={...J,...B},Z=_=>{j=!0,f.has(_)&&(F=!0,f.delete(_)),g.needsAnimating[_]=!0;const O=e.getValue(_);O&&(O.liveStyle=!1)};for(const _ in me){const O=B[_],D=J[_];if(p.hasOwnProperty(_))continue;let L=!1;wd(O)&&wd(D)?L=!Tx(O,D):L=O!==D,L?O!=null?Z(_):f.add(_):O!==void 0&&f.has(_)?Z(_):g.protectedKeys[_]=!0}g.prevProp=v,g.prevResolvedValues=B,g.isActive&&(p={...p,...B}),r&&e.blockInitialAnimation&&(j=!1),j&&(!(T&&E)||F)&&d.push(...U.map(_=>({animation:_,options:{type:y}})))}if(f.size){const w={};f.forEach(y=>{const g=e.getBaseTarget(y),v=e.getValue(y);v&&(v.liveStyle=!0),w[y]=g??null}),d.push({animation:w})}let x=!!d.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(d):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=e.variantChildren)===null||c===void 0||c.forEach(f=>{var p;return(p=f.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const d=o(l);for(const f in n)n[f].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=og(),r=!0}}}function Q4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Tx(t,e):!1}function lr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function og(){return{animate:lr(!0),whileInView:lr(),whileHover:lr(),whileTap:lr(),whileDrag:lr(),whileFocus:lr(),exit:lr()}}class or{constructor(t){this.isMounted=!1,this.node=t}update(){}}class G4 extends or{constructor(t){super(t),t.animationState||(t.animationState=q4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Zl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let Y4=0;class X4 extends or{constructor(){super(...arguments),this.id=Y4++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const J4={animation:{Feature:G4},exit:{Feature:X4}};function uo(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Do(e){return{point:{x:e.pageX,y:e.pageY}}}const Z4=e=>t=>gh(t)&&e(t,Do(t));function Di(e,t,n,r){return uo(e,t,Z4(n),r)}const ag=(e,t)=>Math.abs(e-t);function eO(e,t){const n=ag(e.x,t.x),r=ag(e.y,t.y);return Math.sqrt(n**2+r**2)}class gw{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=zu(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,p=eO(d.offset,{x:0,y:0})>=3;if(!f&&!p)return;const{point:m}=d,{timestamp:x}=Le;this.history.push({...m,timestamp:x});const{onStart:w,onMove:y}=this.handlers;f||(w&&w(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,d)},this.handlePointerMove=(d,f)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=Bu(f,this.transformPagePoint),ue.update(this.updatePoint,!0)},this.handlePointerUp=(d,f)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=zu(d.type==="pointercancel"?this.lastMoveEventInfo:Bu(f,this.transformPagePoint),this.history);this.startEvent&&p&&p(d,w),m&&m(d,w)},!gh(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Do(t),a=Bu(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=Le;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(t,zu(a,this.history)),this.removeListeners=Lo(Di(this.contextWindow,"pointermove",this.handlePointerMove),Di(this.contextWindow,"pointerup",this.handlePointerUp),Di(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Xn(this.updatePoint)}}function Bu(e,t){return t?{point:t(e.point)}:e}function lg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zu({point:e},t){return{point:e,delta:lg(e,yw(t)),offset:lg(e,tO(t)),velocity:nO(t,.1)}}function tO(e){return e[0]}function yw(e){return e[e.length-1]}function nO(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=yw(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>cn(t)));)n--;if(!r)return{x:0,y:0};const i=dn(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const vw=1e-4,rO=1-vw,sO=1+vw,xw=.01,iO=0-xw,oO=0+xw;function dt(e){return e.max-e.min}function aO(e,t,n){return Math.abs(e-t)<=n}function ug(e,t,n,r=.5){e.origin=r,e.originPoint=fe(t.min,t.max,e.origin),e.scale=dt(n)/dt(t),e.translate=fe(n.min,n.max,e.origin)-e.originPoint,(e.scale>=rO&&e.scale<=sO||isNaN(e.scale))&&(e.scale=1),(e.translate>=iO&&e.translate<=oO||isNaN(e.translate))&&(e.translate=0)}function Mi(e,t,n,r){ug(e.x,t.x,n.x,r?r.originX:void 0),ug(e.y,t.y,n.y,r?r.originY:void 0)}function cg(e,t,n){e.min=n.min+t.min,e.max=e.min+dt(t)}function lO(e,t,n){cg(e.x,t.x,n.x),cg(e.y,t.y,n.y)}function dg(e,t,n){e.min=t.min-n.min,e.max=e.min+dt(t)}function Fi(e,t,n){dg(e.x,t.x,n.x),dg(e.y,t.y,n.y)}function uO(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?fe(n,e,r.max):Math.min(e,n)),e}function fg(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function cO(e,{top:t,left:n,bottom:r,right:s}){return{x:fg(e.x,n,s),y:fg(e.y,t,r)}}function hg(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Bs(t.min,t.max-r,e.min):r>s&&(n=Bs(e.min,e.max-s,t.min)),vn(0,1,n)}function hO(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Rd=.35;function pO(e=Rd){return e===!1?e=0:e===!0&&(e=Rd),{x:pg(e,"left","right"),y:pg(e,"top","bottom")}}function pg(e,t,n){return{min:mg(e,t),max:mg(e,n)}}function mg(e,t){return typeof e=="number"?e:e[t]||0}const gg=()=>({translate:0,scale:1,origin:0,originPoint:0}),us=()=>({x:gg(),y:gg()}),yg=()=>({min:0,max:0}),xe=()=>({x:yg(),y:yg()});function gt(e){return[e("x"),e("y")]}function ww({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function mO({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function gO(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Wu(e){return e===void 0||e===1}function Ad({scale:e,scaleX:t,scaleY:n}){return!Wu(e)||!Wu(t)||!Wu(n)}function fr(e){return Ad(e)||bw(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function bw(e){return vg(e.x)||vg(e.y)}function vg(e){return e&&e!=="0%"}function yl(e,t,n){const r=e-n,s=t*r;return n+s}function xg(e,t,n,r,s){return s!==void 0&&(e=yl(e,s,r)),yl(e,n,r)+t}function Ld(e,t=0,n=1,r,s){e.min=xg(e.min,t,n,r,s),e.max=xg(e.max,t,n,r,s)}function Sw(e,{x:t,y:n}){Ld(e.x,t.translate,t.scale,t.originPoint),Ld(e.y,n.translate,n.scale,n.originPoint)}const wg=.999999999999,bg=1.0000000000001;function yO(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let a=0;awg&&(t.x=1),t.ywg&&(t.y=1)}function cs(e,t){e.min=e.min+t,e.max=e.max+t}function Sg(e,t,n,r,s=.5){const i=fe(e.min,e.max,s);Ld(e,t,n,i,r)}function ds(e,t){Sg(e.x,t.x,t.scaleX,t.scale,t.originX),Sg(e.y,t.y,t.scaleY,t.scale,t.originY)}function Pw(e,t){return ww(gO(e.getBoundingClientRect(),t))}function vO(e,t,n){const r=Pw(e,n),{scroll:s}=t;return s&&(cs(r.x,s.offset.x),cs(r.y,s.offset.y)),r}const Cw=({current:e})=>e?e.ownerDocument.defaultView:null,xO=new WeakMap;class wO{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=xe(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=c=>{const{dragSnapToOrigin:d}=this.getProps();d?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Do(c).point)},i=(c,d)=>{const{drag:f,dragPropagation:p,onDragStart:m}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=pN(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),gt(w=>{let y=this.getAxisMotionValue(w).get()||0;if(Jt.test(y)){const{projection:g}=this.visualElement;if(g&&g.layout){const v=g.layout.layoutBox[w];v&&(y=dt(v)*(parseFloat(y)/100))}}this.originPoint[w]=y}),m&&ue.postRender(()=>m(c,d)),Pd(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(c,d)=>{const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:m,onDrag:x}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:w}=d;if(p&&this.currentDirection===null){this.currentDirection=bO(w),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",d.point,w),this.updateAxis("y",d.point,w),this.visualElement.render(),x&&x(c,d)},a=(c,d)=>this.stop(c,d),l=()=>gt(c=>{var d;return this.getAnimationState(c)==="paused"&&((d=this.getAxisMotionValue(c).animation)===null||d===void 0?void 0:d.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new gw(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Cw(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&ue.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!oa(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=uO(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&as(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=cO(s.layoutBox,n):this.constraints=!1,this.elastic=pO(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&>(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=hO(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!as(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=vO(r,s.root,this.visualElement.getTransformPagePoint());let o=dO(s.layout.layoutBox,i);if(n){const a=n(mO(o));this.hasMutatedConstraints=!!a,a&&(o=ww(a))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=gt(c=>{if(!oa(c,n,this.currentDirection))return;let d=l&&l[c]||{};o&&(d={min:0,max:0});const f=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...d};return this.startAxisValueAnimation(c,m)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Pd(this.visualElement,t),r.start(Nh(t,r,0,n,this.visualElement,!1))}stopAnimation(){gt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){gt(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){gt(n=>{const{drag:r}=this.getProps();if(!oa(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];i.set(t[n]-fe(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!as(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};gt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=fO({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),gt(o=>{if(!oa(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(fe(l,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;xO.set(this.visualElement,this);const t=this.visualElement.current,n=Di(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();as(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ue.read(r);const o=uo(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(gt(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Rd,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function oa(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function bO(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class SO extends or{constructor(t){super(t),this.removeGroupControls=ut,this.removeListeners=ut,this.controls=new wO(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ut}unmount(){this.removeGroupControls(),this.removeListeners()}}const Pg=e=>(t,n)=>{e&&ue.postRender(()=>e(t,n))};class PO extends or{constructor(){super(...arguments),this.removePointerDownListener=ut}onPointerDown(t){this.session=new gw(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Cw(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Pg(t),onStart:Pg(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&ue.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Di(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Ra={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Cg(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ci={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(H.test(e))e=parseFloat(e);else return e;const n=Cg(e,t.target.x),r=Cg(e,t.target.y);return`${n}% ${r}%`}},CO={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Jn.parse(e);if(s.length>5)return r;const i=Jn.createTransformer(e),o=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const u=fe(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class kO extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;qj(EO),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Ra.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||ue.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),rh.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function kw(e){const[t,n]=ax(),r=b.useContext(Gf);return h.jsx(kO,{...e,layoutGroup:r,switchLayoutGroup:b.useContext(px),isPresent:t,safeToRemove:n})}const EO={borderRadius:{...ci,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ci,borderTopRightRadius:ci,borderBottomLeftRadius:ci,borderBottomRightRadius:ci,boxShadow:CO};function TO(e,t,n){const r=$e(e)?e:ao(e);return r.start(Nh("",r,t,n)),r.animation}function jO(e){return e instanceof SVGElement&&e.tagName!=="svg"}const NO=(e,t)=>e.depth-t.depth;class OO{constructor(){this.children=[],this.isDirty=!1}add(t){yh(this.children,t),this.isDirty=!0}remove(t){vh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(NO),this.isDirty=!1,this.children.forEach(t)}}function RO(e,t){const n=Zt.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Xn(r),e(i-t))};return ue.read(r,!0),()=>Xn(r)}const Ew=["TopLeft","TopRight","BottomLeft","BottomRight"],AO=Ew.length,kg=e=>typeof e=="string"?parseFloat(e):e,Eg=e=>typeof e=="number"||H.test(e);function LO(e,t,n,r,s,i){s?(e.opacity=fe(0,n.opacity!==void 0?n.opacity:1,DO(r)),e.opacityExit=fe(t.opacity!==void 0?t.opacity:1,0,MO(r))):i&&(e.opacity=fe(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;ort?1:n(Bs(e,t,r))}function jg(e,t){e.min=t.min,e.max=t.max}function mt(e,t){jg(e.x,t.x),jg(e.y,t.y)}function Ng(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Og(e,t,n,r,s){return e-=t,e=yl(e,1/n,r),s!==void 0&&(e=yl(e,1/s,r)),e}function FO(e,t=0,n=1,r=.5,s,i=e,o=e){if(Jt.test(t)&&(t=parseFloat(t),t=fe(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=fe(i.min,i.max,r);e===i&&(a-=t),e.min=Og(e.min,t,n,a,s),e.max=Og(e.max,t,n,a,s)}function Rg(e,t,[n,r,s],i,o){FO(e,t[n],t[r],t[s],t.scale,i,o)}const IO=["x","scaleX","originX"],_O=["y","scaleY","originY"];function Ag(e,t,n,r){Rg(e.x,t,IO,n?n.x:void 0,r?r.x:void 0),Rg(e.y,t,_O,n?n.y:void 0,r?r.y:void 0)}function Lg(e){return e.translate===0&&e.scale===1}function jw(e){return Lg(e.x)&&Lg(e.y)}function Dg(e,t){return e.min===t.min&&e.max===t.max}function VO(e,t){return Dg(e.x,t.x)&&Dg(e.y,t.y)}function Mg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Nw(e,t){return Mg(e.x,t.x)&&Mg(e.y,t.y)}function Fg(e){return dt(e.x)/dt(e.y)}function Ig(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class UO{constructor(){this.members=[]}add(t){yh(this.members,t),t.scheduleRender()}remove(t){if(vh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function $O(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:d,rotateY:f,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),d&&(r+=`rotateX(${d}deg) `),f&&(r+=`rotateY(${f}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const hr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},bi=typeof window<"u"&&window.MotionDebug!==void 0,Hu=["","X","Y","Z"],BO={visibility:"hidden"},_g=1e3;let zO=0;function Ku(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Ow(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Ix(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ue,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Ow(r)}function Rw({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=t==null?void 0:t()){this.id=zO++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,bi&&(hr.totalNodes=hr.resolvedTargetDeltas=hr.recalculatedProjection=0),this.nodes.forEach(KO),this.nodes.forEach(XO),this.nodes.forEach(JO),this.nodes.forEach(qO),bi&&window.MotionDebug.record(hr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=RO(f,250),Ra.hasAnimatedSinceResize&&(Ra.hasAnimatedSinceResize=!1,this.nodes.forEach(Ug))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||c.getDefaultTransition()||rR,{onLayoutAnimationStart:w,onLayoutAnimationComplete:y}=c.getProps(),g=!this.targetLayout||!Nw(this.targetLayout,m)||p,v=!f&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||v||f&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,v);const S={...hh(x,"layout"),onPlay:w,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S)}else f||Ug(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Xn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ZO),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ow(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const C=S/1e3;$g(d.x,o.x,C),$g(d.y,o.y,C),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Fi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),tR(this.relativeTarget,this.relativeTargetOrigin,f,C),v&&VO(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=xe()),mt(v,this.relativeTarget)),x&&(this.animationValues=c,LO(c,u,this.latestValues,C,g,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Xn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ue.update(()=>{Ra.hasAnimatedSinceResize=!0,this.currentAnimation=TO(0,_g,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(_g),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&Aw(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||xe();const d=dt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+d;const f=dt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+f}mt(a,l),ds(a,c),Mi(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new UO),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Ku("z",o,u,this.animationValues);for(let c=0;c{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(Vg),this.root.sharedNodes.clear()}}}function WO(e){e.updateLayout()}function HO(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?gt(d=>{const f=o?n.measuredBox[d]:n.layoutBox[d],p=dt(f);f.min=r[d].min,f.max=f.min+p}):Aw(i,n.layoutBox,r)&>(d=>{const f=o?n.measuredBox[d]:n.layoutBox[d],p=dt(r[d]);f.max=f.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const a=us();Mi(a,r,n.layoutBox);const l=us();o?Mi(l,e.applyTransform(s,!0),n.measuredBox):Mi(l,r,n.layoutBox);const u=!jw(a);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:p}=d;if(f&&p){const m=xe();Fi(m,n.layoutBox,f.layoutBox);const x=xe();Fi(x,r,p.layoutBox),Nw(m,x)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=m,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function KO(e){bi&&hr.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function qO(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function QO(e){e.clearSnapshot()}function Vg(e){e.clearMeasurements()}function GO(e){e.isLayoutDirty=!1}function YO(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ug(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function XO(e){e.resolveTargetDelta()}function JO(e){e.calcProjection()}function ZO(e){e.resetSkewAndRotation()}function eR(e){e.removeLeadSnapshot()}function $g(e,t,n){e.translate=fe(t.translate,0,n),e.scale=fe(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Bg(e,t,n,r){e.min=fe(t.min,n.min,r),e.max=fe(t.max,n.max,r)}function tR(e,t,n,r){Bg(e.x,t.x,n.x,r),Bg(e.y,t.y,n.y,r)}function nR(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const rR={duration:.45,ease:[.4,0,.1,1]},zg=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Wg=zg("applewebkit/")&&!zg("chrome/")?Math.round:ut;function Hg(e){e.min=Wg(e.min),e.max=Wg(e.max)}function sR(e){Hg(e.x),Hg(e.y)}function Aw(e,t,n){return e==="position"||e==="preserve-aspect"&&!aO(Fg(t),Fg(n),.2)}function iR(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const oR=Rw({attachResizeListener:(e,t)=>uo(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),qu={current:void 0},Lw=Rw({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!qu.current){const e=new oR({});e.mount(window),e.setOptions({layoutScroll:!0}),qu.current=e}return qu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),aR={pan:{Feature:PO},drag:{Feature:SO,ProjectionNode:Lw,MeasureLayout:kw}};function Kg(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&ue.postRender(()=>i(t,Do(t)))}class lR extends or{mount(){const{current:t}=this.node;t&&(this.unmount=uN(t,n=>(Kg(this.node,n,"Start"),r=>Kg(this.node,r,"End"))))}unmount(){}}class uR extends or{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Lo(uo(this.node.current,"focus",()=>this.onFocus()),uo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function qg(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&ue.postRender(()=>i(t,Do(t)))}class cR extends or{mount(){const{current:t}=this.node;t&&(this.unmount=hN(t,n=>(qg(this.node,n,"Start"),(r,{success:s})=>qg(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Dd=new WeakMap,Qu=new WeakMap,dR=e=>{const t=Dd.get(e.target);t&&t(e)},fR=e=>{e.forEach(dR)};function hR({root:e,...t}){const n=e||document;Qu.has(n)||Qu.set(n,{});const r=Qu.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(fR,{root:e,...t})),r[s]}function pR(e,t,n){const r=hR(t);return Dd.set(e,n),r.observe(e),()=>{Dd.delete(e),r.unobserve(e)}}const mR={some:0,all:1};class gR extends or{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:mR[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return pR(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(yR(t,n))&&this.startObserver()}unmount(){}}function yR({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const vR={inView:{Feature:gR},tap:{Feature:cR},focus:{Feature:uR},hover:{Feature:lR}},xR={layout:{ProjectionNode:Lw,MeasureLayout:kw}},Md={current:null},Dw={current:!1};function wR(){if(Dw.current=!0,!!Xf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Md.current=e.matches;e.addListener(t),t()}else Md.current=!1}const bR=[...sw,_e,Jn],SR=e=>bR.find(rw(e)),Qg=new WeakMap;function PR(e,t,n){for(const r in t){const s=t[r],i=n[r];if($e(s))e.addValue(r,s);else if($e(i))e.addValue(r,ao(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,ao(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Gg=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class CR{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Eh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Zt.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Dw.current||wR(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Md.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Qg.delete(this.current),this.projection&&this.projection.unmount(),Xn(this.notifyUpdate),Xn(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Wr.has(t),s=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&ue.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in zs){const n=zs[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):xe()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=ao(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(tw(s)||Kx(s))?s=parseFloat(s):!SR(s)&&Jn.test(n)&&(s=Jx(t,n)),this.setBaseTarget(t,$e(s)?s.get():s)),$e(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=ih(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!$e(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new xh),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class Mw extends CR{constructor(){super(...arguments),this.KeyframeResolver=iw}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;$e(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function kR(e){return window.getComputedStyle(e)}class ER extends Mw{constructor(){super(...arguments),this.type="html",this.renderInstance=bx}readValueFromInstance(t,n){if(Wr.has(n)){const r=kh(n);return r&&r.default||0}else{const r=kR(t),s=(vx(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Pw(t,n)}build(t,n,r){lh(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return fh(t,n,r)}}class TR extends Mw{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=xe}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Wr.has(n)){const r=kh(n);return r&&r.default||0}return n=Sx.has(n)?n:nh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return kx(t,n,r)}build(t,n,r){uh(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){Px(t,n,r,s)}mount(t){this.isSVGTag=dh(t.tagName),super.mount(t)}}const jR=(e,t)=>sh(e)?new TR(t):new ER(t,{allowProjection:e!==b.Fragment}),NR=nN({...J4,...vR,...aR,...xR},jR),Yg=yj(NR);function OR(e){e.values.forEach(t=>t.stop())}function Fd(e,t){[...t].reverse().forEach(r=>{const s=e.getVariant(r);s&&wh(e,s),e.variantChildren&&e.variantChildren.forEach(i=>{Fd(i,t)})})}function RR(e,t){if(Array.isArray(t))return Fd(e,t);if(typeof t=="string")return Fd(e,[t]);wh(e,t)}function AR(){const e=new Set,t={subscribe(n){return e.add(n),()=>void e.delete(n)},start(n,r){const s=[];return e.forEach(i=>{s.push(pw(i,n,{transitionOverride:r}))}),Promise.all(s)},set(n){return e.forEach(r=>{RR(r,n)})},stop(){e.forEach(n=>{OR(n)})},mount(){return()=>{t.stop()}}};return t}function LR(){const e=Yl(AR);return Jf(e.mount,[]),e}const DR=LR;function MR({setShow:e,showBlur:t,children:n,theme:r="light"}){const s=b.useRef(null),i=DR(),o={type:"spring",stiffness:500,damping:30};b.useEffect(()=>{i.start({y:20,transition:o})},[]);async function a(l,u){var p;const c=u.offset.y,d=u.velocity.y,f=((p=s.current)==null?void 0:p.getBoundingClientRect().height)||0;c>f/2||d>800?(await i.start({y:"100%",transition:o}),e(!1)):i.start({y:0,transition:o})}return h.jsxs(uj,{children:[h.jsxs(Yg.div,{ref:s,className:so("group fixed inset-x-0 bottom-0 z-40 w-screen cursor-grab overflow-y-scroll pb-5 active:cursor-grabbing sm:hidden",r==="light"?"bg-white":"bg-neutral-800/95"),style:{maxHeight:"95%"},initial:{y:"100%"},animate:i,exit:{y:"100%"},transition:o,drag:"y",dragDirectionLock:!0,onDragEnd:a,dragElastic:{top:0,bottom:1},dragConstraints:{top:0,bottom:0},children:[h.jsxs("div",{className:so("rounded-t-4xl -mb-1 flex h-7 w-full items-center justify-center border-t",r==="light"?"border-gray-200":"border-cyan-50/20"),children:[h.jsx("div",{className:"-mr-1 h-1 w-6 rounded-full bg-gray-300 transition-all group-active:rotate-12"}),h.jsx("div",{className:"h-1 w-6 rounded-full bg-gray-300 transition-all group-active:-rotate-12"})]}),n]},"leaflet"),t&&h.jsx(Yg.div,{className:"fixed inset-0 z-30 bg-gray-100 bg-opacity-10 backdrop-blur",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>e(!1)},"leaflet-backdrop")]})}function Fw({children:e,showModal:t,setShowModal:n,theme:r="light"}){const s=b.useRef(null),{isMobile:i}=sj();b.useEffect(()=>{function a(l){s.current&&!s.current.contains(l.target)&&n(!1)}return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[s,n]);const o=b.useCallback(a=>{a.key==="Escape"&&n(!1)},[n]);return b.useEffect(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),i?t?h.jsx(MR,{setShow:n,showBlur:!0,theme:r,children:e}):null:h.jsx(h.Fragment,{children:t&&h.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center",style:{backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",backgroundColor:"rgba(0, 0, 0, 0.4)"},children:h.jsx("div",{className:"relative z-50 w-full max-w-lg",ref:s,children:e})})})}function Oh(e){return h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[h.jsx("path",{d:"M18 6 6 18"}),h.jsx("path",{d:"m6 6 12 12"})]})}function FR({showPasswordModal:e,setShowPasswordModal:t,onLogin:n,isLoggingIn:r}){const{t:s}=sr(),[i,o]=b.useState(""),a=async l=>{if(l.preventDefault(),!i){ZE.error(s("Password is required"));return}await n(i)};return h.jsx(Fw,{showModal:e,setShowModal:t,children:h.jsxs("div",{className:"w-full overflow-hidden bg-white/95 backdrop-blur-xl shadow-xl p-4 md:max-w-3xl md:rounded-2xl md:border md:border-gray-200",children:[h.jsx(Oh,{className:"absolute top-4 right-4 h-6 w-6 text-gray-500 hover:text-gray-700 cursor-pointer",onClick:()=>t(!1),onPointerDown:l=>l.stopPropagation()}),h.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-5 text-center md:px-16",children:[h.jsx("h3",{className:"font-display text-2xl font-bold",children:s("Save password")}),h.jsx("p",{className:"text-gray-500",children:s("Save your password and continue using this email in 1 day")})]}),h.jsxs("form",{onSubmit:a,className:"flex flex-col mt-4 space-y-4 px-4",children:[h.jsx("input",{value:i,onChange:l=>o(l.target.value),type:"text",name:"password",placeholder:s("Enter your password *"),required:!0,className:"rounded-md border border-slate-200 px-3 py-2 shadow-inner w-full"}),h.jsxs("p",{className:"text-sm",children:[s("How to get a password? Click to create a temporary email and receive at least one email to generate a password"),"."]}),h.jsxs("p",{className:"text-sm text-yellow-600",children:[s("Remember your password, otherwise your email will expire and cannot be retrieved"),"."]}),h.jsx("button",{type:"submit",disabled:r,className:"py-2.5 text-white rounded-md w-full bg-cyan-600 hover:opacity-90 disabled:cursor-not-allowed disabled:bg-zinc-500",children:s(r?"Submitting...":"Login")})]})]})})}function IR(){const[e,t]=b.useState(!1),n=b.useCallback(({onLogin:r,isLoggingIn:s})=>h.jsx(FR,{showPasswordModal:e,setShowPasswordModal:t,onLogin:r,isLoggingIn:s}),[e]);return b.useMemo(()=>({showPasswordModal:e,setShowPasswordModal:t,PasswordModal:n}),[t,n,e])}function _R({className:e="h-5 w-5"}){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 9.75 16.5 12l-2.25 2.25m-4.5 0L7.5 12l2.25-2.25M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})})}function VR({className:e="h-5 w-5"}){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5a17.92 17.92 0 0 1-8.716-2.247m0 0A8.966 8.966 0 0 1 3 12c0-1.97.633-3.794 1.708-5.273"})})}function Aa({showModal:e,setShowModal:t,title:n,children:r}){return h.jsx(Fw,{showModal:e,setShowModal:t,theme:"dark",children:h.jsxs("div",{className:"w-full max-h-[80vh] flex flex-col bg-neutral-800/95 backdrop-blur-xl shadow-xl md:max-w-3xl md:rounded-2xl md:border md:border-cyan-50/20",children:[h.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center p-4 border-b border-cyan-50/20 relative",children:[h.jsx("h3",{className:"font-display text-2xl font-bold text-white",children:n}),h.jsx(Oh,{className:"absolute top-4 right-4 h-6 w-6 text-gray-400 hover:text-white cursor-pointer",onClick:()=>t(!1),onPointerDown:s=>s.stopPropagation()})]}),h.jsx("div",{className:"flex-grow overflow-y-auto text-white p-6",children:h.jsx("div",{className:"text-white",children:r})})]})})}function UR(e){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 22 22",children:h.jsx("path",{fill:"#0891b2",d:"M7.376 6.745c-.447.275 1.197 4.242 1.598 4.888a1.206 1.206 0 0 0 2.053-1.266c-.397-.648-3.205-3.898-3.651-3.622m-.335-4.343a8.98 8.98 0 0 1 5.918 0c.329.114.765-.115.572-.611c-.141-.36-.277-.712-.332-.855c-.131-.339-.6-.619-.804-.665C11.623.097 10.823 0 10 0S8.377.097 7.604.271c-.204.046-.672.326-.803.665l-.332.855c-.193.496.243.726.572.611m12.057.784a10.132 10.132 0 0 0-1.283-1.285c-.153-.129-.603-.234-.888.051l-1.648 1.647a9.27 9.27 0 0 1 1.155.966c.362.361.677.752.966 1.155l1.647-1.647c.286-.286.181-.735.051-.887M10 2.9A8.1 8.1 0 0 0 1.899 11A8.1 8.1 0 0 0 10 19.101A8.1 8.1 0 0 0 10 2.9m0 14.201A6.1 6.1 0 1 1 10.001 4.9A6.1 6.1 0 0 1 10 17.1z"})})}const Gu=e=>e<10?`0${e}`:`${e}`;function $R({expiryTimestamp:e,onReset:t}){const{t:n}=sr(),r=b.useCallback(()=>{const o=e-Date.now();let a={hours:"00",minutes:"00",seconds:"00",expired:o<=0};if(o>0){const l=Math.floor(o/1e3),u=l%60,c=Math.floor(l/60),d=c%60,f=Math.floor(c/60);a={hours:Gu(f),minutes:Gu(d),seconds:Gu(u),expired:!1}}return a},[e]),[s,i]=b.useState(r());return b.useEffect(()=>{i(r());const o=setInterval(()=>{i(r())},1e3);return()=>clearInterval(o)},[e,r]),b.useEffect(()=>{s.expired},[s.expired]),h.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-cyan-400 my-4 p-3 bg-white/5 rounded-md border border-cyan-50/20 shadow-inner",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[" ",h.jsx(UR,{className:"w-5 h-5"}),s.expired?h.jsx("span",{children:n("Email expired")}):h.jsxs("span",{children:[n("Expires in"),": ",s.hours,":",s.minutes,":",s.seconds]})]}),!s.expired&&h.jsxs("button",{onClick:t,className:"p-1 rounded text-cyan-400 hover:text-cyan-300 focus:outline-none focus:ring-1 focus:ring-cyan-500",title:n("Reset validity"),children:[h.jsx(rx,{className:"w-5 h-5"})," "]})]})}function Iw({className:e}){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"512",height:"512",viewBox:"0 0 24 24",className:"h-6 w-6",fill:"currentColor",children:h.jsx("path",{d:"M1 150c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z",children:h.jsx("animate",{fill:"freeze",attributeName:"d",dur:"0.4s",keyTimes:"0;0.3;0.5;1",values:`M4 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z; + M8 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z; + M10 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z; + M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z`})})})}function BR(e){return h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 280 117",children:[h.jsx("path",{fill:"#FBAD41",d:"M205.52 50.813c-.858 0-1.705.03-2.551.058c-.137.007-.272.04-.398.094a1.424 1.424 0 0 0-.92.994l-3.628 12.672c-1.565 5.449-.983 10.48 1.646 14.174c2.41 3.416 6.42 5.421 11.289 5.655l19.679 1.194c.585.03 1.092.312 1.4.776a1.92 1.92 0 0 1 .2 1.692a2.496 2.496 0 0 1-2.134 1.662l-20.448 1.193c-11.11.515-23.062 9.58-27.255 20.633l-1.474 3.9a1.092 1.092 0 0 0 .967 1.49h70.425a1.872 1.872 0 0 0 1.81-1.365A51.172 51.172 0 0 0 256 101.828c0-28.16-22.582-50.984-50.449-50.984"}),h.jsx("path",{fill:"#F6821F",d:"m174.782 115.362l1.303-4.583c1.568-5.449.987-10.48-1.639-14.173c-2.418-3.417-6.424-5.422-11.296-5.656l-92.312-1.193a1.822 1.822 0 0 1-1.459-.776a1.919 1.919 0 0 1-.203-1.693a2.496 2.496 0 0 1 2.154-1.662l93.173-1.193c11.063-.511 23.015-9.58 27.208-20.633l5.313-14.04c.214-.596.27-1.238.156-1.86C191.126 20.51 166.91 0 137.96 0C111.269 0 88.626 17.403 80.5 41.596a26.996 26.996 0 0 0-19.156-5.359C48.549 37.524 38.25 47.946 36.979 60.88a27.905 27.905 0 0 0 .702 9.642C16.773 71.145 0 88.454 0 109.726c0 1.923.137 3.818.413 5.667c.115.897.879 1.57 1.783 1.568h170.48a2.223 2.223 0 0 0 2.106-1.63"})]})}function zR(){const e=ox(),{t}=sr(),n=_f(),[r,s]=b.useState(()=>Vt.get("userMailbox")),[i,o]=b.useState(()=>{const W=Vt.get("emailExpiry");return W?parseInt(W,10):void 0}),[a,l]=b.useState(""),[u,c]=b.useState([]),[d,f]=b.useState(!1),[p,m]=b.useState(null),[x,w]=b.useState(e.emailDomain[0]),[y,g]=b.useState(!1),{PasswordModal:v,setShowPasswordModal:S}=IR(),[C,T]=b.useState(!1),[E,j]=b.useState(!1),{data:F=[],isLoading:U,isFetching:B,refetch:J}=nP({queryKey:["emails",r],queryFn:()=>JT(r),enabled:!!r,refetchInterval:2e4,onError:W=>{Y.error(`${t("Failed to get emails")}: ${W.message}`,{duration:5e3})},retry:!1}),me=b.useCallback(W=>{Y(Re=>h.jsxs("div",{className:"w-full max-w-lg p-4 bg-slate-800 text-white rounded-lg shadow-lg border border-slate-700",children:[h.jsxs("div",{className:"flex items-center justify-between pb-2 mb-3 border-b border-slate-700",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(vd,{className:"h-6 w-6 text-cyan-400"}),h.jsx("h3",{className:"text-lg font-semibold",children:t("View password")})]}),h.jsx("button",{onClick:()=>Y.dismiss(Re.id),className:"p-1 rounded-full text-gray-400 hover:bg-slate-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-cyan-500","aria-label":"Close",children:h.jsx(Oh,{className:"h-5 w-5"})})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-gray-300",children:t("Save your password and continue using this email in 1 day")}),h.jsxs("div",{className:"mt-2 flex items-center text-sm bg-slate-700 px-2 py-1 rounded",children:[h.jsx("span",{className:"flex-1 font-mono break-all text-gray-100",children:W}),h.jsx(xd,{text:W,className:"p-1"})]}),h.jsx("p",{className:"mt-3 text-xs text-yellow-400",children:t("Remember your password, otherwise your email will expire and cannot be retrieved")})]})]}),{id:"password-notification",duration:5e3,position:"top-center",style:{background:"transparent",border:"none",padding:0,boxShadow:"none"}})},[t]),Z=b.useRef(F.length);b.useEffect(()=>{if(F.length>0&&!E&&j(!0),!r)j(!1),o(void 0),Y.dismiss("password-notification");else{const W=Vt.get("emailExpiry");W&&!i&&o(parseInt(W,10))}Z.current=F.length},[F,r,E,i]);const k=async()=>{if(!a){Y.error(t("No captcha response"));return}try{await ZT(a),f(!0);const W=`${_1("",nj())}@${x}`,Ft=Date.now()+24*60*60*1e3;Vt.set("userMailbox",W,{expires:1}),Vt.set("emailExpiry",Ft.toString(),{expires:1}),s(W),o(Ft),j(!1),Y.success(t("Email created successfully"))}catch(W){Y.error(t("Failed to verify captcha")),console.error("Turnstile verification failed:",W)}},R=()=>{Vt.remove("userMailbox"),Vt.remove("emailExpiry"),s(void 0),j(!1),m(null),o(void 0),n.invalidateQueries({queryKey:["emails"]})},_=()=>{J(),Y.success(t("Mailbox refreshed"))},O=b.useCallback(()=>{const W=Date.now()+864e5,Re=new Date(Date.now()+24*60*60*1e3);Vt.set("emailExpiry",W.toString(),{expires:Re}),o(W),Y.success(t("Validity reset successfully"))},[t]),D=rP({mutationFn:W=>ej(W),onSuccess:()=>{Y.success(t("Emails deleted successfully")),c([]),p&&u.includes(p.id)&&m(null),n.invalidateQueries({queryKey:["emails",r]})},onError:()=>{Y.error(t("Failed to delete emails"))}}),L=W=>{if(W.length===0){Y.error(t("Please select emails to delete"));return}D.mutate(W)},M=async W=>{T(!0);try{const Re=await tj(W),Rh=Date.now()+24*60*60*1e3;Vt.set("userMailbox",Re.address,{expires:1}),Vt.set("emailExpiry",Rh.toString(),{expires:1}),s(Re.address),o(Rh),S(!1),Y.success(t("Login successful"))}catch(Re){Y.error(`${t("Login failed")}: ${t(Re.message)}`)}finally{T(!1)}},$=b.useCallback(()=>r&&e.cookiesSecret?rj(r,e.cookiesSecret):null,[r,e.cookiesSecret]),K=W=>{m(W)},ve=()=>{m(null)},pt=()=>{g(!0)};return h.jsxs("div",{className:"h-full flex flex-col gap-4 md:flex-row justify-center items-start mt-24 mx-6 md:mx-10",children:[h.jsx(v,{onLogin:M,isLoggingIn:C}),p&&h.jsx(Aa,{showModal:y,setShowModal:g,title:t("Email Detail"),children:h.jsx(sx,{email:p,onClose:()=>g(!1)})}),h.jsxs("div",{className:"flex flex-col text-white items-start w-full md:w-[350px] mx-auto gap-2",children:[h.jsxs("div",{className:"w-full mb-4 md:max-w-[350px] shrink-0 group group-hover:before:duration-500 group-hover:after:duration-500 after:duration-500 hover:border-cyan-600 hover:before:[box-shadow:_20px_20px_20px_30px_#a21caf] duration-500 before:duration-500 hover:duration-500 hover:after:-right-8 hover:before:right-12 hover:before:-bottom-8 hover:before:blur origin-left hover:decoration-2 relative bg-neutral-800 h-full border text-left p-4 rounded-lg overflow-hidden border-cyan-50/20 before:absolute before:w-12 before:h-12 before:content[''] before:right-1 before:top-1 before:z-10 before:bg-violet-500 before:rounded-full before:blur-lg after:absolute after:z-10 after:w-20 after:h-20 after:content[''] after:bg-rose-300 after:right-8 after:top-3 after:rounded-full after:blur-lg",children:[h.jsx("h1",{className:"text-gray-50 text-xl font-bold mb-7 group-hover:text-cyan-500 duration-500",children:t("Virtual Temporary Email")}),h.jsxs("div",{className:"flex flex-col gap-4 text-sm text-gray-200",children:[h.jsxs("a",{href:"https://github.com/oiov/vmail",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 hover:text-cyan-400 transition-colors cursor-pointer",children:[h.jsx(Iw,{})," ",t("Open Source")]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(BR,{}),t("Stable - 1M+ emails processed")]}),h.jsxs(Wf,{to:"/api-docs",className:"flex items-center gap-1.5 hover:text-cyan-400 transition-colors cursor-pointer",children:[h.jsx(_R,{}),t("Open RESTful API")]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(VR,{}),t("Multi-domain configurable")]})]})]}),r?h.jsxs("div",{className:"w-full md:max-w-[350px] mb-4",children:[h.jsx("div",{className:"mb-4 font-semibold text-sm",children:t("Email address")}),h.jsxs("div",{className:"flex items-center text-zinc-100 bg-white/10 backdrop-blur-xl shadow-inner px-4 py-4 rounded-md w-full",children:[h.jsx("span",{className:"truncate",children:r}),h.jsx(xd,{text:r,className:"p-1 rounded-md ml-auto"})]}),i&&h.jsx($R,{expiryTimestamp:i,onReset:O}),h.jsx("button",{onClick:R,className:"py-2.5 rounded-md w-full bg-cyan-600 hover:opacity-90 disabled:cursor-not-allowed disabled:bg-zinc-500",children:t("Stop")})]}):h.jsxs("div",{className:"w-full md:max-w-[350px]",children:[h.jsxs("div",{className:"mb-4",children:[h.jsx("div",{className:"mb-3 font-semibold",children:t("Domain")}),h.jsx("select",{value:x,onChange:W=>w(W.target.value),className:"w-full p-2.5 rounded-md bg-white/10 text-white border border-cyan-50/20",children:e.emailDomain.map(W=>h.jsxs("option",{value:W,className:"text-black",children:["@",W]},W))})]}),h.jsxs("div",{className:"text-sm relative mb-4",children:[h.jsx("div",{className:"mb-3 font-semibold",children:t("Validater")}),h.jsx("div",{className:"[&_iframe]:!w-full h-[65px] max-w-[300px] bg-gray-700",children:h.jsx(qf,{siteKey:e.turnstileKey,onSuccess:l,options:{theme:"dark"}})})]}),h.jsx("button",{onClick:k,disabled:!a,className:"py-2.5 rounded-md w-full bg-cyan-600 hover:opacity-90 disabled:cursor-not-allowed disabled:bg-zinc-500",children:t("Create temporary email")}),h.jsxs("p",{className:"mt-4 text-sm text-cyan-500 cursor-pointer",onClick:()=>S(!0),children:[h.jsx(vd,{className:"inline-block w-4 h-4 mr-2"}),t("Have a password? Login.")]})]})]}),h.jsx("div",{className:"w-full flex-1 overflow-hidden",children:h.jsx(GT,{isAddressCreated:!!r,emails:F,isLoading:U,isFetching:B,onDelete:L,isDeleting:D.isPending,onRefresh:_,selectedIds:u,setSelectedIds:c,onSelectEmail:K,showViewPasswordButton:E,onShowPassword:()=>{const W=$();W&&me(W)},selectedEmail:p,onCloseDetail:ve,onExpand:pt})})]})}function WR(){const{t:e}=sr(),t=ox(),n=b.useRef(null),[r,s]=b.useState(""),[i,o]=b.useState(!1),[a,l]=b.useState(null),[u,c]=b.useState("");b.useEffect(()=>{n.current&&n.current.querySelectorAll("pre code").forEach(m=>{m.classList.add("language-json")})},[]);const d=async()=>{if(!r){Y.error(e("Please complete the verification first"));return}o(!0);try{const p=await fetch("/api/api-keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r,name:u||void 0})});if(!p.ok){const x=await p.json();throw new Error(x.message||"Failed to create API Key")}const m=await p.json();l(m.data.key),Y.success(e("API Key created successfully"))}catch(p){Y.error(p.message||e("Failed to create API Key"))}finally{o(!1)}},f=()=>{l(null),s(""),c("")};return h.jsx("div",{className:"min-h-screen bg-[#1f2023] text-white py-8 px-4 md:px-8 mt-16",children:h.jsxs("div",{className:"max-w-4xl mx-auto",ref:n,children:[h.jsxs("div",{className:"mb-8 pb-6 border-b border-gray-700",children:[h.jsx("h1",{className:"text-3xl font-bold text-cyan-400 mb-2",children:"API Documentation"}),h.jsx("p",{className:"text-gray-400",children:e("RESTful API for programmatic access to temporary email services")})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:e("Get API Key")}),h.jsx("div",{className:"bg-gray-800 rounded-lg p-4",children:a?h.jsxs("div",{children:[h.jsx("div",{className:"flex items-center gap-2 mb-3",children:h.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e("Created")})}),h.jsx("div",{className:"bg-yellow-900/30 border border-yellow-600/50 rounded-lg p-4 mb-4",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("svg",{className:"w-5 h-5 text-yellow-500 mt-0.5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:h.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-yellow-200 font-semibold text-sm",children:e("Important: Save your API Key now!")}),h.jsx("p",{className:"text-yellow-300/80 text-xs mt-1",children:e("This is the only time you will see the full API Key. It cannot be retrieved later.")})]})]})}),h.jsx("div",{className:"bg-gray-900 p-4 rounded-lg mb-4",children:h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("code",{className:"text-green-400 text-sm break-all flex-1",children:a}),h.jsx(xd,{text:a,className:"flex-shrink-0"})]})}),h.jsx("button",{onClick:f,className:"text-cyan-400 hover:text-cyan-300 text-sm underline",children:e("Create another API Key")})]}):h.jsxs("div",{children:[h.jsx("p",{className:"text-gray-300 mb-4",children:e("Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.")}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsxs("label",{className:"block text-sm text-gray-400 mb-2",children:[e("Key Name")," (",e("optional"),")"]}),h.jsx("input",{type:"text",value:u,onChange:p=>c(p.target.value),placeholder:e("e.g., My Project"),className:"w-full md:w-1/2 px-3 py-2 bg-gray-900 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-cyan-500"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-gray-400 mb-2",children:e("Verification")}),h.jsx("div",{className:"[&_iframe]:!w-full h-[65px] max-w-[300px] bg-gray-700 rounded",children:h.jsx(qf,{siteKey:t.turnstileKey,onSuccess:s,options:{theme:"dark"}})})]}),h.jsx("button",{onClick:d,disabled:!r||i,className:"px-6 py-2.5 bg-cyan-600 hover:bg-cyan-700 disabled:bg-gray-600 disabled:cursor-not-allowed rounded-lg font-medium transition-colors",children:e(i?"Creating...":"Create API Key")})]})]})})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:e("Authentication")}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 mb-4",children:[h.jsx("p",{className:"text-gray-300 mb-3",children:e("All API requests require an API Key. Include it in the request header:")}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto",children:h.jsx("code",{className:"text-green-400",children:"X-API-Key: your-api-key"})}),h.jsx("p",{className:"text-gray-400 text-sm mt-2",children:e("Or use Authorization header:")}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto mt-2",children:h.jsx("code",{className:"text-green-400",children:"Authorization: Bearer your-api-key"})})]})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:"Base URL"}),h.jsx("div",{className:"bg-gray-800 rounded-lg p-4",children:h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto",children:h.jsx("code",{className:"text-yellow-400",children:"https://vmail.dev/api/v1"})})})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:e("Endpoints")}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 mb-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[h.jsx("span",{className:"bg-green-600 text-white px-2 py-1 rounded text-sm font-mono",children:"POST"}),h.jsx("code",{className:"text-white font-mono",children:"/mailboxes"})]}),h.jsx("p",{className:"text-gray-300 mb-4",children:e("Create a new temporary mailbox")}),h.jsxs("h4",{className:"text-cyan-200 font-semibold mb-2",children:[e("Request Body")," (optional)"]}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto mb-4 text-sm",children:h.jsx("code",{className:"text-gray-300",children:`{ + "localPart": "mytest", // Optional: custom local part + "domain": "example.com", // Optional: email domain + "expiresIn": 86400 // Optional: expiry in seconds (default: 24h) +}`})}),h.jsxs("h4",{className:"text-cyan-200 font-semibold mb-2",children:[e("Response")," ",h.jsx("span",{className:"text-green-400",children:"201 Created"})]}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm",children:h.jsx("code",{className:"text-gray-300",children:`{ + "data": { + "id": "abc123xyz", + "address": "mytest@example.com", + "domain": "example.com", + "expiresAt": "2024-02-12T12:00:00.000Z", + "createdAt": "2024-02-11T12:00:00.000Z" + } +}`})})]}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 mb-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[h.jsx("span",{className:"bg-blue-600 text-white px-2 py-1 rounded text-sm font-mono",children:"GET"}),h.jsx("code",{className:"text-white font-mono",children:"/mailboxes/:id"})]}),h.jsx("p",{className:"text-gray-300 mb-4",children:e("Get mailbox information")}),h.jsxs("h4",{className:"text-cyan-200 font-semibold mb-2",children:[e("Response")," ",h.jsx("span",{className:"text-green-400",children:"200 OK"})]}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm",children:h.jsx("code",{className:"text-gray-300",children:`{ + "data": { + "id": "abc123xyz", + "address": "mytest@example.com", + "domain": "example.com", + "expiresAt": "2024-02-12T12:00:00.000Z", + "createdAt": "2024-02-11T12:00:00.000Z", + "messageCount": 5 + } +}`})})]}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 mb-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[h.jsx("span",{className:"bg-blue-600 text-white px-2 py-1 rounded text-sm font-mono",children:"GET"}),h.jsx("code",{className:"text-white font-mono",children:"/mailboxes/:id/messages"})]}),h.jsx("p",{className:"text-gray-300 mb-4",children:e("Get inbox messages with pagination")}),h.jsx("h4",{className:"text-cyan-200 font-semibold mb-2",children:e("Query Parameters")}),h.jsx("div",{className:"overflow-x-auto mb-4",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"text-left text-gray-400 border-b border-gray-700",children:[h.jsx("th",{className:"pb-2 pr-4",children:e("Parameter")}),h.jsx("th",{className:"pb-2 pr-4",children:e("Type")}),h.jsx("th",{className:"pb-2 pr-4",children:e("Default")}),h.jsx("th",{className:"pb-2",children:e("Description")})]})}),h.jsxs("tbody",{className:"text-gray-300",children:[h.jsxs("tr",{className:"border-b border-gray-700/50",children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-yellow-400",children:"page"}),h.jsx("td",{className:"py-2 pr-4",children:"number"}),h.jsx("td",{className:"py-2 pr-4",children:"1"}),h.jsx("td",{className:"py-2",children:e("Page number")})]}),h.jsxs("tr",{className:"border-b border-gray-700/50",children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-yellow-400",children:"limit"}),h.jsx("td",{className:"py-2 pr-4",children:"number"}),h.jsx("td",{className:"py-2 pr-4",children:"20"}),h.jsx("td",{className:"py-2",children:e("Items per page (max 100)")})]}),h.jsxs("tr",{children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-yellow-400",children:"sort"}),h.jsx("td",{className:"py-2 pr-4",children:"string"}),h.jsx("td",{className:"py-2 pr-4",children:"desc"}),h.jsx("td",{className:"py-2",children:e("Sort order (asc/desc)")})]})]})]})}),h.jsxs("h4",{className:"text-cyan-200 font-semibold mb-2",children:[e("Response")," ",h.jsx("span",{className:"text-green-400",children:"200 OK"})]}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm",children:h.jsx("code",{className:"text-gray-300",children:`{ + "data": [ + { + "id": "msg_001", + "from": { "address": "sender@example.com", "name": "Sender" }, + "subject": "Hello World", + "preview": "This is a preview...", + "receivedAt": "2024-02-11T10:30:00.000Z" + } + ], + "pagination": { + "page": 1, + "limit": 20, + "total": 42, + "totalPages": 3, + "hasMore": true + } +}`})})]}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 mb-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[h.jsx("span",{className:"bg-blue-600 text-white px-2 py-1 rounded text-sm font-mono",children:"GET"}),h.jsx("code",{className:"text-white font-mono",children:"/mailboxes/:id/messages/:messageId"})]}),h.jsx("p",{className:"text-gray-300 mb-4",children:e("Get full message details")}),h.jsxs("h4",{className:"text-cyan-200 font-semibold mb-2",children:[e("Response")," ",h.jsx("span",{className:"text-green-400",children:"200 OK"})]}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm",children:h.jsx("code",{className:"text-gray-300",children:`{ + "data": { + "id": "msg_001", + "messageId": "", + "from": { "address": "sender@example.com", "name": "Sender" }, + "to": [{ "address": "mytest@example.com", "name": "" }], + "cc": [], + "bcc": [], + "replyTo": [], + "subject": "Hello World", + "text": "Plain text content...", + "html": "...", + "headers": [{ "name": "X-Custom", "value": "value" }], + "receivedAt": "2024-02-11T10:30:00.000Z" + } +}`})})]}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4 mb-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[h.jsx("span",{className:"bg-red-600 text-white px-2 py-1 rounded text-sm font-mono",children:"DELETE"}),h.jsx("code",{className:"text-white font-mono",children:"/mailboxes/:id/messages/:messageId"})]}),h.jsx("p",{className:"text-gray-300 mb-4",children:e("Delete a specific message")}),h.jsxs("h4",{className:"text-cyan-200 font-semibold mb-2",children:[e("Response")," ",h.jsx("span",{className:"text-green-400",children:"200 OK"})]}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm",children:h.jsx("code",{className:"text-gray-300",children:`{ + "data": { + "deleted": true, + "id": "msg_001" + } +}`})})]})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:e("Error Responses")}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[h.jsx("p",{className:"text-gray-300 mb-4",children:e("All errors follow a consistent format:")}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm mb-4",children:h.jsx("code",{className:"text-gray-300",children:`{ + "error": { + "code": "ERROR_CODE", + "message": "Human readable message" + } +}`})}),h.jsx("h4",{className:"text-cyan-200 font-semibold mb-2",children:e("Error Codes")}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"text-left text-gray-400 border-b border-gray-700",children:[h.jsx("th",{className:"pb-2 pr-4",children:"Code"}),h.jsx("th",{className:"pb-2 pr-4",children:"HTTP Status"}),h.jsx("th",{className:"pb-2",children:e("Description")})]})}),h.jsxs("tbody",{className:"text-gray-300",children:[h.jsxs("tr",{className:"border-b border-gray-700/50",children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-red-400",children:"UNAUTHORIZED"}),h.jsx("td",{className:"py-2 pr-4",children:"401"}),h.jsx("td",{className:"py-2",children:e("Missing or invalid API Key")})]}),h.jsxs("tr",{className:"border-b border-gray-700/50",children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-red-400",children:"FORBIDDEN"}),h.jsx("td",{className:"py-2 pr-4",children:"403"}),h.jsx("td",{className:"py-2",children:e("API Key disabled/expired or no access")})]}),h.jsxs("tr",{className:"border-b border-gray-700/50",children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-red-400",children:"NOT_FOUND"}),h.jsx("td",{className:"py-2 pr-4",children:"404"}),h.jsx("td",{className:"py-2",children:e("Resource not found")})]}),h.jsxs("tr",{className:"border-b border-gray-700/50",children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-red-400",children:"VALIDATION_ERROR"}),h.jsx("td",{className:"py-2 pr-4",children:"400"}),h.jsx("td",{className:"py-2",children:e("Invalid request parameters")})]}),h.jsxs("tr",{children:[h.jsx("td",{className:"py-2 pr-4 font-mono text-red-400",children:"CONFLICT"}),h.jsx("td",{className:"py-2 pr-4",children:"409"}),h.jsx("td",{className:"py-2",children:e("Resource already exists")})]})]})]})})]})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:e("Example Usage")}),h.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[h.jsx("h4",{className:"text-cyan-200 font-semibold mb-2",children:e("Create mailbox and check for messages")}),h.jsx("pre",{className:"bg-gray-900 p-3 rounded overflow-x-auto text-sm",children:h.jsx("code",{className:"text-gray-300",children:`# Create a new mailbox +curl -X POST https://vmail.dev/api/v1/mailboxes \\ + -H "X-API-Key: your-api-key" \\ + -H "Content-Type: application/json" \\ + -d '{"domain": "example.com"}' + +# Response: { "data": { "id": "abc123", "address": "...", ... } } + +# Check inbox +curl https://vmail.dev/api/v1/mailboxes/abc123/messages \\ + -H "X-API-Key: your-api-key" + +# Get specific message +curl https://vmail.dev/api/v1/mailboxes/abc123/messages/msg_001 \\ + -H "X-API-Key: your-api-key"`})})]})]}),h.jsxs("section",{className:"mb-8",children:[h.jsx("h2",{className:"text-2xl font-semibold text-cyan-300 mb-4",children:e("Rate Limits")}),h.jsx("div",{className:"bg-gray-800 rounded-lg p-4",children:h.jsx("p",{className:"text-gray-300",children:e("API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.")})})]})]})})}function HR(){return h.jsxs("svg",{id:"iconce.com",width:"32",height:"32",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[h.jsxs("defs",{children:[h.jsxs("linearGradient",{id:"r5",gradientUnits:"userSpaceOnUse",gradientTransform:"rotate(45)",style:{transformOrigin:"center center"},children:[h.jsx("stop",{stopColor:"#5C5C5C"}),h.jsx("stop",{offset:"1",stopColor:"#0F1015"})]}),h.jsxs("radialGradient",{id:"r6",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(256) rotate(90) scale(512)",children:[h.jsx("stop",{stopColor:"white"}),h.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})]}),h.jsx("rect",{id:"r4",width:"256",height:"256",x:"0",y:"0",rx:"48",fill:"url(#r5)",stroke:"#FFFFFF",strokeWidth:"0",strokeOpacity:"100%",paintOrder:"stroke"}),h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"170",height:"170",viewBox:"0 0 24 24",fill:"none",stroke:"#FFFFFF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white",alignmentBaseline:"middle",x:"43",y:"43",children:[h.jsx("path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z"}),h.jsx("polyline",{points:"15,9 18,9 18,11"}),h.jsx("path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2v0"}),h.jsx("line",{x1:"6",x2:"7",y1:"10",y2:"10"})]})]})}function KR({className:e}){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-[1px]",children:h.jsx("path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5"})})}function qR(){return h.jsx("div",{children:h.jsxs("div",{className:"max-w-[1400px] ",children:[h.jsxs("p",{className:"mt-8",children:[h.jsx("strong",{children:"Vmail.DEV "})," is a Virtual temporary email service."," "]}),h.jsxs("p",{className:"mt-4",children:["You can get a temporary email without revealing any personal information, which greatly protects your privacy."," "]}),h.jsxs("p",{className:"mt-4",children:["It supports selecting one domain names, making it convenient for you to use in different scenarios."," "]}),h.jsxs("p",{className:"mt-4",children:["100% running on the ",h.jsx("strong",{children:"Cloudflare "})," network, providing you with a super-fast experience."," "]}),h.jsx("p",{className:"mt-4",children:"Misuse of the temporary email service not only violates our terms of service but can also impact the normal use of other users. We encourage each user to use our services responsibly to ensure that resources are allocated and used appropriately."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"copyrights",children:h.jsx("a",{href:"#copyrights",children:"Copyrights "})}),h.jsxs("p",{className:"mt-4",children:["All copyrights belong to"," ",h.jsxs("a",{href:"https://vmail.dev",rel:"nofollow",children:[h.jsx("strong",{children:"Vmail.DEV "})," "]}),"."," "]})]})})}function QR(){return h.jsx("div",{children:h.jsxs("div",{className:"max-w-[1400px] ",children:[h.jsx("p",{className:"mt-8",children:"At Vmail.DEV, we value the privacy of our users and are committed to protecting their personal information. This Privacy Policy outlines the practices we follow regarding the collection, use, storage, and deletion of data on our one-time email website."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Collection of Information",children:"1. Collection of Information"}),h.jsx("p",{className:"mt-4",children:"We only collect and store an email name for the duration of the session. This information is necessary to facilitate the functioning of our one-time email service."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Storage of Emails",children:"2. Storage of Emails"}),h.jsx("p",{className:"mt-4",children:"All emails sent and received through our one-time email service are temporarily stored in Cloudflare data centers. This storage is essential for the proper delivery and retrieval of emails during the active session."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Deletion of Emails",children:"3. Deletion of Emails"}),h.jsx("p",{className:"mt-4",children:"Once an email expires, we ensure the complete deletion of the email from our system. This means that all associated data, including the email content and any related information, will be permanently removed from our servers."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Data Security",children:"4. Data Security"}),h.jsx("p",{className:"mt-4",children:"We take appropriate measures to protect the personal information and emails stored on our website. However, it is important to note that no method of data transmission or storage is completely secure. While we strive to use commercially acceptable means to protect user data, we cannot guarantee absolute security."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Third-Party Services",children:"5. Third-Party Services"}),h.jsx("p",{className:"mt-4",children:"We may use third-party services, such as Cloudflare, to assist in the operation and maintenance of our website. These third-party services may have access to certain user data, including email names and content, solely for the purpose of providing their services. We ensure that any third-party services we use are reputable and have appropriate data protection measures in place."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"",children:"6. Information Sharing"}),h.jsx("p",{className:"mt-4",children:"We do not share, sell, or disclose any personal information or email content to third parties, except as required by law or as necessary to protect our rights, property, or safety."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Cookies",children:"7. Cookies"}),h.jsx("p",{className:"mt-4",children:"We may use cookies to enhance the user experience on our website. These cookies may collect non-personal information and are used solely for website analytics and functionality purposes."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Children's Privacy",children:"8. Children's Privacy"}),h.jsx("p",{className:"mt-4",children:"Our website is not intended for use by individuals under the age of 13. We do not knowingly collect personal information from children. If you believe that we may have inadvertently collected personal information from a child under 13, please contact us immediately, and we will take appropriate steps to delete such information."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Changes to the Privacy Policy",children:"9. Changes to the Privacy Policy"}),h.jsx("p",{className:"mt-4",children:"We reserve the right to modify or update this Privacy Policy at any time. Any changes made will be effective immediately upon posting the revised Privacy Policy on our website. It is advisable to review this Privacy Policy periodically for any updates."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Contact Us",children:"10. Contact Us"}),h.jsx("p",{className:"mt-4",children:"If you have any questions, concerns, or feedback regarding this Privacy Policy or our website's privacy practices, please contact us."}),h.jsx("p",{className:"mt-8",children:"Last updated: 2024-03-15"})]})})}function GR(){return h.jsx("div",{children:h.jsxs("div",{className:"max-w-[1400px] ",children:[h.jsx("p",{className:"mt-8",children:'Welcome to Vmail.DEV! These Terms of Service ("Terms") govern your access to and use of our website and services. By accessing or using our services, you agree to be bound by these Terms. If you do not agree to these Terms, please do not use our services.'}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Collection of Information",children:"1. Description of Service"}),h.jsx("p",{className:"mt-4",children:"Vmail.DEV is a minimalistic temporary email service that allows you to obtain a temporary email address without disclosing any personal information, ensuring the protection of your privacy. Our service supports the selection of multiple domain names, providing you with the convenience of using it in various scenarios. Additionally, Vmail.DEV operates on the Cloudflare network, guaranteeing a super-fast experience."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Storage of Emails",children:"2. Usage Restrictions"}),h.jsx("p",{className:"mt-4",children:"2.1 Availability: Please note that Vmail.DEV is not available in China Mainland. We apologize for any inconvenience caused."}),h.jsx("p",{className:"mt-4",children:"2.2 Copyright: All copyrights related to Vmail.DEV and its services belong to Vmail.DEV. You may not copy, reproduce, distribute, modify, or create derivative works of Vmail.DEV or any part thereof without explicit permission from Vmail.DEV."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Deletion of Emails",children:"3. User Responsibilities"}),h.jsx("p",{className:"mt-4",children:"3.1 Registration: You are not required to register or provide any personal information to use Vmail.DEV. However, you are solely responsible for maintaining the confidentiality of any temporary email addresses generated through our service."}),h.jsx("p",{className:"mt-4",children:"3.2 Prohibited Activities: While using Vmail.DEV, you agree not to engage in any activities that may violate any applicable laws, regulations, or these Terms. Prohibited activities include, but are not limited to:"}),h.jsxs("ul",{className:"mt-4",children:[h.jsx("li",{children:"a) Sending spam or unsolicited emails. "}),h.jsx("li",{children:"b) Interfering with or disrupting the operation of our services."}),h.jsx("li",{children:"c) Attempting to gain unauthorized access to our systems or networks."})]}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Data Security",children:"4. Disclaimer of Warranty"}),h.jsx("p",{className:"mt-4",children:'Vmail.DEV is provided on an "as is" and "as available" basis. We do not warrant that our services will be uninterrupted, error-free, or secure. Your use of Vmail.DEV is at your own risk, and we disclaim all warranties, whether express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement.'}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Third-Party Services",children:"5. Limitation of Liability"}),h.jsx("p",{className:"mt-4",children:"To the maximum extent permitted by law, in no event shall Vmail.DEV or its affiliates be liable for any indirect, incidental, special, consequential, or punitive damages, including without limitation, loss of profits, data, use, goodwill, or other intangible losses, resulting from your access to or use of Vmail.DEV or any content or services provided through Vmail.DEV."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"",children:"6. Modification of Terms"}),h.jsx("p",{className:"mt-4",children:"We reserve the right to modify these Terms at any time, without prior notice. Any changes to the Terms will be effective immediately upon posting. Your continued use of Vmail.DEV after the posting of any modified Terms constitutes your acceptance of such changes."}),h.jsx("h2",{className:"mt-8 text-2xl font-bold",id:"Cookies",children:"7. Governing Law and Jurisdiction"}),h.jsx("p",{className:"mt-4",children:"These Terms shall be governed by and construed in accordance with the laws of the jurisdiction where Vmail.DEV is located. Any disputes arising out of or in connection with these Terms shall be subject to the exclusive jurisdiction of the courts in that jurisdiction."}),h.jsx("p",{className:"mt-4",children:"If you have any questions or concerns regarding these Terms, please contact us."}),h.jsx("p",{className:"mt-8",children:"Last updated: 2024-04-10"})]})})}function YR(){const{t:e}=sr(),[t,n]=b.useState(!1),[r,s]=b.useState(!1),[i,o]=b.useState(!1);return h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"fixed top-0 z-20 h-20 w-full px-5 backdrop-blur-xl md:px-10 text-white flex items-center justify-between shadow-sm",children:[h.jsxs(Wf,{to:"/",className:"font-bold flex items-center justify-center gap-3",children:[h.jsx(HR,{}),h.jsx("button",{className:"cool-btn",children:h.jsx("span",{children:"VMAIL.DEV"})})]}),h.jsxs("nav",{className:"flex items-center",children:[h.jsx("a",{className:"ml-3 md:ml-8",target:"_blank",rel:"noopener noreferrer",href:"/api-docs",children:"API"}),h.jsx("button",{onClick:()=>n(!0),className:"ml-3 md:ml-8 text-sm md:text-base hidden md:block hover:text-cyan-400",children:e("About")}),h.jsx("button",{onClick:()=>s(!0),className:"ml-3 md:ml-8 text-sm md:text-base hidden md:block hover:text-cyan-400",children:e("Privacy")}),h.jsx("button",{onClick:()=>o(!0),className:"ml-3 md:ml-8 text-sm md:text-base hidden md:block hover:text-cyan-400",children:e("Terms")}),h.jsx("a",{className:"ml-3 md:ml-8",target:"_blank",rel:"noopener noreferrer",href:"https://github.com/oiov/vmail",children:h.jsxs("button",{className:"whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-transparent hover:bg-accent hover:text-accent-foreground text-md flex h-[32px] w-[85px] cursor-pointer items-center justify-center rounded-md border-2 p-2 font-semibold hover:opacity-50",children:[h.jsx(KR,{}),h.jsx("div",{className:"ml-1.5 text-sm",children:"Star"})]})})]})]}),h.jsx(Aa,{showModal:t,setShowModal:n,title:e("About"),children:h.jsx(qR,{})}),h.jsx(Aa,{showModal:r,setShowModal:s,title:e("Privacy"),children:h.jsx(QR,{})}),h.jsx(Aa,{showModal:i,setShowModal:o,title:e("Terms"),children:h.jsx(GR,{})})]})}function XR({className:e}){return h.jsx("svg",{width:"512",height:"512",viewBox:"0 0 24 24",className:"h-6 w-6",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fill:"currentColor",d:"M8.5 2h2.5L11 2h-2.5zM13 2h2.5L15.5 2h-2.5zM10.5 2h5v0h-5zM8.5 2h5v0h-5zM10 2h3.5L13.5 2h-3.5z",children:h.jsx("animate",{fill:"freeze",attributeName:"d",dur:"0.4s",keyTimes:"0;0.3;0.5;1",values:` + M8.5 2h2.5L11 2h-2.5zM13 2h2.5L15.5 2h-2.5zM10.5 2h5v0h-5zM8.5 2h5v0h-5zM10 2h3.5L13.5 2h-3.5z; + M8.5 2h2.5L11 22h-2.5zM13 2h2.5L15.5 22h-2.5zM10.5 2h5v2h-5zM8.5 20h5v2h-5zM10 2h3.5L13.5 22h-3.5z; + M8.5 2h2.5L11 22h-2.5zM13 2h2.5L15.5 22h-2.5zM10.5 2h5v2h-5zM8.5 20h5v2h-5zM10 2h3.5L13.5 22h-3.5z; + M1 2h2.5L18.5 22h-2.5zM5.5 2h2.5L23 22h-2.5zM3 2h5v2h-5zM16 20h5v2h-5zM18.5 2h3.5L5 22h-3.5z`})})})}function JR(e){return h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{color:"#0070f3",strokeWidth:"3",d:"m12 14 4-4"}),h.jsx("defs",{children:h.jsxs("linearGradient",{id:"gradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[h.jsx("stop",{offset:"0%",style:{stopColor:"rgb(35, 35, 35)",stopOpacity:"1"}}),h.jsx("stop",{offset:"100%",style:{stopColor:"rgb(100,100,100)",stopOpacity:"1"}})]})}),h.jsx("path",{d:"M3.34 19a10 10 0 1 1 17.32 0",stroke:"url(#gradient)",strokeWidth:"3"})]})}function ZR(){return h.jsxs("div",{className:"text-white w-full mt-auto flex flex-col items-center justify-between px-5 pt-16 mb-10 md:px-10 mx-auto sm:flex-row",children:[h.jsx(Wf,{to:"/",className:"text-xl font-black leading-none select-none logo",children:"VMAIL.DEV"})," ",h.jsxs("p",{className:"mt-4 text-sm text-gray-400 sm:ml-4 sm:pl-4 sm:border-l sm:border-gray-200 sm:mt-0",children:["© 2024 Products of"," ",h.jsx("a",{className:"font-semibold underline hover:text-gray-600",href:"https://www.oiov.dev",target:"_blank",rel:"noopener noreferrer",children:"oiov"}),"."]}),h.jsxs("div",{className:"inline-flex justify-center mt-4 space-x-5 sm:ml-auto sm:mt-0 sm:justify-start",children:[h.jsx("a",{href:"https://like.do",target:"_blank",rel:"noopener noreferrer",title:"LikeDo",className:"text-gray-400 hover:text-gray-500 scale-[1.2]",children:h.jsx(JR,{className:"w-6 h-6"})}),h.jsx("a",{href:"mailto:hi@oiov.dev",title:"Email",className:"text-gray-400 hover:text-gray-500",children:h.jsx(nx,{className:"w-6 h-6"})}),h.jsx("a",{href:"https://twitter.com/yesmoree",target:"_blank",rel:"noopener noreferrer",title:"Twitter",className:"text-gray-400 hover:text-gray-500",children:h.jsx(XR,{})}),h.jsx("a",{href:"https://github.com/oiov/vmail",target:"_blank",rel:"noopener noreferrer",title:"Github",className:"text-gray-400 hover:text-gray-500",children:h.jsx(Iw,{})})]})]})}function e5(){return h.jsxs("div",{className:"mx-auto min-h-screen flex flex-col bg-[#1f2023]",children:[h.jsx(YR,{}),h.jsx(kk,{}),h.jsx(ZR,{}),h.jsx(JE,{position:"bottom-right",toastOptions:{style:{background:"#333",color:"#fff"}}})]})}const t5=new VS;function n5(){const[e,t]=b.useState(null);return b.useEffect(()=>{be.get("/config").then(n=>{t(n.data)})},[]),e?h.jsx(ix.Provider,{value:e,children:h.jsx(WS,{client:t5,children:h.jsx(Dk,{children:h.jsx(Tk,{children:h.jsxs(Ea,{element:h.jsx(e5,{}),children:[h.jsx(Ea,{path:"/",element:h.jsx(zR,{})}),h.jsx(Ea,{path:"/api-docs",element:h.jsx(WR,{})})]})})})})}):h.jsx("div",{className:"bg-[#1f2023] text-white w-screen h-screen flex items-center justify-center",children:"Loading..."})}const q=e=>typeof e=="string",di=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},Xg=e=>e==null?"":""+e,r5=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},s5=/###/g,Jg=e=>e&&e.indexOf("###")>-1?e.replace(s5,"."):e,Zg=e=>!e||q(e),Ii=(e,t,n)=>{const r=q(t)?t.split("."):t;let s=0;for(;s{const{obj:r,k:s}=Ii(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],o=t.slice(0,t.length-1),a=Ii(e,o,Object);for(;a.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),a=Ii(e,o,Object),a&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},i5=(e,t,n,r)=>{const{obj:s,k:i}=Ii(e,t,Object);s[i]=s[i]||[],s[i].push(n)},vl=(e,t)=>{const{obj:n,k:r}=Ii(e,t);if(n)return n[r]},o5=(e,t,n)=>{const r=vl(e,n);return r!==void 0?r:vl(t,n)},_w=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?q(e[r])||e[r]instanceof String||q(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):_w(e[r],t[r],n):e[r]=t[r]);return e},qr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var a5={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const l5=e=>q(e)?e.replace(/[&<>"'\/]/g,t=>a5[t]):e;class u5{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const c5=[" ",",","?","!",";"],d5=new u5(20),f5=(e,t,n)=>{t=t||"",n=n||"";const r=c5.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const s=d5.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let i=!s.test(e);if(!i){const o=e.indexOf(n);o>0&&!s.test(e.substring(0,o))&&(i=!0)}return i},Id=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i-1&&le&&e.replace("_","-"),h5={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class wl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||h5,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{let[a,l]=o;for(let u=0;u{let[a,l]=o;for(let u=0;u1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):q(r)&&i?a.push(...r.split(i)):a.push(r)));const l=vl(this.data,a);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),l||!o||!q(r)?l:Id(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."),s=n,n=a[1]),this.addNamespaces(n),ey(this.data,a,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(q(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),s=r,r=n,n=a[1]),this.addNamespaces(n);let l=vl(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?_w(l,r,i):l={...l,...r},ey(this.data,a,l),o.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var Vw={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const ny={};class bl extends ru{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),r5(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Gt.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!f5(t,r,s);if(o&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:q(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:q(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const S=n.nsSeparator||this.options.nsSeparator;return s?{res:`${l}${S}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${S}${o}`}return s?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const d=this.resolve(t,n);let f=d&&d.res;const p=d&&d.usedKey||o,m=d&&d.exactUsedKey||o,x=Object.prototype.toString.apply(f),w=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject,v=!q(f)&&typeof f!="boolean"&&typeof f!="number";if(g&&f&&v&&w.indexOf(x)<0&&!(q(y)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(d.res=S,d.usedParams=this.getUsedParamsDetails(n),d):S}if(i){const S=Array.isArray(f),C=S?[]:{},T=S?m:p;for(const E in f)if(Object.prototype.hasOwnProperty.call(f,E)){const j=`${T}${i}${E}`;C[E]=this.translate(j,{...n,joinArrays:!1,ns:a}),C[E]===j&&(C[E]=f[E])}f=C}}else if(g&&q(y)&&Array.isArray(f))f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let S=!1,C=!1;const T=n.count!==void 0&&!q(n.count),E=bl.hasDefaultValue(n),j=T?this.pluralResolver.getSuffix(u,n.count,n):"",F=n.ordinal&&T?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",U=T&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),B=U&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${j}`]||n[`defaultValue${F}`]||n.defaultValue;!this.isValidLookup(f)&&E&&(S=!0,f=B),this.isValidLookup(f)||(C=!0,f=o);const me=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,Z=E&&B!==f&&this.options.updateMissing;if(C||S||Z){if(this.logger.log(Z?"updateKey":"missingKey",u,l,o,Z?B:f),i){const O=this.resolve(o,{...n,keySeparator:!1});O&&O.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let k=[];const R=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&R&&R[0])for(let O=0;O{const M=E&&L!==f?L:me;this.options.missingKeyHandler?this.options.missingKeyHandler(O,l,D,M,Z,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(O,l,D,M,Z,n),this.emit("missingKey",O,l,D,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&T?k.forEach(O=>{const D=this.pluralResolver.getSuffixes(O,n);U&&n[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(L=>{_([O],o+L,n[`defaultValue${L}`]||B)})}):_(k,o,B))}f=this.extendTranslation(f,t,n,d,r),C&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(C||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,S?f:void 0):f=this.options.parseMissingKeyHandler(f))}return s?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,s,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=q(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&!q(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language||s.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),p=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,o,a;return q(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;s=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!q(n.count),p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),m=n.context!==void 0&&(q(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(w=>{this.isValidLookup(r)||(a=w,!ny[`${x[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(ny[`${x[0]}-${w}`]=!0,this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(y=>{if(this.isValidLookup(r))return;o=y;const g=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(g,c,y,w,n);else{let S;f&&(S=this.pluralResolver.getSuffix(y,n.count,n));const C=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(g.push(c+S),n.ordinal&&S.indexOf(T)===0&&g.push(c+S.replace(T,this.options.pluralSeparator)),p&&g.push(c+C)),m){const E=`${c}${this.options.contextSeparator}${n.context}`;g.push(E),f&&(g.push(E+S),n.ordinal&&S.indexOf(T)===0&&g.push(E+S.replace(T,this.options.pluralSeparator)),p&&g.push(E+C))}}let v;for(;v=g.pop();)this.isValidLookup(r)||(i=v,r=this.getResource(y,w,v,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!q(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const Yu=e=>e.charAt(0).toUpperCase()+e.slice(1);class ry{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gt.create("languageUtils")}getScriptPartFromCode(t){if(t=xl(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=xl(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(q(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Yu(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Yu(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Yu(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),q(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=o=>{o&&(this.isSupportedCode(o)?s.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return q(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):q(t)&&i(this.formatLanguageCode(t)),r.forEach(o=>{s.indexOf(o)<0&&i(this.formatLanguageCode(o))}),s}}let p5=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],m5={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const g5=["v1","v2","v3"],y5=["v4"],sy={zero:0,one:1,two:2,few:3,many:4,other:5},v5=()=>{const e={};return p5.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:m5[t.fc]}})}),e};class x5{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Gt.create("pluralResolver"),(!this.options.compatibilityJSON||y5.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=v5(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=xl(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(l,n)}return this.pluralRulesCache[i]=o,o}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>sy[s]-sy[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!g5.includes(this.options.compatibilityJSON)}}const iy=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=o5(e,t,n);return!i&&s&&q(n)&&(i=Id(e,n,r),i===void 0&&(i=Id(t,n,r))),i},Xu=e=>e.replace(/\$/g,"$$$$");class w5{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Gt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:p,nestingSuffix:m,nestingSuffixEscaped:x,nestingOptionsSeparator:w,maxReplaces:y,alwaysFormat:g}=t.interpolation;this.escape=n!==void 0?n:l5,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?qr(i):o||"{{",this.suffix=a?qr(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=f?qr(f):p||qr("$t("),this.nestingSuffix=m?qr(m):x||qr(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=y||1e3,this.alwaysFormat=g!==void 0?g:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=p=>{if(p.indexOf(this.formatSeparator)<0){const y=iy(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:p}):y}const m=p.split(this.formatSeparator),x=m.shift().trim(),w=m.join(this.formatSeparator).trim();return this.format(iy(n,l,x,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...s,...n,interpolationkey:x})};this.resetRegExp();const c=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>Xu(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?Xu(this.escape(p)):Xu(p)}].forEach(p=>{for(a=0;i=p.regex.exec(t);){const m=i[1].trim();if(o=u(m),o===void 0)if(typeof c=="function"){const w=c(t,i,s);o=q(w)?w:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))o="";else if(d){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),o="";else!q(o)&&!this.useRawValueToEscape&&(o=Xg(o));const x=p.safeValue(o);if(t=t.replace(i[0],x),d?(p.regex.lastIndex+=o.length,p.regex.lastIndex-=i[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,o;const a=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const p=f.match(/'/g),m=f.match(/"/g);(p&&p.length%2===0&&!m||m.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,x),`${l}${c}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;s=this.nestingRegexp.exec(t);){let l=[];o={...r},o=o.replace&&!q(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const c=s[1].split(this.formatSeparator).map(d=>d.trim());s[1]=c.shift(),l=c,u=!0}if(i=n(a.call(this,s[1].trim(),o),o),i&&s[0]===t&&!q(i))return i;q(i)||(i=Xg(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const b5=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();n[c]||(n[c]=u),u==="false"&&(n[c]=!1),u==="true"&&(n[c]=!0),isNaN(u)||(n[c]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Qr=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const o=r+JSON.stringify(i);let a=t[o];return a||(a=e(xl(r),s),t[o]=a),a(n)}};class S5{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Gt.create("formatter"),this.options=t,this.formats={number:Qr((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Qr((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Qr((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Qr((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Qr((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Qr(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(a=>a.indexOf(")")>-1)){const a=i.findIndex(l=>l.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,a)].join(this.formatSeparator)}return i.reduce((a,l)=>{const{formatName:u,formatOptions:c}=b5(l);if(this.formats[u]){let d=a;try{const f=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},p=f.locale||f.lng||s.locale||s.lng||r;d=this.formats[u](a,p,{...c,...s,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const P5=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class C5 extends ru{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Gt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},o={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,c=!1,o[f]===void 0&&(o[f]=!0),i[f]===void 0&&(i[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const s=t.split("|"),i=s[0],o=s[1];n&&this.emit("failedLoading",i,o,n),!n&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(l=>{i5(l.loaded,[i],o),P5(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&s{this.read.call(this,t,n,r,s+1,i*2,o)},i);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();q(t)&&(t=this.languageUtils.toResolveHierarchy(t)),q(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,a),this.loaded(t,o,a)})}saveMissing(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,s,l):c=u(t,n,r,s),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,s,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const oy=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),q(e[1])&&(t.defaultValue=e[1]),q(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),ay=e=>(q(e.ns)&&(e.ns=[e.ns]),q(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),q(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),aa=()=>{},k5=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class co extends ru{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=ay(t),this.services={},this.logger=Gt,this.modules={external:[]},k5(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(q(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=oy();this.options={...s,...this.options,...ay(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Gt.init(i(this.modules.logger),this.options):Gt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=S5);const d=new ry(this.options);this.store=new ty(this.options.resources,this.options);const f=this.services;f.logger=Gt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new x5(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=i(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new w5(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new C5(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var m=arguments.length,x=new Array(m>1?m-1:0),w=1;w1?m-1:0),w=1;w{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=aa),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=di(),u=()=>{const c=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:aa;const s=q(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};s?o(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(i,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const s=di();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=aa),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Vw.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=di();this.emit("languageChanging",t);const i=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=q(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{o(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),s}getFixedT(t,n,r){var s=this;const i=function(o,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${m}`):p=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,s.t(p,l)};return q(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!s||o(i,t)))}loadNamespaces(t,n){const r=di();return this.options.ns?(q(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=di();q(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(o=>s.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=s.concat(i),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new ry(oy());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new co(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:aa;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new co(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new ty(this.store.data,s),i.services.resourceStore=i.store),i.translator=new bl(i.services,s),i.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c0){var a=s.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(s.domain){if(!ly.test(s.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(s.domain)}if(s.path){if(!ly.test(s.path))throw new TypeError("option path is invalid");o+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(o+="; HttpOnly"),s.secure&&(o+="; Secure"),s.sameSite){var l=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},uy={create:function(t,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=D5(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),s=0;s-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),o=0;o0){var l=i[o].substring(0,a);l===t.lookupQuerystring&&(n=i[o].substring(a+1))}}}return n}},fi=null,cy=function(){if(fi!==null)return fi;try{fi=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{fi=!1}return fi},I5={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&cy()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&cy()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},hi=null,dy=function(){if(hi!==null)return hi;try{hi=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{hi=!1}return hi},_5={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&dy()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&dy()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},V5={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},U5={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},$5={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},B5={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},$w=!1;try{document.cookie,$w=!0}catch{}var Bw=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];$w||Bw.splice(1,1);function z5(){return{order:Bw,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var zw=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};E5(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return O5(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=L5(r,this.options||{},z5()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(M5),this.addDetector(F5),this.addDetector(I5),this.addDetector(_5),this.addDetector(V5),this.addDetector(U5),this.addDetector($5),this.addDetector(B5)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var s=[];return n.forEach(function(i){if(r.detectors[i]){var o=r.detectors[i].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(s=s.concat(o))}}),s=s.map(function(i){return r.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var s=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){s.detectors[i]&&s.detectors[i].cacheUserLanguage(n,s.options)}))}}])}();zw.type="languageDetector";function _d(e){"@babel/helpers - typeof";return _d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(e)}function Ww(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":_d(XMLHttpRequest))==="object"}function W5(e){return!!e&&typeof e.then=="function"}function H5(e){return W5(e)?e:Promise.resolve(e)}function K5(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vd={exports:{}},la={exports:{}},fy;function q5(){return fy||(fy=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Si<"u"&&Si,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(o){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof a<"u"&&a,l={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(k){return k&&DataView.prototype.isPrototypeOf(k)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(k){return k&&c.indexOf(Object.prototype.toString.call(k))>-1};function f(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function p(k){return typeof k!="string"&&(k=String(k)),k}function m(k){var R={next:function(){var _=k.shift();return{done:_===void 0,value:_}}};return l.iterable&&(R[Symbol.iterator]=function(){return R}),R}function x(k){this.map={},k instanceof x?k.forEach(function(R,_){this.append(_,R)},this):Array.isArray(k)?k.forEach(function(R){this.append(R[0],R[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(R){this.append(R,k[R])},this)}x.prototype.append=function(k,R){k=f(k),R=p(R);var _=this.map[k];this.map[k]=_?_+", "+R:R},x.prototype.delete=function(k){delete this.map[f(k)]},x.prototype.get=function(k){return k=f(k),this.has(k)?this.map[k]:null},x.prototype.has=function(k){return this.map.hasOwnProperty(f(k))},x.prototype.set=function(k,R){this.map[f(k)]=p(R)},x.prototype.forEach=function(k,R){for(var _ in this.map)this.map.hasOwnProperty(_)&&k.call(R,this.map[_],_,this)},x.prototype.keys=function(){var k=[];return this.forEach(function(R,_){k.push(_)}),m(k)},x.prototype.values=function(){var k=[];return this.forEach(function(R){k.push(R)}),m(k)},x.prototype.entries=function(){var k=[];return this.forEach(function(R,_){k.push([_,R])}),m(k)},l.iterable&&(x.prototype[Symbol.iterator]=x.prototype.entries);function w(k){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}function y(k){return new Promise(function(R,_){k.onload=function(){R(k.result)},k.onerror=function(){_(k.error)}})}function g(k){var R=new FileReader,_=y(R);return R.readAsArrayBuffer(k),_}function v(k){var R=new FileReader,_=y(R);return R.readAsText(k),_}function S(k){for(var R=new Uint8Array(k),_=new Array(R.length),O=0;O-1?R:k}function F(k,R){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var _=R.body;if(k instanceof F){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,R.headers||(this.headers=new x(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!_&&k._bodyInit!=null&&(_=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new x(R.headers)),this.method=j(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(_),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var O=/([?&])_=[^&]*/;if(O.test(this.url))this.url=this.url.replace(O,"$1_="+new Date().getTime());else{var D=/\?/;this.url+=(D.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}F.prototype.clone=function(){return new F(this,{body:this._bodyInit})};function U(k){var R=new FormData;return k.trim().split("&").forEach(function(_){if(_){var O=_.split("="),D=O.shift().replace(/\+/g," "),L=O.join("=").replace(/\+/g," ");R.append(decodeURIComponent(D),decodeURIComponent(L))}}),R}function B(k){var R=new x,_=k.replace(/\r?\n[\t ]+/g," ");return _.split("\r").map(function(O){return O.indexOf(` +`)===0?O.substr(1,O.length):O}).forEach(function(O){var D=O.split(":"),L=D.shift().trim();if(L){var M=D.join(":").trim();R.append(L,M)}}),R}T.call(F.prototype);function J(k,R){if(!(this instanceof J))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new x(R.headers),this.url=R.url||"",this._initBody(k)}T.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new x(this.headers),url:this.url})},J.error=function(){var k=new J(null,{status:0,statusText:""});return k.type="error",k};var me=[301,302,303,307,308];J.redirect=function(k,R){if(me.indexOf(R)===-1)throw new RangeError("Invalid status code");return new J(null,{status:R,headers:{location:k}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(R,_){this.message=R,this.name=_;var O=Error(R);this.stack=O.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Z(k,R){return new Promise(function(_,O){var D=new F(k,R);if(D.signal&&D.signal.aborted)return O(new o.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function M(){L.abort()}L.onload=function(){var K={status:L.status,statusText:L.statusText,headers:B(L.getAllResponseHeaders()||"")};K.url="responseURL"in L?L.responseURL:K.headers.get("X-Request-URL");var ve="response"in L?L.response:L.responseText;setTimeout(function(){_(new J(ve,K))},0)},L.onerror=function(){setTimeout(function(){O(new TypeError("Network request failed"))},0)},L.ontimeout=function(){setTimeout(function(){O(new TypeError("Network request failed"))},0)},L.onabort=function(){setTimeout(function(){O(new o.DOMException("Aborted","AbortError"))},0)};function $(K){try{return K===""&&a.location.href?a.location.href:K}catch{return K}}L.open(D.method,$(D.url),!0),D.credentials==="include"?L.withCredentials=!0:D.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&(l.blob?L.responseType="blob":l.arrayBuffer&&D.headers.get("Content-Type")&&D.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(L.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof x)?Object.getOwnPropertyNames(R.headers).forEach(function(K){L.setRequestHeader(K,p(R.headers[K]))}):D.headers.forEach(function(K,ve){L.setRequestHeader(ve,K)}),D.signal&&(D.signal.addEventListener("abort",M),L.onreadystatechange=function(){L.readyState===4&&D.signal.removeEventListener("abort",M)}),L.send(typeof D._bodyInit>"u"?null:D._bodyInit)})}return Z.polyfill=!0,a.fetch||(a.fetch=Z,a.Headers=x,a.Request=F,a.Response=J),o.Headers=x,o.Request=F,o.Response=J,o.fetch=Z,o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=n.fetch?n:r;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t}(la,la.exports)),la.exports}(function(e,t){var n=typeof fetch=="function"?fetch:void 0;if(typeof Si<"u"&&Si.fetch?n=Si.fetch:typeof window<"u"&&window.fetch&&(n=window.fetch),typeof K5<"u"&&typeof window>"u"){var r=n||q5();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Vd,Vd.exports);var Hw=Vd.exports;const Kw=Oy(Hw),hy=Ny({__proto__:null,default:Kw},[Hw]);function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function my(e){for(var t=1;t"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(i["Content-Type"]="application/json");var o=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=my({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:i},yy?{}:o),l=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{gy(n,a,s,l)}catch(u){if(!o||Object.keys(o).length===0||!u.message||u.message.indexOf("not implemented")<0)return s(u);try{Object.keys(o).forEach(function(c){delete a[c]}),gy(n,a,s,l),yy=!0}catch(c){s(c)}}},J5=function(t,n,r,s){r&&Ur(r)==="object"&&(r=Ud("",r).slice(1)),t.queryStringParams&&(n=Ud(n,t.queryStringParams));try{var i;ho?i=new ho:i=new Sl("MSXML2.XMLHTTP.3.0"),i.open(r?"POST":"GET",n,1),t.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!t.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var o=t.customHeaders;if(o=typeof o=="function"?o():o,o)for(var a in o)i.setRequestHeader(a,o[a]);i.onreadystatechange=function(){i.readyState>3&&s(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(r)}catch(l){console&&console.log(l)}},Z5=function(t,n,r,s){if(typeof r=="function"&&(s=r,r=void 0),s=s||function(){},Zn&&n.indexOf("file:")!==0)return X5(t,n,r,s);if(Ww()||typeof ActiveXObject=="function")return J5(t,n,r,s);s(new Error("No fetch and no xhr implementation found!"))};function Hs(e){"@babel/helpers - typeof";return Hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(e)}function vy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ju(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};eA(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return nA(e,[{key:"init",value:function(n){var r=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Ju(Ju(Ju({},sA()),this.options||{}),s),this.allOptions=i,this.services&&this.options.reloadInterval){var o=setInterval(function(){return r.reload()},this.options.reloadInterval);Hs(o)==="object"&&typeof o.unref=="function"&&o.unref()}}},{key:"readMulti",value:function(n,r,s){this._readAny(n,n,r,r,s)}},{key:"read",value:function(n,r,s){this._readAny([n],n,[r],r,s)}},{key:"_readAny",value:function(n,r,s,i,o){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,s)),l=H5(l),l.then(function(u){if(!u)return o(null,{});var c=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:s.join("+")});a.loadUrl(c,o,r,i)})}},{key:"loadUrl",value:function(n,r,s,i){var o=this,a=typeof s=="string"?[s]:s,l=typeof i=="string"?[i]:i,u=this.options.parseLoadPayload(a,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message){var f=c.message.toLowerCase(),p=["failed","fetch","network","load"].find(function(w){return f.indexOf(w)>-1});if(p)return r("failed loading "+n+": "+c.message,!0)}if(c)return r(c,!1);var m,x;try{typeof d.data=="string"?m=o.options.parse(d.data,s,i):m=d.data}catch{x="failed parsing "+n+" to json"}if(x)return r(x,!1);r(null,m)})}},{key:"create",value:function(n,r,s,i,o){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,s,i),u=0,c=[],d=[];n.forEach(function(f){var p=a.options.addPath;typeof a.options.addPath=="function"&&(p=a.options.addPath(f,r));var m=a.services.interpolator.interpolate(p,{lng:f,ns:r});a.options.request(a.options,m,l,function(x,w){u+=1,c.push(x),d.push(w),u===n.length&&typeof o=="function"&&o(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,s=r.backendConnector,i=r.languageUtils,o=r.logger,a=s.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(d){var f=i.toResolveHierarchy(d);f.forEach(function(p){l.indexOf(p)<0&&l.push(p)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){s.read(c,d,"read",null,null,function(f,p){f&&o.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&p&&o.log("loaded namespace ".concat(d," for language ").concat(c),p),s.loaded("".concat(c,"|").concat(d),f,p)})})})}}}])}();Gw.type="backend";ze.use(Gw).use(zw).use(iE).init({debug:!0,fallbackLng:"en",ns:["common"],defaultNS:"common",supportedLngs:["en","zh","fr","ja","hi","de","ko","zh-TW","it","pt","tr","ru"],backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["cookie","localStorage","htmlTag","path","subdomain"],caches:["cookie","localStorage"]}});ec.createRoot(document.getElementById("root")).render(h.jsx(Zu.StrictMode,{children:h.jsx(Zu.Suspense,{fallback:"loading...",children:h.jsx(n5,{})})})); diff --git a/frontend/build/client/assets/main-fe5He4OT.css b/frontend/build/client/assets/main-fe5He4OT.css new file mode 100644 index 0000000..8cb577f --- /dev/null +++ b/frontend/build/client/assets/main-fe5He4OT.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.right-4{right:1rem}.top-0{top:0}.top-4{top:1rem}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-1{margin-bottom:-.25rem}.-mr-1{margin-right:-.25rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-8{margin-bottom:2rem}.mb-\[1px\]{margin-bottom:1px}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.size-6{width:1.5rem;height:1.5rem}.h-1{height:.25rem}.h-20{height:5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-\[32px\]{height:32px}.h-\[488px\]{height:488px}.h-\[60vh\]{height:60vh}.h-\[65px\]{height:65px}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[80vh\]{max-height:80vh}.min-h-0{min-height:0px}.min-h-24{min-height:6rem}.min-h-screen{min-height:100vh}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-\[85px\]{width:85px}.w-full{width:100%}.w-screen{width:100vw}.max-w-4xl{max-width:56rem}.max-w-\[1400px\]{max-width:1400px}.max-w-\[300px\]{max-width:300px}.max-w-lg{max-width:32rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.origin-left{transform-origin:left}.scale-\[1\.2\]{--tw-scale-x: 1.2;--tw-scale-y: 1.2;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-cyan-50\/20{border-color:#ecfeff33}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.border-gray-700\/50{border-color:#37415180}.border-neutral-300{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.border-yellow-600\/50{border-color:#ca8a0480}.border-zinc-600{--tw-border-opacity: 1;border-color:rgb(82 82 91 / var(--tw-border-opacity))}.bg-\[\#1f2023\]{--tw-bg-opacity: 1;background-color:rgb(31 32 35 / var(--tw-bg-opacity))}.bg-\[\#ffffffd6\]{background-color:#ffffffd6}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-cyan-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-gray-50\/5{background-color:#f9fafb0d}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.bg-neutral-100{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.bg-neutral-800\/95{background-color:#262626f2}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/5{background-color:#ffffff0d}.bg-white\/95{background-color:#fffffff2}.bg-yellow-900\/30{background-color:#713f124d}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity))}.bg-zinc-700{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity))}.bg-opacity-10{--tw-bg-opacity: .1}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pr-4{padding-right:1rem}.pt-16{padding-top:4rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-cyan-200{--tw-text-opacity: 1;color:rgb(165 243 252 / var(--tw-text-opacity))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity))}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-50{--tw-text-opacity: 1;color:rgb(249 250 251 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity))}.text-zinc-100{--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.text-zinc-200{--tw-text-opacity: 1;color:rgb(228 228 231 / var(--tw-text-opacity))}.text-zinc-300{--tw-text-opacity: 1;color:rgb(212 212 216 / var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity))}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-500{transition-duration:.5s}*::-webkit-scrollbar{width:0px;height:10px}*::-webkit-scrollbar-thumb{background:#bec3ca00;border-radius:4px}*::-webkit-scrollbar-thumb:hover{background:#96969686}.grids{background-image:linear-gradient(0deg,rgba(122,122,122,.05) 1px,transparent 0),linear-gradient(90deg,rgba(122,122,122,.05) 1px,transparent 0);background-position:50%;background-size:24px 24px}.cool-btn{--btn-default-bg: rgb(41, 41, 41);--btn-padding: 15px 20px;--btn-hover-bg: rgb(51, 51, 51);--btn-transition: .3s;--btn-letter-spacing: .1rem;--btn-animation-duration: 1.2s;--btn-shadow-color: rgba(0, 0, 0, .137);--btn-shadow: 0 2px 10px 0 var(--btn-shadow-color);--hover-btn-color: #0a9ec4;--default-btn-color: #fff;--font-size: 18px;--font-weight: 800;--font-family: Menlo, Roboto Mono, monospace}.cool-btn{box-sizing:border-box;padding:var(--btn-padding);padding-left:0;display:flex;align-items:center;justify-content:center;color:var(--default-btn-color);font:var(--font-weight) var(--font-size);border:none;cursor:pointer;transition:var(--btn-transition);overflow:hidden}.cool-btn span{letter-spacing:var(--btn-letter-spacing);transition:var(--btn-transition);box-sizing:border-box;position:relative;background:inherit}.cool-btn span:before{box-sizing:border-box;position:absolute;content:"";background:inherit}.cool-btn:hover span,.cool-btn:focus span{color:var(--hover-btn-color)}.cool-btn:hover span:before,.cool-btn:focus span:before{animation:chitchat linear both var(--btn-animation-duration)}@keyframes chitchat{0%{content:"#"}5%{content:"."}10%{content:"^{"}15%{content:"-!"}20%{content:"#$_"}25%{content:"№:0"}30%{content:"#{+."}35%{content:"@}-?"}40%{content:"?{4@%"}45%{content:"=.,^!"}50%{content:"?2@%"}55%{content:";1}]"}60%{content:"?{%:%";right:0}65%{content:"|{f[4";right:0}70%{content:"{4%0%";right:0}75%{content:"'1_0<";right:0}80%{content:"{0%";right:0}85%{content:"]>'";right:0}90%{content:"4";right:0}95%{content:"2";right:0}to{content:"";right:0}}.loader{scale:3;height:50px;width:40px}.box{position:relative;opacity:0;left:10px}.side-left{position:absolute;background-color:#0891b2;width:19px;height:5px;transform:skew(0,-25deg);top:14px;left:10px}.side-right{position:absolute;background-color:#0b9fc4;width:19px;height:5px;transform:skew(0,25deg);top:14px;left:-9px}.side-top{position:absolute;background-color:#19b6dd;width:20px;height:20px;rotate:45deg;transform:skew(-20deg,-20deg)}.box-1{animation:from-left 4s infinite}.box-2{animation:from-right 4s infinite;animation-delay:1s}.box-3{animation:from-left 4s infinite;animation-delay:2s}.box-4{animation:from-right 4s infinite;animation-delay:3s}@keyframes from-left{0%{z-index:20;opacity:0;translate:-20px -6px}20%{z-index:10;opacity:1;translate:0px 0px}40%{z-index:9;translate:0px 4px}60%{z-index:8;translate:0px 8px}80%{z-index:7;opacity:1;translate:0px 12px}to{z-index:5;translate:0px 30px;opacity:0}}@keyframes from-right{0%{z-index:20;opacity:0;translate:20px -6px}20%{z-index:10;opacity:1;translate:0px 0px}40%{z-index:9;translate:0px 4px}60%{z-index:8;translate:0px 8px}80%{z-index:7;opacity:1;translate:0px 12px}to{z-index:5;translate:0px 30px;opacity:0}}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:right-1:before{content:var(--tw-content);right:.25rem}.before\:top-1:before{content:var(--tw-content);top:.25rem}.before\:z-10:before{content:var(--tw-content);z-index:10}.before\:h-12:before{content:var(--tw-content);height:3rem}.before\:w-12:before{content:var(--tw-content);width:3rem}.before\:rounded-full:before{content:var(--tw-content);border-radius:9999px}.before\:bg-violet-500:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity))}.before\:blur-lg:before{content:var(--tw-content);--tw-blur: blur(16px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.before\:duration-500:before{content:var(--tw-content);transition-duration:.5s}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:right-8:after{content:var(--tw-content);right:2rem}.after\:top-3:after{content:var(--tw-content);top:.75rem}.after\:z-10:after{content:var(--tw-content);z-index:10}.after\:h-20:after{content:var(--tw-content);height:5rem}.after\:w-20:after{content:var(--tw-content);width:5rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:bg-rose-300:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(253 164 175 / var(--tw-bg-opacity))}.after\:blur-lg:after{content:var(--tw-content);--tw-blur: blur(16px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.after\:duration-500:after{content:var(--tw-content);transition-duration:.5s}.after\:content-\[\'_↗\'\]:after{--tw-content: " ↗";content:var(--tw-content)}.hover\:border-cyan-600:hover{--tw-border-opacity: 1;border-color:rgb(8 145 178 / var(--tw-border-opacity))}.hover\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.hover\:bg-zinc-700:hover{--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity))}.hover\:text-gray-500:hover{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:decoration-2:hover{text-decoration-thickness:2px}.hover\:opacity-50:hover{opacity:.5}.hover\:opacity-90:hover{opacity:.9}.hover\:duration-500:hover{transition-duration:.5s}.hover\:before\:-bottom-8:hover:before{content:var(--tw-content);bottom:-2rem}.hover\:before\:right-12:hover:before{content:var(--tw-content);right:3rem}.hover\:before\:blur:hover:before{content:var(--tw-content);--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:before\:\[box-shadow\:_20px_20px_20px_30px_\#a21caf\]:hover:before{content:var(--tw-content);box-shadow:20px 20px 20px 30px #a21caf}.hover\:after\:-right-8:hover:after{content:var(--tw-content);right:-2rem}.focus\:border-cyan-500:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-cyan-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(6 182 212 / var(--tw-ring-opacity))}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-600:disabled{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}.disabled\:bg-zinc-500:disabled{--tw-bg-opacity: 1;background-color:rgb(113 113 122 / var(--tw-bg-opacity))}.disabled\:text-gray-500:disabled{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity))}.group:hover .group-hover\:before\:duration-500:before{content:var(--tw-content);transition-duration:.5s}.group:hover .group-hover\:after\:duration-500:after{content:var(--tw-content);transition-duration:.5s}.group:active .group-active\:-rotate-12{--tw-rotate: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:active .group-active\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-neutral-900[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(23 23 23 / var(--tw-border-opacity))}.data-\[state\=checked\]\:bg-neutral-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(82 82 82 / var(--tw-bg-opacity))}.data-\[state\=checked\]\:text-neutral-100[data-state=checked]{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:ml-4{margin-left:1rem}.sm\:ml-auto{margin-left:auto}.sm\:mt-0{margin-top:0}.sm\:hidden{display:none}.sm\:flex-row{flex-direction:row}.sm\:justify-start{justify-content:flex-start}.sm\:border-l{border-left-width:1px}.sm\:border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.sm\:pl-4{padding-left:1rem}}@media (min-width: 768px){.md\:mx-10{margin-left:2.5rem;margin-right:2.5rem}.md\:ml-8{margin-left:2rem}.md\:block{display:block}.md\:w-1\/2{width:50%}.md\:w-\[350px\]{width:350px}.md\:max-w-3xl{max-width:48rem}.md\:max-w-\[350px\]{max-width:350px}.md\:flex-row{flex-direction:row}.md\:rounded-2xl{border-radius:1rem}.md\:border{border-width:1px}.md\:border-cyan-50\/20{border-color:#ecfeff33}.md\:border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.md\:px-10{padding-left:2.5rem;padding-right:2.5rem}.md\:px-16{padding-left:4rem;padding-right:4rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:text-base{font-size:1rem;line-height:1.5rem}}@media (prefers-color-scheme: dark){.dark\:border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity))}.dark\:bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[state\=checked\]\:border-neutral-300[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}.dark\:data-\[state\=checked\]\:bg-neutral-300[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(212 212 212 / var(--tw-bg-opacity))}}.\[\&_iframe\]\:\!w-full iframe{width:100%!important} diff --git a/frontend/build/client/index.html b/frontend/build/client/index.html index eccdd5b..137de8d 100644 --- a/frontend/build/client/index.html +++ b/frontend/build/client/index.html @@ -4,9 +4,9 @@ - Vmail - 临时邮箱 - - + VMAIL - 临时邮箱 + +
diff --git a/frontend/build/client/locales/en/common.json b/frontend/build/client/locales/en/common.json index 503978b..8157c7b 100644 --- a/frontend/build/client/locales/en/common.json +++ b/frontend/build/client/locales/en/common.json @@ -5,6 +5,10 @@ "Valid for 1 Day": "Valid for 1 Day", "AD friendly": "AD friendly", "100% Run on Cloudflare": "100% Run on Cloudflare", + "Open Source": "Open Source", + "Stable - 1M+ emails processed": "Stable - 1M+ emails processed", + "Open RESTful API": "Open RESTful API", + "Multi-domain configurable": "Multi-domain configurable", "Email address": "Email address", "Stop": "Stop", "Validater": "Validater", @@ -63,6 +67,54 @@ "Email Detail": "Email Detail", "Expires in": "Expires in", "Email expired": "Email expired", - "Reset validity": "Reset validity", - "Validity reset successfully": "Validity reset successfully" + "Reset validity": "Reset validity", + "Validity reset successfully": "Validity reset successfully", + "RESTful API for programmatic access to temporary email services": "RESTful API for programmatic access to temporary email services", + "Authentication": "Authentication", + "All API requests require an API Key. Include it in the request header:": "All API requests require an API Key. Include it in the request header:", + "Or use Authorization header:": "Or use Authorization header:", + "Endpoints": "Endpoints", + "Create a new temporary mailbox": "Create a new temporary mailbox", + "Request Body": "Request Body", + "Response": "Response", + "Get mailbox information": "Get mailbox information", + "Get inbox messages with pagination": "Get inbox messages with pagination", + "Query Parameters": "Query Parameters", + "Parameter": "Parameter", + "Type": "Type", + "Default": "Default", + "Description": "Description", + "Page number": "Page number", + "Items per page (max 100)": "Items per page (max 100)", + "Sort order (asc/desc)": "Sort order (asc/desc)", + "Get full message details": "Get full message details", + "Delete a specific message": "Delete a specific message", + "Error Responses": "Error Responses", + "All errors follow a consistent format:": "All errors follow a consistent format:", + "Error Codes": "Error Codes", + "Missing or invalid API Key": "Missing or invalid API Key", + "API Key disabled/expired or no access": "API Key disabled/expired or no access", + "Resource not found": "Resource not found", + "Invalid request parameters": "Invalid request parameters", + "Resource already exists": "Resource already exists", + "Example Usage": "Example Usage", + "Create mailbox and check for messages": "Create mailbox and check for messages", + "Rate Limits": "Rate Limits", + "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.": "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.", + "Need an API Key? Contact the administrator.": "Need an API Key? Contact the administrator.", + "Get API Key": "Get API Key", + "Created": "Created", + "Important: Save your API Key now!": "Important: Save your API Key now!", + "This is the only time you will see the full API Key. It cannot be retrieved later.": "This is the only time you will see the full API Key. It cannot be retrieved later.", + "Create another API Key": "Create another API Key", + "Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.": "Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.", + "Key Name": "Key Name", + "optional": "optional", + "e.g., My Project": "e.g., My Project", + "Verification": "Verification", + "Creating...": "Creating...", + "Create API Key": "Create API Key", + "Please complete the verification first": "Please complete the verification first", + "API Key created successfully": "API Key created successfully", + "Failed to create API Key": "Failed to create API Key" } \ No newline at end of file diff --git a/frontend/build/client/locales/zh/common.json b/frontend/build/client/locales/zh/common.json index d324805..974df43 100644 --- a/frontend/build/client/locales/zh/common.json +++ b/frontend/build/client/locales/zh/common.json @@ -5,6 +5,10 @@ "Valid for 1 Day": "有效期 1 天", "AD friendly": "支持多域名后缀", "100% Run on Cloudflare": "累计接收10万封邮件", + "Open Source": "开源项目", + "Stable - 1M+ emails processed": "稳定 - 累计接收100万封邮件", + "Open RESTful API": "开放 RESTful API", + "Multi-domain configurable": "多域名后缀可配置", "Email address": "电子邮件地址", "Stop": "停止", "Validater": "人机验证", @@ -39,7 +43,7 @@ "Log out": "登出", "Terms": "条款", "Domain": "邮箱后缀", - "How to get a password? Click to create a temporary email and receive at least one email to generate a password": "如何获取密码?点击“创建临时邮箱”,且至少收到一封邮件即可生成密码", + "How to get a password? Click to create a temporary email and receive at least one email to generate a password": "如何获取密码?点击"创建临时邮箱",且至少收到一封邮件即可生成密码", "Blog": "博客", "Emails deleted": "邮件已删除", "Deletion failed": "删除失败", @@ -64,5 +68,53 @@ "Expires in": "有效期剩余", "Email expired": "邮箱已过期", "Reset validity": "重置有效期", - "Validity reset successfully": "有效期重置成功" + "Validity reset successfully": "有效期重置成功", + "RESTful API for programmatic access to temporary email services": "通过程序化方式访问临时邮箱服务的 RESTful API", + "Authentication": "认证", + "All API requests require an API Key. Include it in the request header:": "所有 API 请求都需要 API Key,请在请求头中包含:", + "Or use Authorization header:": "或使用 Authorization 头:", + "Endpoints": "接口", + "Create a new temporary mailbox": "创建新的临时邮箱", + "Request Body": "请求体", + "Response": "响应", + "Get mailbox information": "获取邮箱信息", + "Get inbox messages with pagination": "获取收件箱邮件(分页)", + "Query Parameters": "查询参数", + "Parameter": "参数", + "Type": "类型", + "Default": "默认值", + "Description": "描述", + "Page number": "页码", + "Items per page (max 100)": "每页数量(最大100)", + "Sort order (asc/desc)": "排序方式(asc/desc)", + "Get full message details": "获取邮件详情", + "Delete a specific message": "删除指定邮件", + "Error Responses": "错误响应", + "All errors follow a consistent format:": "所有错误遵循统一格式:", + "Error Codes": "错误码", + "Missing or invalid API Key": "缺少或无效的 API Key", + "API Key disabled/expired or no access": "API Key 已禁用/过期或无权访问", + "Resource not found": "资源不存在", + "Invalid request parameters": "请求参数无效", + "Resource already exists": "资源已存在", + "Example Usage": "使用示例", + "Create mailbox and check for messages": "创建邮箱并检查邮件", + "Rate Limits": "速率限制", + "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.": "API 请求根据您的 API Key 配置进行速率限制,默认限制为每分钟100次请求。", + "Need an API Key? Contact the administrator.": "需要 API Key?请联系管理员。", + "Get API Key": "获取 API Key", + "Created": "已创建", + "Important: Save your API Key now!": "重要:请立即保存您的 API Key!", + "This is the only time you will see the full API Key. It cannot be retrieved later.": "这是您唯一一次看到完整 API Key 的机会,之后将无法再次获取。", + "Create another API Key": "创建另一个 API Key", + "Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.": "免费创建 API Key 以访问接口。每个 Key 的速率限制为每分钟 100 次请求。", + "Key Name": "Key 名称", + "optional": "可选", + "e.g., My Project": "例如:我的项目", + "Verification": "人机验证", + "Creating...": "创建中...", + "Create API Key": "创建 API Key", + "Please complete the verification first": "请先完成人机验证", + "API Key created successfully": "API Key 创建成功", + "Failed to create API Key": "创建 API Key 失败" } \ No newline at end of file diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json index 503978b..8157c7b 100644 --- a/frontend/public/locales/en/common.json +++ b/frontend/public/locales/en/common.json @@ -5,6 +5,10 @@ "Valid for 1 Day": "Valid for 1 Day", "AD friendly": "AD friendly", "100% Run on Cloudflare": "100% Run on Cloudflare", + "Open Source": "Open Source", + "Stable - 1M+ emails processed": "Stable - 1M+ emails processed", + "Open RESTful API": "Open RESTful API", + "Multi-domain configurable": "Multi-domain configurable", "Email address": "Email address", "Stop": "Stop", "Validater": "Validater", @@ -63,6 +67,54 @@ "Email Detail": "Email Detail", "Expires in": "Expires in", "Email expired": "Email expired", - "Reset validity": "Reset validity", - "Validity reset successfully": "Validity reset successfully" + "Reset validity": "Reset validity", + "Validity reset successfully": "Validity reset successfully", + "RESTful API for programmatic access to temporary email services": "RESTful API for programmatic access to temporary email services", + "Authentication": "Authentication", + "All API requests require an API Key. Include it in the request header:": "All API requests require an API Key. Include it in the request header:", + "Or use Authorization header:": "Or use Authorization header:", + "Endpoints": "Endpoints", + "Create a new temporary mailbox": "Create a new temporary mailbox", + "Request Body": "Request Body", + "Response": "Response", + "Get mailbox information": "Get mailbox information", + "Get inbox messages with pagination": "Get inbox messages with pagination", + "Query Parameters": "Query Parameters", + "Parameter": "Parameter", + "Type": "Type", + "Default": "Default", + "Description": "Description", + "Page number": "Page number", + "Items per page (max 100)": "Items per page (max 100)", + "Sort order (asc/desc)": "Sort order (asc/desc)", + "Get full message details": "Get full message details", + "Delete a specific message": "Delete a specific message", + "Error Responses": "Error Responses", + "All errors follow a consistent format:": "All errors follow a consistent format:", + "Error Codes": "Error Codes", + "Missing or invalid API Key": "Missing or invalid API Key", + "API Key disabled/expired or no access": "API Key disabled/expired or no access", + "Resource not found": "Resource not found", + "Invalid request parameters": "Invalid request parameters", + "Resource already exists": "Resource already exists", + "Example Usage": "Example Usage", + "Create mailbox and check for messages": "Create mailbox and check for messages", + "Rate Limits": "Rate Limits", + "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.": "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.", + "Need an API Key? Contact the administrator.": "Need an API Key? Contact the administrator.", + "Get API Key": "Get API Key", + "Created": "Created", + "Important: Save your API Key now!": "Important: Save your API Key now!", + "This is the only time you will see the full API Key. It cannot be retrieved later.": "This is the only time you will see the full API Key. It cannot be retrieved later.", + "Create another API Key": "Create another API Key", + "Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.": "Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.", + "Key Name": "Key Name", + "optional": "optional", + "e.g., My Project": "e.g., My Project", + "Verification": "Verification", + "Creating...": "Creating...", + "Create API Key": "Create API Key", + "Please complete the verification first": "Please complete the verification first", + "API Key created successfully": "API Key created successfully", + "Failed to create API Key": "Failed to create API Key" } \ No newline at end of file diff --git a/frontend/public/locales/zh/common.json b/frontend/public/locales/zh/common.json index d324805..974df43 100644 --- a/frontend/public/locales/zh/common.json +++ b/frontend/public/locales/zh/common.json @@ -5,6 +5,10 @@ "Valid for 1 Day": "有效期 1 天", "AD friendly": "支持多域名后缀", "100% Run on Cloudflare": "累计接收10万封邮件", + "Open Source": "开源项目", + "Stable - 1M+ emails processed": "稳定 - 累计接收100万封邮件", + "Open RESTful API": "开放 RESTful API", + "Multi-domain configurable": "多域名后缀可配置", "Email address": "电子邮件地址", "Stop": "停止", "Validater": "人机验证", @@ -39,7 +43,7 @@ "Log out": "登出", "Terms": "条款", "Domain": "邮箱后缀", - "How to get a password? Click to create a temporary email and receive at least one email to generate a password": "如何获取密码?点击“创建临时邮箱”,且至少收到一封邮件即可生成密码", + "How to get a password? Click to create a temporary email and receive at least one email to generate a password": "如何获取密码?点击"创建临时邮箱",且至少收到一封邮件即可生成密码", "Blog": "博客", "Emails deleted": "邮件已删除", "Deletion failed": "删除失败", @@ -64,5 +68,53 @@ "Expires in": "有效期剩余", "Email expired": "邮箱已过期", "Reset validity": "重置有效期", - "Validity reset successfully": "有效期重置成功" + "Validity reset successfully": "有效期重置成功", + "RESTful API for programmatic access to temporary email services": "通过程序化方式访问临时邮箱服务的 RESTful API", + "Authentication": "认证", + "All API requests require an API Key. Include it in the request header:": "所有 API 请求都需要 API Key,请在请求头中包含:", + "Or use Authorization header:": "或使用 Authorization 头:", + "Endpoints": "接口", + "Create a new temporary mailbox": "创建新的临时邮箱", + "Request Body": "请求体", + "Response": "响应", + "Get mailbox information": "获取邮箱信息", + "Get inbox messages with pagination": "获取收件箱邮件(分页)", + "Query Parameters": "查询参数", + "Parameter": "参数", + "Type": "类型", + "Default": "默认值", + "Description": "描述", + "Page number": "页码", + "Items per page (max 100)": "每页数量(最大100)", + "Sort order (asc/desc)": "排序方式(asc/desc)", + "Get full message details": "获取邮件详情", + "Delete a specific message": "删除指定邮件", + "Error Responses": "错误响应", + "All errors follow a consistent format:": "所有错误遵循统一格式:", + "Error Codes": "错误码", + "Missing or invalid API Key": "缺少或无效的 API Key", + "API Key disabled/expired or no access": "API Key 已禁用/过期或无权访问", + "Resource not found": "资源不存在", + "Invalid request parameters": "请求参数无效", + "Resource already exists": "资源已存在", + "Example Usage": "使用示例", + "Create mailbox and check for messages": "创建邮箱并检查邮件", + "Rate Limits": "速率限制", + "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.": "API 请求根据您的 API Key 配置进行速率限制,默认限制为每分钟100次请求。", + "Need an API Key? Contact the administrator.": "需要 API Key?请联系管理员。", + "Get API Key": "获取 API Key", + "Created": "已创建", + "Important: Save your API Key now!": "重要:请立即保存您的 API Key!", + "This is the only time you will see the full API Key. It cannot be retrieved later.": "这是您唯一一次看到完整 API Key 的机会,之后将无法再次获取。", + "Create another API Key": "创建另一个 API Key", + "Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.": "免费创建 API Key 以访问接口。每个 Key 的速率限制为每分钟 100 次请求。", + "Key Name": "Key 名称", + "optional": "可选", + "e.g., My Project": "例如:我的项目", + "Verification": "人机验证", + "Creating...": "创建中...", + "Create API Key": "创建 API Key", + "Please complete the verification first": "请先完成人机验证", + "API Key created successfully": "API Key 创建成功", + "Failed to create API Key": "创建 API Key 失败" } \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 34b5c3d..beea768 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -3,6 +3,7 @@ import axios from "axios"; import { useEffect, useState } from "react"; import { BrowserRouter, Route, Routes } from "react-router-dom"; import { Home } from "./pages/Home.tsx"; +import { ApiDocs } from "./pages/ApiDocs.tsx"; // MailDetail 组件不再作为独立页面,因此移除其路由 // import { MailDetail } from './pages/MailDetail.tsx'; // import { About } from './pages/About.tsx'; // 移除 @@ -44,6 +45,7 @@ function App() { {/* 使用 Layout 组件作为所有页面的布局框架 */} }> } /> + } /> {/* 移除 /mails/:id, /about, /privacy, /terms 路由 */} diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 29b77fc..26c0133 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -1,12 +1,12 @@ -import { Link } from 'react-router-dom'; -import { VmailLogo } from './icons/vmail.tsx'; +import { Link } from "react-router-dom"; +import { VmailLogo } from "./icons/vmail.tsx"; import { useTranslation } from "react-i18next"; import GithubPlat from "./icons/GitHubPlat.tsx"; -import { useState } from 'react'; -import { InfoModal } from './InfoModal.tsx'; -import { About } from '../pages/About.tsx'; -import { Privacy } from '../pages/Privacy.tsx'; -import { Terms } from '../pages/Terms.tsx'; +import { useState } from "react"; +import { InfoModal } from "./InfoModal.tsx"; +import { About } from "../pages/About.tsx"; +import { Privacy } from "../pages/Privacy.tsx"; +import { Terms } from "../pages/Terms.tsx"; export function Header() { const { t } = useTranslation(); @@ -17,7 +17,9 @@ export function Header() { return ( <>
- + {/* GitHub 链接按钮 */} @@ -48,8 +54,7 @@ export function Header() { className="ml-3 md:ml-8" target="_blank" rel="noopener noreferrer" - href="https://github.com/oiov/vmail" - > + href="https://github.com/oiov/vmail">
- + - + - + diff --git a/frontend/src/components/icons/ApiIcon.tsx b/frontend/src/components/icons/ApiIcon.tsx new file mode 100644 index 0000000..16156ff --- /dev/null +++ b/frontend/src/components/icons/ApiIcon.tsx @@ -0,0 +1,18 @@ +export default function ApiIcon({ className = "h-5 w-5" }: { className?: string }) { + return ( + + + + ); +} diff --git a/frontend/src/components/icons/CodeBracket.tsx b/frontend/src/components/icons/CodeBracket.tsx new file mode 100644 index 0000000..9ac68e0 --- /dev/null +++ b/frontend/src/components/icons/CodeBracket.tsx @@ -0,0 +1,18 @@ +export default function CodeBracketIcon({ className = "h-5 w-5" }: { className?: string }) { + return ( + + + + ); +} diff --git a/frontend/src/components/icons/GlobeAltIcon.tsx b/frontend/src/components/icons/GlobeAltIcon.tsx new file mode 100644 index 0000000..1c70026 --- /dev/null +++ b/frontend/src/components/icons/GlobeAltIcon.tsx @@ -0,0 +1,18 @@ +export default function GlobeAltIcon({ className = "h-5 w-5" }: { className?: string }) { + return ( + + + + ); +} diff --git a/frontend/src/components/icons/ServerIcon.tsx b/frontend/src/components/icons/ServerIcon.tsx new file mode 100644 index 0000000..e9ba2cb --- /dev/null +++ b/frontend/src/components/icons/ServerIcon.tsx @@ -0,0 +1,18 @@ +export default function ServerIcon({ className = "h-5 w-5" }: { className?: string }) { + return ( + + + + ); +} diff --git a/frontend/src/pages/ApiDocs.tsx b/frontend/src/pages/ApiDocs.tsx new file mode 100644 index 0000000..020322f --- /dev/null +++ b/frontend/src/pages/ApiDocs.tsx @@ -0,0 +1,560 @@ +import { useTranslation } from "react-i18next"; +import { useEffect, useRef, useState } from "react"; +import { Turnstile } from "@marsidev/react-turnstile"; +import { toast } from "react-hot-toast"; +import { useConfig } from "../hooks/useConfig"; +import { CopyButton } from "../components/CopyButton"; + +interface ApiKeyResponse { + data: { + id: string; + key: string; + keyPrefix: string; + name: string | null; + createdAt: string; + }; + message: string; +} + +export function ApiDocs() { + const { t } = useTranslation(); + const config = useConfig(); + const contentRef = useRef(null); + + // API Key 创建相关状态 + const [turnstileToken, setTurnstileToken] = useState(""); + const [isCreating, setIsCreating] = useState(false); + const [createdApiKey, setCreatedApiKey] = useState(null); + const [keyName, setKeyName] = useState(""); + + // 添加代码高亮样式 + useEffect(() => { + if (contentRef.current) { + const codeBlocks = contentRef.current.querySelectorAll("pre code"); + codeBlocks.forEach((block) => { + block.classList.add("language-json"); + }); + } + }, []); + + // 创建 API Key + const handleCreateApiKey = async () => { + if (!turnstileToken) { + toast.error(t("Please complete the verification first")); + return; + } + + setIsCreating(true); + try { + const response = await fetch("/api/api-keys", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + token: turnstileToken, + name: keyName || undefined, + }), + }); + + if (!response.ok) { + const error = await response.json(); + throw new Error(error.message || "Failed to create API Key"); + } + + const result: ApiKeyResponse = await response.json(); + setCreatedApiKey(result.data.key); + toast.success(t("API Key created successfully")); + } catch (error: any) { + toast.error(error.message || t("Failed to create API Key")); + } finally { + setIsCreating(false); + } + }; + + // 重置状态,允许创建新的 API Key + const handleCreateAnother = () => { + setCreatedApiKey(null); + setTurnstileToken(""); + setKeyName(""); + }; + + return ( +
+
+ {/* Header */} +
+

+ API Documentation +

+

+ {t( + "RESTful API for programmatic access to temporary email services", + )} +

+
+ + {/* Get API Key Section */} +
+

+ {t("Get API Key")} +

+
+ {createdApiKey ? ( + // 显示创建的 API Key +
+
+ + {t("Created")} + +
+
+
+ + + +
+

+ {t("Important: Save your API Key now!")} +

+

+ {t("This is the only time you will see the full API Key. It cannot be retrieved later.")} +

+
+
+
+
+
+ + {createdApiKey} + + +
+
+ +
+ ) : ( + // 创建 API Key 表单 +
+

+ {t("Create a free API Key to access the API. Each key has a rate limit of 100 requests per minute.")} +

+
+
+ + setKeyName(e.target.value)} + placeholder={t("e.g., My Project")} + className="w-full md:w-1/2 px-3 py-2 bg-gray-900 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-cyan-500" + /> +
+
+ +
+ +
+
+ +
+
+ )} +
+
+ + {/* Authentication */} +
+

+ {t("Authentication")} +

+
+

+ {t( + "All API requests require an API Key. Include it in the request header:", + )} +

+
+              X-API-Key: your-api-key
+            
+

+ {t("Or use Authorization header:")} +

+
+              
+                Authorization: Bearer your-api-key
+              
+            
+
+
+ + {/* Base URL */} +
+

+ Base URL +

+
+
+              https://vmail.dev/api/v1
+            
+
+
+ + {/* Endpoints */} +
+

+ {t("Endpoints")} +

+ + {/* POST /mailboxes */} +
+
+ + POST + + /mailboxes +
+

+ {t("Create a new temporary mailbox")} +

+ +

+ {t("Request Body")} (optional) +

+
+              {`{
+  "localPart": "mytest",     // Optional: custom local part
+  "domain": "example.com",   // Optional: email domain
+  "expiresIn": 86400         // Optional: expiry in seconds (default: 24h)
+}`}
+            
+ +

+ {t("Response")}{" "} + 201 Created +

+
+              {`{
+  "data": {
+    "id": "abc123xyz",
+    "address": "mytest@example.com",
+    "domain": "example.com",
+    "expiresAt": "2024-02-12T12:00:00.000Z",
+    "createdAt": "2024-02-11T12:00:00.000Z"
+  }
+}`}
+            
+
+ + {/* GET /mailboxes/:id */} +
+
+ + GET + + /mailboxes/:id +
+

{t("Get mailbox information")}

+ +

+ {t("Response")} 200 OK +

+
+              {`{
+  "data": {
+    "id": "abc123xyz",
+    "address": "mytest@example.com",
+    "domain": "example.com",
+    "expiresAt": "2024-02-12T12:00:00.000Z",
+    "createdAt": "2024-02-11T12:00:00.000Z",
+    "messageCount": 5
+  }
+}`}
+            
+
+ + {/* GET /mailboxes/:id/messages */} +
+
+ + GET + + + /mailboxes/:id/messages + +
+

+ {t("Get inbox messages with pagination")} +

+ +

+ {t("Query Parameters")} +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{t("Parameter")}{t("Type")}{t("Default")}{t("Description")}
+ page + number1{t("Page number")}
+ limit + number20{t("Items per page (max 100)")}
+ sort + stringdesc{t("Sort order (asc/desc)")}
+
+ +

+ {t("Response")} 200 OK +

+
+              {`{
+  "data": [
+    {
+      "id": "msg_001",
+      "from": { "address": "sender@example.com", "name": "Sender" },
+      "subject": "Hello World",
+      "preview": "This is a preview...",
+      "receivedAt": "2024-02-11T10:30:00.000Z"
+    }
+  ],
+  "pagination": {
+    "page": 1,
+    "limit": 20,
+    "total": 42,
+    "totalPages": 3,
+    "hasMore": true
+  }
+}`}
+            
+
+ + {/* GET /mailboxes/:id/messages/:messageId */} +
+
+ + GET + + + /mailboxes/:id/messages/:messageId + +
+

+ {t("Get full message details")} +

+ +

+ {t("Response")} 200 OK +

+
+              {`{
+  "data": {
+    "id": "msg_001",
+    "messageId": "",
+    "from": { "address": "sender@example.com", "name": "Sender" },
+    "to": [{ "address": "mytest@example.com", "name": "" }],
+    "cc": [],
+    "bcc": [],
+    "replyTo": [],
+    "subject": "Hello World",
+    "text": "Plain text content...",
+    "html": "...",
+    "headers": [{ "name": "X-Custom", "value": "value" }],
+    "receivedAt": "2024-02-11T10:30:00.000Z"
+  }
+}`}
+            
+
+ + {/* DELETE /mailboxes/:id/messages/:messageId */} +
+
+ + DELETE + + + /mailboxes/:id/messages/:messageId + +
+

+ {t("Delete a specific message")} +

+ +

+ {t("Response")} 200 OK +

+
+              {`{
+  "data": {
+    "deleted": true,
+    "id": "msg_001"
+  }
+}`}
+            
+
+
+ + {/* Error Responses */} +
+

+ {t("Error Responses")} +

+
+

+ {t("All errors follow a consistent format:")} +

+
+              {`{
+  "error": {
+    "code": "ERROR_CODE",
+    "message": "Human readable message"
+  }
+}`}
+            
+ +

+ {t("Error Codes")} +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeHTTP Status{t("Description")}
+ UNAUTHORIZED + 401{t("Missing or invalid API Key")}
+ FORBIDDEN + 403 + {t("API Key disabled/expired or no access")} +
+ NOT_FOUND + 404{t("Resource not found")}
+ VALIDATION_ERROR + 400{t("Invalid request parameters")}
+ CONFLICT + 409{t("Resource already exists")}
+
+
+
+ + {/* Example Usage */} +
+

+ {t("Example Usage")} +

+
+

+ {t("Create mailbox and check for messages")} +

+
+              {`# Create a new mailbox
+curl -X POST https://vmail.dev/api/v1/mailboxes \\
+  -H "X-API-Key: your-api-key" \\
+  -H "Content-Type: application/json" \\
+  -d '{"domain": "example.com"}'
+
+# Response: { "data": { "id": "abc123", "address": "...", ... } }
+
+# Check inbox
+curl https://vmail.dev/api/v1/mailboxes/abc123/messages \\
+  -H "X-API-Key: your-api-key"
+
+# Get specific message
+curl https://vmail.dev/api/v1/mailboxes/abc123/messages/msg_001 \\
+  -H "X-API-Key: your-api-key"`}
+            
+
+
+ + {/* Rate Limits */} +
+

+ {t("Rate Limits")} +

+
+

+ {t( + "API requests are rate limited based on your API Key configuration. Default limit is 100 requests per minute.", + )} +

+
+
+
+
+ ); +} diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index d92a575..01eb253 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -4,6 +4,7 @@ import { Turnstile } from "@marsidev/react-turnstile"; import randomName from "@scaleway/random-name"; import { useTranslation } from "react-i18next"; import Cookies from "js-cookie"; +import { Link } from "react-router-dom"; // feat: 导入全局 toast import { toast } from "react-hot-toast"; @@ -27,9 +28,10 @@ import Close from "../components/icons/Close.tsx"; // 导入关闭图标 // 图标导入 import ShieldCheck from "../components/icons/ShieldCheck.tsx"; -import Cloudflare from "../components/icons/Cloudflare.tsx"; -import Clock from "../components/icons/Clock.tsx"; -import Info from "../components/icons/Info.tsx"; +import CodeBracketIcon from "../components/icons/CodeBracket.tsx"; +import ServerIcon from "../components/icons/ServerIcon.tsx"; +import ApiIcon from "../components/icons/ApiIcon.tsx"; +import GlobeAltIcon from "../components/icons/GlobeAltIcon.tsx"; // refactor: 将导入从 'database' 包更改为本地的类型定义文件 import type { Email } from "../database_types.ts"; @@ -37,6 +39,8 @@ import { InfoModal } from "../components/InfoModal.tsx"; import { MailDetail } from "./MailDetail.tsx"; // feat: 导入倒计时组件 import { CountdownTimer } from "../components/CountdownTimer.tsx"; +import Github from "../components/icons/GitHub.tsx"; +import Cloudflare from "../components/icons/Cloudflare.tsx"; export function Home() { const config = useConfig(); @@ -45,21 +49,21 @@ export function Home() { // 状态管理 const [address, setAddress] = useState(() => - Cookies.get("userMailbox") + Cookies.get("userMailbox"), ); // feat: 新增状态,用于存储邮箱过期时间戳 const [expiryTimestamp, setExpiryTimestamp] = useState( () => { const expiry = Cookies.get("emailExpiry"); return expiry ? parseInt(expiry, 10) : undefined; - } + }, ); const [turnstileToken, setTurnstileToken] = useState(""); const [selectedIds, setSelectedIds] = useState([]); const [isTurnstileVerified, setIsTurnstileVerified] = useState(false); const [selectedEmail, setSelectedEmail] = useState(null); // 新增状态,用于存储当前选中的邮件 const [selectedDomain, setSelectedDomain] = useState( - config.emailDomain[0] + config.emailDomain[0], ); // feat: 新增状态,用于存储当前选中的域名 const [showEmailModal, setShowEmailModal] = useState(false); // feat: 新增状态,用于控制邮件详情模态框的显示 @@ -124,7 +128,7 @@ export function Home() {

{t( - "Remember your password, otherwise your email will expire and cannot be retrieved" + "Remember your password, otherwise your email will expire and cannot be retrieved", )}

@@ -141,10 +145,10 @@ export function Home() { padding: 0, boxShadow: "none", }, - } + }, ); }, - [t] + [t], ); // feat(fix): 使用useEffect来检测新邮件、显示密码通知,并控制“查看密码”按钮的可见性 @@ -326,20 +330,26 @@ export function Home() { {t("Virtual Temporary Email")}
+ + {t("Open Source")} +
- {t("Privacy friendly")} -
-
- - {t("Valid for 1 Day")} -
-
- - {t("AD friendly")} -
-
- {t("100% Run on Cloudflare")} + {t("Stable - 1M+ emails processed")} +
+ + + {t("Open RESTful API")} + +
+ + {t("Multi-domain configurable")}
diff --git a/worker/drizzle/0001_add_api_tables.sql b/worker/drizzle/0001_add_api_tables.sql new file mode 100644 index 0000000..b838059 --- /dev/null +++ b/worker/drizzle/0001_add_api_tables.sql @@ -0,0 +1,29 @@ +-- API Keys 表 +CREATE TABLE IF NOT EXISTS `api_keys` ( + `id` text PRIMARY KEY NOT NULL, + `key` text NOT NULL, + `key_prefix` text NOT NULL, + `name` text, + `rate_limit` integer DEFAULT 100, + `is_active` integer DEFAULT 1 NOT NULL, + `last_used_at` integer, + `expires_at` integer, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); + +-- Mailboxes 表 +CREATE TABLE IF NOT EXISTS `mailboxes` ( + `id` text PRIMARY KEY NOT NULL, + `address` text NOT NULL, + `domain` text NOT NULL, + `expires_at` integer, + `api_key_id` text NOT NULL, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); + +-- 索引 +CREATE UNIQUE INDEX IF NOT EXISTS `api_keys_key_unique` ON `api_keys` (`key`); +CREATE UNIQUE INDEX IF NOT EXISTS `mailboxes_address_unique` ON `mailboxes` (`address`); +CREATE INDEX IF NOT EXISTS `idx_mailboxes_api_key_id` ON `mailboxes` (`api_key_id`); diff --git a/worker/src/api/v1/index.ts b/worker/src/api/v1/index.ts new file mode 100644 index 0000000..3c9eced --- /dev/null +++ b/worker/src/api/v1/index.ts @@ -0,0 +1,18 @@ +import { Hono } from 'hono'; +import { cors } from 'hono/cors'; +import type { Env } from '../../index'; +import { apiKeyAuth } from './middleware/apiKeyAuth'; +import mailboxesRouter from './routes/mailboxes'; + +const v1 = new Hono<{ Bindings: Env }>(); + +// 配置 CORS +v1.use('/*', cors()); + +// 所有 v1 路由都需要 API Key 认证 +v1.use('/*', apiKeyAuth); + +// 挂载邮箱路由 +v1.route('/mailboxes', mailboxesRouter); + +export default v1; diff --git a/worker/src/api/v1/middleware/apiKeyAuth.ts b/worker/src/api/v1/middleware/apiKeyAuth.ts new file mode 100644 index 0000000..8a37931 --- /dev/null +++ b/worker/src/api/v1/middleware/apiKeyAuth.ts @@ -0,0 +1,73 @@ +import { Context, Next } from 'hono'; +import { getD1DB } from '../../../database/db'; +import { findApiKeyByKey, updateApiKeyLastUsed } from '../../../database/dao'; +import type { Env } from '../../../index'; + +/** + * API Key 认证中间件 + * 从请求头 X-API-Key 或 Authorization: Bearer 中提取 API Key + */ +export const apiKeyAuth = async (c: Context<{ Bindings: Env }>, next: Next) => { + // 1. 提取 API Key + let apiKey = c.req.header('X-API-Key'); + + if (!apiKey) { + const authHeader = c.req.header('Authorization'); + if (authHeader?.startsWith('Bearer ')) { + apiKey = authHeader.substring(7); + } + } + + if (!apiKey) { + return c.json({ + error: { + code: 'UNAUTHORIZED', + message: 'Missing API Key. Provide it via X-API-Key header or Authorization: Bearer ', + } + }, 401); + } + + // 2. 验证 API Key + const db = getD1DB(c.env.DB); + const keyRecord = await findApiKeyByKey(db, apiKey); + + if (!keyRecord) { + return c.json({ + error: { + code: 'UNAUTHORIZED', + message: 'Invalid API Key', + } + }, 401); + } + + // 3. 检查是否启用 + if (!keyRecord.isActive) { + return c.json({ + error: { + code: 'FORBIDDEN', + message: 'API Key is disabled', + } + }, 403); + } + + // 4. 检查是否过期 + if (keyRecord.expiresAt && keyRecord.expiresAt < new Date()) { + return c.json({ + error: { + code: 'FORBIDDEN', + message: 'API Key has expired', + } + }, 403); + } + + // 5. 更新最后使用时间 (异步,不阻塞请求) + c.executionCtx.waitUntil(updateApiKeyLastUsed(db, keyRecord.id)); + + // 6. 将 API Key 信息存入上下文 + c.set('apiKey', { + id: keyRecord.id, + rateLimit: keyRecord.rateLimit || 100, + }); + + await next(); +}; diff --git a/worker/src/api/v1/routes/mailboxes.ts b/worker/src/api/v1/routes/mailboxes.ts new file mode 100644 index 0000000..af5793b --- /dev/null +++ b/worker/src/api/v1/routes/mailboxes.ts @@ -0,0 +1,299 @@ +import { Hono } from 'hono'; +import type { Env } from '../../../index'; +import { getD1DB } from '../../../database/db'; +import { nanoid } from 'nanoid/non-secure'; +import { + insertMailbox, + findMailboxById, + getMailboxMessages, + findMailboxMessage, + deleteMailboxMessage, + getMailboxMessageCount, +} from '../../../database/dao'; + +// 随机邮箱名称生成 +function generateRandomLocalPart(): string { + const adjectives = ['quick', 'lazy', 'happy', 'sad', 'bright', 'dark', 'warm', 'cold', 'soft', 'hard']; + const nouns = ['fox', 'dog', 'cat', 'bird', 'fish', 'lion', 'bear', 'wolf', 'deer', 'hawk']; + const adj = adjectives[Math.floor(Math.random() * adjectives.length)]; + const noun = nouns[Math.floor(Math.random() * nouns.length)]; + const num = Math.floor(Math.random() * 1000); + return `${adj}-${noun}-${num}`; +} + +const mailboxesRouter = new Hono<{ Bindings: Env }>(); + +// POST /api/v1/mailboxes - 创建邮箱 +mailboxesRouter.post('/', async (c) => { + const db = getD1DB(c.env.DB); + const apiKey = c.get('apiKey') as { id: string; rateLimit: number }; + + let body: { localPart?: string; domain?: string; expiresIn?: number } = {}; + try { + body = await c.req.json(); + } catch { + // 允许空请求体 + } + + // 获取可用域名 + const availableDomains = c.env.EMAIL_DOMAIN ? c.env.EMAIL_DOMAIN.split(',').map(d => d.trim()) : []; + if (availableDomains.length === 0) { + return c.json({ + error: { + code: 'CONFIGURATION_ERROR', + message: 'No email domains configured', + } + }, 500); + } + + // 验证域名 + const domain = body.domain || availableDomains[0]; + if (!availableDomains.includes(domain)) { + return c.json({ + error: { + code: 'VALIDATION_ERROR', + message: `Invalid domain. Available domains: ${availableDomains.join(', ')}`, + details: { field: 'domain', allowed: availableDomains } + } + }, 400); + } + + // 生成邮箱地址 + const localPart = body.localPart || generateRandomLocalPart(); + const address = `${localPart}@${domain}`; + + // 计算过期时间 + const expiresIn = body.expiresIn || 24 * 60 * 60; // 默认 24 小时 + const expiresAt = new Date(Date.now() + expiresIn * 1000); + + const now = new Date(); + const mailbox = { + id: nanoid(), + address, + domain, + expiresAt, + apiKeyId: apiKey.id, + createdAt: now, + updatedAt: now, + }; + + try { + await insertMailbox(db, mailbox); + return c.json({ + data: { + id: mailbox.id, + address: mailbox.address, + domain: mailbox.domain, + expiresAt: mailbox.expiresAt.toISOString(), + createdAt: mailbox.createdAt.toISOString(), + } + }, 201); + } catch (e: any) { + if (e.message?.includes('UNIQUE constraint failed')) { + return c.json({ + error: { + code: 'CONFLICT', + message: 'Email address already exists', + } + }, 409); + } + console.error('Create mailbox error:', e); + return c.json({ + error: { + code: 'INTERNAL_ERROR', + message: 'Failed to create mailbox', + } + }, 500); + } +}); + +// GET /api/v1/mailboxes/:id - 获取邮箱信息 +mailboxesRouter.get('/:id', async (c) => { + const db = getD1DB(c.env.DB); + const apiKey = c.get('apiKey') as { id: string; rateLimit: number }; + const { id } = c.req.param(); + + const mailbox = await findMailboxById(db, id); + if (!mailbox) { + return c.json({ + error: { + code: 'NOT_FOUND', + message: 'Mailbox not found', + } + }, 404); + } + + // 验证所属关系 + if (mailbox.apiKeyId !== apiKey.id) { + return c.json({ + error: { + code: 'FORBIDDEN', + message: 'You do not have access to this mailbox', + } + }, 403); + } + + const messageCount = await getMailboxMessageCount(db, mailbox.address); + + return c.json({ + data: { + id: mailbox.id, + address: mailbox.address, + domain: mailbox.domain, + expiresAt: mailbox.expiresAt?.toISOString() || null, + createdAt: mailbox.createdAt.toISOString(), + messageCount, + } + }); +}); + +// GET /api/v1/mailboxes/:id/messages - 获取收件箱 +mailboxesRouter.get('/:id/messages', async (c) => { + const db = getD1DB(c.env.DB); + const apiKey = c.get('apiKey') as { id: string; rateLimit: number }; + const { id } = c.req.param(); + + const mailbox = await findMailboxById(db, id); + if (!mailbox) { + return c.json({ + error: { + code: 'NOT_FOUND', + message: 'Mailbox not found', + } + }, 404); + } + + // 验证所属关系 + if (mailbox.apiKeyId !== apiKey.id) { + return c.json({ + error: { + code: 'FORBIDDEN', + message: 'You do not have access to this mailbox', + } + }, 403); + } + + // 解析分页参数 + const page = Math.max(1, parseInt(c.req.query('page') || '1', 10)); + const limit = Math.min(100, Math.max(1, parseInt(c.req.query('limit') || '20', 10))); + const sort = c.req.query('sort') === 'asc' ? 'asc' : 'desc'; + + const { messages, total, totalPages } = await getMailboxMessages(db, mailbox.address, { page, limit, sort }); + + return c.json({ + data: messages.map((msg) => ({ + id: msg.id, + from: msg.from, + subject: msg.subject, + preview: msg.text?.substring(0, 100) || null, + receivedAt: msg.createdAt.toISOString(), + })), + pagination: { + page, + limit, + total, + totalPages, + hasMore: page < totalPages, + } + }); +}); + +// GET /api/v1/mailboxes/:id/messages/:messageId - 获取邮件详情 +mailboxesRouter.get('/:id/messages/:messageId', async (c) => { + const db = getD1DB(c.env.DB); + const apiKey = c.get('apiKey') as { id: string; rateLimit: number }; + const { id, messageId } = c.req.param(); + + const mailbox = await findMailboxById(db, id); + if (!mailbox) { + return c.json({ + error: { + code: 'NOT_FOUND', + message: 'Mailbox not found', + } + }, 404); + } + + // 验证所属关系 + if (mailbox.apiKeyId !== apiKey.id) { + return c.json({ + error: { + code: 'FORBIDDEN', + message: 'You do not have access to this mailbox', + } + }, 403); + } + + const message = await findMailboxMessage(db, mailbox.address, messageId); + if (!message) { + return c.json({ + error: { + code: 'NOT_FOUND', + message: 'Message not found', + } + }, 404); + } + + return c.json({ + data: { + id: message.id, + messageId: message.messageId, + from: message.from, + to: message.to, + cc: message.cc, + bcc: message.bcc, + replyTo: message.replyTo, + subject: message.subject, + text: message.text, + html: message.html, + headers: message.headers, + receivedAt: message.createdAt.toISOString(), + } + }); +}); + +// DELETE /api/v1/mailboxes/:id/messages/:messageId - 删除邮件 +mailboxesRouter.delete('/:id/messages/:messageId', async (c) => { + const db = getD1DB(c.env.DB); + const apiKey = c.get('apiKey') as { id: string; rateLimit: number }; + const { id, messageId } = c.req.param(); + + const mailbox = await findMailboxById(db, id); + if (!mailbox) { + return c.json({ + error: { + code: 'NOT_FOUND', + message: 'Mailbox not found', + } + }, 404); + } + + // 验证所属关系 + if (mailbox.apiKeyId !== apiKey.id) { + return c.json({ + error: { + code: 'FORBIDDEN', + message: 'You do not have access to this mailbox', + } + }, 403); + } + + const deleted = await deleteMailboxMessage(db, mailbox.address, messageId); + if (!deleted) { + return c.json({ + error: { + code: 'NOT_FOUND', + message: 'Message not found', + } + }, 404); + } + + return c.json({ + data: { + deleted: true, + id: messageId, + } + }); +}); + +export default mailboxesRouter; diff --git a/worker/src/database/dao.ts b/worker/src/database/dao.ts index 68676ca..92d09dd 100644 --- a/worker/src/database/dao.ts +++ b/worker/src/database/dao.ts @@ -1,8 +1,8 @@ -import { count, desc, eq, and, inArray, lt } from "drizzle-orm"; +import { count, desc, asc, eq, and, inArray, lt } from "drizzle-orm"; // fix: 将数据库类型从 LibSQLDatabase 更改为 DrizzleD1Database,以匹配 Cloudflare D1 import { DrizzleD1Database } from "drizzle-orm/d1"; // refactor: 更新 schema 的导入路径 -import { emails, InsertEmail } from "./schema"; +import { emails, InsertEmail, apiKeys, InsertApiKey, mailboxes, InsertMailbox } from "./schema"; export async function insertEmail(db: DrizzleD1Database, email: InsertEmail) { try { @@ -99,4 +99,219 @@ export async function deleteExpiredEmails(db: DrizzleD1Database, expirationTime: // 并返回一个表示删除数量为0的对象 return { count: 0 }; } +} + +// ==================== API Key 相关函数 ==================== + +/** + * 通过 API Key 值查找记录 + */ +export async function findApiKeyByKey(db: DrizzleD1Database, key: string) { + try { + const result = await db + .select() + .from(apiKeys) + .where(eq(apiKeys.key, key)) + .execute(); + return result.length === 1 ? result[0] : null; + } catch (e) { + console.error('findApiKeyByKey error:', e); + return null; + } +} + +/** + * 更新 API Key 最后使用时间 + */ +export async function updateApiKeyLastUsed(db: DrizzleD1Database, id: string) { + try { + await db + .update(apiKeys) + .set({ lastUsedAt: new Date(), updatedAt: new Date() }) + .where(eq(apiKeys.id, id)) + .execute(); + } catch (e) { + console.error('updateApiKeyLastUsed error:', e); + } +} + +/** + * 创建 API Key + */ +export async function insertApiKey(db: DrizzleD1Database, apiKey: InsertApiKey) { + try { + await db.insert(apiKeys).values(apiKey).execute(); + return apiKey; + } catch (e) { + console.error('insertApiKey error:', e); + return null; + } +} + +// ==================== Mailbox 相关函数 ==================== + +/** + * 创建邮箱 + */ +export async function insertMailbox(db: DrizzleD1Database, mailbox: InsertMailbox) { + try { + await db.insert(mailboxes).values(mailbox).execute(); + return mailbox; + } catch (e) { + console.error('insertMailbox error:', e); + throw e; + } +} + +/** + * 通过 ID 查找邮箱 + */ +export async function findMailboxById(db: DrizzleD1Database, id: string) { + try { + const result = await db + .select() + .from(mailboxes) + .where(eq(mailboxes.id, id)) + .execute(); + return result.length === 1 ? result[0] : null; + } catch (e) { + console.error('findMailboxById error:', e); + return null; + } +} + +/** + * 通过邮箱地址查找邮箱 + */ +export async function findMailboxByAddress(db: DrizzleD1Database, address: string) { + try { + const result = await db + .select() + .from(mailboxes) + .where(eq(mailboxes.address, address)) + .execute(); + return result.length === 1 ? result[0] : null; + } catch (e) { + console.error('findMailboxByAddress error:', e); + return null; + } +} + +/** + * 获取邮箱的邮件列表(带分页) + */ +export async function getMailboxMessages( + db: DrizzleD1Database, + address: string, + options: { page: number; limit: number; sort: 'asc' | 'desc' } +) { + try { + const offset = (options.page - 1) * options.limit; + const orderFn = options.sort === 'asc' ? asc : desc; + + const [messages, countResult] = await Promise.all([ + db + .select() + .from(emails) + .where(eq(emails.messageTo, address)) + .orderBy(orderFn(emails.createdAt)) + .limit(options.limit) + .offset(offset) + .execute(), + db + .select({ count: count() }) + .from(emails) + .where(eq(emails.messageTo, address)) + .execute(), + ]); + + const total = countResult[0]?.count || 0; + + return { + messages, + total, + totalPages: Math.ceil(total / options.limit), + }; + } catch (e) { + console.error('getMailboxMessages error:', e); + return { messages: [], total: 0, totalPages: 0 }; + } +} + +/** + * 获取特定邮箱的特定邮件(验证所属关系) + */ +export async function findMailboxMessage( + db: DrizzleD1Database, + address: string, + messageId: string +) { + try { + const result = await db + .select() + .from(emails) + .where(and(eq(emails.id, messageId), eq(emails.messageTo, address))) + .execute(); + return result.length === 1 ? result[0] : null; + } catch (e) { + console.error('findMailboxMessage error:', e); + return null; + } +} + +/** + * 删除特定邮箱的特定邮件(验证所属关系) + */ +export async function deleteMailboxMessage( + db: DrizzleD1Database, + address: string, + messageId: string +) { + try { + const result = await db + .delete(emails) + .where(and(eq(emails.id, messageId), eq(emails.messageTo, address))) + .execute(); + return result.rowsAffected > 0; + } catch (e) { + console.error('deleteMailboxMessage error:', e); + return false; + } +} + +/** + * 获取邮箱的邮件数量 + */ +export async function getMailboxMessageCount( + db: DrizzleD1Database, + address: string +) { + try { + const result = await db + .select({ count: count() }) + .from(emails) + .where(eq(emails.messageTo, address)) + .execute(); + return result[0]?.count || 0; + } catch (e) { + console.error('getMailboxMessageCount error:', e); + return 0; + } +} + +/** + * 删除过期的邮箱 + */ +export async function deleteExpiredMailboxes(db: DrizzleD1Database) { + try { + const now = new Date(); + const result = await db + .delete(mailboxes) + .where(lt(mailboxes.expiresAt, now)) + .execute(); + return { count: result.rowsAffected }; + } catch (e) { + console.error('deleteExpiredMailboxes error:', e); + return { count: 0 }; + } } \ No newline at end of file diff --git a/worker/src/database/schema.ts b/worker/src/database/schema.ts index 83056fe..068c232 100644 --- a/worker/src/database/schema.ts +++ b/worker/src/database/schema.ts @@ -1,7 +1,40 @@ -import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; +import { integer, sqliteTable, text, index } from "drizzle-orm/sqlite-core"; import { createInsertSchema } from "drizzle-zod"; import * as z from "zod"; +// ==================== API Keys 表 ==================== +export const apiKeys = sqliteTable("api_keys", { + id: text("id").primaryKey(), + key: text("key").notNull().unique(), // API Key 值 + keyPrefix: text("key_prefix").notNull(), // Key 前缀用于显示 (如 vmail_xxx...) + name: text("name"), // API Key 名称 + rateLimit: integer("rate_limit").default(100), // 每分钟请求限制 + isActive: integer("is_active", { mode: "boolean" }).default(true).notNull(), + lastUsedAt: integer("last_used_at", { mode: "timestamp" }), + expiresAt: integer("expires_at", { mode: "timestamp" }), + createdAt: integer("created_at", { mode: "timestamp" }).notNull(), + updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(), +}); + +export const insertApiKeySchema = createInsertSchema(apiKeys); +export type InsertApiKey = z.infer; +export type ApiKey = typeof apiKeys.$inferSelect; + +// ==================== Mailboxes 表 ==================== +export const mailboxes = sqliteTable("mailboxes", { + id: text("id").primaryKey(), + address: text("address").notNull().unique(), // 完整邮箱地址 + domain: text("domain").notNull(), // 邮箱域名 + expiresAt: integer("expires_at", { mode: "timestamp" }), + apiKeyId: text("api_key_id").notNull(), // 关联的 API Key ID + createdAt: integer("created_at", { mode: "timestamp" }).notNull(), + updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(), +}); + +export const insertMailboxSchema = createInsertSchema(mailboxes); +export type InsertMailbox = z.infer; +export type Mailbox = typeof mailboxes.$inferSelect; + // 定义 Header 类型,用于存储邮件头信息 export type Header = Record; diff --git a/worker/src/index.ts b/worker/src/index.ts index b25ec40..d018240 100644 --- a/worker/src/index.ts +++ b/worker/src/index.ts @@ -2,13 +2,15 @@ import { Hono } from 'hono'; import { serveStatic } from 'hono/cloudflare-workers'; import { cors } from 'hono/cors'; // 导入数据库相关的模块 -import { deleteEmails, findEmailById, getEmailsByMessageTo, insertEmail, deleteExpiredEmails } from './database/dao'; +import { deleteEmails, findEmailById, getEmailsByMessageTo, insertEmail, deleteExpiredEmails, insertApiKey } from './database/dao'; import { getD1DB } from './database/db'; import { InsertEmail, insertEmailSchema } from './database/schema'; import { nanoid } from 'nanoid/non-secure'; import PostalMime from 'postal-mime'; // 导入加解密工具函数 import { decrypt } from './utils'; +// 导入 v1 API +import v1Api from './api/v1'; // 定义 Cloudflare 绑定和环境变量的类型 @@ -91,6 +93,62 @@ api.post('/verify', turnstile, async (c) => { return c.json({ success: true }); }); +// 生成 API Key 的函数 +function generateApiKey(): string { + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + let key = 'vmail_'; + for (let i = 0; i < 32; i++) { + key += chars.charAt(Math.floor(Math.random() * chars.length)); + } + return key; +} + +// 创建 API Key 接口(需要 Turnstile 验证) +api.post('/api-keys', turnstile, async (c) => { + const db = getD1DB(c.env.DB); + const body = c.get('parsedBody') as { name?: string }; + + const now = new Date(); + const apiKey = generateApiKey(); + const keyPrefix = apiKey.substring(0, 12) + '...'; + + const newApiKey = { + id: nanoid(), + key: apiKey, + keyPrefix: keyPrefix, + name: body?.name || null, + rateLimit: 100, + isActive: true, + lastUsedAt: null, + expiresAt: null, + createdAt: now, + updatedAt: now, + }; + + try { + await insertApiKey(db, newApiKey); + // 只返回一次完整的 API Key,之后无法再获取 + return c.json({ + data: { + id: newApiKey.id, + key: apiKey, // 完整的 API Key,只展示这一次 + keyPrefix: keyPrefix, + name: newApiKey.name, + createdAt: now.toISOString(), + }, + message: 'API Key created successfully. Please save it now, it will not be shown again!' + }, 201); + } catch (e: any) { + console.error('Create API Key error:', e); + return c.json({ + error: { + code: 'INTERNAL_ERROR', + message: 'Failed to create API Key', + } + }, 500); + } +}); + // fix: 移除获取邮件列表接口的 turnstile 验证。 // 这个接口现在是公开的,刷新收件箱时可以直接调用,不再需要重复验证。 api.post('/emails', async (c) => { @@ -186,6 +244,9 @@ app.get('/config', (c) => { }); }); +// 挂载 v1 API 路由 +app.route('/api/v1', v1Api); + // 静态资源服务 (放在最后,作为默认路由) // 修正: 确保 serveStatic 正确指向静态文件目录